RFR: 8268611: jar --validate should check targeted classes in MR-JAR files [v3]
Christian Stein
cstein at openjdk.org
Mon Dec 16 12:34:52 UTC 2024
> Please review this change ensuring all targeted classes in a MR-JAR file should target the same or a lower classfile version. The [JAR File Specification](https://docs.oracle.com/javase/9/docs/specs/jar/jar.html#Multi-release) of JavaSE 9 reads:
>
>> A class file under a versioned directory, of version N say, in a multi-release JAR must have a class file version less than or equal to the class file version associated with Nth major version of a Java platform release.
>
> For example, having compiled source files with `javac` 25 without using the `--release` option (or with `--release 25`) and trying to archive them via a `jar --create --file a.jar --release 9 ... --release 10 ...` command now fails with:
>
> classfile release value of META-INF/versions/9/version/Version.class too high: 25
> classfile release value of META-INF/versions/10/version/Version.class too high: 25
> invalid multi-release jar file a.jar deleted
>
>
> This pull request contains fixes to existing tests which produced invalid MR-JAR files. Most of those fixes are achieved by adding an appropriate `--release N` option to the associated `javac` call. One of those fixes rewrites the classfile version bytes between the `javac` and `jar` calls.
Christian Stein has updated the pull request incrementally with one additional commit since the last revision:
Remove the informal "(Java N)" clause.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/22103/files
- new: https://git.openjdk.org/jdk/pull/22103/files/d889660c..1170fd9e
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=22103&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=22103&range=01-02
Stats: 3 lines in 2 files changed: 0 ins; 1 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/22103.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22103/head:pull/22103
PR: https://git.openjdk.org/jdk/pull/22103
More information about the compiler-dev
mailing list