modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
modified: src/test/java/insertGenerics/TestTPHsAndGenerics.java
This commit is contained in:
parent
ff93b0967e
commit
da2a17c794
@ -812,6 +812,36 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
return tempMC;
|
return tempMC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static List<MethodConstraint> methodTypesWithoutClassTypesNEW(String tphToCompute, List<MethodConstraint> cs_m, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs) {
|
||||||
|
List<MethodConstraint> tempMC = new ArrayList<>(cs_m);
|
||||||
|
if(tphToCompute==null || tphToCompute.isEmpty()) {
|
||||||
|
for(TPHConstraint tphCons: tempMC) {
|
||||||
|
for(String tph: posOfTphs.keySet()){
|
||||||
|
for(PairTphMethod p: posOfTphs.get(tph)) {
|
||||||
|
if(p.fst == PositionFinder.Position.FIELD && tphCons.getLeft() == tph) {
|
||||||
|
String rightTPH = tphCons.getRight();
|
||||||
|
tempMC.remove(tphCons);
|
||||||
|
methodTypesWithoutClassTypesNEW(rightTPH,tempMC,posOfTphs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(TPHConstraint tphCons: tempMC) {
|
||||||
|
if(tphCons.getLeft() == tphToCompute) {
|
||||||
|
String newRightTPH = tphCons.getRight();
|
||||||
|
tempMC.remove(tphCons);
|
||||||
|
methodTypesWithoutClassTypesNEW(newRightTPH,tempMC,posOfTphs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tempMC;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static HashMap<String, List<MethodConstraint>> getMethodConstraintsWithPositionNew(List<TPHConstraint> cs, List<ClassConstraint> cs_cl, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs, List<MethodAndTPH> listOfMethodsAndTph, ResultSet resSet, Set<Pair> oldCons) {
|
public static HashMap<String, List<MethodConstraint>> getMethodConstraintsWithPositionNew(List<TPHConstraint> cs, List<ClassConstraint> cs_cl, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs, List<MethodAndTPH> listOfMethodsAndTph, ResultSet resSet, Set<Pair> oldCons) {
|
||||||
HashMap<String, List<MethodConstraint>> tempMethodConstraintsWithPosition = new HashMap<>();
|
HashMap<String, List<MethodConstraint>> tempMethodConstraintsWithPosition = new HashMap<>();
|
||||||
List<MethodConstraint> newMCList = new ArrayList<>();
|
List<MethodConstraint> newMCList = new ArrayList<>();
|
||||||
@ -857,7 +887,8 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcWithoutCc = methodTypesWithoutClassTypes(cs_cl, listToAdd);
|
// mcWithoutCc = methodTypesWithoutClassTypes(cs_cl, listToAdd);
|
||||||
|
mcWithoutCc = methodTypesWithoutClassTypesNEW(null, listToAdd, posOfTphs);
|
||||||
|
|
||||||
tempMethodConstraintsWithPosition.put(currentMethod, mcWithoutCc);
|
tempMethodConstraintsWithPosition.put(currentMethod, mcWithoutCc);
|
||||||
}
|
}
|
||||||
|
@ -100,9 +100,9 @@ public class TestTPHsAndGenerics {
|
|||||||
methodConstraintsWithPositionTest.put("TPH AIm2(TPH AMTPH AI)", lmc);
|
methodConstraintsWithPositionTest.put("TPH AIm2(TPH AMTPH AI)", lmc);
|
||||||
} else {
|
} else {
|
||||||
if (fogg.allConstraints.contains((new MethodConstraint("EIM", "FEA", Relation.EXTENDS)))) {
|
if (fogg.allConstraints.contains((new MethodConstraint("EIM", "FEA", Relation.EXTENDS)))) {
|
||||||
classConstraintsTest.add(new ClassConstraint("ETW", "DZP", Relation.EXTENDS));
|
classConstraintsTest.add(new ClassConstraint("VK", "EIM", Relation.EXTENDS));
|
||||||
classConstraintsTest.add(new ClassConstraint("DZP", "U", Relation.EXTENDS));
|
classConstraintsTest.add(new ClassConstraint("EIM", "FEA", Relation.EXTENDS));
|
||||||
classConstraintsTest.add(new ClassConstraint("ETW", "java/lang/Object", Relation.EXTENDS));
|
classConstraintsTest.add(new ClassConstraint("FEA", "java/lang/Object", Relation.EXTENDS));
|
||||||
|
|
||||||
lmc.add(new MethodConstraint("AI", "AE", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("AI", "AE", Relation.EXTENDS));
|
||||||
lmc.add(new MethodConstraint("AD", "AI", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("AD", "AI", Relation.EXTENDS));
|
||||||
@ -112,9 +112,10 @@ public class TestTPHsAndGenerics {
|
|||||||
methodConstraintsWithPositionTest.put("TPH ABm(TPH ABTPH AD)", lmc);
|
methodConstraintsWithPositionTest.put("TPH ABm(TPH ABTPH AD)", lmc);
|
||||||
lmc = new HashSet<>();
|
lmc = new HashSet<>();
|
||||||
lmc.add(new MethodConstraint("V", "VK", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("V", "VK", Relation.EXTENDS));
|
||||||
methodConstraintsWithPositionTest.put("TPH ETWid2(TPH V)", lmc);
|
methodConstraintsWithPositionTest.put("TPH FEAid2(TPH V)", lmc);
|
||||||
lmc = new HashSet<>();
|
lmc = new HashSet<>();
|
||||||
lmc.add(new MethodConstraint("AM", "java/lang/Object", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("AM", "java/lang/Object", Relation.EXTENDS));
|
||||||
|
lmc.add(new MethodConstraint("AI", "java/lang/Object", Relation.EXTENDS));
|
||||||
methodConstraintsWithPositionTest.put("TPH AIm2(TPH AMTPH AI)", lmc);
|
methodConstraintsWithPositionTest.put("TPH AIm2(TPH AMTPH AI)", lmc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user