modified: src/main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java

modified:   src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
This commit is contained in:
AluAli 2021-03-05 09:12:19 +01:00
parent d1a796f37b
commit b99c022b50
2 changed files with 25 additions and 17 deletions

View File

@ -55,6 +55,7 @@ public class TPHExtractor extends AbstractASTWalker {
boolean inLocalOrParamOrReturn = false;
public final ArrayList<MethodAndTPH> ListOfMethodsAndTph = new ArrayList<>();
public Set<Pair> oldConstraints = new HashSet<>(); // Alle Constraints in einer Menge (und- & Oder-Constraints)
final ArrayList<ResultPair<TypePlaceholder, TypePlaceholder>> allPairs = new ArrayList<>();
public final ArrayList<TPHConstraint> allCons = new ArrayList<>();
private ResultSet resultSet;

View File

@ -136,7 +136,7 @@ public class FamilyOfGeneratedGenerics {
listOfThisMethod = getMethodConstraints(cs,cs_cl,posOfTPHsForThisMethod,listOfMethodsAndTph);
tempMethodConstraintsWithPosition.put(currentMethod, listOfThisMethod);
List<MethodConstraint> newMCList = firstLineMethodDefinition(cs, posOfTphs, resSet);
List<MethodConstraint> newMCList = firstLineMethodDefinition(cs, posOfTphs, method, resSet);
}
}
@ -477,29 +477,36 @@ public class FamilyOfGeneratedGenerics {
}
*/
public static List<MethodConstraint> firstLineMethodDefinition(List<TPHConstraint> allConstraints, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs, ResultSet resSet) {
public static List<MethodConstraint> firstLineMethodDefinition(List<TPHConstraint> allConstraints, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs, MethodAndTPH methodAndTPH, ResultSet resSet) {
List<MethodConstraint> tempMC= new ArrayList<>();
// MethodAndTPH methAndTphs = methodAndTPH;
// Set undCons = methAndTphs.constraints.getUndConstraints();
// Iterator it = undCons.iterator();
MethodAndTPH methAndTphs = methodAndTPH;
Set<Pair> undCons = methAndTphs.constraints.getUndConstraints();
List<Set<Pair>> orCons = methAndTphs.constraints.getOderConstraints();
Iterator<Pair> it = undCons.iterator();
while(it.hasNext()) {
Pair p = it.next();
String ta1 = ((TypePlaceholder) p.TA1).getName();
String ta2 = ((TypePlaceholder) p.TA2).getName();
System.out.println(p);
}
// Set res = resSet.results;
// Iterator it = res.iterator();
// System.out.println("res: " + res.size() + res);
// System.out.println("booooooooo");
// while(it.hasNext()) {
// System.out.println(it.next());
// }
Set res = resSet.results;
Iterator it = res.iterator();
System.out.println("res: " + res.size() + res);
System.out.println("booooooooo");
while(it.hasNext()) {
System.out.println(it.next());
}
System.out.println("booooooooo2");
// System.out.println("booooooooo2");
// for(TPHConstraint tphC: allConstraints) {
// }
Predicate<Pair> filterUndConstraints = ab -> resSet.resolveType((TypePlaceholder)(ab.TA1)).resolvedType instanceof TypePlaceholder;
System.out.println(filterUndConstraints);
Predicate<Pair> the = x -> resSet.resolveType((TypePlaceholder)(x.TA1)).resolvedType instanceof TypePlaceholder;
ResultPair rp = y -> resSet.resolveType((TypePlaceholder)(y.TA1)).getResultPair();
// Predicate<Pair> filterUndConstraints = ab -> resSet.resolveType((TypePlaceholder)(ab.TA1)).resolvedType instanceof TypePlaceholder;
// System.out.println(filterUndConstraints);
// Predicate<Pair> the = x -> resSet.resolveType((TypePlaceholder)(x.TA1)).resolvedType instanceof TypePlaceholder;
// ResultPair rp = y -> resSet.resolveType((TypePlaceholder)(y.TA1)).getResultPair();
// (resultSet.resolveType((TypePlaceholder)(cs.TA1)).resolvedType instanceof TypePlaceholder)