Änderungen am TypeInsertSet. Momentan werden keine Generics eingesetzt

This commit is contained in:
JanUlrich 2014-06-19 19:40:13 +02:00
parent 370bb8913b
commit 1f55b81b02
25 changed files with 149 additions and 47 deletions

View File

@ -4,11 +4,11 @@ import java.util.Vector;
import typinferenz.GenericTypeInsertPoint; import typinferenz.GenericTypeInsertPoint;
import typinferenz.ResultSet; import typinferenz.ResultSet;
import typinferenz.TypeInsertPoint;
import typinferenz.TypeInsertSet;
import typinferenz.TypeInsertable; import typinferenz.TypeInsertable;
import typinferenz.exceptions.DebugException; import typinferenz.exceptions.DebugException;
import typinferenz.exceptions.TypeinferenceException; import typinferenz.exceptions.TypeinferenceException;
import typinferenz.typedeployment.TypeInsertPoint;
import typinferenz.typedeployment.TypeInsertSet;
import mycompiler.myclass.Class; import mycompiler.myclass.Class;
import mycompiler.myclass.Generic; import mycompiler.myclass.Generic;
import mycompiler.mytype.GenericTypeVar; import mycompiler.mytype.GenericTypeVar;
@ -86,6 +86,7 @@ public abstract class SyntaxTreeNode{
tip = that.createTypeInsertPoint((TypePlaceholder) t, result); tip = that.createTypeInsertPoint((TypePlaceholder) t, result);
insertSet.add(tip);//ret.addAll(((TypePlaceholder)t).getTypeInsertPoints(result)); insertSet.add(tip);//ret.addAll(((TypePlaceholder)t).getTypeInsertPoints(result));
} }
/*
//Für den Fall, dass dieser Knoten Generische Variablen halten kann. //Für den Fall, dass dieser Knoten Generische Variablen halten kann.
if(that instanceof Generic && that.getOffset()>=0){ if(that instanceof Generic && that.getOffset()>=0){
//Alle unresolvedTPHs ermitteln und GenericTypeVarInsertPoints bilden: //Alle unresolvedTPHs ermitteln und GenericTypeVarInsertPoints bilden:
@ -102,6 +103,7 @@ public abstract class SyntaxTreeNode{
} }
} }
} }
*/
} }

View File

@ -63,18 +63,19 @@ import org.apache.log4j.Logger;
import sun.reflect.generics.reflectiveObjects.NotImplementedException; import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import typinferenz.ConstraintsSet; import typinferenz.ConstraintsSet;
import typinferenz.JavaCodeResult; import typinferenz.JavaCodeResult;
import typinferenz.OderConstraint; import typinferenz.OderConstraint;
import typinferenz.ResultSet; import typinferenz.ResultSet;
import typinferenz.TypeInsertPoint;
import typinferenz.Typeable; import typinferenz.Typeable;
import typinferenz.UndConstraint; import typinferenz.UndConstraint;
import typinferenz.FunN; import typinferenz.FunN;
import typinferenz.assumptions.ClassAssumption; import typinferenz.assumptions.ClassAssumption;
import typinferenz.assumptions.TypeAssumptions; import typinferenz.assumptions.TypeAssumptions;
import typinferenz.exceptions.TypeinferenceException; import typinferenz.exceptions.TypeinferenceException;
import typinferenz.typedeployment.TypeInsertPoint;
import typinferenz.*; import typinferenz.*;

View File

