Skip to content

Commit

Permalink
regen examples
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Dietrich <christian.dietrich.opensource@gmail.com>
  • Loading branch information
cdietrich committed Feb 20, 2024
1 parent da0b0db commit e234197
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,29 @@ class CompilerTest {
]
}

@Test def void testGeneratedJavaInheritedMethod() throws Exception {
#[
'''
entity Foo extends Bar {
// getName and setName inherited from Bar
op doStuff(String x) : String {
return x + ' ' + getName()
}
}
''',
'''
entity Bar {
name : String
}
'''
].compile [
val fooObj = it.getCompiledClass("Foo").getDeclaredConstructor().newInstance
fooObj.invoke('setName', 'World')
assertEquals("Hello World", fooObj.invoke('doStuff','Hello'))
]
}


@Test def void compareGeneratedJava() throws Exception {
'''
entity Foo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Require-Bundle: org.antlr.runtime;bundle-version="[3.2.0,3.2.1)",
org.eclipse.xtend.lib;bundle-version="2.14.0",
org.eclipse.xtext,
org.eclipse.xtext.common.types,
org.eclipse.xtext.util,
org.eclipse.xtext.xbase,
org.eclipse.xtext.xbase.lib;bundle-version="2.14.0",
org.objectweb.asm;bundle-version="[9.6.0,9.7.0)";resolution:=optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class DomainmodelJvmModelInferrer extends AbstractModelInferrer {
def dispatch infer(Entity entity, extension IJvmDeclaredTypeAcceptor acceptor, boolean prelinkingPhase) {
accept(entity.toClass( entity.fullyQualifiedName )) [
documentation = entity.documentation
if (entity.superType !== null)
superTypes += entity.superType.cloneWithProxies
superClass = entity.superType

// let's add a default constructor
members += entity.toConstructor []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<unit id="org.junit" version="4.13.2.v20230809-1000"/>
<unit id="org.hamcrest" version="2.2.0"/>
<unit id="org.hamcrest.core" version="2.2.0.v20230809-1000"/>
<unit id="org.apache.commons.logging" version="1.2.0"/>
<unit id="org.apiguardian.api" version="0.0.0"/>
<unit id="junit-jupiter-api" version="0.0.0"/>
<unit id="junit-jupiter-engine" version="0.0.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<unit id="org.junit" version="4.13.2.v20230809-1000"/>
<unit id="org.hamcrest" version="2.2.0"/>
<unit id="org.hamcrest.core" version="2.2.0.v20230809-1000"/>
<unit id="org.apache.commons.logging" version="1.2.0"/>
<unit id="org.apiguardian.api" version="0.0.0"/>
<unit id="junit-jupiter-api" version="0.0.0"/>
<unit id="junit-jupiter-engine" version="0.0.0"/>
Expand Down

0 comments on commit e234197

Please sign in to comment.