cadence-java-client
cadence-java-client copied to clipboard
Java 17 support - Illegal reflective access in CustomThrowableTypeAdapter and CheckedExceptionWrapper
I tried using the cadence-java-client with java 17. However it appears that the CustomThrowableTypeAdapter uses a reflection method which no longer works in java 17.
The code https://github.com/uber/cadence-java-client/blob/master/src/main/java/com/uber/cadence/converter/CustomThrowableTypeAdapter.java#L83 Makes the cause field accessible in order to set a non-accessible field to null. This is no longer possible in java 17 because of https://openjdk.java.net/jeps/403 .
Similarly, the initializer of CheckedExceptionWrapper also uses a reflective method which is no longer allowed.
It seems like there are some standard replacements recommended. Would you like to propose some changes to that?
Is it possible to use the same solution as in temporal? https://github.com/temporalio/sdk-java/commit/4bb23c3a660de6a2630901d0dc6c049d9742ebe1
Also handling errors seems like a nice fix: https://github.com/temporalio/sdk-java/commit/6653b3d71af118824f5eedcbef6e33be103d9f1e
Is there any solve or alternative proposed for this issue for using uber cadence with Java-17? I am facing java.lang.NoClassDefFoundError: Could not initialize class com.uber.cadence.internal.common.CheckedExceptionWrapper after upgrading to java 17. This should be related to the issue stated above.
If you include the VM parameter "--add-opens java.base/java.lang=ALL-UNNAMED," it will prevent the exception from being thrown.