RFR(S): 8075253: Multiversion JAR feature: CDS does not support MV-JARs

Calvin Cheung calvin.cheung at oracle.com
Sat Mar 19 17:24:54 UTC 2016



On 3/19/16, 12:41 AM, Alan Bateman wrote:
>
>
> On 18/03/2016 23:38, Claes Redestad wrote:
>> Hi,
>>
>> sorry for being a bit out of the loop, but according to the most 
>> recent published spec[1] I could find the manifest attribute names 
>> needs to be treated case-insensitively. Has JEP-238 made necessary 
>> specification updates to allow deviation from this rule for new 
>> attribute names?
> Good point, attributes names have always been case insensitive. I 
> don't recall anything in JEP 238 that proposes otherwise.

Currently, the jdk code only honors "Multi-Release" as the attribute 
name for multi-release jar.

I ran the following test: jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java

It created a multi-release.jar.
Running the jar file manually:
java -cp ./multi-release.jar version.Main
gives the following output:
I am running on version 9

Then, I expanded the jar file and modified the manifest entry from 
"Multi-Release" to "multi-Release" and created another jar file.
Running the new jar file shows:
I am running on version 8

The code in JarFileSystem.java seems to confirm my findings:

     private boolean isMultiReleaseJar() {
         try (InputStream is = 
newInputStream(getBytes("META-INF/MANIFEST.MF"))) {
             return (new Manifest(is)).getMainAttributes()
                     .containsKey(new Attributes.Name("Multi-Release"));
             // fixme change line above after JarFile integration to 
contain Attributes.Name.MULTI_RELEASE
         } catch (IOException x) {
             return false;
         }
     }

To be consistent, I think hotspot should wait until jdk side has a fix 
to handle case insensitive "Multi-Release" attribute name.

What do you think?

thanks,
Calvin



More information about the hotspot-runtime-dev mailing list