forked from JavaTX/JavaCompilerCore
Bugfix
This commit is contained in:
parent
eab2c7ef93
commit
db4442628b
@ -303,6 +303,7 @@ public class Pair
|
|||||||
{
|
{
|
||||||
boolean ret = true;
|
boolean ret = true;
|
||||||
ret &= (obj instanceof Pair);
|
ret &= (obj instanceof Pair);
|
||||||
|
if(!ret)return ret;
|
||||||
ret &= ((Pair)obj).TA1.equals(this.TA1);
|
ret &= ((Pair)obj).TA1.equals(this.TA1);
|
||||||
ret &= ((Pair)obj).TA2.equals(this.TA2);
|
ret &= ((Pair)obj).TA2.equals(this.TA2);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -174,8 +174,8 @@ public class Type implements IItemWithOffset
|
|||||||
// ino.method.equals.26765.body
|
// ino.method.equals.26765.body
|
||||||
{
|
{
|
||||||
if(obj instanceof Type){
|
if(obj instanceof Type){
|
||||||
String name2 = ((Type)obj).name;
|
String name2 = ((Type)obj).printJavaCode(new ResultSet()).toString();
|
||||||
return getName().equals(name2);
|
return printJavaCode(new ResultSet()).toString().equals(name2);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
return false;
|
return false;
|
||||||
|
@ -21,6 +21,13 @@ public class ResultSet implements Iterable<Pair> {
|
|||||||
resultPairs = resultSet;
|
resultPairs = resultSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstellt ein leeres ResultSet
|
||||||
|
*/
|
||||||
|
public ResultSet() {
|
||||||
|
this(new Vector<Pair>());
|
||||||
|
}
|
||||||
|
|
||||||
public Vector<Pair> getResultSet(){
|
public Vector<Pair> getResultSet(){
|
||||||
return resultPairs;
|
return resultPairs;
|
||||||
}
|
}
|
||||||
|
@ -21,26 +21,18 @@ public class TypeInsertPoint implements Comparable<TypeInsertPoint>{
|
|||||||
protected IItemWithOffset point;
|
protected IItemWithOffset point;
|
||||||
protected Type type;
|
protected Type type;
|
||||||
protected ResultSet resultSet;
|
protected ResultSet resultSet;
|
||||||
protected Vector<TypePlaceholder> generics = null;
|
|
||||||
|
|
||||||
public TypeInsertPoint(IItemWithOffset insertPoint, Type insertType, ResultSet resultSet){
|
|
||||||
this(insertPoint, insertType, resultSet, null);
|
|
||||||
this.generics = this.getUnresolvedTPH();//Alle im insertType vorkommenden TPH müssen als Generics eingesetzt werden.
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dieser Konstruktor erstellt einen TypInsertPoint, welcher nicht nur insertType einsetzt,
|
* Dieser Konstruktor erstellt einen TypInsertPoint
|
||||||
* sonder auch die übergebenen generischen Variablen einsetzt.
|
|
||||||
* @param insertPoint
|
* @param insertPoint
|
||||||
* @param insertType
|
* @param insertType
|
||||||
* @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, Vector<TypePlaceholder> generics){
|
public TypeInsertPoint(IItemWithOffset insertPoint, Type insertType, ResultSet resultSet){
|
||||||
this.point = insertPoint;
|
this.point = insertPoint;
|
||||||
this.type = insertType;
|
this.type = insertType;
|
||||||
this.resultSet = resultSet;
|
this.resultSet = resultSet;
|
||||||
this.generics = generics;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,7 +54,7 @@ public class TypeInsertPoint implements Comparable<TypeInsertPoint>{
|
|||||||
|
|
||||||
public Vector<TypePlaceholder> getUnresolvedTPH(){
|
public Vector<TypePlaceholder> getUnresolvedTPH(){
|
||||||
Vector<TypePlaceholder> ret = new Vector<TypePlaceholder>();
|
Vector<TypePlaceholder> ret = new Vector<TypePlaceholder>();
|
||||||
ret.addAll(this.type.getUnresolvedTPH(resultSet));
|
ret.addAll(this.getInsertType().getUnresolvedTPH(resultSet));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,12 +66,16 @@ public class TypeInsertPoint implements Comparable<TypeInsertPoint>{
|
|||||||
return this.getInsertNode().getOffset();
|
return this.getInsertNode().getOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Type getInsertType(){
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Die Zeichenkette die durch diesen TypeInsertPoint eingesetzt wird. (Der Typ als String)
|
* Die Zeichenkette die durch diesen TypeInsertPoint eingesetzt wird. (Der Typ als String)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public JavaCodeResult getTypeInsertString(){
|
public JavaCodeResult getTypeInsertString(){
|
||||||
JavaCodeResult ret = type.printJavaCode(this.resultSet).attach(" ");
|
JavaCodeResult ret = this.getInsertType().printJavaCode(this.resultSet).attach(" ");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,9 +90,9 @@ public class TypeInsertPoint implements Comparable<TypeInsertPoint>{
|
|||||||
public boolean equals(Object obj){
|
public boolean equals(Object obj){
|
||||||
if(! (obj instanceof TypeInsertPoint))return false;
|
if(! (obj instanceof TypeInsertPoint))return false;
|
||||||
TypeInsertPoint equals = (TypeInsertPoint) obj;
|
TypeInsertPoint equals = (TypeInsertPoint) obj;
|
||||||
if(!(equals.point.equals(this.point)))return false;
|
if(!(equals.getInsertNode().equals(this.getInsertNode())))return false;
|
||||||
if(!(equals.resultSet.equals(this.resultSet)))return false;
|
if(!(equals.resultSet.equals(this.resultSet)))return false;
|
||||||
if(!(equals.type.equals(this.type)))return false;
|
if(!(equals.getInsertType().equals(this.getInsertType())))return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,10 @@ 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(tphs);
|
TypeInsertSet toAdd = new TypeInsertSet();
|
||||||
|
for(TypeInsertPoint tip : tphs){
|
||||||
|
toAdd.add(tip);
|
||||||
|
}
|
||||||
System.out.println("Füge hinzu: "+toAdd);
|
System.out.println("Füge hinzu: "+toAdd);
|
||||||
if(!replaceSet.contains(toAdd))replaceSet.add(toAdd);
|
if(!replaceSet.contains(toAdd))replaceSet.add(toAdd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user