-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Description
After moving my project to fully support JPMS (JDK11), and retrofit has become unusable due to the following error:
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int) accessible: module java.base does not "opens java.lang.invoke" to module retrofit2
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:189)
at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:182)
at [email protected]/retrofit2.Platform.<init>(Platform.java:59)
at [email protected]/retrofit2.Platform.findPlatform(Platform.java:44)
at [email protected]/retrofit2.Platform.<clinit>(Platform.java:35)
... 11 more
It seems that retrofit deeply depends on Java's Lookup class and making its constructor visible to itself. The issue becomes apparent, when using the JPMS. A workaround for this is to add --add-opens java.base/java.lang.invoke=retrofit2
but it would be nice if there wasn't such need to expose the base module's packages myself. Perhaps add a call to Module#addOpen(String, Module)
when initializing retrofit's class?
Metadata
Metadata
Assignees
Labels
No labels