Correct gernation of oder constraints

This commit is contained in:
Till Schnell 2021-04-27 17:54:31 +02:00
parent ba9335e2f6
commit c5c8ffeed1

View File

@ -78,23 +78,28 @@ public final class ConstraintsGenerationUtils
Set<Constraint<Pair>> oderConstraints = new HashSet<>(); Set<Constraint<Pair>> oderConstraints = new HashSet<>();
constraintSet.addOderConstraint(oderConstraints); constraintSet.addOderConstraint(oderConstraints);
Constraint<Pair> c = new Constraint<>();
oderConstraints.add(c);
// single type // single type
ConstraintsGenerationUtils.addToConstraint(c, tph, refType); ConstraintsGenerationUtils.addToOderConstraint(oderConstraints, tph, refType);
// extends type // extends type
ExtendsWildcardType extendsWildcardType = new ExtendsWildcardType(refType, new NullToken()); ExtendsWildcardType extendsWildcardType = new ExtendsWildcardType(refType, new NullToken());
ConstraintsGenerationUtils.addToConstraint(c, tph, extendsWildcardType); ConstraintsGenerationUtils.addToOderConstraint(oderConstraints, tph, extendsWildcardType);
// super type // super type
SuperWildcardType superWildcardType = new SuperWildcardType(refType, new NullToken()); SuperWildcardType superWildcardType = new SuperWildcardType(refType, new NullToken());
ConstraintsGenerationUtils.addToConstraint(c, tph, superWildcardType); ConstraintsGenerationUtils.addToOderConstraint(oderConstraints, tph, superWildcardType);
return constraintSet; return constraintSet;
} }
private static void addToOderConstraint (Set<Constraint<Pair>> oderConstraints, TypePlaceholder tph,
RefTypeOrTPHOrWildcardOrGeneric refType) {
Constraint<Pair> c = new Constraint<>();
oderConstraints.add(c);
ConstraintsGenerationUtils.addToConstraint(c, tph, refType);
}
/** /**
* Generate a pair and adds it to a constraint. * Generate a pair and adds it to a constraint.
* *