-
-
Notifications
You must be signed in to change notification settings - Fork 841
Open
Labels
Description
Hello.
When instrumenting lambdas, i get the following Exception:
Exception in thread "main" java.lang.AbstractMethodError: Receiver class ByteBuddyLambdaTest$StringFunction$$Lambda$ByteBuddy$1/0x000002b6c81495c0 does not define or inherit an implementation of the resolved method 'java.lang.Object apply(java.lang.Object)' of interface ByteBuddyLambdaTest$StringFunction.
at ByteBuddyLambdaTest.main(ByteBuddyLambdaTest.java:13)
Minimal code to reproduce the problem is as follows:
import java.util.function.Function;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.agent.builder.AgentBuilder.LambdaInstrumentationStrategy;
public class ByteBuddyLambdaTest {
public static void main(String[] args) {
new AgentBuilder.Default()
.with(LambdaInstrumentationStrategy.ENABLED)
.installOn(ByteBuddyAgent.install());
StringFunction.TEST.apply("test");
}
interface StringFunction extends Function<String, String> {
StringFunction TEST = System::getProperty;
}
}
It seems to be due to the interface extending a generified lambda (i.e. Function<String, String>).
Somehow the code produced by the LambdaInstrumentationStrategy doesn't contain the right parameter types, I guess?
Thanks in advance
Alex