RFR 8235513: Change JVM to check for preview features using JVM_CLASSFILE_MAJOR_VERSION

David Holmes david.holmes at oracle.com
Sat Dec 7 06:21:12 UTC 2019


Hi Harold,

On 7/12/2019 7:12 am, Harold Seigel wrote:
> Hi,
> 
> Please review this small change to use JVM_CLASSFILE_MAJOR_VERSION 
> instead of 58 when checking that a class file using a preview feature 
> has the right major class file version.
> 
> Open Webrev: 
> http://cr.openjdk.java.net/~hseigel/bug_8235513/webrev/index.html

This looks good. I, for one, had not realized that preview features had 
to be "re-bound" to the current classfile version as long as they remain 
a preview feature - hence we always have to validate against the 
"current version".

There was some concern that this code:

3707         } else if (_major_version >= JAVA_14_VERSION) {
3708           if (tag == vmSymbols::tag_record()) {
3709             // Skip over Record attribute if not supported or if 
super class is
3710             // not java.lang.Record.
3711             if (supports_records() &&

will need to change in JDK 15, but I think the call to 
supports_records() will take care of that. Essentially the above states 
that JAVA_VERSION_14 is the first version that supported records as a 
preview feature, but supports_records() will ensure we're actually using 
a classfile of the "current version" when this code runs in 15.

Thanks,
David

> JBS Bug: http://cr.openjdk.java.net/~hseigel/bug_8235513/webrev/index.html
> 
> The fix was regression tested by running Mach5 tiers 1 and 2 tests and 
> builds on Linux-x64, Solaris, Windows, and Mac OS X and JCK lang and VM 
> tests on Linux-x64. Additional testing of Mach5 tiers 3-5 tests on 
> Linux-x64 is in progress.
> 
> Thanks, Harold
> 


More information about the hotspot-runtime-dev mailing list