From 330451271eac52ff56514285f2611f9ba85cd8c4 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Tue, 9 Sep 2014 14:32:53 +0200 Subject: [PATCH] =?UTF-8?q?Kleine=20=C3=84nderungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/dhbwstuttgart/parser/JavaClassName.java | 2 +- .../dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java | 9 ++++++++- src/de/dhbwstuttgart/typeinference/unify/Unify.java | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/de/dhbwstuttgart/parser/JavaClassName.java b/src/de/dhbwstuttgart/parser/JavaClassName.java index 1f99511a1..dbb879435 100644 --- a/src/de/dhbwstuttgart/parser/JavaClassName.java +++ b/src/de/dhbwstuttgart/parser/JavaClassName.java @@ -54,7 +54,7 @@ public class JavaClassName { if (obj == null) return false; if(obj instanceof String) - return this.toString().equals(obj) || this.name != null && this.name.equals(obj); //Auch mit Strings als Klassennamen kompatibel TODO: sollte bald obsolet sein + return this.toString().equals(obj) || (this.name != null && this.name.equals(obj)); //Auch mit Strings als Klassennamen kompatibel TODO: sollte bald obsolet sein if (getClass() != obj.getClass()) return false; JavaClassName other = (JavaClassName) obj; diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java b/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java index fe5a0244e..0f4ff5b1f 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java @@ -6,8 +6,8 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; - import org.apache.log4j.Logger; + import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.core.MyCompiler; @@ -389,6 +389,13 @@ public class LocalVarDecl extends Statement implements TypeInsertable return ret; } + @Override + public String getDescription() { + if(this.getType() == null)return "no type " + declid.toString(); + if(this.getType() instanceof TypePlaceholder)return declid.toString(); + return this.getType().toString() + " " + declid.toString(); + } + @Override public void parserPostProcessing(SyntaxTreeNode parent) { super.parserPostProcessing(parent); diff --git a/src/de/dhbwstuttgart/typeinference/unify/Unify.java b/src/de/dhbwstuttgart/typeinference/unify/Unify.java index 36b0c158c..6bae8d6ab 100755 --- a/src/de/dhbwstuttgart/typeinference/unify/Unify.java +++ b/src/de/dhbwstuttgart/typeinference/unify/Unify.java @@ -1443,7 +1443,7 @@ throws MatchException } // end if P.OperatorSmaller() } // end if: RefType - + // Swap if( (P.TA1 instanceof RefType || P.TA1 instanceof GenericTypeVar || P.TA1 instanceof WildcardType) && P.TA2 instanceof TypePlaceholder && P.OperatorEqual()) //PL 06-05-16 GenericTypeVar eingefuegt @@ -1840,8 +1840,8 @@ throws MatchException //in ein Vector von Paaren um. Vector ret = new Vector(); - for(Enumeration e=ht.keys();e.hasMoreElements();) { - String k = (String)e.nextElement(); + for(Enumeration e=ht.keys();e.hasMoreElements();) { + String k = e.nextElement().toString(); // #JB# 11.04.2005 // ########################################################### ret.addElement(new Pair(TypePlaceholder.backdoorCreate(k), (Type)ht.get(k), PairOperator.Equal));