This commit is contained in:
JanUlrich 2017-09-25 15:57:35 +02:00
parent 276ff44756
commit 07b159f9a3
4 changed files with 4 additions and 5 deletions

View File

@ -20,12 +20,11 @@ public class TypeInferenceBlockInformation extends TypeInferenceInformation {
public TypeInferenceBlockInformation(Set<ClassOrInterface> 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;

View File

@ -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());
}
}

View File

@ -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);

View File

@ -223,7 +223,7 @@ public class TYPEStmt implements StatementVisitor{
return new TypeScope() {
@Override
public Iterable<? extends GenericTypeVar> getGenerics() {
return null;
return new ArrayList<>();
}
@Override