RFR: 7904149: jtreg fails when test with @enablePreview is executed with driver mode [v2]

Leonid Mesnik lmesnik at openjdk.org
Fri Feb 20 01:49:16 UTC 2026


> The test like this
> 
> 
> 
> /*
>  * @test
>  * @enablePreview
>  * @run driver ${test.main.class}
>  */
> 
> 
> 
> public class PreviewDriverTest {
>     Integer i;
>     public static void main(String[] args) throws Exception {
>     }
> }
> 
> 
> fails in valhalla repo because class is compiled with enable-preview while executed without this option.
> 
> Test fails with:
> java.lang.UnsupportedClassVersionError: Preview features are not enabled for PreviewDriverTest (class file version 71.65535). Try running with '--enable-preview'
> 
> It doesn't use any Valhalla feature directly but has a field Integer and javac generates additional attributes because of this.
> 
> Fix is just to pass --enable-preview to driver code.
> The workaround is to don't run driver tests with enable preview.

Leonid Mesnik has updated the pull request incrementally with two additional commits since the last revision:

 - added faq
 - tag-spec updated

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

Changes:
  - all: https://git.openjdk.org/jtreg/pull/314/files
  - new: https://git.openjdk.org/jtreg/pull/314/files/b5b5cbd1..bd09de1e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jtreg&pr=314&range=01
 - incr: https://webrevs.openjdk.org/?repo=jtreg&pr=314&range=00-01

  Stats: 5 lines in 2 files changed: 3 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jtreg/pull/314.diff
  Fetch: git fetch https://git.openjdk.org/jtreg.git pull/314/head:pull/314

PR: https://git.openjdk.org/jtreg/pull/314


More information about the jtreg-dev mailing list