Merge branch 'bytecode' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode
This commit is contained in:
commit
b14c264435
16
test/bytecode/types/OL.jav
Normal file
16
test/bytecode/types/OL.jav
Normal file
@ -0,0 +1,16 @@
|
||||
class OL {
|
||||
|
||||
Integer m(Integer x) { return x + x; }
|
||||
|
||||
Boolean m(Boolean x) {return x || x; }
|
||||
}
|
||||
|
||||
class Main {
|
||||
|
||||
main(x) {
|
||||
ol;
|
||||
ol = new OL();
|
||||
return ol.m(x);
|
||||
}
|
||||
|
||||
}
|
75
test/bytecode/types/OLTest.java
Normal file
75
test/bytecode/types/OLTest.java
Normal file
@ -0,0 +1,75 @@
|
||||
package bytecode.types;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import bytecode.SourceFileBytecodeTest;
|
||||
|
||||
public class OLTest extends SourceFileBytecodeTest{
|
||||
@Override
|
||||
protected void init() {
|
||||
testName = "OL";
|
||||
rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/";
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testInteger() {
|
||||
try{
|
||||
ClassLoader classLoader = getClassLoader();
|
||||
|
||||
Class cls = classLoader.loadClass(testName);
|
||||
|
||||
Object obj = cls.newInstance();
|
||||
|
||||
File file = new File(rootDirectory);
|
||||
URL url = file.toURL();
|
||||
URL[] urls = new URL[]{url};
|
||||
|
||||
Class stringVector = classLoader.loadClass("Integer");
|
||||
|
||||
Class[] params = new Class[1];
|
||||
params[0] = stringVector;
|
||||
|
||||
Method method = cls.getDeclaredMethod("m", params);
|
||||
method.invoke(obj, stringVector.newInstance());
|
||||
assertTrue(true);
|
||||
}catch(Exception e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBoolen() {
|
||||
try{
|
||||
ClassLoader classLoader = getClassLoader();
|
||||
|
||||
Class cls = classLoader.loadClass(testName);
|
||||
|
||||
Object obj = cls.newInstance();
|
||||
|
||||
File file = new File(rootDirectory);
|
||||
URL url = file.toURL();
|
||||
URL[] urls = new URL[]{url};
|
||||
|
||||
Class stringVector = classLoader.loadClass("Boolean");
|
||||
|
||||
Class[] params = new Class[1];
|
||||
params[0] = stringVector;
|
||||
|
||||
Method method = cls.getDeclaredMethod("m", params);
|
||||
method.invoke(obj, stringVector.newInstance());
|
||||
assertTrue(true);
|
||||
}catch(Exception e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -11,12 +11,7 @@ class Overloading{
|
||||
}
|
||||
|
||||
main(String[] args) {
|
||||
ol;
|
||||
ol = new Overloading();
|
||||
v;
|
||||
v = new Vector<String> ();
|
||||
ol.method(v);
|
||||
|
||||
new Overloading().method(new Vector<String> ());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user