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

Leonid Mesnik lmesnik at openjdk.org
Fri Feb 20 15:38:23 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 three additional commits since the last revision:

 - Update src/share/doc/javatest/regtest/tag-spec.html
   
   Co-authored-by: Christian Stein <sormuras at gmail.com>
 - Update src/share/classes/com/sun/javatest/regtest/exec/DriverAction.java
   
   Co-authored-by: Christian Stein <sormuras at gmail.com>
 - Update src/share/doc/javatest/regtest/tag-spec.html
   
   Co-authored-by: Christian Stein <sormuras at gmail.com>

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

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

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

  Stats: 3 lines in 2 files changed: 0 ins; 0 del; 3 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