Hi Andy,

I've committed a small patch to master [1] to fallback to 
MethodHandles.privateLookupIn (JDK9+)
in case the main flow fails with IllegalAccessException, it seems to fix the 
issue and properly
invoke the default method for JDK9+. As far as I know, at the moment there is 
no universal 
solution which works for JDK 8, 9, 10 and 11. Please let me know what do you 
think. 

Thank you!

[1] 
https://github.com/apache/cxf/commit/58d9bcd12059c46713902b756881e80c2f28f030

Best Regards,
    Andriy Redko

Thursday, December 20, 2018, 3:52:29 PM, you wrote:

AM> Hi Dennis,

AM> I most likely introduced this with my fix for CXF-7922 - in that fix, I
AM> made some changes to internal JDK classes in ClientProxyImpl's
AM> invokeDefaultMethod method.  The MP Rest Client (as well as the CXF proxy
AM> client) should be able to invoke default methods, and there doesn't seem to
AM> be a good way of doing that... Romain wrote a blog post on the subject
AM> here:
AM> 
https://rmannibucau.wordpress.com/2014/03/27/java-8-default-interface-methods-and-jdk-dynamic-proxies/
AM> - this was the idea behind that change, but I would bet that it is not
AM> allowed with JPMS enabled - and is most likely causing the failure.

AM> It sounds like I need to find a better way to invoke default interface
AM> methods without using JDK internals.  If anyone knows of a better way or
AM> has any hints, please let me know.  In the meantime, I could add something
AM> like "assume Java 8" to skip the test in Java 9+ environments.  What do you
AM> think?

AM> Thanks,

AM> Andy

AM> On Thu, Dec 20, 2018 at 2:33 PM Dennis Kieselhorst <[email protected]> wrote:

>> Hi,

>> only CxfTypeSafeClientBuilderTest is missing to have a stable build from
>> JDK 9 - 11.

>> java.lang.reflect.UndeclaredThrowableException
>>         at
>> org.apache.cxf.microprofile.client.CxfTypeSafeClientBuilderTest.testCanInvokeDefaultInterfaceMethods(CxfTypeSafeClientBuilderTest.java:173)
>> Caused by: java.lang.IllegalAccessException: access to public member
>> failed:
>> org.apache.cxf.microprofile.client.mock.MyClient.myDefaultMethod[Ljava.lang.Object;@10cf09e8/invokeSpecial,
>> from org.apache.cxf.microprofile.client.mock.MyClient/2 (unnamed module
>> @14dd9eb7)
>>         at
>> org.apache.cxf.microprofile.client.CxfTypeSafeClientBuilderTest.testCanInvokeDefaultInterfaceMethods(CxfTypeSafeClientBuilderTest.java:173)

>> Anyone seen something similar before?

>> Cheers
>> Dennis


Reply via email to