MethodHandles.lookup errors where publicLookup is ok
Charles Oliver Nutter
headius at headius.com
Tue Sep 2 15:31:12 UTC 2025
I've run into various versions of this situation and I wonder if my
expectations about MethodHandles.lookup vs publicLookup are flawed.
This issue shows an IllegalAccessException "symbolic reference class is not
accessible: class jdk.proxy4.$Proxy49" when using a Lookup produced by
MethodHandles.lookup, but it works correctly when using publicLookup:
https://github.com/jruby/jruby/issues/8987#issuecomment-3245803956
My expectation would be that if publicLookup works, then lookup should also
work. I've filed a similar issue in the past (unresolved) where I was
forced to use publicLookup instead of lookup:
https://bugs.openjdk.org/browse/JDK-8313913
The error is similar here, but I'm not sure if it's related (module system
should have been fully booted by the time of the JRuby failure).
If my expectation is correct, this is a new version of the bug and I can
file an issue. It's happening at least as late as JDK 24.0.2.
If my expectation is not correct, please explain to me how I can know
whether lookup will produce errors when publicLookup does not.
*Charles Oliver Nutter*
*Architect and Technologist*
Headius Enterprises
https://www.headius.com
headius at headius.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250902/e93ede55/attachment.htm>
More information about the core-libs-dev
mailing list