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

David Beaumont duke at openjdk.org
Wed Jun 18 20:22:30 UTC 2025


On Wed, 11 Jun 2025 05:50:38 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/platform/JDKPlatformProvider.java line 261:
>> 
>>> 259:                         // If for any reason this was not opened from a ZIP file,
>>> 260:                         // then the resulting file system would not be read-only.
>>> 261:                         assert fs.isReadOnly();
>> 
>> Not sure if an assert is the right thing here or if this should be an always-on runtime check (it can be provoked by having a non-ZIP symbol file, but it's not sanctioned in any way).
>
> We typically don't use `assert` in javac anymore, as it can be disabled. Either the condition is important, then we typically use `com.sun.tools.javac.util.Assert.check`, or we don't do the check. I think using `Assert` here would be appropriate.

Hmmm .... question:

The other place using FSInfo static method was the cySym verifier. And this is the cySym code. So it feels like it would be good to be consistent between both these cases. So is this a place for FSInfo as well, or not?

The advantage of FSInfo is that you can get the JAR provider (which we know is the ZIP provider too) and not have to worry about mismatches between given file and "discovered" file system type. You just only use the JAR provider and you're done.

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

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


More information about the compiler-dev mailing list