diff --git a/src/main/java/de/dhbwstuttgart/bytecode/genericsGenerator/GeneratedGenericsFinder.java b/src/main/java/de/dhbwstuttgart/bytecode/genericsGenerator/GeneratedGenericsFinder.java index e25958d1..930ba3e3 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/genericsGenerator/GeneratedGenericsFinder.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/genericsGenerator/GeneratedGenericsFinder.java @@ -169,7 +169,7 @@ public class GeneratedGenericsFinder implements ASTVisitor { if(ggResult != null) { //Hinzufuegen von Fayez ggResult - generatedGenericsForSF.addGenericGeneratorResultClass(ggResult); + //generatedGenericsForSF.addGenericGeneratorResultClass(ggResult); } // Fayez Ansatz Ende //*/ @@ -198,7 +198,7 @@ public class GeneratedGenericsFinder implements ASTVisitor { ggResultAlternative = new GenericsGeneratorResultForClass(className, listOfClassCons, ggRfaM); if(ggResultAlternative != null) {//hinzufuegen von Alis ggResult - //generatedGenericsForSF.addGenericGeneratorResultClass(ggResultAlternative); + generatedGenericsForSF.addGenericGeneratorResultClass(ggResultAlternative); System.out.println(generatedGenericsForSF); } System.out.println(ggResultAlternative); diff --git a/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/GenericGeneratorResultsForAllMethods.java b/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/GenericGeneratorResultsForAllMethods.java index 40f7692a..091587ff 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/GenericGeneratorResultsForAllMethods.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/GenericGeneratorResultsForAllMethods.java @@ -29,5 +29,13 @@ public class GenericGeneratorResultsForAllMethods { public List getMethodsAndConstraints() { return methodsAndConstraints; } + + @Override + public String toString() { + String ret = ""; + ret = ret + methodsAndConstraints.stream().reduce("", (x,y) -> x + y.toString(), (x,y) -> x + y); + //ret = ret + "\n"; + return ret; + } } diff --git a/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/GenericsGeneratorResult.java b/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/GenericsGeneratorResult.java index c0d1251a..fe23f239 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/GenericsGeneratorResult.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/GenericsGeneratorResult.java @@ -52,4 +52,8 @@ public class GenericsGeneratorResult { this.equalsTPHs = equalsTPHs; } + @Override + public String toString() { + return constraint.toString() + " EqualsTPS: " + equalsTPHs.toString(); + } } diff --git a/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/GenericsGeneratorResultForClass.java b/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/GenericsGeneratorResultForClass.java index 79eaabd0..0a3626d2 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/GenericsGeneratorResultForClass.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/GenericsGeneratorResultForClass.java @@ -73,4 +73,12 @@ public class GenericsGeneratorResultForClass { return Collections.emptyList(); } } + + @Override + public String toString() { + String ret = "Classconstraints: "; + ret = ret + classConstraints.stream().reduce("", (x,y) -> x + y.toString(), (x,y) -> x + y); + ret = ret + "\n" + methodsAndTheirConstraints.toString(); + return ret; + } } diff --git a/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/MethodAndConstraints.java b/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/MethodAndConstraints.java index 3f034f6d..bf582707 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/MethodAndConstraints.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/MethodAndConstraints.java @@ -33,4 +33,14 @@ public class MethodAndConstraints { return constraints; } + + @Override + public String toString() { + String ret = methodID + ": "; + ret = ret + constraints.stream().reduce("", + (x,y) -> x + y.toString(), + (x,y) -> x + y); + ret = ret + "\n"; + return ret; + } } diff --git a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java index fc29b869..33e241e7 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java @@ -636,7 +636,20 @@ public class FamilyOfGeneratedGenerics { } } } - String key = ((TypePlaceholder)pairExtends2.TA2).getName(); + Set containedVars = new HashSet<>(); + String key = ((TypePlaceholder)((resSet.resolveType((TypePlaceholder)pairExtends2.TA2)).resolvedType)).getName(); + //TODO: containedVars stimmt noch nicht. Ueberpruefen, ob ggf. mit den containedVars möglicherweise auch die anderen Faelle + // rEqExRtilde isPairInTExTapostrophe abgedeckt sind => ggf. integrieren + posOfTphs.forEach((x,y) -> { + if (y.contains(new PairTphMethod<>(PositionFinder.Position.METHOD, methodAndTPH.getId()))) { + containedVars.add(x); + }; + } + ); + if (containedVars.stream().filter(v -> tcOfCs.contains(new TPHConstraint(key, v, Relation.EXTENDS))) + .count() > 0) { + //tempSet2.add(pairExtends2); + } if (posOfTphs.containsKey(key)) { if (posOfTphs.get(key).contains(new PairTphMethod<>(PositionFinder.Position.METHOD, methodAndTPH.getId()))) { tempSet2.add(pairExtends2);