modified: ../../../main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java

modified:   ../../../main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java
Im Bytecode werden MethpdCaltypen bereits beim TYPEen angelegt.
This commit is contained in:
pl@gohorb.ba-horb.de 2020-02-07 18:17:58 +01:00
parent 98997d686f
commit e913bfa768
2 changed files with 14 additions and 4 deletions

View File

@ -754,7 +754,8 @@ public class BytecodeGenMethod implements StatementVisitor {
public void visit(MethodCall methodCall) { public void visit(MethodCall methodCall) {
boolean parentBinary = isParentBinary; boolean parentBinary = isParentBinary;
System.out.println("In MethodCall = " + methodCall.name); System.out.println("In MethodCall = " + methodCall.name);
String receiverName = resolver.getResolvedType(methodCall.receiver.getType()); //String receiverName = resolver.getResolvedType(methodCall.receiver.getType());
String receiverName = resolver.getResolvedType(methodCall.receiverType);
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("/", ".");
@ -768,7 +769,8 @@ public class BytecodeGenMethod implements StatementVisitor {
ClassLoader cLoader2; ClassLoader cLoader2;
String methCallType = resultSet.resolveType(methodCall.getType()).resolvedType.acceptTV(new TypeToDescriptor()); String methCallType = resultSet.resolveType(methodCall.getType()).resolvedType.acceptTV(new TypeToDescriptor());
String[] typesOfParams = getTypes(methodCall.arglist.getArguments()); //String[] typesOfParams = getTypes(methodCall.arglist.getArguments());
String[] typesOfParams = getTypes(methodCall.argTypes);
try { try {
clazz = getRawClassName(receiverName, clazz); clazz = getRawClassName(receiverName, clazz);
@ -918,10 +920,10 @@ public class BytecodeGenMethod implements StatementVisitor {
return clazz; return clazz;
} }
private String[] getTypes(List<Expression> arguments) { private String[] getTypes(List<RefTypeOrTPHOrWildcardOrGeneric> arguments) {
String[] types = new String[arguments.size()]; String[] types = new String[arguments.size()];
for(int i = 0; i<arguments.size(); ++i) { for(int i = 0; i<arguments.size(); ++i) {
String t = resolver.getResolvedType(arguments.get(i).getType()); String t = resolver.getResolvedType(arguments.get(i));
types[i] = t; types[i] = t;
} }
return types; return types;

View File

@ -575,6 +575,11 @@ public class TYPEStmt implements StatementVisitor{
RefTypeOrTPHOrWildcardOrGeneric retType = assumption.getReceiverType(resolver); RefTypeOrTPHOrWildcardOrGeneric retType = assumption.getReceiverType(resolver);
methodConstraint.add(new Pair(forMethod.receiver.getType(), retType, methodConstraint.add(new Pair(forMethod.receiver.getType(), retType,
PairOperator.SMALLERDOT)); PairOperator.SMALLERDOT));
//Fuer Bytecodegenerierung
methodConstraint.add(new Pair(forMethod.receiverType, retType,
PairOperator.EQUALSDOT));
methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(),
PairOperator.EQUALSDOT)); PairOperator.EQUALSDOT));
methodConstraint.addAll(generateParameterConstraints(forMethod, assumption, info, resolver)); methodConstraint.addAll(generateParameterConstraints(forMethod, assumption, info, resolver));
@ -589,6 +594,9 @@ public class TYPEStmt implements StatementVisitor{
RefTypeOrTPHOrWildcardOrGeneric argType = foMethod.arglist.getArguments().get(i).getType(); RefTypeOrTPHOrWildcardOrGeneric argType = foMethod.arglist.getArguments().get(i).getType();
RefTypeOrTPHOrWildcardOrGeneric assType = assumption.getArgTypes(resolver).get(i); RefTypeOrTPHOrWildcardOrGeneric assType = assumption.getArgTypes(resolver).get(i);
ret.add(new Pair(argType, assType, PairOperator.SMALLERDOT)); ret.add(new Pair(argType, assType, PairOperator.SMALLERDOT));
//Fuer Bytecodegenerierung
ret.add(new Pair(foMethod.argTypes.get(i), assType, PairOperator.EQUALSDOT));
} }
return ret; return ret;
} }