Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to call a default interface method on a JDK proxy #2658

Closed
sdeleuze opened this issue Jul 6, 2020 · 4 comments
Closed

Unable to call a default interface method on a JDK proxy #2658

sdeleuze opened this issue Jul 6, 2020 · 4 comments
Assignees
Labels
bug native-image spring spring related issue
Milestone

Comments

@sdeleuze
Copy link
Collaborator

sdeleuze commented Jul 6, 2020

We are looking for a way to call a default interface method on a JDK proxy. Currently with https://github.com/lettuce-io/lettuce-core/blob/main/src/main/java/io/lettuce/core/dynamic/intercept/DefaultMethodInvokingInterceptor.java and https://github.com/lettuce-io/lettuce-core/blob/main/src/main/java/io/lettuce/core/internal/DefaultMethods.java we get:

[4:29 PM] Exception in thread "main" com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported constructor java.lang.invoke.MemberName.<init>(Method, boolean) is reachable: All methods from java.lang.invoke should have been replaced during image building.
	at com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:86)
	at java.lang.invoke.MemberName.<init>(MemberName.java:521)
	at java.lang.invoke.MethodHandles$Lookup.unreflectSpecial(MethodHandles.java:1233)
	at io.lettuce.core.internal.DefaultMethods$MethodHandleLookup$1.lookup(DefaultMethods.java:71)
	at io.lettuce.core.internal.DefaultMethods.lookupMethodHandle(DefaultMethods.java:49)
	at io.lettuce.core.cluster.ClusterFutureSyncInvocationHandler.lookupDefaultMethod(ClusterFutureSyncInvocationHandler.java:202)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at io.lettuce.core.cluster.ClusterFutureSyncInvocationHandler.handleInvocation(ClusterFutureSyncInvocationHandler.java:85)
	at io.lettuce.core.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80)
	at com.sun.proxy.$Proxy131.masters(Unknown Source)
	at example.App.main(App.java:19)
@farquet farquet added the spring spring related issue label Jul 6, 2020
@peter-hofer
Copy link
Member

Thank you for your report @sdeleuze. The target method of a method handle call must be known at image build time, which is not possible with how io.lettuce.core.internal.DefaultMethods utilities are used here.

@cstancu
Copy link
Member

cstancu commented Sep 24, 2020

MethodHandle support is under development and is being tracked by #2761.

@peter-hofer
Copy link
Member

I believe this should be resolved by the recent method handle enhancements. @sdeleuze @loicottet , please reopen if it is not.

@sdeleuze
Copy link
Collaborator Author

@peter-hofer Thanks, could you please set the related milestone (21.1 I guess) ?

@peter-hofer peter-hofer added this to the 21.1 milestone Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug native-image spring spring related issue
Projects
None yet
Development

No branches or pull requests

4 participants