Bug in MatrixTest gefixt. Die richtige Descriptor von MethodCalls wird erzeugt

This commit is contained in:
Fayez Abu Alia 2019-02-20 12:15:55 +01:00
parent 67469bbb84
commit d010c843df
2 changed files with 10 additions and 5 deletions

View File

@ -767,7 +767,7 @@ public class BytecodeGenMethod implements StatementVisitor {
System.out.println("Methods of " + receiverName + " "); System.out.println("Methods of " + receiverName + " ");
java.lang.reflect.Method methodRefl = null; java.lang.reflect.Method methodRefl = null;
String clazz = receiverName.replace("/", "."); String clazz = receiverName.replace("/", ".");
if(!receiverName.equals(className)) { // if(!receiverName.equals(className)) {
ClassLoader cLoader = ClassLoader.getSystemClassLoader(); ClassLoader cLoader = ClassLoader.getSystemClassLoader();
// This will be used if the class is not standard class (not in API) // This will be used if the class is not standard class (not in API)
ClassLoader cLoader2; ClassLoader cLoader2;
@ -847,7 +847,7 @@ public class BytecodeGenMethod implements StatementVisitor {
//do nothing //do nothing
} }
} }
} // }
methodCall.receiver.accept(this); methodCall.receiver.accept(this);
@ -861,6 +861,7 @@ public class BytecodeGenMethod implements StatementVisitor {
mDesc = method.accept(new DescriptorToString(resultSet)); mDesc = method.accept(new DescriptorToString(resultSet));
methodCall.arglist.accept(this); methodCall.arglist.accept(this);
} else { } else {
System.out.println(methodCall.name + " -> Refl != null");
receiverRefl = methodRefl.getAnnotatedReceiverType().getType().toString(); receiverRefl = methodRefl.getAnnotatedReceiverType().getType().toString();
for(Parameter p:methodRefl.getParameters()) { for(Parameter p:methodRefl.getParameters()) {
System.out.println(p.getName() + " und is Primitive = " + p.getType().isPrimitive()); 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); // methodCall.arglist.accept(this);

View File

@ -201,16 +201,20 @@ public class Simplify {
break; break;
} }
} }
// finder looks for constraints that have the same left hand side
// and put them in a list
ConstraintsFinder finder = new ConstraintsFinder(allCons); ConstraintsFinder finder = new ConstraintsFinder(allCons);
List<List<TPHConstraint>> foundCons = finder.findConstraints(); List<List<TPHConstraint>> foundCons = finder.findConstraints();
ArrayList<TPHConstraint> eqCons = new ArrayList<>(); ArrayList<TPHConstraint> eqCons = new ArrayList<>();
for(List<TPHConstraint> list : foundCons) { for(List<TPHConstraint> 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); NameReplacer replacer = new NameReplacer(list,allCons,methodTphs);
// new name -> [all old names]
Map<String, List<String>> replRes = replacer.replaceNames(); Map<String, List<String>> replRes = replacer.replaceNames();
// create an equal constraint for each value in repres
String key = replRes.keySet().iterator().next(); String key = replRes.keySet().iterator().next();
for(String val : replRes.values().iterator().next()) { for(String val : replRes.values().iterator().next()) {
EqualConstraint ec = new EqualConstraint(val, key, Relation.EQUAL); EqualConstraint ec = new EqualConstraint(val, key, Relation.EQUAL);