From 5624af609cf4b6f3f551fc5ca60d837559438404 Mon Sep 17 00:00:00 2001 From: Fayez Abu Alia Date: Wed, 19 Dec 2018 14:18:50 +0100 Subject: [PATCH] Simplify fuer TPH Method < TPH Field angepasst --- .../dhbwstuttgart/bytecode/utilities/Simplify.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/de/dhbwstuttgart/bytecode/utilities/Simplify.java b/src/de/dhbwstuttgart/bytecode/utilities/Simplify.java index 7a121fba..49b1b4f4 100644 --- a/src/de/dhbwstuttgart/bytecode/utilities/Simplify.java +++ b/src/de/dhbwstuttgart/bytecode/utilities/Simplify.java @@ -302,8 +302,12 @@ public class Simplify { if(!containTPH(methodTphs, superTphRes)) { HashSet 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 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 tphsClass, String superTphRes) { + for(TypePlaceholder tph : tphsClass) { + if(tph.getName().equals(superTphRes)) + return true; + } + return false; + } + private static boolean isTphInEqualSet(HashMap> result, String tph) { for(HashSet hs: result.values()) { if(hs.contains(tph))