Code aufgeräumt

This commit is contained in:
JanUlrich 2014-07-09 16:04:33 +02:00
parent bbb3cf76d9
commit 0327894686
3 changed files with 32 additions and 22 deletions

View File

@ -969,7 +969,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
// ino.method.wandleRefTypeAttributes2GenericAttributes.23128.body // ino.method.wandleRefTypeAttributes2GenericAttributes.23128.body
{ {
for(Field f : this.getFields()){ for(Field f : this.getFields()){
f.wandleRefTypeAttributes2GenericAttributes(paralist); //f.wandleRefTypeAttributes2GenericAttributes(paralist);
} }
/* /*
Vector fieldsAndMethods=this.getFields(); Vector fieldsAndMethods=this.getFields();

View File

@ -8,6 +8,9 @@ import java.util.Vector;
import sun.reflect.generics.reflectiveObjects.NotImplementedException; import sun.reflect.generics.reflectiveObjects.NotImplementedException;
// ino.end // ino.end
import typinferenz.ConstraintsSet;
import typinferenz.SingleConstraint;
import typinferenz.assumptions.TypeAssumptions;
// ino.class.BoundedGenericTypeVar.26464.description type=javadoc // ino.class.BoundedGenericTypeVar.26464.description type=javadoc
/** /**
@ -52,7 +55,7 @@ public class BoundedGenericTypeVar extends GenericTypeVar
{ {
super(s, offset); super(s, offset);
if(bounds != null)for(Type t : bounds){ if(bounds != null)for(Type t : bounds){
if(t!=null)this.extendVars.add(t); //if(t!=null)this.extendVars.add(t);
} }
this.genericTypeVar = new RefType(s,offset); this.genericTypeVar = new RefType(s,offset);
this.bounds = bounds; this.bounds = bounds;
@ -68,17 +71,21 @@ public class BoundedGenericTypeVar extends GenericTypeVar
} }
// ino.end // ino.end
// ino.method.setBounds.26477.definition
public void setBounds(Vector<Type> types)
// ino.end
// ino.method.setBounds.26477.body
{
this.bounds=types;
}
// ino.end
// ino.method.addBound.26480.definition @Override
public ConstraintsSet TYPE(TypeAssumptions ass) {
ConstraintsSet ret = super.TYPE(ass);
ass.addGenericVarAssumption(this);
//Die Type methode der BoundedGenericTypeVar schreibt zusätzlich noch die Constraints für die bounds
if(this.bounds != null){
for(Type ev : this.bounds){
ret.add(new SingleConstraint(ass.getTypeFor(this), ass.getTypeFor(ev)));
}
}
return ret;
}
// ino.method.addBound.26480.definition
public void addBound(Type bound) public void addBound(Type bound)
// ino.end // ino.end
// ino.method.addBound.26480.body // ino.method.addBound.26480.body

View File

@ -42,7 +42,7 @@ public class GenericTypeVar extends Type
// ino.class.GenericTypeVar.26505.body // ino.class.GenericTypeVar.26505.body
{ {
Type genericTypeVar; Type genericTypeVar;
Vector<Type> extendVars = new Vector<Type>(); //Vector<Type> extendVars = new Vector<Type>();
protected Pair genericConstraint; protected Pair genericConstraint;
/** /**
* 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
@ -57,7 +57,7 @@ public class GenericTypeVar extends Type
/** /**
* *
* @param genericTypeVarExtendsVar * @param genericTypeVarExtendsVar
*/
public GenericTypeVar(Pair genericTypeVarExtendsVar, int offset){ public GenericTypeVar(Pair genericTypeVarExtendsVar, int offset){
super(offset); super(offset);
genericTypeVar = genericTypeVarExtendsVar.TA1; genericTypeVar = genericTypeVarExtendsVar.TA1;
@ -66,7 +66,8 @@ public class GenericTypeVar extends Type
this.genericConstraint = genericTypeVarExtendsVar; this.genericConstraint = genericTypeVarExtendsVar;
} }
this.name = genericTypeVar.toString(); this.name = genericTypeVar.toString();
} }
*/
// ino.method.GenericTypeVar.26509.definition // ino.method.GenericTypeVar.26509.definition
public GenericTypeVar(String s, int offset) public GenericTypeVar(String s, int offset)
@ -78,10 +79,11 @@ public class GenericTypeVar extends Type
} }
// ino.end // ino.end
/*
public GenericTypeVar(Type tA1, int offset) { public GenericTypeVar(Type tA1, int offset) {
this(new Pair(tA1,null),offset); this(new Pair(tA1,null),offset);
} }
*/
// ino.method.clone.26512.defdescription type=javadoc // ino.method.clone.26512.defdescription type=javadoc
/** /**
* <br>Author: J<EFBFBD>rg B<EFBFBD>uerle * <br>Author: J<EFBFBD>rg B<EFBFBD>uerle
@ -160,6 +162,7 @@ public class GenericTypeVar extends Type
if(this.genericTypeVar!=null){ if(this.genericTypeVar!=null){
JavaCodeResult ret = new JavaCodeResult(); JavaCodeResult ret = new JavaCodeResult();
ret.attach(this.genericTypeVar.printJavaCode(resultSet)); ret.attach(this.genericTypeVar.printJavaCode(resultSet));
/*
if(this.extendVars.size()>0){ if(this.extendVars.size()>0){
ret.attach(" extends "); ret.attach(" extends ");
Iterator<Type> it = this.extendVars.iterator(); Iterator<Type> it = this.extendVars.iterator();
@ -169,6 +172,7 @@ public class GenericTypeVar extends Type
if(it.hasNext())ret.attach(", "); if(it.hasNext())ret.attach(", ");
} }
} }
*/
return ret; return ret;
} }
return new JavaCodeResult(this.name); return new JavaCodeResult(this.name);
@ -193,15 +197,14 @@ public class GenericTypeVar extends Type
return this.name; return this.name;
} }
/**
* Die Type Methode auf generische Variablen angewandt sorgt für deren Eintragung in die TypeAssumptions.
* @param ass
* @return
*/
public ConstraintsSet TYPE(TypeAssumptions ass){ public ConstraintsSet TYPE(TypeAssumptions ass){
ConstraintsSet ret = new ConstraintsSet(); ConstraintsSet ret = new ConstraintsSet();
ass.addGenericVarAssumption(this); ass.addGenericVarAssumption(this);
//if(this.genericConstraint != null)ret.add(new SingleConstraint(this.genericConstraint.TA1, this.genericConstraint.TA2));
if(this.extendVars != null){
for(Type ev : this.extendVars){
ret.add(new SingleConstraint(ass.getTypeFor(this), ass.getTypeFor(ev)));
}
}
return ret; return ret;
} }