Simplify fuer TPH Method < TPH Field angepasst

This commit is contained in:
Fayez Abu Alia 2018-12-19 14:18:50 +01:00
parent b71efd65a0
commit 5624af609c

View File

@ -302,8 +302,12 @@ public class Simplify {
if(!containTPH(methodTphs, superTphRes)) {
HashSet<String> equals = getEqualsTphsFromEqualCons(eqCons,superTphRes);
if(classTPHSContainsTPH(tphsClass,superTphRes)) {
result.put(new ExtendsConstraint(subTphRes, superTphRes, Relation.EXTENDS), equals);
} else {
result.put(new ExtendsConstraint(subTphRes, Type.getInternalName(Object.class), Relation.EXTENDS), equals);
}
result.put(new ExtendsConstraint(subTphRes, Type.getInternalName(Object.class), Relation.EXTENDS), equals);
} else {
HashSet<String> equals = getEqualsTphsFromEqualCons(eqCons,subTphRes);
result.put(new ExtendsConstraint(subTphRes, superTphRes, Relation.EXTENDS), equals);
@ -341,6 +345,14 @@ public class Simplify {
return result;
}
private static boolean classTPHSContainsTPH(ArrayList<TypePlaceholder> tphsClass, String superTphRes) {
for(TypePlaceholder tph : tphsClass) {
if(tph.getName().equals(superTphRes))
return true;
}
return false;
}
private static boolean isTphInEqualSet(HashMap<TPHConstraint, HashSet<String>> result, String tph) {
for(HashSet<String> hs: result.values()) {
if(hs.contains(tph))