diff --git a/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java b/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java index 2b3c99fdd..f638957d9 100644 --- a/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java +++ b/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java @@ -803,11 +803,12 @@ public class StatementGenerator { }else { Java8Parser.MethodInvocation_lf_primaryContext ctxt = e.methodInvocation_lf_primary(); String methodName = ctxt.Identifier().toString(); - ArrayList argTypes = ctxt.argumentList().expression().stream() + ArrayList signature = ctxt.argumentList().expression().stream() .map(x -> TypePlaceholder.fresh(e.getStart())) .collect(Collectors.toCollection(ArrayList::new)); + signature.add(TypePlaceholder.fresh(e.getStart())); //ReturnType return new MethodCall(TypePlaceholder.fresh(e.getStart()), getReceiver(expr), methodName, - convert(ctxt.argumentList()), TypePlaceholder.fresh(e.getStart()), argTypes, e.getStart()); + convert(ctxt.argumentList()), TypePlaceholder.fresh(e.getStart()), signature, e.getStart()); } } diff --git a/src/main/java/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java b/src/main/java/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java index ad1cbf3ee..a7aea577a 100644 --- a/src/main/java/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java +++ b/src/main/java/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java @@ -25,16 +25,18 @@ public class MethodCall extends Statement public final ArgumentList arglist; public RefTypeOrTPHOrWildcardOrGeneric receiverType; - public final ArrayList argTypes; //sind Tphs, repraesentieren im Resultset die Typen der aufgerufenen Methoden + + //sind Tphs, repraesentieren im Resultset die Signatur der aufgerufenen Methoden, letztes Element ist der Returntyp + public final ArrayList signature; public MethodCall(RefTypeOrTPHOrWildcardOrGeneric retType, Receiver receiver, String methodName, ArgumentList argumentList, - RefTypeOrTPHOrWildcardOrGeneric receiverType, ArrayList argTypes, Token offset){ + RefTypeOrTPHOrWildcardOrGeneric receiverType, ArrayList signature, Token offset){ super(retType,offset); this.arglist = argumentList; this.name = methodName; this.receiver = receiver; this.receiverType = receiverType; - this.argTypes = argTypes; + this.signature = signature; } diff --git a/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java b/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java index 69ba4b9a9..e9c39fed7 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java @@ -655,8 +655,8 @@ public class TYPEStmt implements StatementVisitor{ RefTypeOrTPHOrWildcardOrGeneric argType = foMethod.arglist.getArguments().get(i).getType(); RefTypeOrTPHOrWildcardOrGeneric assType = assumption.getArgTypes(resolver).get(i); - //Zuordnung von MethoCall.argTypes zu der Argumenttypen der ausgewaehlten Methode (assumption.params) - ret.add(new Pair(foMethod.argTypes.get(i), assumption.getArgTypes().get(i), PairOperator.EQUALSDOT)); + //Zuordnung von MethoCall.signature (Argumenttypen) zu der Argumenttypen der ausgewaehlten Methode (assumption.params) + ret.add(new Pair(foMethod.signature.get(i), assumption.getArgTypes().get(i), PairOperator.EQUALSDOT)); ret.add(new Pair(argType, assType, PairOperator.SMALLERDOT)); @@ -664,6 +664,10 @@ public class TYPEStmt implements StatementVisitor{ // ret.add(new Pair(foMethod.argTypes.get(i), assType, PairOperator.EQUALSDOT)); //Fuer Bytecodegenerierung PL 2020-03-09 wird derzeit nicht benutzt ENDE } + + //Zuordnung von MethodCall.signature(ReturnType) zu dem ReturnType der ausgewaehlten Methode (assumption.returnType) + ret.add(new Pair(foMethod.signature.get(foMethod.signature.size()), assumption.getReturnType(), PairOperator.EQUALSDOT)); + return ret; }