<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Hi Charlie,</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
This is definitely a bug in the JDK, but I need more investigation to ensure if the issue lies in Lookup or Proxy. I guess this might relate to the fact that proxy dynamic modules are open to java.base as an implementation artifact, because the public lookup
has Object.class as its lookup class.</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Since proxy has different module configurations depending on whether it has module-private or package-private interfaces, can you share a minimal setup where you can replicate this issue? I tried replicating on:</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Proxy.newProxyInstance(ClassLoader.getSystemClassLoader(), new Class<?> []{Runnable.class}, (_, _, _) -> {return null;})</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
In jshell, and failed to replicate your failure with Lookup::accessClass.</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Regards,</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Chen Liang<br>
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> core-libs-dev <core-libs-dev-retn@openjdk.org> on behalf of Charles Oliver Nutter <headius@headius.com><br>
<b>Sent:</b> Tuesday, September 2, 2025 10:31 AM<br>
<b>To:</b> core-libs-dev@openjdk.org <core-libs-dev@openjdk.org><br>
<b>Subject:</b> MethodHandles.lookup errors where publicLookup is ok</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>I've run into various versions of this situation and I wonder if my expectations about MethodHandles.lookup vs publicLookup are flawed.</div>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div><a href="https://github.com/jruby/jruby/issues/8987#issuecomment-3245803956">https://github.com/jruby/jruby/issues/8987#issuecomment-3245803956</a></div>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div><a href="https://bugs.openjdk.org/browse/JDK-8313913">https://bugs.openjdk.org/browse/JDK-8313913</a></div>
<div><br>
</div>
<div>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).</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>If my expectation is not correct, please explain to me how I can know whether lookup will produce errors when publicLookup does not.</div>
<div><br>
</div>
<div>
<div dir="ltr" class="x_gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr"><b>Charles Oliver Nutter</b>
<div><i>Architect and Technologist</i></div>
<div>Headius Enterprises</div>
<a href="https://www.headius.com" target="_blank">https://www.headius.com</a>
<div>
<div><a href="mailto:headius@headius.com" target="_blank">headius@headius.com</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>