modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java

This commit is contained in:
AluAli 2021-01-22 15:52:14 +01:00
parent cfacc6235c
commit bb900af6bf

View File

@ -35,19 +35,19 @@ public class FamilyOfGeneratedGenerics {
cs_cl.add(cons);
}
}
boolean addedToConstraintsList = false;
do {
addedToConstraintsList = false;
List<ClassConstraint> classConstraints2 = new ArrayList<>();
classConstraints2 = transitiveSubtypeForClassTypes(cs, cs_cl); // in Klammer classConstraints1 oder constraintsSet? beides eher
// if sth new is added to cs_cl, then do same step again
boolean addedToConstraintsListForCC2 = false;
do {
addedToConstraintsListForCC2 = false;
List<ClassConstraint> classConstraints2 = transitiveSubtypeForClassTypes(cs, cs_cl); // in Klammer classConstraints1 oder constraintsSet? beides eher
for (ClassConstraint cons: classConstraints2) {
if (!checkForDuplicates(cons, cs_cl)) {
cs_cl.add(cons);
addedToConstraintsList = true;
addedToConstraintsListForCC2 = true;
}
}
}while(addedToConstraintsList);
} while (addedToConstraintsListForCC2);
List<ClassConstraint> classConstraints3 = hasNoSupertypeForClassTypes(cs, cs_cl, posOfTphs);
for (ClassConstraint cons: classConstraints3) {
@ -59,7 +59,6 @@ public class FamilyOfGeneratedGenerics {
}
public static List<MethodConstraint> getMethodConstraints(List<TPHConstraint> cs, List<ClassConstraint> cs_cl, HashMap<String, PairTphMethod<PositionFinder.Position, String>> posOfTphs) {
//TODO: Regeln
List<MethodConstraint> cs_m = new ArrayList<>();
List<MethodConstraint> methodConstraints1 = typeOfTheMethodInClSigma(cs, posOfTphs);
for (MethodConstraint cons: methodConstraints1) {
@ -67,18 +66,32 @@ public class FamilyOfGeneratedGenerics {
cs_m.add(cons);
}
}
List<MethodConstraint> methodConstraints2 = firstTransitiveSubtypeForMethodTypes(cs, cs_m);
for (MethodConstraint cons: methodConstraints2) {
if (!checkForDuplicates(cons, cs_m)) {
cs_m.add(cons);
// if sth new is added to cs_cl, then do same step again
boolean addedToConstraintsListForMC2 = false;
do {
addedToConstraintsListForMC2 = false;
List<MethodConstraint> methodConstraints2 = firstTransitiveSubtypeForMethodTypes(cs, cs_m);
for (MethodConstraint cons : methodConstraints2) {
if (!checkForDuplicates(cons, cs_m)) {
cs_m.add(cons);
addedToConstraintsListForMC2 = true;
}
}
}
List<MethodConstraint> methodConstraints3 = secondTransitiveSubtypeForMethodTypes(cs, cs_cl, cs_m);
for (MethodConstraint cons: methodConstraints3) {
if (!checkForDuplicates(cons, cs_m)) {
cs_m.add(cons);
} while (addedToConstraintsListForMC2);
// if sth new is added to cs_cl, then do same step again
boolean addedToConstraintsListForMC3 = false;
do {
addedToConstraintsListForMC3 = false;
List<MethodConstraint> methodConstraints3 = secondTransitiveSubtypeForMethodTypes(cs, cs_cl, cs_m);
for (MethodConstraint cons : methodConstraints3) {
if (!checkForDuplicates(cons, cs_m)) {
cs_m.add(cons);
addedToConstraintsListForMC3 = true;
}
}
}
} while (addedToConstraintsListForMC3);
List<MethodConstraint> methodConstraints4 = hasNoSupertypeForMethodTypes(cs, posOfTphs);
for (MethodConstraint cons: methodConstraints4) {
if (!checkForDuplicates(cons, cs_m)) {