@ -13,10 +13,10 @@ import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
import typinferenz.ConstraintsSet; import typinferenz.ConstraintsSet;
import typinferenz.JavaCodeResult; import typinferenz.JavaCodeResult;
import typinferenz.ResultSet; import typinferenz.ResultSet;
import typinferenz.TypeInsertPoint;
import typinferenz.Typeable; import typinferenz.Typeable;
import typinferenz.TypeInsertable; import typinferenz.TypeInsertable;
import typinferenz.assumptions.TypeAssumptions; import typinferenz.assumptions.TypeAssumptions;
import typinferenz.typedeployment.TypeInsertPoint;
public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Typeable, Generic{ public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Typeable, Generic{

View File

@ -28,14 +28,15 @@ import org.apache.log4j.Logger;
import sun.reflect.generics.reflectiveObjects.NotImplementedException; import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import typinferenz.JavaCodeResult; import typinferenz.JavaCodeResult;
import typinferenz.ResultSet; import typinferenz.ResultSet;
import typinferenz.TypeInsertPoint;
import typinferenz.TypeInsertSet;
import typinferenz.Typeable; import typinferenz.Typeable;
import typinferenz.TypeInsertable; import typinferenz.TypeInsertable;
import typinferenz.exceptions.TypeinferenceException; import typinferenz.exceptions.TypeinferenceException;
import typinferenz.typedeployment.TypeInsertPoint;
import typinferenz.typedeployment.TypeInsertSet;
// ino.class.FormalParameter.23391.declaration // ino.class.FormalParameter.23391.declaration
public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementListener, Typeable, TypeInsertable public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementListener, Typeable, TypeInsertable

View File

@ -36,12 +36,12 @@ import typinferenz.JavaCodeResult;
import typinferenz.SingleConstraint; import typinferenz.SingleConstraint;
import typinferenz.ConstraintsSet; import typinferenz.ConstraintsSet;
import typinferenz.ResultSet; import typinferenz.ResultSet;
import typinferenz.TypeInsertPoint;
import typinferenz.TypeInsertable; import typinferenz.TypeInsertable;
import typinferenz.assumptions.MethodAssumption; import typinferenz.assumptions.MethodAssumption;
import typinferenz.assumptions.ParameterAssumption; import typinferenz.assumptions.ParameterAssumption;
import typinferenz.assumptions.TypeAssumptions; import typinferenz.assumptions.TypeAssumptions;
import typinferenz.exceptions.TypeinferenceException; import typinferenz.exceptions.TypeinferenceException;
import typinferenz.typedeployment.TypeInsertPoint;

View File

@ -1,7 +1,7 @@
package mycompiler.mystatement; package mycompiler.mystatement;
import typinferenz.ResultSet; import typinferenz.ResultSet;
import typinferenz.TypeInsertPoint; import typinferenz.typedeployment.TypeInsertPoint;
import mycompiler.myclass.DeclId; import mycompiler.myclass.DeclId;
import mycompiler.myclass.FormalParameter; import mycompiler.myclass.FormalParameter;
import mycompiler.mytype.Type; import mycompiler.mytype.Type;

View File

@ -41,15 +41,16 @@ import org.apache.log4j.Logger;
import typinferenz.ConstraintsSet; import typinferenz.ConstraintsSet;
import typinferenz.FreshTypeVariable; import typinferenz.FreshTypeVariable;
import typinferenz.JavaCodeResult; import typinferenz.JavaCodeResult;
import typinferenz.ResultSet; import typinferenz.ResultSet;
import typinferenz.TypeInsertPoint;
import typinferenz.TypeInsertable; import typinferenz.TypeInsertable;
import typinferenz.assumptions.LocalVarAssumption; import typinferenz.assumptions.LocalVarAssumption;
import typinferenz.assumptions.TypeAssumptions; import typinferenz.assumptions.TypeAssumptions;
import typinferenz.exceptions.TypeinferenceException; import typinferenz.exceptions.TypeinferenceException;
import typinferenz.typedeployment.TypeInsertPoint;

View File

@ -17,15 +17,16 @@ import java.util.Vector;
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
import typinferenz.ConstraintsSet; import typinferenz.ConstraintsSet;
import typinferenz.JavaCodeResult; import typinferenz.JavaCodeResult;
import typinferenz.ResultSet; import typinferenz.ResultSet;
import typinferenz.SingleConstraint; import typinferenz.SingleConstraint;
import typinferenz.TypeInsertPoint;
import typinferenz.TypeInsertable; import typinferenz.TypeInsertable;
import typinferenz.assumptions.TypeAssumptions; import typinferenz.assumptions.TypeAssumptions;
import typinferenz.typedeployment.TypeInsertPoint;
// ino.class.GenericTypeVar.26505.description type=javadoc // ino.class.GenericTypeVar.26505.description type=javadoc

View File

@ -10,9 +10,9 @@ import java.util.logging.Logger;
import typinferenz.JavaCodeResult; import typinferenz.JavaCodeResult;
import typinferenz.ResultSet; import typinferenz.ResultSet;
import typinferenz.TypeInsertPoint;
import typinferenz.TypeInsertSet;
import typinferenz.TypeInsertable; import typinferenz.TypeInsertable;
import typinferenz.typedeployment.TypeInsertPoint;
import typinferenz.typedeployment.TypeInsertSet;
import mycompiler.MyCompiler; import mycompiler.MyCompiler;
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
import mycompiler.mytypereconstruction.replacementlistener.IReplaceTypeEventProvider; import mycompiler.mytypereconstruction.replacementlistener.IReplaceTypeEventProvider;

View File

@ -9,10 +9,10 @@ import java.util.Vector;
import typinferenz.ConstraintsSet; import typinferenz.ConstraintsSet;
import typinferenz.ResultSet; import typinferenz.ResultSet;
import typinferenz.TypeInsertPoint;
import typinferenz.TypeInsertSet;
import typinferenz.assumptions.TypeAssumptions; import typinferenz.assumptions.TypeAssumptions;
import typinferenz.exceptions.TypeinferenceException; import typinferenz.exceptions.TypeinferenceException;
import typinferenz.typedeployment.TypeInsertPoint;
import typinferenz.typedeployment.TypeInsertSet;
import mycompiler.mytype.GenericTypeVar; import mycompiler.mytype.GenericTypeVar;
import mycompiler.mytype.Pair; import mycompiler.mytype.Pair;
import mycompiler.mytype.RefType; import mycompiler.mytype.RefType;
@ -74,7 +74,6 @@ public class TypeinferenceResultSet
return this.constraints; return this.constraints;
} }
/** /**
* @author Andreas Stadelmeier, a10023 * @author Andreas Stadelmeier, a10023
* Nach dem Durchführen des Interferenzalgorithmus von Lambda 8 entsteht für jede Lösung ein Set con Constraints. * Nach dem Durchführen des Interferenzalgorithmus von Lambda 8 entsteht für jede Lösung ein Set con Constraints.
@ -114,7 +113,7 @@ public class TypeinferenceResultSet
* @return * @return
*/ */
public TypeInsertSet getTypeInsertionPoints(){ public TypeInsertSet getTypeInsertionPoints(){
TypeInsertSet ret = new TypeInsertSet(); TypeInsertSet ret = new TypeInsertSet(this.unifiedConstraints);
this.ownerOfResultSet.addTypeInsertPoints(ret,this.unifiedConstraints); this.ownerOfResultSet.addTypeInsertPoints(ret,this.unifiedConstraints);

View File

@ -2,6 +2,7 @@ package typinferenz;
import java.util.Vector; import java.util.Vector;
import typinferenz.typedeployment.TypeInsertPoint;
import mycompiler.mytype.*; import mycompiler.mytype.*;
import mycompiler.myclass.*; import mycompiler.myclass.*;
import mycompiler.mytype.TypePlaceholder; import mycompiler.mytype.TypePlaceholder;

View File

@ -4,6 +4,7 @@ import java.util.Iterator;
import java.util.Vector; import java.util.Vector;
import typinferenz.exceptions.DebugException; import typinferenz.exceptions.DebugException;
import typinferenz.typedeployment.TypeInsertPoint;
import mycompiler.IItemWithOffset; import mycompiler.IItemWithOffset;
import mycompiler.SyntaxTreeNode; import mycompiler.SyntaxTreeNode;
import mycompiler.mytype.GenericTypeVar; import mycompiler.mytype.GenericTypeVar;
@ -19,6 +20,7 @@ import mycompiler.mytype.TypePlaceholder;
*/ */
public class GenericTypeInsertPoint extends TypeInsertPoint { public class GenericTypeInsertPoint extends TypeInsertPoint {
private Vector<Pair> genericPairs = new Vector<Pair>(); private Vector<Pair> genericPairs = new Vector<Pair>();
public GenericTypeInsertPoint(TypeInsertPoint p) { public GenericTypeInsertPoint(TypeInsertPoint p) {
@ -100,9 +102,10 @@ public class GenericTypeInsertPoint extends TypeInsertPoint {
} }
@Override @Override
public IItemWithOffset getInsertNode(){ public TypeInsertable getInsertNode(){
return super.getGenericTypeVarInsertNode(); return super.getGenericTypeVarInsertNode();
} }
/** /**
* Versucht den GenericTypeInsertPoint mit dem <FC>bergebenenen p2 zusam * Versucht den GenericTypeInsertPoint mit dem <FC>bergebenenen p2 zusam
* basierend auf ihren insertPoints. * basierend auf ihren insertPoints.
@ -121,4 +124,17 @@ public class GenericTypeInsertPoint extends TypeInsertPoint {
return ret; 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<TypePlaceholder> tphs = new Vector<>();
tphs.add((TypePlaceholder)tip.point);
resultSet.getConstraintsFor(tphs);
return false;
}
} }

View File

@ -1,5 +1,6 @@
package typinferenz; package typinferenz;
import typinferenz.typedeployment.TypeInsertPoint;
import mycompiler.IItemWithOffset; import mycompiler.IItemWithOffset;
import mycompiler.mytype.TypePlaceholder; import mycompiler.mytype.TypePlaceholder;
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;

View File

@ -1,7 +1,10 @@
package typinferenz; package typinferenz.typedeployment;
import java.util.Vector; import java.util.Vector;
import typinferenz.JavaCodeResult;
import typinferenz.ResultSet;
import typinferenz.TypeInsertable;
import typinferenz.exceptions.DebugException; import typinferenz.exceptions.DebugException;
import mycompiler.myclass.*; import mycompiler.myclass.*;
import mycompiler.myclass.Class; import mycompiler.myclass.Class;
@ -18,9 +21,9 @@ import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListe
*/ */
public class TypeInsertPoint implements Comparable<TypeInsertPoint>{ public class TypeInsertPoint implements Comparable<TypeInsertPoint>{
protected IItemWithOffset point; public TypeInsertable point;
protected Type type; public Type type;
protected ResultSet resultSet; public ResultSet resultSet;
/** /**
* Dieser Konstruktor erstellt einen TypInsertPoint * Dieser Konstruktor erstellt einen TypInsertPoint
@ -29,7 +32,7 @@ public class TypeInsertPoint implements Comparable<TypeInsertPoint>{
* @param resultSet * @param resultSet
* @param generics - die generischen Parameter des einzusetzenden Typs * @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.point = insertPoint;
this.type = insertType; this.type = insertType;
this.resultSet = resultSet; this.resultSet = resultSet;
@ -106,10 +109,7 @@ public class TypeInsertPoint implements Comparable<TypeInsertPoint>{
return resultSet; return resultSet;
} }
public IItemWithOffset getGenericTypeVarInsertNode() { public TypeInsertable getGenericTypeVarInsertNode() {
if(! (this.point instanceof SyntaxTreeNode)){
throw new DebugException("Ein IItemWithOffset muss immer auch ein SyntaxTreeNode sein");
}
SyntaxTreeNode ret = (SyntaxTreeNode)this.point; SyntaxTreeNode ret = (SyntaxTreeNode)this.point;
while(!(ret instanceof Field || ret instanceof Class)){ while(!(ret instanceof Field || ret instanceof Class)){
ret = ret.getParent(); ret = ret.getParent();
@ -117,7 +117,7 @@ public class TypeInsertPoint implements Comparable<TypeInsertPoint>{
throw new DebugException(this.getInsertNode().toString()+" hat kein Feld oder Klasse als Elternelement"); throw new DebugException(this.getInsertNode().toString()+" hat kein Feld oder Klasse als Elternelement");
} }
} }
return (IItemWithOffset)ret; return (TypeInsertable) ret;
} }
} }

View File

@ -1,10 +1,14 @@
package typinferenz; package typinferenz.typedeployment;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Vector; import java.util.Vector;
import typinferenz.GenericTypeInsertPoint;
import typinferenz.JavaCodeResult;
import typinferenz.ResultSet;
import typinferenz.TypeInsertable;
import mycompiler.IItemWithOffset; import mycompiler.IItemWithOffset;
import mycompiler.SyntaxTreeNode; import mycompiler.SyntaxTreeNode;
import mycompiler.mytype.GenericTypeVar; import mycompiler.mytype.GenericTypeVar;
@ -26,8 +30,10 @@ public class TypeInsertSet {
public Vector<TypeInsertPoint> points = new Vector<TypeInsertPoint>(); public Vector<TypeInsertPoint> points = new Vector<TypeInsertPoint>();
private Vector<GenericTypeInsertPoint> genericTypeInsertPoints = new Vector<GenericTypeInsertPoint>(); private Vector<GenericTypeInsertPoint> genericTypeInsertPoints = new Vector<GenericTypeInsertPoint>();
private ResultSet resultSet;
public TypeInsertSet() { public TypeInsertSet(ResultSet resultSet) {
this.resultSet = resultSet;
} }
/** /**
@ -53,26 +59,56 @@ public class TypeInsertSet {
* @return * @return
*/ */
public String insertType(TypeInsertPoint tip, String fileContent){ public String insertType(TypeInsertPoint tip, String fileContent){
TypeInsertSet tis = new TypeInsertSet(); TypePatchJob tpj = new TypePatchJob();
int additionalOffset = 0; int additionalOffset = 0;
String ret = fileContent; String ret = fileContent;
JavaCodeResult unresolvedTPHs = tip.insertType(ret, additionalOffset); JavaCodeResult unresolvedTPHs = tip.insertType(ret, additionalOffset);
for(TypePlaceholder tph : unresolvedTPHs.getUnresolvedTPH()){ for(TypePlaceholder tph : unresolvedTPHs.getUnresolvedTPH()){
GenericTypeInsertPoint genericTIP = new GenericTypeInsertPoint((TypeInsertable)tip.getGenericTypeVarInsertNode(),tph,tip.getResultSet()); GenericTypeInsertPoint genericTIP = new GenericTypeInsertPoint(tip.getGenericTypeVarInsertNode(),tph,tip.getResultSet());
tis.add(genericTIP); 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 * Fügt alle Typen dieses TypeInsertSets in den übergebenen Quellcode ein
* @param fileContent * @param fileContent
* @return * @return
*/ */
public String insertAllTypes(String fileContent) { 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; int additionalOffset = 0;
String ret = fileContent; String ret = fileContent;
@ -105,6 +141,7 @@ public class TypeInsertSet {
additionalOffset += p.getInsertLength(); additionalOffset += p.getInsertLength();
} }
return ret; return ret;
*/
} }
/** /**
@ -166,3 +203,26 @@ public class TypeInsertSet {
} }
} }
/**
* Stellt eine Reihe von TypeInsertions dar
*/
class TypePatchJob{
private Vector<TypeInsertPoint> 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;
}
}

View File

@ -15,8 +15,8 @@ import mycompiler.MyCompiler;
import mycompiler.MyCompilerAPI; import mycompiler.MyCompilerAPI;
import mycompiler.myparser.JavaParser.yyException; import mycompiler.myparser.JavaParser.yyException;
import mycompiler.mytypereconstruction.TypeinferenceResultSet; import mycompiler.mytypereconstruction.TypeinferenceResultSet;
import typinferenz.TypeInsertPoint; import typinferenz.typedeployment.TypeInsertPoint;
import typinferenz.TypeInsertSet; import typinferenz.typedeployment.TypeInsertSet;
public class InsertSingleTypeTest { public class InsertSingleTypeTest {
private static final String testFile = "SingleTypeInsertTest.jav"; private static final String testFile = "SingleTypeInsertTest.jav";

View File

@ -13,7 +13,7 @@ import mycompiler.MyCompiler;
import mycompiler.MyCompilerAPI; import mycompiler.MyCompilerAPI;
import mycompiler.myparser.JavaParser.yyException; import mycompiler.myparser.JavaParser.yyException;
import mycompiler.mytypereconstruction.TypeinferenceResultSet; import mycompiler.mytypereconstruction.TypeinferenceResultSet;
import typinferenz.TypeInsertSet; import typinferenz.typedeployment.TypeInsertSet;
public class Tester extends TypeInsertTester{ public class Tester extends TypeInsertTester{

View File

@ -21,9 +21,9 @@ import mycompiler.mytype.TypePlaceholder;
import mycompiler.mytypereconstruction.TypeinferenceResultSet; import mycompiler.mytypereconstruction.TypeinferenceResultSet;
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
import typinferenz.ResultSet; import typinferenz.ResultSet;
import typinferenz.TypeInsertPoint;
import typinferenz.TypeInsertSet;
import typinferenz.TypeInsertable; import typinferenz.TypeInsertable;
import typinferenz.typedeployment.TypeInsertPoint;
import typinferenz.typedeployment.TypeInsertSet;
public class TRMEqualTest { public class TRMEqualTest {
Vector<TypeInsertSet> replaceSet = new Vector<TypeInsertSet>(); Vector<TypeInsertSet> replaceSet = new Vector<TypeInsertSet>();
@ -56,7 +56,7 @@ public class TRMEqualTest {
resultContent.add(pair); resultContent.add(pair);
ResultSet resultSet = new ResultSet(resultContent); ResultSet resultSet = new ResultSet(resultContent);
Vector<TypeInsertPoint> tphs = tph.getTypeInsertPoints(resultSet); Vector<TypeInsertPoint> tphs = tph.getTypeInsertPoints(resultSet);
TypeInsertSet toAdd = new TypeInsertSet(); TypeInsertSet toAdd = new TypeInsertSet(resultSet);
for(TypeInsertPoint tip : tphs){ for(TypeInsertPoint tip : tphs){
toAdd.add(tip); toAdd.add(tip);
} }

View File

@ -12,7 +12,7 @@ import mycompiler.mytypereconstruction.TypeinferenceResultSet;
import org.junit.Test; import org.junit.Test;
import typinferenz.TypeInsertSet; import typinferenz.typedeployment.TypeInsertSet;
public class TypeInsertSetEqualTest { public class TypeInsertSetEqualTest {

View File

@ -17,8 +17,8 @@ import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout; import org.apache.log4j.PatternLayout;
import org.apache.log4j.SimpleLayout; import org.apache.log4j.SimpleLayout;
import typinferenz.TypeInsertPoint; import typinferenz.typedeployment.TypeInsertPoint;
import typinferenz.TypeInsertSet; import typinferenz.typedeployment.TypeInsertSet;
import junit.framework.TestCase; import junit.framework.TestCase;
import mycompiler.MyCompiler; import mycompiler.MyCompiler;
import mycompiler.MyCompilerAPI; import mycompiler.MyCompilerAPI;

View File

@ -10,7 +10,7 @@ public class BoundedGenericsTest {
@Test @Test
public void run(){ public void run(){
Vector<String> mustContain = new Vector<String>(); Vector<String> mustContain = new Vector<String>();
mustContain.add("var"); mustContain.add("java.lang.String var");
MultipleTypesInsertTester.test(this.TEST_FILE, mustContain); MultipleTypesInsertTester.test(this.TEST_FILE, mustContain);
} }
} }

View File

@ -0,0 +1,3 @@
class GenericParaListInsertTest{
methode(a){return a;}
}

View File

@ -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<String> mustContain = new Vector<String>();
mustContain.add("<"); //Es muss eine Parameterliste generiert werden.
MultipleTypesInsertTester.test(this.TEST_FILE, mustContain);
}
}

View File

@ -10,7 +10,7 @@ import mycompiler.MyCompiler;
import mycompiler.MyCompilerAPI; import mycompiler.MyCompilerAPI;
import mycompiler.myparser.JavaParser.yyException; import mycompiler.myparser.JavaParser.yyException;
import mycompiler.mytypereconstruction.TypeinferenceResultSet; import mycompiler.mytypereconstruction.TypeinferenceResultSet;
import typinferenz.TypeInsertSet; import typinferenz.typedeployment.TypeInsertSet;
public class MultipleTypesInsertTester extends TypeInsertTester{ public class MultipleTypesInsertTester extends TypeInsertTester{

View File

@ -12,7 +12,7 @@ import mycompiler.mytypereconstruction.TypeinferenceResultSet;
import org.junit.Test; import org.junit.Test;
import typinferenz.TypeInsertSet; import typinferenz.typedeployment.TypeInsertSet;
public class OverloadingInsertTest { public class OverloadingInsertTest {
private static final String TEST_FILE = "OverloadingInsertTest.jav"; private static final String TEST_FILE = "OverloadingInsertTest.jav";