From 1f55b81b02146656a9031ad0453c52ac4e754af1 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Thu, 19 Jun 2014 19:40:13 +0200 Subject: [PATCH] =?UTF-8?q?=C3=84nderungen=20am=20TypeInsertSet.=20Momenta?= =?UTF-8?q?n=20werden=20keine=20Generics=20eingesetzt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mycompiler/SyntaxTreeNode.java | 6 +- src/mycompiler/myclass/Class.java | 3 +- src/mycompiler/myclass/Field.java | 2 +- src/mycompiler/myclass/FormalParameter.java | 5 +- src/mycompiler/myclass/Method.java | 2 +- .../mystatement/LambdaParameter.java | 2 +- src/mycompiler/mystatement/LocalVarDecl.java | 3 +- src/mycompiler/mytype/GenericTypeVar.java | 3 +- src/mycompiler/mytype/TypePlaceholder.java | 4 +- .../TypeinferenceResultSet.java | 7 +- src/typinferenz/FunNMethod.java | 1 + src/typinferenz/GenericTypeInsertPoint.java | 18 ++++- src/typinferenz/TypeInsertable.java | 1 + .../{ => typedeployment}/TypeInsertPoint.java | 20 ++--- .../{ => typedeployment}/TypeInsertSet.java | 76 +++++++++++++++++-- .../InsertSingleTypeTest.java | 4 +- .../MartinTestCases/Tester.java | 2 +- test/plugindevelopment/TRMEqualTest.java | 6 +- .../TypeInsertSetEqualTest.java | 2 +- test/plugindevelopment/TypeInsertTester.java | 4 +- .../TypeInsertTests/BoundedGenericsTest.java | 2 +- .../GenericParaListInsertTest.jav | 3 + .../GenericParaListInsertTest.java | 16 ++++ .../MultipleTypesInsertTester.java | 2 +- .../OverloadingInsertTest.java | 2 +- 25 files changed, 149 insertions(+), 47 deletions(-) rename src/typinferenz/{ => typedeployment}/TypeInsertPoint.java (88%) rename src/typinferenz/{ => typedeployment}/TypeInsertSet.java (70%) create mode 100644 test/plugindevelopment/TypeInsertTests/GenericParaListInsertTest.jav create mode 100644 test/plugindevelopment/TypeInsertTests/GenericParaListInsertTest.java diff --git a/src/mycompiler/SyntaxTreeNode.java b/src/mycompiler/SyntaxTreeNode.java index 1c8c6e2b..378fa814 100644 --- a/src/mycompiler/SyntaxTreeNode.java +++ b/src/mycompiler/SyntaxTreeNode.java @@ -4,11 +4,11 @@ import java.util.Vector; import typinferenz.GenericTypeInsertPoint; import typinferenz.ResultSet; -import typinferenz.TypeInsertPoint; -import typinferenz.TypeInsertSet; import typinferenz.TypeInsertable; import typinferenz.exceptions.DebugException; import typinferenz.exceptions.TypeinferenceException; +import typinferenz.typedeployment.TypeInsertPoint; +import typinferenz.typedeployment.TypeInsertSet; import mycompiler.myclass.Class; import mycompiler.myclass.Generic; import mycompiler.mytype.GenericTypeVar; @@ -86,6 +86,7 @@ public abstract class SyntaxTreeNode{ tip = that.createTypeInsertPoint((TypePlaceholder) t, result); insertSet.add(tip);//ret.addAll(((TypePlaceholder)t).getTypeInsertPoints(result)); } + /* //Für den Fall, dass dieser Knoten Generische Variablen halten kann. if(that instanceof Generic && that.getOffset()>=0){ //Alle unresolvedTPHs ermitteln und GenericTypeVarInsertPoints bilden: @@ -102,6 +103,7 @@ public abstract class SyntaxTreeNode{ } } } + */ } diff --git a/src/mycompiler/myclass/Class.java b/src/mycompiler/myclass/Class.java index 9c1aed6f..4f87df8c 100755 --- a/src/mycompiler/myclass/Class.java +++ b/src/mycompiler/myclass/Class.java @@ -63,18 +63,19 @@ import org.apache.log4j.Logger; + import sun.reflect.generics.reflectiveObjects.NotImplementedException; import typinferenz.ConstraintsSet; import typinferenz.JavaCodeResult; import typinferenz.OderConstraint; import typinferenz.ResultSet; -import typinferenz.TypeInsertPoint; import typinferenz.Typeable; import typinferenz.UndConstraint; import typinferenz.FunN; import typinferenz.assumptions.ClassAssumption; import typinferenz.assumptions.TypeAssumptions; import typinferenz.exceptions.TypeinferenceException; +import typinferenz.typedeployment.TypeInsertPoint; import typinferenz.*; diff --git a/src/mycompiler/myclass/Field.java b/src/mycompiler/myclass/Field.java index 8f5690a5..23486403 100644 --- a/src/mycompiler/myclass/Field.java +++ b/src/mycompiler/myclass/Field.java @@ -13,10 +13,10 @@ import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; import typinferenz.ConstraintsSet; import typinferenz.JavaCodeResult; import typinferenz.ResultSet; -import typinferenz.TypeInsertPoint; import typinferenz.Typeable; import typinferenz.TypeInsertable; import typinferenz.assumptions.TypeAssumptions; +import typinferenz.typedeployment.TypeInsertPoint; public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Typeable, Generic{ diff --git a/src/mycompiler/myclass/FormalParameter.java b/src/mycompiler/myclass/FormalParameter.java index a9d99ff6..f30a394c 100755 --- a/src/mycompiler/myclass/FormalParameter.java +++ b/src/mycompiler/myclass/FormalParameter.java @@ -28,14 +28,15 @@ import org.apache.log4j.Logger; + import sun.reflect.generics.reflectiveObjects.NotImplementedException; import typinferenz.JavaCodeResult; import typinferenz.ResultSet; -import typinferenz.TypeInsertPoint; -import typinferenz.TypeInsertSet; import typinferenz.Typeable; import typinferenz.TypeInsertable; import typinferenz.exceptions.TypeinferenceException; +import typinferenz.typedeployment.TypeInsertPoint; +import typinferenz.typedeployment.TypeInsertSet; // ino.class.FormalParameter.23391.declaration public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementListener, Typeable, TypeInsertable diff --git a/src/mycompiler/myclass/Method.java b/src/mycompiler/myclass/Method.java index 165cad11..961dc25a 100755 --- a/src/mycompiler/myclass/Method.java +++ b/src/mycompiler/myclass/Method.java @@ -36,12 +36,12 @@ import typinferenz.JavaCodeResult; import typinferenz.SingleConstraint; import typinferenz.ConstraintsSet; import typinferenz.ResultSet; -import typinferenz.TypeInsertPoint; import typinferenz.TypeInsertable; import typinferenz.assumptions.MethodAssumption; import typinferenz.assumptions.ParameterAssumption; import typinferenz.assumptions.TypeAssumptions; import typinferenz.exceptions.TypeinferenceException; +import typinferenz.typedeployment.TypeInsertPoint; diff --git a/src/mycompiler/mystatement/LambdaParameter.java b/src/mycompiler/mystatement/LambdaParameter.java index 46a116d8..4dad882a 100644 --- a/src/mycompiler/mystatement/LambdaParameter.java +++ b/src/mycompiler/mystatement/LambdaParameter.java @@ -1,7 +1,7 @@ package mycompiler.mystatement; import typinferenz.ResultSet; -import typinferenz.TypeInsertPoint; +import typinferenz.typedeployment.TypeInsertPoint; import mycompiler.myclass.DeclId; import mycompiler.myclass.FormalParameter; import mycompiler.mytype.Type; diff --git a/src/mycompiler/mystatement/LocalVarDecl.java b/src/mycompiler/mystatement/LocalVarDecl.java index f42e172c..487c5657 100755 --- a/src/mycompiler/mystatement/LocalVarDecl.java +++ b/src/mycompiler/mystatement/LocalVarDecl.java @@ -41,15 +41,16 @@ import org.apache.log4j.Logger; + import typinferenz.ConstraintsSet; import typinferenz.FreshTypeVariable; import typinferenz.JavaCodeResult; import typinferenz.ResultSet; -import typinferenz.TypeInsertPoint; import typinferenz.TypeInsertable; import typinferenz.assumptions.LocalVarAssumption; import typinferenz.assumptions.TypeAssumptions; import typinferenz.exceptions.TypeinferenceException; +import typinferenz.typedeployment.TypeInsertPoint; diff --git a/src/mycompiler/mytype/GenericTypeVar.java b/src/mycompiler/mytype/GenericTypeVar.java index e228ee66..6d2feccc 100755 --- a/src/mycompiler/mytype/GenericTypeVar.java +++ b/src/mycompiler/mytype/GenericTypeVar.java @@ -17,15 +17,16 @@ import java.util.Vector; + import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; import typinferenz.ConstraintsSet; import typinferenz.JavaCodeResult; import typinferenz.ResultSet; import typinferenz.SingleConstraint; -import typinferenz.TypeInsertPoint; import typinferenz.TypeInsertable; import typinferenz.assumptions.TypeAssumptions; +import typinferenz.typedeployment.TypeInsertPoint; // ino.class.GenericTypeVar.26505.description type=javadoc diff --git a/src/mycompiler/mytype/TypePlaceholder.java b/src/mycompiler/mytype/TypePlaceholder.java index 85275816..a443aea6 100755 --- a/src/mycompiler/mytype/TypePlaceholder.java +++ b/src/mycompiler/mytype/TypePlaceholder.java @@ -10,9 +10,9 @@ import java.util.logging.Logger; import typinferenz.JavaCodeResult; import typinferenz.ResultSet; -import typinferenz.TypeInsertPoint; -import typinferenz.TypeInsertSet; import typinferenz.TypeInsertable; +import typinferenz.typedeployment.TypeInsertPoint; +import typinferenz.typedeployment.TypeInsertSet; import mycompiler.MyCompiler; import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; import mycompiler.mytypereconstruction.replacementlistener.IReplaceTypeEventProvider; diff --git a/src/mycompiler/mytypereconstruction/TypeinferenceResultSet.java b/src/mycompiler/mytypereconstruction/TypeinferenceResultSet.java index ee5a0461..51575b45 100755 --- a/src/mycompiler/mytypereconstruction/TypeinferenceResultSet.java +++ b/src/mycompiler/mytypereconstruction/TypeinferenceResultSet.java @@ -9,10 +9,10 @@ import java.util.Vector; import typinferenz.ConstraintsSet; import typinferenz.ResultSet; -import typinferenz.TypeInsertPoint; -import typinferenz.TypeInsertSet; import typinferenz.assumptions.TypeAssumptions; import typinferenz.exceptions.TypeinferenceException; +import typinferenz.typedeployment.TypeInsertPoint; +import typinferenz.typedeployment.TypeInsertSet; import mycompiler.mytype.GenericTypeVar; import mycompiler.mytype.Pair; import mycompiler.mytype.RefType; @@ -73,7 +73,6 @@ public class TypeinferenceResultSet public Vector getConstraints() { return this.constraints; } - /** * @author Andreas Stadelmeier, a10023 @@ -114,7 +113,7 @@ public class TypeinferenceResultSet * @return */ public TypeInsertSet getTypeInsertionPoints(){ - TypeInsertSet ret = new TypeInsertSet(); + TypeInsertSet ret = new TypeInsertSet(this.unifiedConstraints); this.ownerOfResultSet.addTypeInsertPoints(ret,this.unifiedConstraints); diff --git a/src/typinferenz/FunNMethod.java b/src/typinferenz/FunNMethod.java index 7da2b3df..269a58ab 100644 --- a/src/typinferenz/FunNMethod.java +++ b/src/typinferenz/FunNMethod.java @@ -2,6 +2,7 @@ package typinferenz; import java.util.Vector; +import typinferenz.typedeployment.TypeInsertPoint; import mycompiler.mytype.*; import mycompiler.myclass.*; import mycompiler.mytype.TypePlaceholder; diff --git a/src/typinferenz/GenericTypeInsertPoint.java b/src/typinferenz/GenericTypeInsertPoint.java index d2dce726..8aed5e8e 100644 --- a/src/typinferenz/GenericTypeInsertPoint.java +++ b/src/typinferenz/GenericTypeInsertPoint.java @@ -4,6 +4,7 @@ import java.util.Iterator; import java.util.Vector; import typinferenz.exceptions.DebugException; +import typinferenz.typedeployment.TypeInsertPoint; import mycompiler.IItemWithOffset; import mycompiler.SyntaxTreeNode; import mycompiler.mytype.GenericTypeVar; @@ -19,6 +20,7 @@ import mycompiler.mytype.TypePlaceholder; */ public class GenericTypeInsertPoint extends TypeInsertPoint { + private Vector genericPairs = new Vector(); public GenericTypeInsertPoint(TypeInsertPoint p) { @@ -100,9 +102,10 @@ public class GenericTypeInsertPoint extends TypeInsertPoint { } @Override - public IItemWithOffset getInsertNode(){ + public TypeInsertable getInsertNode(){ return super.getGenericTypeVarInsertNode(); } + /** * Versucht den GenericTypeInsertPoint mit dem bergebenenen p2 zusam * basierend auf ihren insertPoints. @@ -121,4 +124,17 @@ public class GenericTypeInsertPoint extends TypeInsertPoint { return ret; } + @Override + public JavaCodeResult insertType(String fileContent, int additionalOffset) { + //TODO: Es kann sein, dass eine Methode bereits Generische Variablen hat, diese müssen dann an diese Liste angefügt werden. + return super.insertType(fileContent, additionalOffset); + } + + public boolean associatedWith(TypeInsertPoint tip, ResultSet resultSet) { + if(!(tip.point instanceof TypePlaceholder))return false; + Vector tphs = new Vector<>(); + tphs.add((TypePlaceholder)tip.point); + resultSet.getConstraintsFor(tphs); + return false; + } } diff --git a/src/typinferenz/TypeInsertable.java b/src/typinferenz/TypeInsertable.java index c7d9fe08..ca93a49e 100644 --- a/src/typinferenz/TypeInsertable.java +++ b/src/typinferenz/TypeInsertable.java @@ -1,5 +1,6 @@ package typinferenz; +import typinferenz.typedeployment.TypeInsertPoint; import mycompiler.IItemWithOffset; import mycompiler.mytype.TypePlaceholder; import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; diff --git a/src/typinferenz/TypeInsertPoint.java b/src/typinferenz/typedeployment/TypeInsertPoint.java similarity index 88% rename from src/typinferenz/TypeInsertPoint.java rename to src/typinferenz/typedeployment/TypeInsertPoint.java index 7ac41981..33741cd9 100644 --- a/src/typinferenz/TypeInsertPoint.java +++ b/src/typinferenz/typedeployment/TypeInsertPoint.java @@ -1,7 +1,10 @@ -package typinferenz; +package typinferenz.typedeployment; import java.util.Vector; +import typinferenz.JavaCodeResult; +import typinferenz.ResultSet; +import typinferenz.TypeInsertable; import typinferenz.exceptions.DebugException; import mycompiler.myclass.*; import mycompiler.myclass.Class; @@ -18,9 +21,9 @@ import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListe */ public class TypeInsertPoint implements Comparable{ - protected IItemWithOffset point; - protected Type type; - protected ResultSet resultSet; + public TypeInsertable point; + public Type type; + public ResultSet resultSet; /** * Dieser Konstruktor erstellt einen TypInsertPoint @@ -29,7 +32,7 @@ public class TypeInsertPoint implements Comparable{ * @param resultSet * @param generics - die generischen Parameter des einzusetzenden Typs */ - public TypeInsertPoint(IItemWithOffset insertPoint, Type insertType, ResultSet resultSet){ + public TypeInsertPoint(TypeInsertable insertPoint, Type insertType, ResultSet resultSet){ this.point = insertPoint; this.type = insertType; this.resultSet = resultSet; @@ -106,10 +109,7 @@ public class TypeInsertPoint implements Comparable{ return resultSet; } - public IItemWithOffset getGenericTypeVarInsertNode() { - if(! (this.point instanceof SyntaxTreeNode)){ - throw new DebugException("Ein IItemWithOffset muss immer auch ein SyntaxTreeNode sein"); - } + public TypeInsertable getGenericTypeVarInsertNode() { SyntaxTreeNode ret = (SyntaxTreeNode)this.point; while(!(ret instanceof Field || ret instanceof Class)){ ret = ret.getParent(); @@ -117,7 +117,7 @@ public class TypeInsertPoint implements Comparable{ throw new DebugException(this.getInsertNode().toString()+" hat kein Feld oder Klasse als Elternelement"); } } - return (IItemWithOffset)ret; + return (TypeInsertable) ret; } } diff --git a/src/typinferenz/TypeInsertSet.java b/src/typinferenz/typedeployment/TypeInsertSet.java similarity index 70% rename from src/typinferenz/TypeInsertSet.java rename to src/typinferenz/typedeployment/TypeInsertSet.java index 6f329e7f..de413292 100644 --- a/src/typinferenz/TypeInsertSet.java +++ b/src/typinferenz/typedeployment/TypeInsertSet.java @@ -1,10 +1,14 @@ -package typinferenz; +package typinferenz.typedeployment; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Vector; +import typinferenz.GenericTypeInsertPoint; +import typinferenz.JavaCodeResult; +import typinferenz.ResultSet; +import typinferenz.TypeInsertable; import mycompiler.IItemWithOffset; import mycompiler.SyntaxTreeNode; import mycompiler.mytype.GenericTypeVar; @@ -26,8 +30,10 @@ public class TypeInsertSet { public Vector points = new Vector(); private Vector genericTypeInsertPoints = new Vector(); + private ResultSet resultSet; - public TypeInsertSet() { + public TypeInsertSet(ResultSet resultSet) { + this.resultSet = resultSet; } /** @@ -53,26 +59,56 @@ public class TypeInsertSet { * @return */ public String insertType(TypeInsertPoint tip, String fileContent){ - TypeInsertSet tis = new TypeInsertSet(); + TypePatchJob tpj = new TypePatchJob(); int additionalOffset = 0; String ret = fileContent; JavaCodeResult unresolvedTPHs = tip.insertType(ret, additionalOffset); for(TypePlaceholder tph : unresolvedTPHs.getUnresolvedTPH()){ - GenericTypeInsertPoint genericTIP = new GenericTypeInsertPoint((TypeInsertable)tip.getGenericTypeVarInsertNode(),tph,tip.getResultSet()); - tis.add(genericTIP); + GenericTypeInsertPoint genericTIP = new GenericTypeInsertPoint(tip.getGenericTypeVarInsertNode(),tph,tip.getResultSet()); + tpj.add(genericTIP); } - tis.add(tip); + tpj.add(tip); - return tis.insertAllTypes(fileContent); + return tpj.run(fileContent); } + /** + * Fügt einen einzelnen TypeInsertPoint einem TypePatchJob hinzu + * @param tip + * @param tpj + */ + public void insertType(TypeInsertPoint tip, TypePatchJob tpj){ + for(GenericTypeInsertPoint gip : this.genericTypeInsertPoints){ + if(gip.associatedWith(tip, this.resultSet)){ + tpj.add(gip); + } + } + tpj.add(tip); + } + + /* + * Der Plan: + * SyntaxTreeNode generiert die TypeInsertPoints. + * Beim Einsetzen eines TIP werden die ebenfalls von den SyntaxTreeNodes berechneten GenericInsertPoints durchsucht nach den Punkten + * die mit dem einzusetzenden TIP zusammenhängen. + * Das funktioniert mithilfe des ResultSets. Denn es müssen alle Constraints mit einbezogen werden, da der Unify + * Algorithmus als Ergebnis nur die zu einem RefType aufgelösten TPHs ausgibt. + * + */ + /** * Fügt alle Typen dieses TypeInsertSets in den übergebenen Quellcode ein * @param fileContent * @return */ public String insertAllTypes(String fileContent) { - + //TODO: Das hier kann nicht funktionieren. Nach jedem einsetzen eines TIP muss momentan neu geparst werden + TypePatchJob tpj = new TypePatchJob(); + for(TypeInsertPoint tip : this.points){ + this.insertType(tip, tpj); + } + return tpj.run(fileContent); + /* int additionalOffset = 0; String ret = fileContent; @@ -105,6 +141,7 @@ public class TypeInsertSet { additionalOffset += p.getInsertLength(); } return ret; + */ } /** @@ -166,3 +203,26 @@ public class TypeInsertSet { } } + +/** + * Stellt eine Reihe von TypeInsertions dar + */ +class TypePatchJob{ + private Vector points = new Vector<>(); + void add(TypeInsertPoint tip){ + points.add(tip); + } + String run(String fileContent){ + //sortieren (nach dem Offset der InsertPoints): + Collections.sort(points); + int additionalOffset = 0; + for(TypeInsertPoint p : points){ + //Zuerst den Typ einsetzen + JavaCodeResult insertCode = p.insertType(fileContent, additionalOffset); + fileContent = insertCode.toString(); + //Dann Additional Offset korrigieren: + additionalOffset += p.getInsertLength(); + } + return fileContent; + } +} diff --git a/test/plugindevelopment/InsertSingleTypeTest.java b/test/plugindevelopment/InsertSingleTypeTest.java index 0c6ae47c..0a524771 100644 --- a/test/plugindevelopment/InsertSingleTypeTest.java +++ b/test/plugindevelopment/InsertSingleTypeTest.java @@ -15,8 +15,8 @@ import mycompiler.MyCompiler; import mycompiler.MyCompilerAPI; import mycompiler.myparser.JavaParser.yyException; import mycompiler.mytypereconstruction.TypeinferenceResultSet; -import typinferenz.TypeInsertPoint; -import typinferenz.TypeInsertSet; +import typinferenz.typedeployment.TypeInsertPoint; +import typinferenz.typedeployment.TypeInsertSet; public class InsertSingleTypeTest { private static final String testFile = "SingleTypeInsertTest.jav"; diff --git a/test/plugindevelopment/MartinTestCases/Tester.java b/test/plugindevelopment/MartinTestCases/Tester.java index 98769837..2f9778e0 100644 --- a/test/plugindevelopment/MartinTestCases/Tester.java +++ b/test/plugindevelopment/MartinTestCases/Tester.java @@ -13,7 +13,7 @@ import mycompiler.MyCompiler; import mycompiler.MyCompilerAPI; import mycompiler.myparser.JavaParser.yyException; import mycompiler.mytypereconstruction.TypeinferenceResultSet; -import typinferenz.TypeInsertSet; +import typinferenz.typedeployment.TypeInsertSet; public class Tester extends TypeInsertTester{ diff --git a/test/plugindevelopment/TRMEqualTest.java b/test/plugindevelopment/TRMEqualTest.java index b3ae20d6..0dd52a0f 100644 --- a/test/plugindevelopment/TRMEqualTest.java +++ b/test/plugindevelopment/TRMEqualTest.java @@ -21,9 +21,9 @@ import mycompiler.mytype.TypePlaceholder; import mycompiler.mytypereconstruction.TypeinferenceResultSet; import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; import typinferenz.ResultSet; -import typinferenz.TypeInsertPoint; -import typinferenz.TypeInsertSet; import typinferenz.TypeInsertable; +import typinferenz.typedeployment.TypeInsertPoint; +import typinferenz.typedeployment.TypeInsertSet; public class TRMEqualTest { Vector replaceSet = new Vector(); @@ -56,7 +56,7 @@ public class TRMEqualTest { resultContent.add(pair); ResultSet resultSet = new ResultSet(resultContent); Vector tphs = tph.getTypeInsertPoints(resultSet); - TypeInsertSet toAdd = new TypeInsertSet(); + TypeInsertSet toAdd = new TypeInsertSet(resultSet); for(TypeInsertPoint tip : tphs){ toAdd.add(tip); } diff --git a/test/plugindevelopment/TypeInsertSetEqualTest.java b/test/plugindevelopment/TypeInsertSetEqualTest.java index 836aa2b0..592a9f1e 100644 --- a/test/plugindevelopment/TypeInsertSetEqualTest.java +++ b/test/plugindevelopment/TypeInsertSetEqualTest.java @@ -12,7 +12,7 @@ import mycompiler.mytypereconstruction.TypeinferenceResultSet; import org.junit.Test; -import typinferenz.TypeInsertSet; +import typinferenz.typedeployment.TypeInsertSet; public class TypeInsertSetEqualTest { diff --git a/test/plugindevelopment/TypeInsertTester.java b/test/plugindevelopment/TypeInsertTester.java index 781fbd73..f1129eac 100644 --- a/test/plugindevelopment/TypeInsertTester.java +++ b/test/plugindevelopment/TypeInsertTester.java @@ -17,8 +17,8 @@ import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; import org.apache.log4j.SimpleLayout; -import typinferenz.TypeInsertPoint; -import typinferenz.TypeInsertSet; +import typinferenz.typedeployment.TypeInsertPoint; +import typinferenz.typedeployment.TypeInsertSet; import junit.framework.TestCase; import mycompiler.MyCompiler; import mycompiler.MyCompilerAPI; diff --git a/test/plugindevelopment/TypeInsertTests/BoundedGenericsTest.java b/test/plugindevelopment/TypeInsertTests/BoundedGenericsTest.java index f0c5094a..6e2c772c 100644 --- a/test/plugindevelopment/TypeInsertTests/BoundedGenericsTest.java +++ b/test/plugindevelopment/TypeInsertTests/BoundedGenericsTest.java @@ -10,7 +10,7 @@ public class BoundedGenericsTest { @Test public void run(){ Vector mustContain = new Vector(); - mustContain.add("var"); + mustContain.add("java.lang.String var"); MultipleTypesInsertTester.test(this.TEST_FILE, mustContain); } } diff --git a/test/plugindevelopment/TypeInsertTests/GenericParaListInsertTest.jav b/test/plugindevelopment/TypeInsertTests/GenericParaListInsertTest.jav new file mode 100644 index 00000000..e3c98b2b --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/GenericParaListInsertTest.jav @@ -0,0 +1,3 @@ +class GenericParaListInsertTest{ +methode(a){return a;} +} \ No newline at end of file diff --git a/test/plugindevelopment/TypeInsertTests/GenericParaListInsertTest.java b/test/plugindevelopment/TypeInsertTests/GenericParaListInsertTest.java new file mode 100644 index 00000000..d88ca52c --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/GenericParaListInsertTest.java @@ -0,0 +1,16 @@ +package plugindevelopment.TypeInsertTests; + +import java.util.Vector; + +import org.junit.Test; + +public class GenericParaListInsertTest { + private static final String TEST_FILE = "GenericParaListInsertTest.jav"; + + @Test + public void run(){ + Vector mustContain = new Vector(); + mustContain.add("<"); //Es muss eine Parameterliste generiert werden. + MultipleTypesInsertTester.test(this.TEST_FILE, mustContain); + } +} diff --git a/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java b/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java index 593cd0bc..16229e7b 100644 --- a/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java +++ b/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java @@ -10,7 +10,7 @@ import mycompiler.MyCompiler; import mycompiler.MyCompilerAPI; import mycompiler.myparser.JavaParser.yyException; import mycompiler.mytypereconstruction.TypeinferenceResultSet; -import typinferenz.TypeInsertSet; +import typinferenz.typedeployment.TypeInsertSet; public class MultipleTypesInsertTester extends TypeInsertTester{ diff --git a/test/plugindevelopment/TypeInsertTests/OverloadingInsertTest.java b/test/plugindevelopment/TypeInsertTests/OverloadingInsertTest.java index 1347e703..77e3ea9d 100644 --- a/test/plugindevelopment/TypeInsertTests/OverloadingInsertTest.java +++ b/test/plugindevelopment/TypeInsertTests/OverloadingInsertTest.java @@ -12,7 +12,7 @@ import mycompiler.mytypereconstruction.TypeinferenceResultSet; import org.junit.Test; -import typinferenz.TypeInsertSet; +import typinferenz.typedeployment.TypeInsertSet; public class OverloadingInsertTest { private static final String TEST_FILE = "OverloadingInsertTest.jav";