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

This commit is contained in:
AluAli 2021-03-05 21:47:22 +01:00
parent f208432c54
commit af9943be28

View File

@ -505,9 +505,9 @@ public class FamilyOfGeneratedGenerics {
MethodAndTPH methAndTphs = methodAndTPH;
List<Set<Constraint<Pair>>> orCons = methAndTphs.constraints.getOderConstraints();
List<List<Constraint<Pair>>> orConsList = new ArrayList<>();
List<List<List<TPHConstraint>>> orConsListConverted = new ArrayList<>();
List<HashMap<Relation, List<TPHConstraint>>> orConsListConverted = new ArrayList<>();
for(int i=0; i<orCons.size(); i++) {
List<List<TPHConstraint>> orConsInternal = new ArrayList<>();
HashMap<Relation, List<TPHConstraint>> orConsInternal = new HashMap<>();
List<TPHConstraint> orConsWithEQUAL = new ArrayList();
List<TPHConstraint> orConsWithEXTENDS = new ArrayList();
for(Constraint con: orCons.get(i)) {
@ -524,8 +524,8 @@ public class FamilyOfGeneratedGenerics {
}
}
}
orConsInternal.add(orConsWithEXTENDS);
orConsInternal.add(orConsWithEQUAL);
orConsInternal.put(Relation.EXTENDS, orConsWithEXTENDS);
orConsInternal.put(Relation.EQUAL, orConsWithEQUAL);
orConsListConverted.add(orConsInternal);
}
@ -542,9 +542,22 @@ public class FamilyOfGeneratedGenerics {
}
List<TPHConstraint> tcOfoldCons = buildTransitiveClosure(oldConsListConverted);
for(int i=0; i<orConsListConverted.size(); i++) {
List<TPHConstraint> extendsList = orConsListConverted.get(i).get(Relation.EXTENDS);
List<TPHConstraint> equalList = orConsListConverted.get(i).get(Relation.EQUAL);
for(TPHConstraint ex: extendsList) {
for(TPHConstraint eq: equalList) {
MethodConstraint mc = new MethodConstraint(ex.getRight(), eq.getLeft(), Relation.EXTENDS);
for(TPHConstraint tc: tcOfoldCons) {
if(tc.getLeft()==mc.getLeft() && tc.getRight()==mc.getRight() && tc.getRel()==mc.getRel()) {
if(!checkForDuplicates(mc, tempMC)) {
tempMC.add(mc);
}
}
}
}
}
}
return tempMC;
}