From 45ea59e7adab14b81971a56866a82ffd043e9492 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Tue, 9 Sep 2014 17:47:57 +0200 Subject: [PATCH] Fehler in get_ParaList behoben --- .../dhbwstuttgart/syntaxtree/type/RefType.java | 16 ++++++++++++---- .../assumptions/TypeAssumptions.java | 2 +- .../dhbwstuttgart/typeinference/unify/Unify.java | 2 -- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java index aaef7adad..a25994b4f 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java @@ -111,7 +111,7 @@ public class RefType extends Type implements IMatchable super(offset); // otth: Copy-Konstruktor this.setName(R.getTypeName()); - this.set_ParaList(R.get_ParaList()); + this.set_ParaList(R.getParaList()); } // ino.end @@ -332,14 +332,22 @@ public class RefType extends Type implements IMatchable } // ino.end + /** + * @return gibt bei leere Parameterliste null zurück. Ist entscheidend für unify-Algorithmus + */ // ino.method.get_ParaList.26664.definition public Vector get_ParaList() // ino.end // ino.method.get_ParaList.26664.body { - return this.parameter; + if(this.parameter == null || this.parameter.size()==0)return null; + return this.parameter; } // ino.end + + public Vector getParaList(){ + return this.parameter; + } // ino.method.add_Parameter.26667.definition public void add_Parameter(Type o) @@ -737,9 +745,9 @@ public class RefType extends Type implements IMatchable @Override public JavaCodeResult printJavaCode(ResultSet resultSet) { JavaCodeResult ret = new JavaCodeResult(this.name.toString()); - if(this.get_ParaList()!=null && this.get_ParaList().size()>0){ + if(this.getParaList()!=null && this.getParaList().size()>0){ ret .attach( "<" ); - Iterator it = this.get_ParaList().iterator(); + Iterator it = this.getParaList().iterator(); while(it.hasNext()){ Type t = it.next(); ret .attach( t.printJavaCode(resultSet)); diff --git a/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java b/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java index ae128ffd2..befd80002 100755 --- a/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java +++ b/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java @@ -301,7 +301,7 @@ public class TypeAssumptions { if(match && t instanceof RefType){ RefType tr = (RefType)t; RefType ret = ass.getAssumedClass().getType(); //Dadurch erhält der RefType den vollen Namen (bsp. java.lang.Integer) - ret.set_ParaList(tr.get_ParaList()); + ret.set_ParaList(tr.getParaList()); return new ConstraintType(ret); } } diff --git a/src/de/dhbwstuttgart/typeinference/unify/Unify.java b/src/de/dhbwstuttgart/typeinference/unify/Unify.java index 6bae8d6ab..3317cbeac 100755 --- a/src/de/dhbwstuttgart/typeinference/unify/Unify.java +++ b/src/de/dhbwstuttgart/typeinference/unify/Unify.java @@ -7,9 +7,7 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; - import org.apache.log4j.Logger; - import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.MatchException;