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
{{ message }}
Repository navigation
LambdaFetchingSupport is broken for cross class loader method access after JDK >= 14 #3369
This effectively breaks LambdaFetchingSupport.createGetter in cross class loader situations and always silently goes into the try (... ignore) {} and falls back to the original reflection:
To Reproduce
Run the LambdaFetchingSupportTest.'different class loaders induce certain behaviours' on a JDK 14+ (triggered for me on JDK 17)
How to fix
Jackson fixed this by (if I understand correctly) creating a dummy class in the same package as the 'hidden' class that has a static reference to the MethodHandle.Lookup instance, which can then be resolved using reflection:
To fix this for GraphQL Java the GrantAccess.java would need to be edited a bit to give the "dummy" class a different name i.e, GraphQLJavaAccess, running this will create the necessary class bytes
Then the CrossLoaderAccess would be copied and the bytes would be modified with the correct class bytes that were generated.
Then the class would have to be "opened up" in LambdaFetchingSupport.getLookup (see CrossLoaderAccess.apply) after which it will work like normal again
Other
I am unsure of how many deployments this applies to, but considering that having GraphQL Java in one class loader and the target classes in another is not the craziest idea, it should probably be fixed. Especially considering the performance gains (#2985 )
The good news here is that it falls back to the previous reflection and this decision is remembered between calls.
So while its not as fast as it could be - its not broken per se and it falls back to a secondary strategy. I saw this because before it did not do that and when it broken with funky class loaders we had bad bug
Activity
bbakerman commentedon Oct 30, 2023
The good news here is that it falls back to the previous reflection and this decision is remembered between calls.
So while its not as fast as it could be - its not broken per se and it falls back to a secondary strategy. I saw this because before it did not do that and when it broken with funky class loaders we had bad bug
jord1e commentedon Oct 30, 2023
Yes, it does indeed fall back to the “old” reflection fetcher. And at least Jackson already constructed a fix
would there be interest in a PR from me or will you guys fix it?
dondonz commentedon Feb 23, 2025
Thanks for reporting the issue.
As there is a fallback strategy already in place I'm closing this issue as part of an old issue cleanup.
To anyone reading, if you would like to continue the conversation, feel free to open a new issue.