diff --git a/src/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/de/dhbwstuttgart/core/JavaTXCompiler.java index 68bb2585..05edbaa1 100644 --- a/src/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -121,8 +121,9 @@ public class JavaTXCompiler { System.out.println(xConsSet); Set paraTypeVarNames = allClasses.stream().map(x -> x.getMethods().stream().map(y -> y.getParameterList().getFormalparalist() .stream().filter(z -> z.getType() instanceof TypePlaceholder) - .map(z -> ((TypePlaceholder)z.getType()).getName()).collect(Collectors.toCollection(HashSet::new))).reduce((a,b) -> { a.addAll(b); return a;} ).get()) - .reduce((a,b) -> { a.addAll(b); return a;} ).get(); + .map(z -> ((TypePlaceholder)z.getType()).getName()).collect(Collectors.toCollection(HashSet::new))) + .reduce(new HashSet(), (a,b) -> { a.addAll(b); return a;}, (a,b) -> { a.addAll(b); return a;} ) ) + .reduce(new HashSet(), (a,b) -> { a.addAll(b); return a;} ); Set returnTypeVarNames = allClasses.stream().map(x -> x.getMethods().stream().filter(y -> y.getReturnType() instanceof TypePlaceholder) .map(z -> ((TypePlaceholder)z.getReturnType()).getName()).collect(Collectors.toCollection(HashSet::new))).reduce((a,b) -> { a.addAll(b); return a;} ).get(); diff --git a/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java b/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java index 4dad9de6..c15f65fc 100644 --- a/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java +++ b/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java @@ -217,7 +217,7 @@ public class TYPEStmt implements StatementVisitor{ binary.operation.equals(BinaryExpr.Operator.MUL)|| binary.operation.equals(BinaryExpr.Operator.MOD)|| binary.operation.equals(BinaryExpr.Operator.ADD)){ - Set numericAdditionOrStringConcatenation = new HashSet<>(); + Set> numericAdditionOrStringConcatenation = new HashSet<>(); //Zuerst der Fall für Numerische AusdrücPairOpnumericeratorke, das sind Mul, Mod und Div immer: //see: https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17 @@ -273,7 +273,7 @@ public class TYPEStmt implements StatementVisitor{ binary.operation.equals(BinaryExpr.Operator.BIGGERTHAN) || binary.operation.equals(BinaryExpr.Operator.LESSTHAN)){ //eingefuegt PL 2018-05-24 - Set numericRelationConcatenation = new HashSet<>(); + Set> numericRelationConcatenation = new HashSet<>(); Constraint numeric = new Constraint<>(); numeric.add(new Pair(binary.lexpr.getType(), bytee, PairOperator.SMALLERDOT)); numeric.add(new Pair(binary.rexpr.getType(), bytee, PairOperator.SMALLERDOT)); diff --git a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 1d5ca564..d3448d49 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -586,8 +586,13 @@ public class TypeUnifyTask extends RecursiveTask>> { protected boolean isUndefinedPairSet(Set s) { + if (s.size() >= 1 ) { Boolean ret = s.stream().map(x -> x.isUndefinedPair()).reduce(true, (x,y)-> (x && y)); return ret; + } + else { + return false; + } } protected boolean isUndefinedPairSetSet(Set> s) { diff --git a/test/bytecode/LambdaTest.java b/test/bytecode/LambdaTest.java index 12e16829..f29690cb 100644 --- a/test/bytecode/LambdaTest.java +++ b/test/bytecode/LambdaTest.java @@ -13,7 +13,7 @@ public class LambdaTest { @Test public void generateBC() throws Exception { - path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Lambda2.jav"; + path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Lambda.jav"; fileToTest = new File(path); compiler = new JavaTXCompiler(fileToTest); compiler.generateBytecode(); diff --git a/test/bytecode/javFiles/Plus.jav b/test/bytecode/javFiles/Plus.jav index 86b4eb36..4d425bf0 100644 --- a/test/bytecode/javFiles/Plus.jav +++ b/test/bytecode/javFiles/Plus.jav @@ -1,4 +1,4 @@ -//import java.lang.Integer; +import java.lang.Integer; public class Plus { diff --git a/test/bytecode/javFiles/RelOps.jav b/test/bytecode/javFiles/RelOps.jav index d75ee2f3..0fdd2cff 100644 --- a/test/bytecode/javFiles/RelOps.jav +++ b/test/bytecode/javFiles/RelOps.jav @@ -1,4 +1,5 @@ import java.lang.Integer; +import java.lang.Boolean; public class RelOps { m(a,b){