diff --git a/src/de/dhbwstuttgart/typeinference/assumptions/TypeInferenceBlockInformation.java b/src/de/dhbwstuttgart/typeinference/assumptions/TypeInferenceBlockInformation.java index 54fe9bb59..36d7a3033 100644 --- a/src/de/dhbwstuttgart/typeinference/assumptions/TypeInferenceBlockInformation.java +++ b/src/de/dhbwstuttgart/typeinference/assumptions/TypeInferenceBlockInformation.java @@ -20,12 +20,11 @@ public class TypeInferenceBlockInformation extends TypeInferenceInformation { public TypeInferenceBlockInformation(Set availableClasses, ClassOrInterface currentClass, TypeScope methodContext) { super(availableClasses); - this.methodContext = methodContext; + this.methodContext = new TypeScopeContainer(currentClass, methodContext); this.currentClass = currentClass; } public TypeInferenceBlockInformation(TypeInferenceBlockInformation oldScope, TypeScope newScope) { this(oldScope.getAvailableClasses(), oldScope.currentClass, oldScope.methodContext); - methodContext = new TypeScopeContainer(methodContext, newScope); } public ClassOrInterface getCurrentClass() { return currentClass; diff --git a/src/de/dhbwstuttgart/typeinference/constraints/ConstraintsFactory.java b/src/de/dhbwstuttgart/typeinference/constraints/ConstraintsFactory.java index b299d57c2..3d1058da2 100644 --- a/src/de/dhbwstuttgart/typeinference/constraints/ConstraintsFactory.java +++ b/src/de/dhbwstuttgart/typeinference/constraints/ConstraintsFactory.java @@ -36,7 +36,7 @@ public class ConstraintsFactory { if(type instanceof GenericRefType){ //TODO: Für Generics müssen auch noch Constraints generiert werden for(GenericTypeVar genericTypeVar : currentScope.getGenerics()){ - if(genericTypeVar.getName().equals(((GenericRefType)type).getName())){ + if(genericTypeVar.getName().toString().equals(((GenericRefType)type).getName().toString())){ return new RefType(((GenericRefType)type).getName(),type.getOffset()); } } diff --git a/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPE.java b/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPE.java index ad9f454b2..23d740a41 100644 --- a/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPE.java +++ b/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPE.java @@ -67,7 +67,7 @@ public class TYPE { } private ConstraintSet getConstraintsConstructor(Constructor m, TypeInferenceInformation info, ClassOrInterface currentClass) { - TypeInferenceBlockInformation blockInfo = new TypeInferenceBlockInformation(info.getAvailableClasses(), currentClass, null); + TypeInferenceBlockInformation blockInfo = new TypeInferenceBlockInformation(info.getAvailableClasses(), currentClass, m); TYPEStmt methodScope = new TYPEStmt(blockInfo); //for(Statement stmt : m.fieldInitializations)stmt.accept(methodScope); ConstraintSet ret = this.getConstraintsMethod(m, info, currentClass); diff --git a/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java b/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java index 79b6a503c..a547a16b0 100644 --- a/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java +++ b/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java @@ -223,7 +223,7 @@ public class TYPEStmt implements StatementVisitor{ return new TypeScope() { @Override public Iterable getGenerics() { - return null; + return new ArrayList<>(); } @Override