From 93a6070bd4801a959331f0e582ec6ed7817eeb98 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 3 Sep 2014 16:15:04 +0200 Subject: [PATCH] =?UTF-8?q?=C3=84nderungen=20an=20Testfiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/dhbwstuttgart/core/MyCompiler.java | 8 ++++---- src/de/dhbwstuttgart/core/SourceFile.java | 6 +++++- src/de/dhbwstuttgart/syntaxtree/Class.java | 3 --- src/de/dhbwstuttgart/syntaxtree/type/Type.java | 5 +++-- .../typeinference/unify/FC_TTO.java | 8 ++++++++ .../typeinference/unify/Unify.java | 2 +- .../TypeInsertTests/LambdaTest23.jav | 15 +++++++-------- .../TypeInsertTests/Matrix.java | 2 +- .../TypeInsertTests/OperatorTest.jav | 5 +++++ .../TypeInsertTests/OperatorTest.java | 18 ++++++++++++++++++ 10 files changed, 52 insertions(+), 20 deletions(-) create mode 100644 test/plugindevelopment/TypeInsertTests/OperatorTest.jav create mode 100644 test/plugindevelopment/TypeInsertTests/OperatorTest.java diff --git a/src/de/dhbwstuttgart/core/MyCompiler.java b/src/de/dhbwstuttgart/core/MyCompiler.java index 20e885010..1095a4b0b 100755 --- a/src/de/dhbwstuttgart/core/MyCompiler.java +++ b/src/de/dhbwstuttgart/core/MyCompiler.java @@ -658,7 +658,7 @@ public class MyCompiler implements MyCompilerAPI return OutputDir; } // ino.end - +/* // ino.method.getFullyQualifiedNameFromClassname.21322.definition public static String getFullyQualifiedNameFromClassname(String typ, ImportDeclarations declarations) // ino.end @@ -677,7 +677,7 @@ public class MyCompiler implements MyCompilerAPI return ret; } // ino.end - + */ // ino.method.makeRefTypesFullyQualified.21325.defdescription type=javadoc /** * @author HOTI @@ -686,7 +686,7 @@ public class MyCompiler implements MyCompilerAPI * @param containedTypes Alle Typen, die die Klasse beinhaltet * @param name Alle Klassen, die es in den BasicAssumptions und im * AbstractSyntaxTree gibt @param declarations Alle Import-Declarations - */ + // ino.end // ino.method.makeRefTypesFullyQualified.21325.definition public static void makeRefTypesFullyQualified(Vector containedTypes, ImportDeclarations declarations) @@ -716,7 +716,7 @@ public class MyCompiler implements MyCompilerAPI } } // ino.end - + */ /** * @author Arne Lüdtke * Ersetzt alle GTVs durch TPHs mit gleichem Namen. Arbeitet Rekursiv. diff --git a/src/de/dhbwstuttgart/core/SourceFile.java b/src/de/dhbwstuttgart/core/SourceFile.java index 84116c4a2..201e7ef13 100755 --- a/src/de/dhbwstuttgart/core/SourceFile.java +++ b/src/de/dhbwstuttgart/core/SourceFile.java @@ -690,7 +690,9 @@ public class SourceFile } xConstraints.add(cons); } - typinferenzLog.debug("Karthesisches Produkt der Constraints: "+xConstraints); + //typinferenzLog.debug("Karthesisches Produkt der Constraints: "+xConstraints); + + finiteClosure.generateFullyNamedTypes(globalAssumptions); ////////////////////////////// // Unifizierung der Constraints: @@ -735,6 +737,7 @@ public class SourceFile //Erst die Unifizierung erstellen: Vector constraintsClone = (Vector)constraints.clone(); + /* //Typen kontrollieren: for(Pair p : constraintsClone){ Type t = p.TA1; @@ -754,6 +757,7 @@ public class SourceFile if(!(replaceType == null))p.TA2 = replaceType; } } + */ Vector> unifyResult = Unify.unify(constraintsClone, finiteClosure); //Dann den Ergebnissen anfügen diff --git a/src/de/dhbwstuttgart/syntaxtree/Class.java b/src/de/dhbwstuttgart/syntaxtree/Class.java index 2dba67201..2bc0e7ad6 100755 --- a/src/de/dhbwstuttgart/syntaxtree/Class.java +++ b/src/de/dhbwstuttgart/syntaxtree/Class.java @@ -659,9 +659,6 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit // ino.end // ino.method.TRProg.23110.body { - /* - - */ ////////////////////////////// // Und los geht's: ////////////////////////////// diff --git a/src/de/dhbwstuttgart/syntaxtree/type/Type.java b/src/de/dhbwstuttgart/syntaxtree/type/Type.java index 7b2ec3eac..6dc590142 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/Type.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/Type.java @@ -176,8 +176,9 @@ public class Type implements IItemWithOffset // ino.method.equals.26765.body { if(obj instanceof Type){ - String name2 = ((Type)obj).printJavaCode(new ResultSet()).toString(); - return printJavaCode(new ResultSet()).toString().equals(name2); + // String name2 = ((Type)obj).printJavaCode(new ResultSet()).toString(); + //return printJavaCode(new ResultSet()).toString().equals(name2); + return ((Type)obj).name.equals(name); } else{ return false; diff --git a/src/de/dhbwstuttgart/typeinference/unify/FC_TTO.java b/src/de/dhbwstuttgart/typeinference/unify/FC_TTO.java index 9bfd99b32..4adfb430f 100755 --- a/src/de/dhbwstuttgart/typeinference/unify/FC_TTO.java +++ b/src/de/dhbwstuttgart/typeinference/unify/FC_TTO.java @@ -7,6 +7,7 @@ import java.util.Vector; import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.type.Pair; +import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; // ino.class.FC_TTO.28013.description type=javadoc /** @@ -70,5 +71,12 @@ public class FC_TTO public String toString(){ return "FC: "+getFC()+"\nTTO: "+getTTO()+"\nCLASSVEC: "+getClasses(); } + + public void generateFullyNamedTypes(TypeAssumptions ass) { + for(Pair p : this.FC){ + p.TA1 = ass.getTypeFor(p.TA1, null); + p.TA2 = ass.getTypeFor(p.TA2, null); + } + } } // ino.end diff --git a/src/de/dhbwstuttgart/typeinference/unify/Unify.java b/src/de/dhbwstuttgart/typeinference/unify/Unify.java index c2319b003..0e87ee83f 100755 --- a/src/de/dhbwstuttgart/typeinference/unify/Unify.java +++ b/src/de/dhbwstuttgart/typeinference/unify/Unify.java @@ -1833,7 +1833,7 @@ throws MatchException // ino.end // ino.method.SubstHashtable2VectorPair.28076.definition - public static Vector SubstHashtable2VectorPair (Hashtable ht) + public static Vector SubstHashtable2VectorPair (Hashtable ht) // ino.end // ino.method.SubstHashtable2VectorPair.28076.body { diff --git a/test/plugindevelopment/TypeInsertTests/LambdaTest23.jav b/test/plugindevelopment/TypeInsertTests/LambdaTest23.jav index 30ae2689c..4bc270c4b 100644 --- a/test/plugindevelopment/TypeInsertTests/LambdaTest23.jav +++ b/test/plugindevelopment/TypeInsertTests/LambdaTest23.jav @@ -1,13 +1,12 @@ import java.util.Vector; -class Matrix extends Vector> { +class Matrix extends Vector> { - Matrix mul(m){ - ret; - ret = new Matrix(); - i; - i = this.size(); - - return ret; + void mul(m){ + v1; + v1 = this.elementAt(1); + erg; + erg = v1.elementAt(1); } + } \ No newline at end of file diff --git a/test/plugindevelopment/TypeInsertTests/Matrix.java b/test/plugindevelopment/TypeInsertTests/Matrix.java index 500f58d30..dbc9ed1c0 100644 --- a/test/plugindevelopment/TypeInsertTests/Matrix.java +++ b/test/plugindevelopment/TypeInsertTests/Matrix.java @@ -11,6 +11,6 @@ public class Matrix { public void run(){ Vector mustContain = new Vector(); //mustContain.add("TestIfStmt var"); - MultipleTypesInsertTester.testSingleInsert(this.TEST_FILE, mustContain); + //MultipleTypesInsertTester.testSingleInsert(this.TEST_FILE, mustContain); } } diff --git a/test/plugindevelopment/TypeInsertTests/OperatorTest.jav b/test/plugindevelopment/TypeInsertTests/OperatorTest.jav new file mode 100644 index 000000000..1f97f6dab --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/OperatorTest.jav @@ -0,0 +1,5 @@ +class RelOpTest{ + i = 1 + 1; + j = 1 * 1; + k = 1 / 0; +} \ No newline at end of file diff --git a/test/plugindevelopment/TypeInsertTests/OperatorTest.java b/test/plugindevelopment/TypeInsertTests/OperatorTest.java new file mode 100644 index 000000000..48d5c6718 --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/OperatorTest.java @@ -0,0 +1,18 @@ +package plugindevelopment.TypeInsertTests; + +import java.util.Vector; + +import org.junit.Test; + +public class OperatorTest { + private static final String TEST_FILE = "OperatorTest.jav"; + + @Test + public void run(){ + Vector mustContain = new Vector(); + mustContain.add("Integer i"); + mustContain.add("Integer j"); + mustContain.add("Integer k"); + MultipleTypesInsertTester.testSingleInsert(this.TEST_FILE, mustContain); + } +}