forked from JavaTX/JavaCompilerCore
modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
This commit is contained in:
parent
2e5581ab6e
commit
f0db6cb901
@ -50,6 +50,7 @@ public class FamilyOfGeneratedGenerics {
|
||||
* {T < .T' | T is a type variable in a type of a node of a field}
|
||||
*/
|
||||
public static List<ClassConstraint> typeOfANodeOfAField(List<TPHConstraint> allConstraints, List<ClassConstraint> cs_cl, HashMap<String, PositionFinder.Position> posOfTphs) {
|
||||
//RuntimeException re = new RuntimeException("enthält EQUALS-Relation");
|
||||
List<ClassConstraint> tempCC= new ArrayList<>();
|
||||
for(TPHConstraint allCons: allConstraints){
|
||||
if(posOfTphs.containsKey(allCons.getLeft()) && allCons.getRight()!=null && allCons.getRel()==Relation.EXTENDS) {
|
||||
@ -62,6 +63,9 @@ public class FamilyOfGeneratedGenerics {
|
||||
}
|
||||
}
|
||||
}
|
||||
/*else if (allCons.getRel() != Relation.EXTENDS) {
|
||||
throw re;
|
||||
}*/
|
||||
}
|
||||
return tempCC;
|
||||
}
|
||||
@ -97,19 +101,13 @@ public class FamilyOfGeneratedGenerics {
|
||||
for(TPHConstraint allCons: allConstraints) {
|
||||
for(ClassConstraint cCons: cs_cl) {
|
||||
for(String tph: posOfTphs.keySet()) {
|
||||
for(int i=0; i<allConstraints.size(); i++) {
|
||||
if( ((posOfTphs.get(tph) == PositionFinder.Position.FIELD) ||
|
||||
(posOfTphs.containsKey(cCons.getRight()) && cCons.getRight() == tph && cCons.getLeft() != null)) &&
|
||||
cCons.getRel()==Relation.EXTENDS &&
|
||||
// (allCons.getLeft() == tph && allCons.getRight() == null) &&
|
||||
// (tph != allCons.getLeft()) &&
|
||||
// (allConstraints.in.getLeft() != tph))
|
||||
allConstraints.get(i).getLeft() != tph &&
|
||||
allCons.getRel()==Relation.EXTENDS) {
|
||||
ClassConstraint consToAdd = new ClassConstraint(cCons.getRight(), "Object", Relation.EXTENDS);
|
||||
if (!checkForDuplicates(consToAdd, tempCC)){
|
||||
tempCC.add(consToAdd);
|
||||
}
|
||||
boolean tvInField = posOfTphs.get(tph) == PositionFinder.Position.FIELD;
|
||||
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);
|
||||
if (!checkForDuplicates(consToAdd, tempCC)){
|
||||
tempCC.add(consToAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,10 +115,16 @@ public class FamilyOfGeneratedGenerics {
|
||||
}
|
||||
return tempCC;
|
||||
}
|
||||
/*
|
||||
|
||||
public static boolean checkUpperBound(List<TPHConstraint> cs, String tph) {
|
||||
for(int i=0; i<cs.size(); i++) {
|
||||
if(cs.get(i).getLeft() == tph) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Def. FGG: erste Zeile von cs_m
|
||||
* {T < .T' | T is a type variable in a type of the method/constructor m in cl_\sigma, (T <. T') \in cs}
|
||||
|
Loading…
Reference in New Issue
Block a user