modified: ../../src/de/dhbwstuttgart/core/JavaTXCompiler.java

Reduce ausgetauscht bei ArgPara und Returntype
	modified:   ../../src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java
	modified:   ../../src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
isUndefinedPair korrigiert.
	modified:   ../../test/bytecode/LambdaTest.java
	modified:   ../../test/bytecode/javFiles/Plus.jav
	modified:   ../../test/bytecode/javFiles/RelOps.jav
This commit is contained in:
Martin Plümicke 2018-05-24 14:11:04 +02:00
parent 3470215bae
commit 34e632b872
6 changed files with 13 additions and 6 deletions

View File

@ -121,8 +121,9 @@ public class JavaTXCompiler {
System.out.println(xConsSet);
Set<String> 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<String>(), (a,b) -> { a.addAll(b); return a;}, (a,b) -> { a.addAll(b); return a;} ) )
.reduce(new HashSet<String>(), (a,b) -> { a.addAll(b); return a;} );
Set<String> 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();

View File

@ -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<Constraint> numericAdditionOrStringConcatenation = new HashSet<>();
Set<Constraint<Pair>> 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<Constraint> numericRelationConcatenation = new HashSet<>();
Set<Constraint<Pair>> numericRelationConcatenation = new HashSet<>();
Constraint<Pair> numeric = new Constraint<>();
numeric.add(new Pair(binary.lexpr.getType(), bytee, PairOperator.SMALLERDOT));
numeric.add(new Pair(binary.rexpr.getType(), bytee, PairOperator.SMALLERDOT));

View File

@ -586,8 +586,13 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
protected boolean isUndefinedPairSet(Set<UnifyPair> 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<Set<UnifyPair>> s) {

View File

@ -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();

View File

@ -1,4 +1,4 @@
//import java.lang.Integer;
import java.lang.Integer;
public class Plus {

View File

@ -1,4 +1,5 @@
import java.lang.Integer;
import java.lang.Boolean;
public class RelOps {
m(a,b){