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

modified:   src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
This commit is contained in:
AluAli 2021-01-29 19:36:17 +01:00
parent 42bb787195
commit dc62b72f7f
2 changed files with 7 additions and 7 deletions

View File

@ -167,8 +167,8 @@ public class GeneratedGenericsFinder implements ASTVisitor {
}
GenericGeneratorResultsForAllMethods ggRfaM = null;
List<MethodAndConstraints> listOfMethAndCons = new ArrayList<>();
for(String methID: fogg.methodConstraintsWithPosition.keySet()) {
List<MethodAndConstraints> listOfMethAndCons = new ArrayList<>();
List<GenericsGeneratorResult> listOfGGR = new ArrayList<>();
for(TPHConstraint methCons: fogg.methodConstraintsWithPosition.get(methID)) {
GenericsGeneratorResult ggR = new GenericsGeneratorResult(methCons, new HashSet<>());
@ -176,8 +176,8 @@ public class GeneratedGenericsFinder implements ASTVisitor {
}
MethodAndConstraints mac = new MethodAndConstraints(methID, listOfGGR);
listOfMethAndCons.add(mac);
ggRfaM = new GenericGeneratorResultsForAllMethods(listOfMethAndCons);
}
ggRfaM = new GenericGeneratorResultsForAllMethods(listOfMethAndCons);
ggResultAlternative = new GenericsGeneratorResultForClass(className, listOfClassCons, ggRfaM);
if(ggResultAlternative != null) {

View File

@ -128,8 +128,8 @@ public class FamilyOfGeneratedGenerics {
for(String curMeth: tempMethodConstraintsWithPosition.keySet()){
for(int i=0; i<tempMethodConstraintsWithPosition.get(curMeth).size(); i++) {
MethodConstraint currentMC = tempMethodConstraintsWithPosition.get(curMeth).get(i);
if(currentMC.getRight()!= "Object" && !compareTphsOfConstraints(currentMC.getRight(), cs_cl) && !compareTphsOfConstraints(currentMC.getRight(), tempMethodConstraintsWithPosition.get(curMeth))) {
MethodConstraint mc = new MethodConstraint(currentMC.getRight(), "Object", Relation.EXTENDS);
if(currentMC.getRight()!= Object.class.getTypeName() && !compareTphsOfConstraints(currentMC.getRight(), cs_cl) && !compareTphsOfConstraints(currentMC.getRight(), tempMethodConstraintsWithPosition.get(curMeth))) {
MethodConstraint mc = new MethodConstraint(currentMC.getRight(), Object.class.getTypeName(), Relation.EXTENDS);
tempMethodConstraintsWithPosition.get(curMeth).add(mc);
}
}
@ -212,7 +212,7 @@ public class FamilyOfGeneratedGenerics {
boolean hasSmallerTVInClCons = (posOfTphs.containsKey(cCons.getRight()) && cCons.getRight() == tph && cCons.getLeft() != null);
if( ((tvInField || hasSmallerTVInClCons) && cCons.getRel()==Relation.EXTENDS) &&
!checkUpperBound(allConstraints, tph) && allCons.getRel()==Relation.EXTENDS) {
ClassConstraint consToAdd = new ClassConstraint(tph, "Object", Relation.EXTENDS);
ClassConstraint consToAdd = new ClassConstraint(tph, Object.class.getTypeName(), Relation.EXTENDS);
if (!checkForDuplicates(consToAdd, tempCC)){
tempCC.add(consToAdd);
}
@ -312,7 +312,7 @@ public class FamilyOfGeneratedGenerics {
for(PairTphMethod pair: posOfTphs.get(tph)) {
for(TPHConstraint allCons: allConstraints) {
if((pair.fst.equals(PositionFinder.Position.METHOD) || pair.fst.equals(PositionFinder.Position.CONSTRUCTOR)) && !checkUpperBound(allConstraints,tph)) {
MethodConstraint consToAdd = new MethodConstraint(tph, "Object", Relation.EXTENDS);
MethodConstraint consToAdd = new MethodConstraint(tph, Object.class.getTypeName(), Relation.EXTENDS);
if (!checkForDuplicates(consToAdd, tempMC)) {
tempMC.add(consToAdd);
}
@ -326,7 +326,7 @@ public class FamilyOfGeneratedGenerics {
}
for(TPHConstraint mc1: tempMCObject1) {
if(tph==mc1.getRight() && !checkUpperBound(tempMCObject1,tph)) {
MethodConstraint consToAdd = new MethodConstraint(tph, "Object", Relation.EXTENDS);
MethodConstraint consToAdd = new MethodConstraint(tph, Object.class.getTypeName(), Relation.EXTENDS);
if (!checkForDuplicates(consToAdd, tempMC)) {
tempMC.add(consToAdd);
}