RFR: 8356645: Javac should utilize new ZIP file system read-only access mode [v3]

David Beaumont duke at openjdk.org
Thu Jun 19 10:25:32 UTC 2025


On Thu, 19 Jun 2025 09:56:18 GMT, David Beaumont <duke at openjdk.org> wrote:

>> For new tests, I would often prefer to use on-the-fly compilation (although javac has its own frameworks to do that, like the `ToolBox` used here).
>> 
>> For existing tests, I generally prefer to restrict changes to a minimum (although opinions may differ on that).
>> 
>> But here, I wonder: why is the test failing? I didn't see anything in the patch that would seem to be an obvious cause of a breakage of a test like this. So, I think it deserves a good look to find out what's the cause of the test failing, rather than just adjusting the test to pass.
>
> When I revert to the original code, I get:
> 
> 
> java.lang.NullPointerException: Cannot invoke "java.io.InputStream.readAllBytes()" because the return value of "java.lang.Class.getResourceAsStream(String)" is null
> 	at ClassRefDupInConstantPoolTest.main(ClassRefDupInConstantPoolTest.java:40)
> 	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
> 	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
> 	at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
> 	at java.base/java.lang.Thread.run(Thread.java:1474)
> 
> JavaTest Message: Test threw exception: java.lang.NullPointerException: Cannot invoke "java.io.InputStream.readAllBytes()" because the return value of "java.lang.Class.getResourceAsStream(String)" is null
> JavaTest Message: shutting down test
> 
> 
> when running via IntelliJ, but it passes when running via make. So there's some fragility with the environment.
> 
> I probably didn't realize originally that this was conditionally failing, so just changed it on the assumption that it was failing everywhere.

I have just verified that syncing back to master causes this test to fail when run via IntelliJ, so it's been "broken" for a while (whether it is at fault, or something in the way IntelliJ runs tests is at fault, I'm not sure). I'll revert it in this PR then, since it's not related to my change (I guess I just stumbled over the break and thought it was, so fixed it). Thanks for getting me to dig deeper.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25639#discussion_r2156667328


More information about the compiler-dev mailing list