From af9943be28647d5156f5326be26737077c3cf0a7 Mon Sep 17 00:00:00 2001 From: AluAli Date: Fri, 5 Mar 2021 21:47:22 +0100 Subject: [PATCH] modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java --- .../FamilyOfGeneratedGenerics.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java index 8ea4638a..4d5f4c18 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java @@ -505,9 +505,9 @@ public class FamilyOfGeneratedGenerics { MethodAndTPH methAndTphs = methodAndTPH; List>> orCons = methAndTphs.constraints.getOderConstraints(); List>> orConsList = new ArrayList<>(); - List>> orConsListConverted = new ArrayList<>(); + List>> orConsListConverted = new ArrayList<>(); for(int i=0; i> orConsInternal = new ArrayList<>(); + HashMap> orConsInternal = new HashMap<>(); List orConsWithEQUAL = new ArrayList(); List 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 tcOfoldCons = buildTransitiveClosure(oldConsListConverted); - - - + for(int i=0; i extendsList = orConsListConverted.get(i).get(Relation.EXTENDS); + List 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; }