Add generation of constraints for ref type

This commit is contained in:
Till Schnell 2021-04-06 18:25:04 +02:00
parent ce8b19acae
commit 465f82e967

View File

@ -4,7 +4,6 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import de.dhbwstuttgart.parser.NullToken; import de.dhbwstuttgart.parser.NullToken;
import de.dhbwstuttgart.parser.scope.JavaClassName;
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
@ -23,7 +22,7 @@ public final class ConstraintsGenerationUtils
} }
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
public static ConstraintSet generateConstraints (JavaClassName name, TypePlaceholder tph) { public static ConstraintSet generateConstraints (RefType refType, TypePlaceholder tph) {
ConstraintSet constraintSet = new ConstraintSet<>(); ConstraintSet constraintSet = new ConstraintSet<>();
Set<Constraint<?>> oderConstraints = new HashSet<>(); Set<Constraint<?>> oderConstraints = new HashSet<>();
constraintSet.addOderConstraint(oderConstraints); constraintSet.addOderConstraint(oderConstraints);
@ -32,7 +31,6 @@ public final class ConstraintsGenerationUtils
oderConstraints.add(c); oderConstraints.add(c);
// single type // single type
RefType refType = new RefType(name, new NullToken());
ConstraintsGenerationUtils.addToConstraint(c, tph, refType); ConstraintsGenerationUtils.addToConstraint(c, tph, refType);
// extends type // extends type
@ -44,9 +42,6 @@ public final class ConstraintsGenerationUtils
ConstraintsGenerationUtils.addToConstraint(c, tph, superWildcardType); ConstraintsGenerationUtils.addToConstraint(c, tph, superWildcardType);
return constraintSet; return constraintSet;
// Constraints müssen nicht übernommen werden. InferWildcard constraints können
// individuell erstellt werden und müssen später umgebaut werden
} }
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })