From d010c843df9d265819411c21cee0487e6463ae86 Mon Sep 17 00:00:00 2001 From: Fayez Abu Alia Date: Wed, 20 Feb 2019 12:15:55 +0100 Subject: [PATCH] Bug in MatrixTest gefixt. Die richtige Descriptor von MethodCalls wird erzeugt --- .../java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java | 7 ++++--- .../de/dhbwstuttgart/bytecode/utilities/Simplify.java | 8 ++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java b/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java index ef9b9946..dd3d27ed 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java @@ -767,7 +767,7 @@ public class BytecodeGenMethod implements StatementVisitor { System.out.println("Methods of " + receiverName + " "); java.lang.reflect.Method methodRefl = null; String clazz = receiverName.replace("/", "."); - if(!receiverName.equals(className)) { +// if(!receiverName.equals(className)) { ClassLoader cLoader = ClassLoader.getSystemClassLoader(); // This will be used if the class is not standard class (not in API) ClassLoader cLoader2; @@ -847,7 +847,7 @@ public class BytecodeGenMethod implements StatementVisitor { //do nothing } } - } +// } methodCall.receiver.accept(this); @@ -861,6 +861,7 @@ public class BytecodeGenMethod implements StatementVisitor { mDesc = method.accept(new DescriptorToString(resultSet)); methodCall.arglist.accept(this); } else { + System.out.println(methodCall.name + " -> Refl != null"); receiverRefl = methodRefl.getAnnotatedReceiverType().getType().toString(); for(Parameter p:methodRefl.getParameters()) { System.out.println(p.getName() + " und is Primitive = " + p.getType().isPrimitive()); @@ -876,7 +877,7 @@ public class BytecodeGenMethod implements StatementVisitor { } } - System.out.println("Methodcall Desc : " + mDesc); + System.out.println("Methodcall ("+ methodCall.name +") Desc : " + mDesc); // methodCall.arglist.accept(this); diff --git a/src/main/java/de/dhbwstuttgart/bytecode/utilities/Simplify.java b/src/main/java/de/dhbwstuttgart/bytecode/utilities/Simplify.java index 83eb7cc7..e1528254 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/utilities/Simplify.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/utilities/Simplify.java @@ -201,16 +201,20 @@ public class Simplify { break; } } - + // finder looks for constraints that have the same left hand side + // and put them in a list ConstraintsFinder finder = new ConstraintsFinder(allCons); List> foundCons = finder.findConstraints(); ArrayList eqCons = new ArrayList<>(); for(List list : foundCons) { + // generate a new name and replace the right hand side for each constraint + // in list with the new name NameReplacer replacer = new NameReplacer(list,allCons,methodTphs); + // new name -> [all old names] Map> replRes = replacer.replaceNames(); - + // create an equal constraint for each value in repres String key = replRes.keySet().iterator().next(); for(String val : replRes.values().iterator().next()) { EqualConstraint ec = new EqualConstraint(val, key, Relation.EQUAL);