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
a0c92c2d9d
commit
9f06118138
@ -155,7 +155,6 @@ public class GeneratedGenericsFinder implements ASTVisitor {
|
||||
addMethodConstraints(simplifiedConstraints, ggResult, m);
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
if(ggResult != null) { //Hinzufuegen von Fayez ggResult
|
||||
|
@ -8,6 +8,7 @@ import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
public class FamilyOfGeneratedGenerics {
|
||||
public List<TPHConstraint> allConstraints = new ArrayList<>();
|
||||
@ -17,6 +18,7 @@ public class FamilyOfGeneratedGenerics {
|
||||
public List<MethodConstraint> methodConstraints = new ArrayList<>();
|
||||
public HashMap<String, List<MethodConstraint>> methodConstraintsWithPosition = new HashMap<>();
|
||||
|
||||
private static final String objectType = Type.getInternalName(Object.class);
|
||||
|
||||
public FamilyOfGeneratedGenerics(TPHExtractor tphExtractor) {
|
||||
this.allConstraints = tphExtractor.allCons;
|
||||
@ -128,8 +130,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.class.getTypeName() && !compareTphsOfConstraints(currentMC.getRight(), cs_cl) && !compareTphsOfConstraints(currentMC.getRight(), tempMethodConstraintsWithPosition.get(curMeth))) {
|
||||
MethodConstraint mc = new MethodConstraint(currentMC.getRight(), Object.class.getTypeName(), Relation.EXTENDS);
|
||||
if(currentMC.getRight()!= objectType && !compareTphsOfConstraints(currentMC.getRight(), cs_cl) && !compareTphsOfConstraints(currentMC.getRight(), tempMethodConstraintsWithPosition.get(curMeth))) {
|
||||
MethodConstraint mc = new MethodConstraint(currentMC.getRight(), objectType, Relation.EXTENDS);
|
||||
tempMethodConstraintsWithPosition.get(curMeth).add(mc);
|
||||
}
|
||||
}
|
||||
@ -212,7 +214,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.class.getTypeName(), Relation.EXTENDS);
|
||||
ClassConstraint consToAdd = new ClassConstraint(tph, objectType, Relation.EXTENDS);
|
||||
if (!checkForDuplicates(consToAdd, tempCC)){
|
||||
tempCC.add(consToAdd);
|
||||
}
|
||||
@ -312,7 +314,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.class.getTypeName(), Relation.EXTENDS);
|
||||
MethodConstraint consToAdd = new MethodConstraint(tph, objectType, Relation.EXTENDS);
|
||||
if (!checkForDuplicates(consToAdd, tempMC)) {
|
||||
tempMC.add(consToAdd);
|
||||
}
|
||||
@ -326,7 +328,7 @@ public class FamilyOfGeneratedGenerics {
|
||||
}
|
||||
for(TPHConstraint mc1: tempMCObject1) {
|
||||
if(tph==mc1.getRight() && !checkUpperBound(tempMCObject1,tph)) {
|
||||
MethodConstraint consToAdd = new MethodConstraint(tph, Object.class.getTypeName(), Relation.EXTENDS);
|
||||
MethodConstraint consToAdd = new MethodConstraint(tph, objectType, Relation.EXTENDS);
|
||||
if (!checkForDuplicates(consToAdd, tempMC)) {
|
||||
tempMC.add(consToAdd);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user