RFR: 8268611: jar --validate should check targeted classes in MR-JAR files
Christian Stein
cstein at openjdk.org
Thu Dec 12 07:56:49 UTC 2024
Please review this change ensuring all targeted classes in a MR-JAR file should target the same or a lower classfile version.
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
- [x] Implement check
- [x] Update failing tests
-------------
Commit messages:
- Fix test to not produce an invalid MRJAR file
- Introduce dedicated error message for "too high" check
- Fix MultiReleaseJar.java
- Fix MultiVersionError.java
- Fix MissingDepsTest.java
- Fix VersionValidatorTest.java
- Fix Basic.java and Basic1.java
- Fix ApiValidatorTest.java
- Fix Basic.java
- 8268611: jar --validate should check targeted classes in MR-JAR files
Changes: https://git.openjdk.org/jdk/pull/22103/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22103&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8268611
Stats: 132 lines in 13 files changed: 41 ins; 23 del; 68 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