On Thu, 24 Mar 2022 17:48:23 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

>> make/test/BuildMicrobenchmark.gmk line 97:
>> 
>>> 95:     SRC := $(MICROBENCHMARK_SRC), \
>>> 96:     BIN := $(MICROBENCHMARK_CLASSES), \
>>> 97:     JAVAC_FLAGS := --add-exports 
>>> java.base/sun.security.util=ALL-UNNAMED --enable-preview, \
>> 
>> It still seems like this would lead to potential issues. i.e. requiring all 
>> benchmarks to be run with `--enable-preview`? We ended up adding 
>> `--enable-preview` to our benchmarks, but do other benchmarks still work 
>> without it? AFAIK the entire benchmarks.jar will have the altered class file 
>> version.
>
> Sure, this is problematic - but at the same time I don't think there's a 
> better way to deal with this? I'd prefer to defer this to a separate issue 
> (and I think the build team is in a much better position to suggest a better 
> fix). IIRC we had this problem in the past as well.

I'd suggest at least adding `--enable-preview` as an argument when running 
benchmarks through the build system in that case. I think this should do the 
trick:


diff --git a/make/RunTests.gmk b/make/RunTests.gmk
index 81540266ec0..9ed45fb02a8 100644
--- a/make/RunTests.gmk
+++ b/make/RunTests.gmk
@@ -583,7 +583,7 @@ define SetupRunMicroTestBody
   $$(eval $$(call SetMicroValue,$1,MICRO_JAVA_OPTIONS))

   # Current tests needs to open java.io
-  $1_MICRO_JAVA_OPTIONS += --add-opens=java.base/java.io=ALL-UNNAMED
+  $1_MICRO_JAVA_OPTIONS += --add-opens=java.base/java.io=ALL-UNNAMED 
--enable-preview

   # Save output as JSON or CSV file
   ifneq ($$(MICRO_RESULTS_FORMAT), )


People manually running the benchmarks.jar will have to pass `--enable-preview` 
still though.

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

PR: https://git.openjdk.java.net/jdk/pull/7888

Reply via email to