[lworld] RFR: 8372515: [lworld] Plumb in javac flags for compiling with preview mode [v5]

David Beaumont duke at openjdk.org
Tue Dec 16 14:22:48 UTC 2025


> Plumbing for javac flags, mostly inspired by/copied from test commits made by @lahodaj .
> 
> There are several things here, mostly entangled, so it's a bit tricky to try splitting this out, but it would be possible if people wanted.
> 
> The biggest "refactoing" part of this PR is "src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java" which now has a properly controlled lifecycle and disposed its resources correctly. Prior to this, the class used a non-closeable JRT file-system reference, which leads to "persistent open file" issues such as JDK-8357249.
> 
> This *does* mean that if compilation and the runtime have the same preview mode, then a 2nd JRT file system to the same jimage file is "opened", *but* the file system itself is lightweight, non-caching and both of them will use the underlying SharedImageReader (which is where nodes are cached etc.) so it really shouldn't be an issue (I will make sure javac benchmarks are checked however).
> 
> The benefit of this is that now, the shared index (which does do some caching) is correctly tracked across all users, and will be closed when the last user closes the lightweight wrapper instance.
> 
> A lot of the smaller "spot fix" changes in this PR were just copied by me, or at least inspired directly by Jan's work, so I may have missed some semantic subtlety in the code I'm not familiar with. Please evaluate that carefully.

David Beaumont has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:

 - Merge branch 'lworld' into plumbing
 - correct assertion
 - review feedback
 - remove automatic formatting
 - comments
 - Remove note about StableValue (not possible)
 - Use byte array not stream for simplicity
 - properties fix
 - Arguments fix, tweak close method
 - with extra patches
 - ... and 1 more: https://git.openjdk.org/valhalla/compare/2839e49d...5dba9c85

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

Changes:
  - all: https://git.openjdk.org/valhalla/pull/1761/files
  - new: https://git.openjdk.org/valhalla/pull/1761/files/11e4c83e..5dba9c85

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=valhalla&pr=1761&range=04
 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=1761&range=03-04

  Stats: 270102 lines in 2548 files changed: 179878 ins; 50975 del; 39249 mod
  Patch: https://git.openjdk.org/valhalla/pull/1761.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1761/head:pull/1761

PR: https://git.openjdk.org/valhalla/pull/1761


More information about the valhalla-dev mailing list