From 2f37bb7313c7cd47c035dcca8628c415daa5375a Mon Sep 17 00:00:00 2001 From: AluAli Date: Tue, 29 Dec 2020 01:03:55 +0100 Subject: [PATCH] modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java modified: src/test/java/insertGenerics/FamilyOfGeneratedGenericsTest.java --- .../FamilyOfGeneratedGenerics.java | 43 +++++++++---------- .../FamilyOfGeneratedGenericsTest.java | 2 +- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java index 94ff8b98..d8df6cc1 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java @@ -76,7 +76,7 @@ public class FamilyOfGeneratedGenerics { } } List methodConstraints5 = methodTypesWithoutClassTypes(cs_cl, cs_m); -// cs_m = methodConstraints5; + cs_m = methodConstraints5; return cs_m; } @@ -253,33 +253,32 @@ public class FamilyOfGeneratedGenerics { */ public static List methodTypesWithoutClassTypes(List cs_cl, List cs_m) { //TODO: - /*List tempMCToReturn = new ArrayList<>(); - List tempMC = new ArrayList(); - for (int i=0; i < cs_m.size(); i++) { - TPHConstraint tphC = (TPHConstraint) cs_m.get(i); - tempMC.add((TPHConstraint) tphC); - } - List tempCC = new ArrayList(cs_cl); - for (TPHConstraint cc: cs_cl) { - TPHConstraint tphC = TPHConstraint.class.cast(cc); + List tempCC = new ArrayList<>(); + for(ClassConstraint cc: cs_cl) { + TPHConstraint tphC = new TPHConstraint(cc.getLeft(), cc.getRight(), cc.getRel()); tempCC.add(tphC); } + List tempMC = new ArrayList<>(); + for(MethodConstraint mc: cs_m) { + TPHConstraint tphC = new TPHConstraint(mc.getLeft(), mc.getRight(), mc.getRel()); + tempMC.add(tphC); + } + List tempMC2 = new ArrayList<>(); + tempMC2.addAll(tempMC); + List tempMCToReturn = new ArrayList<>(); - for (TPHConstraint cc: tempCC) { - if(tempMC.contains(cc)) { - tempMC.remove(cc); + for(TPHConstraint cc: tempCC) { + for(TPHConstraint mc: tempMC) { + if(cc.getLeft().equals(mc.getLeft()) && cc.getRight().equals(mc.getRight())) { + tempMC2.remove(mc); + } } } - tempMCToReturn = List.class.cast(tempMC); - return tempMCToReturn;*/ - - List tempMC = new ArrayList<>(); - List tempTphC = new ArrayList<>(); - for(int i=0; i