From 4fc78f494ca7b16cd38dbaa9d2bcd406fdbbdc5b Mon Sep 17 00:00:00 2001 From: Daniel Holle Date: Wed, 10 Apr 2024 10:22:34 +0200 Subject: [PATCH] More poking around --- .../target/generate/StatementToTargetExpression.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java b/src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java index 92f20b9d..3816e12d 100644 --- a/src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java +++ b/src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java @@ -208,8 +208,9 @@ public class StatementToTargetExpression implements ASTVisitor { var isPrivate = false; var signature = methodCall.signatureArguments().stream().map(converter::convert).toList(); - var receiverClass = converter.compiler.getClass(new JavaClassName(converter.convert(methodCall.receiver.getType()).name())); + var receiverClass = converter.compiler.getClass(receiverName); if (methodCall.receiver instanceof ExpressionReceiver expressionReceiver && expressionReceiver.expr instanceof This) { + if (receiverClass == null) throw new DebugException("Class " + receiverName + " does not exist!"); var thisMethod = converter.findMethod(receiverClass, methodCall.name, signature); ClassOrInterface finalReceiverClass = receiverClass; foundMethod = thisMethod.orElseGet(() -> findMethod(finalReceiverClass.getSuperClass().getName(), methodCall.name, signature).orElseThrow());