From 16e14f9363d1cad3fc9f791d33f894999ef0b1fe Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Thu, 16 Nov 2017 15:10:08 +0100 Subject: [PATCH] =?UTF-8?q?Finite=20CLosure=20TEst=20l=C3=A4uft=20wieder?= =?UTF-8?q?=20halbwegs.=20Sonst=20unfertiger=20Zustand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/dhbwstuttgart/core/JavaTXCompiler.java | 2 +- .../dhbwstuttgart/syntaxtree/type/ExtendsWildcardType.java | 5 +++++ src/de/dhbwstuttgart/syntaxtree/type/GenericRefType.java | 5 +++++ src/de/dhbwstuttgart/syntaxtree/type/RefType.java | 5 +++++ .../syntaxtree/type/RefTypeOrTPHOrWildcardOrGeneric.java | 4 +--- .../dhbwstuttgart/syntaxtree/type/SuperWildcardType.java | 5 +++++ src/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java | 5 +++++ src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java | 1 + test/javFiles/fc.jav | 7 ++++--- 9 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/de/dhbwstuttgart/core/JavaTXCompiler.java index adc160fcd..4ec0e2c34 100644 --- a/src/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -70,7 +70,7 @@ public class JavaTXCompiler { xConsSet.addAll(constraint); } - //System.out.println(xConsSet); + System.out.println(xConsSet); Set> result = unify.unify(xConsSet, finiteClosure); //System.out.println("RESULT: " + result); results.addAll(result); diff --git a/src/de/dhbwstuttgart/syntaxtree/type/ExtendsWildcardType.java b/src/de/dhbwstuttgart/syntaxtree/type/ExtendsWildcardType.java index dbf768157..d5abd93b8 100644 --- a/src/de/dhbwstuttgart/syntaxtree/type/ExtendsWildcardType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/ExtendsWildcardType.java @@ -35,6 +35,11 @@ public class ExtendsWildcardType extends WildcardType{ } + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + @Override public A acceptTV(TypeVisitor visitor) { return visitor.visit(this); diff --git a/src/de/dhbwstuttgart/syntaxtree/type/GenericRefType.java b/src/de/dhbwstuttgart/syntaxtree/type/GenericRefType.java index b5698be8e..a5d394aaa 100644 --- a/src/de/dhbwstuttgart/syntaxtree/type/GenericRefType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/GenericRefType.java @@ -24,6 +24,11 @@ public class GenericRefType extends RefTypeOrTPHOrWildcardOrGeneric return name.toString(); } + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + @Override public A acceptTV(TypeVisitor visitor) { return visitor.visit(this); diff --git a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java index 10842d24e..002e792df 100644 --- a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java @@ -95,6 +95,11 @@ public class RefType extends RefTypeOrTPHOrWildcardOrGeneric } + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + @Override public A acceptTV(TypeVisitor visitor) { return visitor.visit(this); diff --git a/src/de/dhbwstuttgart/syntaxtree/type/RefTypeOrTPHOrWildcardOrGeneric.java b/src/de/dhbwstuttgart/syntaxtree/type/RefTypeOrTPHOrWildcardOrGeneric.java index 1dcdefc0d..8a573d160 100644 --- a/src/de/dhbwstuttgart/syntaxtree/type/RefTypeOrTPHOrWildcardOrGeneric.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/RefTypeOrTPHOrWildcardOrGeneric.java @@ -11,9 +11,7 @@ public abstract class RefTypeOrTPHOrWildcardOrGeneric extends SyntaxTreeNode{ } @Override - public void accept(ASTVisitor visitor){ - this.acceptTV((TypeVisitor)visitor); - } + public abstract void accept(ASTVisitor visitor); public abstract A acceptTV(TypeVisitor visitor); public abstract void accept(ResultSetVisitor visitor); diff --git a/src/de/dhbwstuttgart/syntaxtree/type/SuperWildcardType.java b/src/de/dhbwstuttgart/syntaxtree/type/SuperWildcardType.java index e7a19b5ab..f630583e9 100644 --- a/src/de/dhbwstuttgart/syntaxtree/type/SuperWildcardType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/SuperWildcardType.java @@ -45,6 +45,11 @@ public class SuperWildcardType extends WildcardType{ return true; } + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + @Override public A acceptTV(TypeVisitor visitor) { return visitor.visit(this); diff --git a/src/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java b/src/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java index af79fa39c..ab4414fd2 100644 --- a/src/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java @@ -68,6 +68,11 @@ public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric return name; } + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + @Override public A acceptTV(TypeVisitor visitor) { return visitor.visit(this); diff --git a/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java b/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java index da712f1ea..d710ed3e5 100644 --- a/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java +++ b/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java @@ -321,6 +321,7 @@ public class TYPEStmt implements StatementVisitor{ public static List getMethods(String name, int numArgs, TypeInferenceBlockInformation info) { List ret = new ArrayList<>(); + //TODO: apply Methoden wieder anfügen. Diese könnten möglicherweise auch in den Assumptions auftauchen (überdenken) /* if(name.equals("apply")){ List funNParams = new ArrayList<>(); diff --git a/test/javFiles/fc.jav b/test/javFiles/fc.jav index cb8c17997..a3278cbcc 100644 --- a/test/javFiles/fc.jav +++ b/test/javFiles/fc.jav @@ -1,13 +1,14 @@ -import java.util.*; +import java.util.List; class Test{ methode(param1, param2, param3) { - return param1.meth(param2.add(param3)); + param2.add(param3); + return param1.meth(param2); } } interface Klasse1{ - Klasse1 meth(Klasse1 p); + Klasse1 meth(List p); Klasse1 meth(Klasse2 p); }