RFR: 8268611: jar --validate should check targeted classes in MR-JAR files
Alex Buckley
alex.buckley at oracle.com
Thu Dec 12 23:35:39 UTC 2024
Consider:
META-INF/versions/9/com/foo/Bar.class has class file version 69.0, but
class file version 53.0 or less is required to target release 9 of the
Java Platform
or, to use a term of art from the JAR File Spec:
com/foo/Bar.class in versioned directory META-INF/versions/9 has class
file version 69.0, but class file version 53.0 or less is required
Alex
On 12/12/2024 2:23 PM, Mandy Chung wrote:
> On Thu, 12 Dec 2024 16:27:23 GMT, Christian Stein <cstein at openjdk.org> wrote:
>
>>>> `release of {0} too high: {1}`
>>>
>>> I think this is better. Probably good enough.
>>>
>>> My concern stems from the fact that 'release' doesn't seem to be defined for _class files_. I see that the term 'release' exists, and maps to a versioned directory, or you can compile classes _for_ a certain release, But, it seems that 'the release of a class file' is a new concept here. (after all, `javac` doesn't produce class files _with_ a certain release).
>>>
>>> Maybe: `class file {fp.entryName()} compiled for release {fp.classReleaseVersion()}, is illegal in version directory {fp.mrversion()}`
>>>
>>> (This is perhaps somewhat terse, but `javac` sets the precedent for that. A user could find out _why_ the version is illegal by referencing the jar file spec).
>>
>> Let's try it out with the two examples from the initial description:
>>
>>
>> release version of META-INF/versions/9/version/Version.class too high: 25
>> release version of META-INF/versions/10/version/Version.class too high: 25
>>
>>
>>
>> class file META-INF/versions/9/version/Version.class compiled for release 25, is illegal in version directory 9
>> class file META-INF/versions/10/version/Version.class compiled for release 25, is illegal in version directory 10
>
> What about:
>
>
> META-INF/versions/9/version/Version.class of class file major version 69 is unsupported in versioned release 9; only supported in release >= 25
> META-INF/versions/10/version/Version.class of class file major version 69 is unsupported in versioned release 10; only supported in release >= 25
>
> -------------
>
> PR Review Comment: https://git.openjdk.org/jdk/pull/22103#discussion_r1882967313
More information about the compiler-dev
mailing list