On 02/09/2025 16:31, Charles Oliver Nutter wrote:
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:
publicLookup has UNCONDITIONAL access so it assumes readability (like
core reflection). The lookup object obtained with MethodsHandles.lookup
does not so there may be cases where the caller needs to use
Module.addReads to add the read edge at runtime. I can't tell if this is
what you are running it but if you could create a small test case then
it might be possible to diagnose (the linked JBS issue seems to be using
JDK 8 so pre-dates modules and the encapsulation of proxy classes).
-Alan