GenericTypeVar setParentClass entfernt

This commit is contained in:
JanUlrich 2014-09-10 23:32:36 +02:00
parent 45ea59e7ad
commit ca8145e4a2
8 changed files with 25 additions and 28 deletions

13
bin/.gitignore vendored
View File

@ -1,6 +1,7 @@
/de /bytecode/
/plugindevelopment /de/
/mycompiler /log4jTesting.xml
/mytypereconstruction /mycompiler/
/syntaxTree /parser/
/userinterface /plugindevelopment/
/syntaxTree/

View File

@ -1134,10 +1134,11 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
if(t instanceof GenericTypeVar)this.genericClassParameters.add((GenericTypeVar)t); if(t instanceof GenericTypeVar)this.genericClassParameters.add((GenericTypeVar)t);
else this.genericClassParameters.add(new GenericTypeVar(t.get_Name(),this,-1)); else this.genericClassParameters.add(new GenericTypeVar(t.get_Name(),this,-1));
} }
/*
for(GenericTypeVar gtv : this.getGenericParameter()){ for(GenericTypeVar gtv : this.getGenericParameter()){
gtv.setParentClass(this);; gtv.setParentClass(this);;
} }
*/
//TODO: Umwandlung zu RefTypes funktioniert noch nicht richtig. (siehe LambdaTest2) //TODO: Umwandlung zu RefTypes funktioniert noch nicht richtig. (siehe LambdaTest2)
//Als RefType geparste Generische Variablen umwandeln: //Als RefType geparste Generische Variablen umwandeln:
this.wandleRefTypeAttributes2GenericAttributes(); this.wandleRefTypeAttributes2GenericAttributes();
@ -1153,8 +1154,8 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
Vector<SyntaxTreeNode> ret = new Vector<SyntaxTreeNode>(); Vector<SyntaxTreeNode> ret = new Vector<SyntaxTreeNode>();
for(Field f : this.getFields()){ for(Field f : this.getFields()){
ret.add(f); ret.add(f);
ret.addAll(this.getGenericParameter());
} }
ret.addAll(this.getGenericParameter());
return ret; return ret;
} }

View File

@ -158,6 +158,7 @@ public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Ty
public Vector<SyntaxTreeNode> getChildren() { public Vector<SyntaxTreeNode> getChildren() {
Vector<SyntaxTreeNode> ret = new Vector<>(); Vector<SyntaxTreeNode> ret = new Vector<>();
if(this.getType()!=null)ret.add(this.getType()); if(this.getType()!=null)ret.add(this.getType());
ret.addAll(this.getGenericParameter());
return ret; return ret;
} }

View File

@ -101,7 +101,6 @@ public class FieldDeclaration extends Field{
public void parserPostProcessing(SyntaxTreeNode parent){ public void parserPostProcessing(SyntaxTreeNode parent){
super.parserPostProcessing(parent); super.parserPostProcessing(parent);
if(this.getType() == null)this.setType(TypePlaceholder.fresh(this)); if(this.getType() == null)this.setType(TypePlaceholder.fresh(this));
} }
@Override @Override

View File

@ -103,7 +103,7 @@ public abstract class SyntaxTreeNode implements IItemWithOffset{
*/ */
} }
} }
public boolean seesType(Type tA2) { public boolean seesType(Type tA2) {

View File

@ -7,6 +7,7 @@ package de.dhbwstuttgart.syntaxtree.type;
import java.util.Vector; import java.util.Vector;
import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.typeinference.ConstraintType; import de.dhbwstuttgart.typeinference.ConstraintType;
import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.SingleConstraint; import de.dhbwstuttgart.typeinference.SingleConstraint;
@ -55,7 +56,7 @@ public class BoundedGenericTypeVar extends GenericTypeVar
*/ */
// ino.method.BoundedGenericTypeVar.29409.definition // ino.method.BoundedGenericTypeVar.29409.definition
public BoundedGenericTypeVar(String s, Vector<Type> bounds, Class parentClass, int offset, int endOffset) public BoundedGenericTypeVar(String s, Vector<Type> bounds, SyntaxTreeNode parentClass, int offset, int endOffset)
// ino.end // ino.end
// ino.method.BoundedGenericTypeVar.29409.body // ino.method.BoundedGenericTypeVar.29409.body
{ {
@ -147,5 +148,12 @@ public class BoundedGenericTypeVar extends GenericTypeVar
} }
// ino.end // ino.end
@Override
public Vector<SyntaxTreeNode> getChildren() {
Vector<SyntaxTreeNode> ret = super.getChildren();
ret.addAll(this.bounds);
return ret;
}
} }
// ino.end // ino.end

View File

@ -36,7 +36,6 @@ public class GenericTypeVar extends Type
//Type genericTypeVar; //Type genericTypeVar;
//Vector<Type> extendVars = new Vector<Type>(); //Vector<Type> extendVars = new Vector<Type>();
protected Pair genericConstraint; protected Pair genericConstraint;
private Class parent;
/** /**
* Eine Registry f<EFBFBD>r alle Generic-Instanzen, die vor der Bytecode-Generierung durch * Eine Registry f<EFBFBD>r alle Generic-Instanzen, die vor der Bytecode-Generierung durch
* Ihre Superklasse ersetzt werden m<EFBFBD>ssen. Siehe "Type Erasure" in Sun Spezifikation. * Ihre Superklasse ersetzt werden m<EFBFBD>ssen. Siehe "Type Erasure" in Sun Spezifikation.
@ -63,7 +62,7 @@ public class GenericTypeVar extends Type
*/ */
// ino.method.GenericTypeVar.26509.definition // ino.method.GenericTypeVar.26509.definition
public GenericTypeVar(String s, Class parentClass, int offset) public GenericTypeVar(String s, SyntaxTreeNode parentClass, int offset)
// ino.end // ino.end
// ino.method.GenericTypeVar.26509.body // ino.method.GenericTypeVar.26509.body
{ {
@ -218,18 +217,6 @@ public class GenericTypeVar extends Type
public int getEndOffset() { public int getEndOffset() {
return this.getOffset() + this.name.toString().length(); return this.getOffset() + this.name.toString().length();
} }
public void setParentClass(Class parent){
//TODO: Die Methode sollte mit neuem Parser raus und dafür nur noch im Konstruktor gesetzt werden.
this.parent = parent;
}
public Class getParentClass() {
if(this.parent == null)
throw new DebugException("GenericTypeVar ohne Elternelement");
return this.parent;
}
} }
// ino.end // ino.end

View File

@ -36,17 +36,17 @@ public class Type extends SyntaxTreeNode implements IItemWithOffset
// ino.end // ino.end
// ino.method.Type.26729.definition // ino.method.Type.26729.definition
public Type(String s, int offset) public Type(String s, SyntaxTreeNode parent, int offset)
// ino.end // ino.end
// ino.method.Type.26729.body // ino.method.Type.26729.body
{ {
this(offset); this(parent, offset);
this.name = new JavaClassName(s); this.name = new JavaClassName(s);
} }
// ino.end // ino.end
// ino.method.Type.26732.definition // ino.method.Type.26732.definition
public Type(int offset) public Type(SyntaxTreeNode parent,int offset)
// ino.end // ino.end
// ino.method.Type.26732.body // ino.method.Type.26732.body
{ {