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());