From 3d2c699964ceffd8b9c738c1ab9940eeb0dd9274 Mon Sep 17 00:00:00 2001 From: Daniel Holle Date: Thu, 2 Nov 2023 15:46:40 +0100 Subject: [PATCH] Fix up functional interface --- .../target/generate/StatementToTargetExpression.java | 2 +- src/test/java/TestComplete.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java b/src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java index d89da929..1e5d77d5 100644 --- a/src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java +++ b/src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java @@ -195,7 +195,7 @@ public class StatementToTargetExpression implements ASTVisitor { var thisMethod = converter.findMethod(converter.currentClass, methodCall.name, signature); foundMethod = thisMethod.orElseGet(() -> findMethod(converter.currentClass.getSuperClass().getName(), methodCall.name, signature).orElseThrow()); } else if (!isFunNType) { - System.out.println(methodCall.signature); + receiverClass = converter.compiler.getClass(receiverName); foundMethod = findMethod(receiverName, methodCall.name, signature).orElseThrow(); } diff --git a/src/test/java/TestComplete.java b/src/test/java/TestComplete.java index e7ea2466..43c8883d 100644 --- a/src/test/java/TestComplete.java +++ b/src/test/java/TestComplete.java @@ -751,8 +751,8 @@ public class TestComplete { var classFiles = generateClassFiles(new ByteArrayClassLoader(), "FunctionalInterface.jav"); var clazz = classFiles.get("FunctionalInterface"); var instance = clazz.getDeclaredConstructor().newInstance(); - var m = clazz.getDeclaredMethod("m", Integer.class); - assertEquals(m.invoke(instance, 20), 400); + var m = clazz.getDeclaredMethod("m"); + assertEquals(m.invoke(instance), 200); } @Test