> Consider a simple module, like:
> 
> module test {}
> 
> 
> And compile it with JDK 22 and JDK 21 using:
> javac --release 21
> 
> The results of the compilations will differ: when compiling with JDK 21, the 
> mandated java.base dependency will get a version, possibly like 
> "21-internal". When compiling with JDK 22, the version of the java.base 
> dependency will be empty.
> 
> This is a) because `module-info.class`es in `ct.sym` do not have any module 
> version set; b) for JDK N, `--release N` is not using `ct.sym`, but rather 
> `lib/modules`, which may contain a range of version specifiers.
> 
> This patch does two changes:
> a) tweaks the `module-info.class`es in `ct.sym`, so that they contain a 
> simple version. For `--release N`, the version is `N`.
> b) tweaks the whole build so that `ct.sym` is used always for `--release`, a 
> `lib/modules` is never used. I.e. the appropriate classfiles are copied into 
> `ct.sym`. This not only allows for a general approach to module versions, but 
> simplifies the `--release` handling in javac, and should enable future 
> improvements. This is, however, a relatively big change.
> 
> The use of `lib/modules` for `--release <current>` was made to improve build 
> performance, but the build has been updated since this has been introduced, 
> so the slowdown caused by rebuilding `ct.sym` should be much lower now.
> 
> With these changes, compiling with `--release N` should record the same 
> dependency versions in `module-info` on JDK N and JDK N + 1.

Jan Lahoda has updated the pull request incrementally with four additional 
commits since the last revision:

 - Fixing tests.
 - Merge remote-tracking branch 'erikj/pull/16400' into JDK-8318913
 - Build fixes
 - Include pre-release version in the module version.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/16400/files
  - new: https://git.openjdk.org/jdk/pull/16400/files/522d58d6..f3be97d6

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=16400&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=16400&range=00-01

  Stats: 86 lines in 8 files changed: 49 ins; 9 del; 28 mod
  Patch: https://git.openjdk.org/jdk/pull/16400.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16400/head:pull/16400

PR: https://git.openjdk.org/jdk/pull/16400

Reply via email to