On Fri, 28 Aug 2026 19:22:21 GMT, Matias Saavedra Silva <[email protected]> 
wrote:

>> When performing an AOT training run using a multi-release JAR file, the 
>> following warning can be encountered:
>> `[warning][aot] class org/example/Foo cannot be archived because it was not 
>> defined from <path to mr.jar> as claimed`
>> This warning results from a specific configuration of the JAR file where the 
>> class is not in the root directory but is present in the versioned directory 
>> `META-INF/version`. To fix this, an upcall to ClassLoader.getResource() is 
>> now made in the specific case where a multi-release JAR is being used and 
>> the class cannot be found through normal means. Verified with tier 1-5 tests.
>> 
>> 
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Matias Saavedra Silva 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 13 additional 
> commits since the last revision:
> 
>  - Merge branch 'master' into version_class_jar_8380847
>  - Coleen comment
>  - Fixed minimal build failure
>  - Merge branch 'master' into version_class_jar_8380847
>  - Added assert
>  - Ioi offline comments
>  - Coleen and Alan comments
>  - Ioi offline comments
>  - Fixed build issues
>  - Cleanup
>  - ... and 3 more: https://git.openjdk.org/jdk/compare/5767542a...f2bc58da

src/hotspot/share/cds/aotClassLocation.cpp line 284:

> 282:   assert(*(cs->manifest() + cs->manifest_length()) == '\0', "should be 
> nul-terminated");
> 283: 
> 284:   if (StringUtils::strstr_nocase(cs->manifest(), "Multi-Release: true") 
> != nullptr) {

Would you mind checking the behavior when there is a space after "true"? The 
JAR file spec is that the value must be "true" and the implementation in Java 
doesn't trimming leading/trailing spaces either.

The other thing to check is `-Djdk.util.jar.enableMultiRelease=false`. This is 
specified by JarFile to disable the MR JAR feature, a migration/compatibility 
knob due to tooling and libraries that are unable to handle multi-release JARs. 
(It might be that it's time to consider dropping this knob as the eco system 
has had 9 years to deal with this).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32087#discussion_r3888825477

Reply via email to