modified: src/main/java/de/dhbwstuttgart/bytecode/genericsGenerator/GeneratedGenericsFinder.java

Alis Ansatz zur Bytecodeerzeugung eingesetzt

	modified:   src/main/java/de/dhbwstuttgart/bytecode/genericsGeneratorTypes/MethodAndConstraints.java
ToString ausprogramnmiert

	modified:   src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
Einige bytecode-Usecases laufen noch nicht (z.B. Put.jav) Erste Ansaetze versucht.
Muss noch erweitert werden.
This commit is contained in:
pl@gohorb.ba-horb.de 2021-04-08 09:56:49 +02:00
parent b46415e45a
commit c8d4301e5e
6 changed files with 46 additions and 3 deletions

View File

@ -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);

View File

@ -29,5 +29,13 @@ public class GenericGeneratorResultsForAllMethods {
public List<MethodAndConstraints> 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;
}
}

View File

@ -52,4 +52,8 @@ public class GenericsGeneratorResult {
this.equalsTPHs = equalsTPHs;
}
@Override
public String toString() {
return constraint.toString() + " EqualsTPS: " + equalsTPHs.toString();
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -636,7 +636,20 @@ public class FamilyOfGeneratedGenerics {
}
}
}
String key = ((TypePlaceholder)pairExtends2.TA2).getName();
Set<String> 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);