Fix up functional interface

This commit is contained in:
Daniel Holle 2023-11-02 15:46:40 +01:00
parent f95c3c5fcf
commit 3d2c699964
2 changed files with 3 additions and 3 deletions

View File

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

View File

@ -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