Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2905

HeaderUtils requires --add-opens on JDK 16+

XMLWordPrintable

      Per the analysis by ropalka of JPMS --add-opens calls needed by WildFly when running on SE 16+ (see [1]), we need --add-opens=java.base/java.lang.invoke=ALL-UNNAMED due to this:

      Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make java.lang.invoke.MethodHandles$Lookup(java.lang.Class) accessible: module java.base does not "opens java.lang.invoke" to unnamed module @7cdb1e58
          at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
          at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
          at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:188)
          at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:181)
          at org.jboss.resteasy.resteasy-client-microprofile@3.15.1.Final//org.jboss.resteasy.microprofile.client.header.HeaderUtils.createMethodHandle(HeaderUtils.java:31)
          at org.jboss.resteasy.resteasy-client-microprofile@3.15.1.Final//org.jboss.resteasy.microprofile.client.header.DefaultHeaderFiller.<init>(DefaultHeaderFiller.java:40)
          at org.jboss.resteasy.resteasy-client-microprofile@3.15.1.Final//org.jboss.resteasy.microprofile.client.header.DefaultHeaderFillerFactory.createFiller(DefaultHeaderFillerFactory.java:19)
          at org.jboss.resteasy.resteasy-client-microprofile@3.15.1.Final//org.jboss.resteasy.microprofile.client.header.ClientHeaderGenerator.<init>(ClientHeaderGenerator.java:35)
          at org.jboss.resteasy.resteasy-client-microprofile@3.15.1.Final//org.jboss.resteasy.microprofile.client.header.ClientHeaderProvider.forMethod(ClientHeaderProvider.java:32)
          at org.jboss.resteasy.resteasy-client-microprofile@3.15.1.Final//org.jboss.resteasy.microprofile.client.header.ClientHeaderProviders.registerForMethod(ClientHeaderProviders.java:98)
          at org.jboss.resteasy.resteasy-client-microprofile@3.15.1.Final//org.jboss.resteasy.microprofile.client.header.ClientHeaderProviders.lambda$registerForClass$0(ClientHeaderProviders.java:72)
          at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
          at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
          at org.jboss.resteasy.resteasy-client-microprofile@3.15.1.Final//org.jboss.resteasy.microprofile.client.header.ClientHeaderProviders.registerForClass(ClientHeaderProviders.java:72)
          at org.jboss.resteasy.resteasy-client-microprofile@3.15.1.Final//org.jboss.resteasy.microprofile.client.RestClientBuilderImpl.build(RestClientBuilderImpl.java:341)
          at deployment.InvalidInterfaceTest.war//org.eclipse.microprofile.rest.client.tck.InvalidInterfaceTest.testExceptionThrownWhenMultipleClientHeaderParamsSpecifySameHeaderOnMethod(InvalidInterfaceTest.java:90)
      

      The smallrye faulttolerance project has code similar to what HeaderUtils does[2] but they use a multi-release jar to provide a different implementation on JDK9+[3]. If that approach is suitable to RESTEasy it would be nice as it would eliminate the need for WildFly to open that module/package.

      [1] WFCORE-5406 attachment file https://issues.redhat.com/secure/attachment/12523672/modular-params-needed-analysis.txt

      [2] https://github.com/smallrye/smallrye-fault-tolerance/blob/main/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/DefaultMethodFallbackProvider.java

      [3] https://github.com/smallrye/smallrye-fault-tolerance/blob/main/implementation/fault-tolerance/src/main/java9/io/smallrye/faulttolerance/DefaultMethodFallbackProvider.java

              jperkins-rhn James Perkins
              bstansbe@redhat.com Brian Stansberry
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: