Integrated: JDK-8292060: Make ClassFileVersionTest.java version adapting

David Holmes dholmes at openjdk.org
Mon Oct 28 21:00:00 UTC 2024


On Mon, 8 Aug 2022 19:30:22 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> The goal of this update is to allow ClassFileVersionTest.java to be modified less often while still testing class files of the latest version.
> 
> Since the build policy of the JDK is to use the latest source and target, the class files in the java.base module will have the latest major version. By having the test file itself reference a preview API, its class file will have a nonzero minor version. (Simply compiling under "--enable-preview -source ${jdk.version}" is not sufficient to cause the minor version bits to be set.)
> 
> As written, the test now only need to be updated when the referenced API goes non-preview as opposed needing to be updated for every feature release.
> 
> After JDK-8289106 is fixed, setting latestMajor  can be changed to something like
> 
> ClassFileFormatVersion.latest().major()

@jddarcy  please note that hotspot changes, including tests, are subject to a  two review rule.

I'm not sure this makes that much difference versus editing the jcod file. Can we define a fake preview class to use instead?

test/hotspot/jtreg/runtime/ClassFile/ClassFileVersionTest.java line 43:

> 41:      * version of the class file for this class gets set during
> 42:      * compilation. If a particular class becomes non-preview, any
> 43:      * currently preview class can be substituted in.

This potentially will need changing on each release so doesn't really make the test more stable.

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

PR Review: https://git.openjdk.org/jdk/pull/9796#pullrequestreview-1069332053
PR Review Comment: https://git.openjdk.org/jdk/pull/9796#discussion_r943211233


More information about the hotspot-runtime-dev mailing list