forked from JavaTX/JavaCompilerCore
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:
parent
42bb787195
commit
dc62b72f7f
@ -167,8 +167,8 @@ public class GeneratedGenericsFinder implements ASTVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GenericGeneratorResultsForAllMethods ggRfaM = null;
|
GenericGeneratorResultsForAllMethods ggRfaM = null;
|
||||||
for(String methID: fogg.methodConstraintsWithPosition.keySet()) {
|
|
||||||
List<MethodAndConstraints> listOfMethAndCons = new ArrayList<>();
|
List<MethodAndConstraints> listOfMethAndCons = new ArrayList<>();
|
||||||
|
for(String methID: fogg.methodConstraintsWithPosition.keySet()) {
|
||||||
List<GenericsGeneratorResult> listOfGGR = new ArrayList<>();
|
List<GenericsGeneratorResult> listOfGGR = new ArrayList<>();
|
||||||
for(TPHConstraint methCons: fogg.methodConstraintsWithPosition.get(methID)) {
|
for(TPHConstraint methCons: fogg.methodConstraintsWithPosition.get(methID)) {
|
||||||
GenericsGeneratorResult ggR = new GenericsGeneratorResult(methCons, new HashSet<>());
|
GenericsGeneratorResult ggR = new GenericsGeneratorResult(methCons, new HashSet<>());
|
||||||
@ -176,8 +176,8 @@ public class GeneratedGenericsFinder implements ASTVisitor {
|
|||||||
}
|
}
|
||||||
MethodAndConstraints mac = new MethodAndConstraints(methID, listOfGGR);
|
MethodAndConstraints mac = new MethodAndConstraints(methID, listOfGGR);
|
||||||
listOfMethAndCons.add(mac);
|
listOfMethAndCons.add(mac);
|
||||||
ggRfaM = new GenericGeneratorResultsForAllMethods(listOfMethAndCons);
|
|
||||||
}
|
}
|
||||||
|
ggRfaM = new GenericGeneratorResultsForAllMethods(listOfMethAndCons);
|
||||||
ggResultAlternative = new GenericsGeneratorResultForClass(className, listOfClassCons, ggRfaM);
|
ggResultAlternative = new GenericsGeneratorResultForClass(className, listOfClassCons, ggRfaM);
|
||||||
|
|
||||||
if(ggResultAlternative != null) {
|
if(ggResultAlternative != null) {
|
||||||
|
@ -128,8 +128,8 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
for(String curMeth: tempMethodConstraintsWithPosition.keySet()){
|
for(String curMeth: tempMethodConstraintsWithPosition.keySet()){
|
||||||
for(int i=0; i<tempMethodConstraintsWithPosition.get(curMeth).size(); i++) {
|
for(int i=0; i<tempMethodConstraintsWithPosition.get(curMeth).size(); i++) {
|
||||||
MethodConstraint currentMC = tempMethodConstraintsWithPosition.get(curMeth).get(i);
|
MethodConstraint currentMC = tempMethodConstraintsWithPosition.get(curMeth).get(i);
|
||||||
if(currentMC.getRight()!= "Object" && !compareTphsOfConstraints(currentMC.getRight(), cs_cl) && !compareTphsOfConstraints(currentMC.getRight(), tempMethodConstraintsWithPosition.get(curMeth))) {
|
if(currentMC.getRight()!= Object.class.getTypeName() && !compareTphsOfConstraints(currentMC.getRight(), cs_cl) && !compareTphsOfConstraints(currentMC.getRight(), tempMethodConstraintsWithPosition.get(curMeth))) {
|
||||||
MethodConstraint mc = new MethodConstraint(currentMC.getRight(), "Object", Relation.EXTENDS);
|
MethodConstraint mc = new MethodConstraint(currentMC.getRight(), Object.class.getTypeName(), Relation.EXTENDS);
|
||||||
tempMethodConstraintsWithPosition.get(curMeth).add(mc);
|
tempMethodConstraintsWithPosition.get(curMeth).add(mc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
boolean hasSmallerTVInClCons = (posOfTphs.containsKey(cCons.getRight()) && cCons.getRight() == tph && cCons.getLeft() != null);
|
boolean hasSmallerTVInClCons = (posOfTphs.containsKey(cCons.getRight()) && cCons.getRight() == tph && cCons.getLeft() != null);
|
||||||
if( ((tvInField || hasSmallerTVInClCons) && cCons.getRel()==Relation.EXTENDS) &&
|
if( ((tvInField || hasSmallerTVInClCons) && cCons.getRel()==Relation.EXTENDS) &&
|
||||||
!checkUpperBound(allConstraints, tph) && allCons.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)){
|
if (!checkForDuplicates(consToAdd, tempCC)){
|
||||||
tempCC.add(consToAdd);
|
tempCC.add(consToAdd);
|
||||||
}
|
}
|
||||||
@ -312,7 +312,7 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
for(PairTphMethod pair: posOfTphs.get(tph)) {
|
for(PairTphMethod pair: posOfTphs.get(tph)) {
|
||||||
for(TPHConstraint allCons: allConstraints) {
|
for(TPHConstraint allCons: allConstraints) {
|
||||||
if((pair.fst.equals(PositionFinder.Position.METHOD) || pair.fst.equals(PositionFinder.Position.CONSTRUCTOR)) && !checkUpperBound(allConstraints,tph)) {
|
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)) {
|
if (!checkForDuplicates(consToAdd, tempMC)) {
|
||||||
tempMC.add(consToAdd);
|
tempMC.add(consToAdd);
|
||||||
}
|
}
|
||||||
@ -326,7 +326,7 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
}
|
}
|
||||||
for(TPHConstraint mc1: tempMCObject1) {
|
for(TPHConstraint mc1: tempMCObject1) {
|
||||||
if(tph==mc1.getRight() && !checkUpperBound(tempMCObject1,tph)) {
|
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)) {
|
if (!checkForDuplicates(consToAdd, tempMC)) {
|
||||||
tempMC.add(consToAdd);
|
tempMC.add(consToAdd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user