forked from JavaTX/JavaCompilerCore
Merge branch 'targetBytecode' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into targetBytecode
This commit is contained in:
commit
c51190feef
9
resources/bytecode/javFiles/HelloWorld.jav
Normal file
9
resources/bytecode/javFiles/HelloWorld.jav
Normal file
@ -0,0 +1,9 @@
|
||||
import java.lang.System;
|
||||
import java.lang.String;
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class HelloWorld {
|
||||
static hello() {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
@ -119,6 +119,10 @@ public class JavaTXCompiler {
|
||||
if (clazz.getClassName().equals(name)) return clazz;
|
||||
}
|
||||
}
|
||||
try {
|
||||
var clazz = classLoader.loadClass(name.toString());
|
||||
return ASTFactory.createClass(clazz);
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -763,4 +763,12 @@ public class TestComplete {
|
||||
var m = clazz.getDeclaredMethod("m");
|
||||
assertEquals(m.invoke(instance), 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHelloWorld() throws Exception {
|
||||
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "HelloWorld.jav");
|
||||
var clazz = classFiles.get("HelloWorld");
|
||||
var hello = clazz.getDeclaredMethod("hello");
|
||||
hello.invoke(null);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user