From 55ee8ab61af6d84836f2565d5160e37c4dcd0ed0 Mon Sep 17 00:00:00 2001 From: AluAli Date: Fri, 12 Mar 2021 11:43:55 +0100 Subject: [PATCH] modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java --- .../FamilyOfGeneratedGenerics.java | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java index 4d5f4c18..53c7d1ac 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java @@ -35,7 +35,7 @@ public class FamilyOfGeneratedGenerics { this.posOfTPHs = positionConverter(tphExtractor.allTPHS, tphExtractor.ListOfMethodsAndTph); this.classConstraints = getClassConstraints(allConstraints,posOfTPHs); this.methodConstraints = getMethodConstraints(allConstraints,classConstraints,posOfTPHs, tphExtractor.ListOfMethodsAndTph); - this.methodConstraintsWithPosition = getMethodConstraintsWithPosition(allConstraints,classConstraints,posOfTPHs, tphExtractor.ListOfMethodsAndTph, resSet, oldCons); + this.methodConstraintsWithPosition = getMethodConstraintsWithPositionNew(allConstraints,classConstraints,posOfTPHs, tphExtractor.ListOfMethodsAndTph, resSet, oldCons); } public static List getClassConstraints(List cs, HashMap>> posOfTphs) { //Inputparameter List constraintsSet weg @@ -137,6 +137,8 @@ public class FamilyOfGeneratedGenerics { List newMCList = firstLineMethodDefinition(cs, posOfTphs, method, resSet); List newMCList2 = secondLineMethodDefinition(cs, posOfTphs, method, resSet, oldCons); + System.out.println(newMCList); + System.out.println(newMCList2); } } @@ -561,5 +563,47 @@ public class FamilyOfGeneratedGenerics { return tempMC; } + public static HashMap> getMethodConstraintsWithPositionNew(List cs, List cs_cl, HashMap>> posOfTphs, List listOfMethodsAndTph, ResultSet resSet, Set oldCons) { + HashMap> tempMethodConstraintsWithPosition = new HashMap<>(); + List newMCList = new ArrayList<>(); + List newMCList2 = new ArrayList<>(); + List methodsAddedToHashMap = new ArrayList<>(); + for(MethodAndTPH method: listOfMethodsAndTph){ + String currentMethod = method.getId(); + boolean containsCurrentMethod = false; + if(!containsCurrentMethod) { + methodsAddedToHashMap.add(currentMethod); + containsCurrentMethod = true; + List listToAdd = new ArrayList<>(); + HashMap>> posOfTPHsForThisMethod = new HashMap<>(); + for(String s: posOfTphs.keySet()) { + for(PairTphMethod pair: posOfTphs.get(s)) { + if(pair.snd == currentMethod && pair.snd != null) { + posOfTPHsForThisMethod.put(s,posOfTphs.get(s)); + } + } + } + + newMCList = firstLineMethodDefinition(cs, posOfTphs, method, resSet); + for(int i=0; i