diff --git a/src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java b/src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java index 533ea9a0..73cd2df7 100644 --- a/src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java +++ b/src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java @@ -19,6 +19,10 @@ public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric { private final String name; + /** + * wird bisher nicht genutzt + * setVariance muss ggf. auskommentiert werden. + */ int variance = 0; @@ -70,9 +74,11 @@ public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric return name; } + /* wird bisher nicht genutzt public void setVariance(int variance) { this.variance= variance; } + */ public int getVariance() { return this.variance; diff --git a/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java b/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java index aca5912e..af1ba5ed 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java @@ -573,17 +573,10 @@ public class TYPEStmt implements StatementVisitor{ */ RefTypeOrTPHOrWildcardOrGeneric retType = assumption.getReceiverType(resolver); - RefTypeOrTPHOrWildcardOrGeneric zwSp; - methodConstraint.add(new Pair(zwSp = forMethod.receiver.getType(), retType, + methodConstraint.add(new Pair(forMethod.receiver.getType(), retType, PairOperator.SMALLERDOT)); - if (zwSp instanceof TypePlaceholder) { - ((TypePlaceholder) zwSp).setVariance(1); - } - methodConstraint.add(new Pair(assumption.getReturnType(resolver), zwSp = forMethod.getType(), + methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT)); - if (zwSp instanceof TypePlaceholder) { - ((TypePlaceholder) zwSp).setVariance(-1); - } methodConstraint.addAll(generateParameterConstraints(forMethod, assumption, info, resolver)); return methodConstraint; } @@ -596,9 +589,6 @@ public class TYPEStmt implements StatementVisitor{ RefTypeOrTPHOrWildcardOrGeneric argType = foMethod.arglist.getArguments().get(i).getType(); RefTypeOrTPHOrWildcardOrGeneric assType = assumption.getArgTypes(resolver).get(i); ret.add(new Pair(argType, assType, PairOperator.SMALLERDOT)); - if (argType instanceof TypePlaceholder) { - ((TypePlaceholder) argType).setVariance(1); - } } return ret; }