From 032789468605ee1bab9aa459dcf37e1c6b47b3c2 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 9 Jul 2014 16:04:33 +0200 Subject: [PATCH] =?UTF-8?q?Code=20aufger=C3=A4umt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mycompiler/myclass/Class.java | 2 +- .../mytype/BoundedGenericTypeVar.java | 29 ++++++++++++------- src/mycompiler/mytype/GenericTypeVar.java | 23 ++++++++------- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/mycompiler/myclass/Class.java b/src/mycompiler/myclass/Class.java index 80c4e831..202ef45f 100755 --- a/src/mycompiler/myclass/Class.java +++ b/src/mycompiler/myclass/Class.java @@ -969,7 +969,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit // ino.method.wandleRefTypeAttributes2GenericAttributes.23128.body { for(Field f : this.getFields()){ - f.wandleRefTypeAttributes2GenericAttributes(paralist); + //f.wandleRefTypeAttributes2GenericAttributes(paralist); } /* Vector fieldsAndMethods=this.getFields(); diff --git a/src/mycompiler/mytype/BoundedGenericTypeVar.java b/src/mycompiler/mytype/BoundedGenericTypeVar.java index a2d8566a..dca83d4d 100755 --- a/src/mycompiler/mytype/BoundedGenericTypeVar.java +++ b/src/mycompiler/mytype/BoundedGenericTypeVar.java @@ -8,6 +8,9 @@ import java.util.Vector; import sun.reflect.generics.reflectiveObjects.NotImplementedException; // ino.end +import typinferenz.ConstraintsSet; +import typinferenz.SingleConstraint; +import typinferenz.assumptions.TypeAssumptions; // ino.class.BoundedGenericTypeVar.26464.description type=javadoc /** @@ -52,7 +55,7 @@ public class BoundedGenericTypeVar extends GenericTypeVar { super(s, offset); 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.bounds = bounds; @@ -68,17 +71,21 @@ public class BoundedGenericTypeVar extends GenericTypeVar } // ino.end - // ino.method.setBounds.26477.definition - public void setBounds(Vector 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) // ino.end // ino.method.addBound.26480.body diff --git a/src/mycompiler/mytype/GenericTypeVar.java b/src/mycompiler/mytype/GenericTypeVar.java index 6d2feccc..f6260c8d 100755 --- a/src/mycompiler/mytype/GenericTypeVar.java +++ b/src/mycompiler/mytype/GenericTypeVar.java @@ -42,7 +42,7 @@ public class GenericTypeVar extends Type // ino.class.GenericTypeVar.26505.body { Type genericTypeVar; - Vector extendVars = new Vector(); + //Vector extendVars = new Vector(); protected Pair genericConstraint; /** * Eine Registry f�r alle Generic-Instanzen, die vor der Bytecode-Generierung durch @@ -57,7 +57,7 @@ public class GenericTypeVar extends Type /** * * @param genericTypeVarExtendsVar - */ + public GenericTypeVar(Pair genericTypeVarExtendsVar, int offset){ super(offset); genericTypeVar = genericTypeVarExtendsVar.TA1; @@ -66,7 +66,8 @@ public class GenericTypeVar extends Type this.genericConstraint = genericTypeVarExtendsVar; } this.name = genericTypeVar.toString(); - } + } + */ // ino.method.GenericTypeVar.26509.definition public GenericTypeVar(String s, int offset) @@ -78,10 +79,11 @@ public class GenericTypeVar extends Type } // ino.end + /* public GenericTypeVar(Type tA1, int offset) { this(new Pair(tA1,null),offset); } - + */ // ino.method.clone.26512.defdescription type=javadoc /** *
Author: J�rg B�uerle @@ -160,6 +162,7 @@ public class GenericTypeVar extends Type if(this.genericTypeVar!=null){ JavaCodeResult ret = new JavaCodeResult(); ret.attach(this.genericTypeVar.printJavaCode(resultSet)); + /* if(this.extendVars.size()>0){ ret.attach(" extends "); Iterator it = this.extendVars.iterator(); @@ -169,6 +172,7 @@ public class GenericTypeVar extends Type if(it.hasNext())ret.attach(", "); } } + */ return ret; } return new JavaCodeResult(this.name); @@ -193,15 +197,14 @@ public class GenericTypeVar extends Type 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){ ConstraintsSet ret = new ConstraintsSet(); 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; }