Change for 8248135: Build microbenchmarks with --enable-preview makes other non-preview JMH benchmarks to fail

Peter Levart peter.levart at gmail.com
Tue Jul 7 07:59:33 UTC 2020


Hi,


Recently I proposed and pushed a change for [1] which adds 
--enable-preview option to javac compilation of JMH microbenchmarks in 
general to enable running a benchmark that uses preview feature 
(Records). This makes the class files produced marked with version 
60.65535. The benchmark that uses preview feature executes without 
problems because it explicitly specifies the following in its code:


@Fork(value = 1, warmups = 0, jvmArgsAppend = "--enable-preview")


Recently I wanted to run JMH benchmarks for Stream ops with:


make test TEST="micro:java.util.stream.ops"


...but all of them fail to run with the following exception:


java.lang.UnsupportedClassVersionError: Preview features are not enabled 
for 
org/openjdk/bench/java/util/stream/ops/value/generated/NoneMatchShort_seq_start_jmhTest 
(class file version 60.65535). Try running with '--enable-preview'


What shall we do? Add similar annotation to all of them? Is there a way 
to specify that all micro benchmarks should be run with --enable-preview 
option passed to java?


[1] https://bugs.openjdk.java.net/browse/JDK-8248135


Regards, Peter





More information about the build-dev mailing list