forked from JavaTX/JavaCompilerCore
Bug in der Implemintierung von Simplify Algorithmus gefixt
This commit is contained in:
parent
e07b189ba4
commit
9e0a6151fd
@ -174,9 +174,11 @@ public class Simplify {
|
||||
allCons.addAll(result.keySet());
|
||||
|
||||
if(!allCons.isEmpty() && allCons.size()<2) {
|
||||
|
||||
if(!result.containsKey(allCons.get(0)))
|
||||
result.put(allCons.get(0), null);
|
||||
TPHConstraint cons = allCons.get(0);
|
||||
if(!result.containsKey(cons)) {
|
||||
result.put(cons, null);
|
||||
result.put(new ExtendsConstraint(cons.getRight(), Type.getInternalName(Object.class), Relation.EXTENDS), null);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
38
src/test/java/bytecode/IdTest.java
Normal file
38
src/test/java/bytecode/IdTest.java
Normal file
@ -0,0 +1,38 @@
|
||||
package bytecode;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||
|
||||
public class IdTest {
|
||||
|
||||
private static String path;
|
||||
private static File fileToTest;
|
||||
private static JavaTXCompiler compiler;
|
||||
private static ClassLoader loader;
|
||||
private static Class<?> classToTest;
|
||||
private static String pathToClassFile;
|
||||
private static Object instanceOfClass;
|
||||
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
path = System.getProperty("user.dir")+"/src/test/resources/bytecodeJavFiles/Id.jav";
|
||||
fileToTest = new File(path);
|
||||
compiler = new JavaTXCompiler(fileToTest);
|
||||
compiler.generateBytecode(System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/");
|
||||
pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/";
|
||||
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
|
||||
classToTest = loader.loadClass("Id");
|
||||
instanceOfClass = classToTest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
|
||||
}
|
6
src/test/resources/bytecodeJavFiles/Id.jav
Normal file
6
src/test/resources/bytecodeJavFiles/Id.jav
Normal file
@ -0,0 +1,6 @@
|
||||
public class Id {
|
||||
|
||||
id(b){
|
||||
return b;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user