diff --git a/src/mycompiler/SourceFile.java b/src/mycompiler/SourceFile.java index 8f148b8d..4dd5c1d5 100755 --- a/src/mycompiler/SourceFile.java +++ b/src/mycompiler/SourceFile.java @@ -679,7 +679,8 @@ public class SourceFile } //Erst die Unifizierung erstellen: - Vector> unifyResult = Unify.unify(constraints, finiteClosure); + Vector constraintsClone = (Vector)constraints.clone(); + Vector> unifyResult = Unify.unify(constraintsClone, finiteClosure); //Dann den Ergebnissen anfügen result.addAll(unifyResult); diff --git a/src/mycompiler/myclass/Method.java b/src/mycompiler/myclass/Method.java index fece74d8..f41a2a99 100755 --- a/src/mycompiler/myclass/Method.java +++ b/src/mycompiler/myclass/Method.java @@ -51,7 +51,7 @@ import typinferenz.assumptions.TypeAssumptions; * @author janulrich * */ -public class Method extends Field implements ITypeReplacementListener, IItemWithOffset, TypeInsertable +public class Method extends Field implements IItemWithOffset, TypeInsertable // ino.end // ino.class.Method.23482.body { diff --git a/src/mycompiler/mystatement/MethodCall.java b/src/mycompiler/mystatement/MethodCall.java index b6304f2b..fcebc774 100755 --- a/src/mycompiler/mystatement/MethodCall.java +++ b/src/mycompiler/mystatement/MethodCall.java @@ -231,7 +231,7 @@ public class MethodCall extends Expr } Vector paraAssumptions=assumption.getParaAssumptions(); Type returnType=assumption.getAssumedType(); - Method meth=new Method(); + Method meth=new Method(0); Vector parameterVector=new Vector(); ParameterList pl=new ParameterList(); for(int i=0;i points = new Vector(); + public Vector points = new Vector(); public TypeInsertSet(TypeInsertPoint p){ points.add(p); diff --git a/test/plugindevelopment/TypeInsertTester.java b/test/plugindevelopment/TypeInsertTester.java index f49a3292..4e8d42ae 100644 --- a/test/plugindevelopment/TypeInsertTester.java +++ b/test/plugindevelopment/TypeInsertTester.java @@ -10,17 +10,35 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.Vector; +import org.apache.log4j.ConsoleAppender; +import org.apache.log4j.FileAppender; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.log4j.PatternLayout; +import org.apache.log4j.SimpleLayout; + import typinferenz.TypeInsertPoint; import typinferenz.TypeInsertSet; import junit.framework.TestCase; import mycompiler.MyCompiler; import mycompiler.MyCompilerAPI; import mycompiler.myparser.JavaParser.yyException; +import mycompiler.mytest.LambdaTest; import mycompiler.mytypereconstruction.TypeinferenceResultSet; public class TypeInsertTester{ + private static Logger inferencelog = Logger.getLogger("Typeinference"); + static{ + { + // Ausgabeoptionen fuer die Logger + ConsoleAppender logAppender = new ConsoleAppender(new SimpleLayout()); + logAppender.setTarget("System.out"); + logAppender.activateOptions(); + inferencelog.addAppender(logAppender); //Bei den Tests wird der Log auch in System.out geschrieben. + } + } private static final String rootDirectory = System.getProperty("user.dir")+"/test/plugindevelopment/"; public static void test(String sourceFileToInfere, String solutionFile){ @@ -34,10 +52,12 @@ public class TypeInsertTester{ Vector points = result.getTypeInsertionPoints(); TestCase.assertTrue("Es muss mindestens ein TypeInsertSet vorhanden sein", points.size()>0); for(TypeInsertSet point : points){ + if(point.points.size()>0){ inferedSource = point.insertAllTypes(getFileContent(rootDirectory + sourceFileToInfere)); String solutionSource = getFileContent(rootDirectory + solutionFile); System.out.println("\nInferierter Source:\n"+inferedSource); TestCase.assertTrue("Nicht das erwartete Ergebnis", inferedSource.equals(solutionSource)); + } } } @@ -53,4 +73,5 @@ public class TypeInsertTester{ byte[] encoded = Files.readAllBytes(Paths.get(path)); return StandardCharsets.UTF_8.decode(ByteBuffer.wrap(encoded)).toString(); } + }