You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ReflectionCheckingTypeAdapterFactory class accesses a GSON internal class directly. This breaks when GSON is placed on the module path due to encapsulation.
java.lang.IllegalAccessError: class com.stripe.net.ReflectionCheckingTypeAdapterFactory (in unnamed module @0x69a3d1d) cannot access class com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter (in module com.google.gson) because module com.google.gson does not export com.google.gson.internal.bind to unnamed module @0x69a3d1d @ com.stripe.net.ReflectionCheckingTypeAdapterFactory.create(Unknown Source)
To Reproduce
Place gson on the module path and then try to use the Stripe API.
Expected behavior
There are a few possible fixes that spring to mind:
This class looks like a utility / assertion checking class, so it could be disabled in production code paths.
Instead of using instanceof, the class name could maybe be checked using reflection?
The IllegalAccessError could be caught, and that used to disable the check at runtime.
Code snippets
No response
OS
macOS
Java version
Java 17
stripe-java version
22.1.0
API version
2022-11-15
Additional context
A workaround is to place gson on the classpath instead of the module path. One could probably also use --add-opens.
The text was updated successfully, but these errors were encountered:
Describe the bug
The
ReflectionCheckingTypeAdapterFactory
class accesses a GSON internal class directly. This breaks when GSON is placed on the module path due to encapsulation.java.lang.IllegalAccessError: class com.stripe.net.ReflectionCheckingTypeAdapterFactory (in unnamed module @0x69a3d1d) cannot access class com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter (in module com.google.gson) because module com.google.gson does not export com.google.gson.internal.bind to unnamed module @0x69a3d1d @ com.stripe.net.ReflectionCheckingTypeAdapterFactory.create(Unknown Source)
To Reproduce
Place gson on the module path and then try to use the Stripe API.
Expected behavior
There are a few possible fixes that spring to mind:
instanceof
, the class name could maybe be checked using reflection?IllegalAccessError
could be caught, and that used to disable the check at runtime.Code snippets
No response
OS
macOS
Java version
Java 17
stripe-java version
22.1.0
API version
2022-11-15
Additional context
A workaround is to place gson on the classpath instead of the module path. One could probably also use
--add-opens
.The text was updated successfully, but these errors were encountered: