JDK-8372602 : [lworld] runtime/cds/appcds/aotCode/AOTCodeFlags.java fails with --enable-preview
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: repo-valhalla
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2025-11-26
  • Updated: 2025-12-19
  • Resolved: 2025-12-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-valhallaFixed
Related Reports
Blocks :  
Duplicate :  
Duplicate :  
Description
java.lang.RuntimeException: 'Adapters:\\s+total=[1-9][0-9]+' missing from stdout/stderr
	at jdk.test.lib.process.OutputAnalyzer.shouldMatch(OutputAnalyzer.java:407)
	at AOTCodeFlags$Tester.checkExecution(AOTCodeFlags.java:131)
	at jdk.test.lib.cds.CDSAppTester.executeAndCheck(CDSAppTester.java:222)
	at jdk.test.lib.cds.CDSAppTester.createAOTCache(CDSAppTester.java:338)
	at jdk.test.lib.cds.CDSAppTester.runAOTWorkflow(CDSAppTester.java:498)
	at jdk.test.lib.cds.CDSAppTester.run(CDSAppTester.java:448)
	at AOTCodeFlags.main(AOTCodeFlags.java:56)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:335)
	at java.base/java.lang.Thread.run(Thread.java:1474)

This gets a warning that preview features need to be enabled for the compilation task.

STDOUT:
Command line: [/Users/cphillim/hg/valhalla-matias-cds/build/macosx-aarch64/images/jdk/bin/java -cp /Users/cphillim/hg/valhalla-matias-cds/build/macosx-aarch64/test-support/jtreg_open_test_hotspot_jtreg_runtime_cds_appcds_aotCode_AOTCodeFlags_java/classes/0/runtime/cds/appcds/aotCode/AOTCodeFlags.d:/Users/cphillim/hg/valhalla-matias-cds/open/test/hotspot/jtreg/runtime/cds/appcds/aotCode:/Users/cphillim/hg/valhalla-matias-cds/build/macosx-aarch64/test-support/jtreg_open_test_hotspot_jtreg_runtime_cds_appcds_aotCode_AOTCodeFlags_java/classes/0/runtime/cds/appcds/aotCode/AOTCodeFlags.d/test/lib:/Users/cphillim/hg/valhalla-matias-cds/build/macosx-aarch64/test-support/jtreg_open_test_hotspot_jtreg_runtime_cds_appcds_aotCode_AOTCodeFlags_java/classes/0/runtime/cds/appcds/aotCode/AOTCodeFlags.d/test/setup_aot:/private/var/tmp/jib-cphillim/install/jtreg/8.1/1/bundles/jtreg-8.1+1.zip/jtreg/lib/jtreg.jar:/private/var/tmp/jib-cphillim/install/jtreg/8.1/1/bundles/jtreg-8.1+1.zip/jtreg/lib/junit-platform-console-standalone-1.13.4.jar:/private/var/tmp/jib-cphillim/install/jtreg/8.1/1/bundles/jtreg-8.1+1.zip/jtreg/lib/testng-7.3.0.jar:/private/var/tmp/jib-cphillim/install/jtreg/8.1/1/bundles/jtreg-8.1+1.zip/jtreg/lib/jcommander-1.82.jar:/private/var/tmp/jib-cphillim/install/jtreg/8.1/1/bundles/jtreg-8.1+1.zip/jtreg/lib/guice-5.1.0.jar -Dtidy=/var/tmp/jib-cphillim/install/jpg/infra/builddeps/tidy-html-macosx/5.9.20+1/tidy-html-macosx-5.9.20+1.tar.gz/tidy/bin/tidy -XX:MaxRAMPercentage=4.16667 -Dtest.boot.jdk=/var/tmp/jib-cphillim/install/jdk/25/37/bundles/macos-aarch64/jdk-25_macos-aarch64_bin.tar.gz/jdk-25.jdk/Contents/Home -Djava.io.tmpdir=/Users/cphillim/hg/valhalla-matias-cds/build/macosx-aarch64/test-support/jtreg_open_test_hotspot_jtreg_runtime_cds_appcds_aotCode_AOTCodeFlags_java/tmp --enable-preview -XX:AOTMode=record -XX:AOTConfiguration=AOTCodeFlags.aotconfig -Xlog:arguments,class+load=debug,aot=debug,cds=debug,aot+class=debug:file=AOTCodeFlags.aotconfig.log::filesize=0 -cp app.jar JavacBenchApp 10 ]
[2025-12-11T20:53:24.513830Z] Gathering output for process 88646
[ELAPSED: 1955 ms]
[logging stdout to /Users/cphillim/hg/valhalla-matias-cds/build/macosx-aarch64/test-support/jtreg_open_test_hotspot_jtreg_runtime_cds_appcds_aotCode_AOTCodeFlags_java/scratch/0/runtime.cds.appcds.aotCode.AOTCodeFlags.java-0000-TRAINING.stdout]
[logging stderr to /Users/cphillim/hg/valhalla-matias-cds/build/macosx-aarch64/test-support/jtreg_open_test_hotspot_jtreg_runtime_cds_appcds_aotCode_AOTCodeFlags_java/scratch/0/runtime.cds.appcds.aotCode.AOTCodeFlags.java-0000-TRAINING.stderr]
[STDERR]
error: class file for /modules/java.base/java/lang/Record.class uses preview features of Java SE 26.
  (use --enable-preview to allow loading of class files which contain preview features)
1 error
Exception in thread "main" java.lang.InternalError: compilation failure
	at JavacBenchApp.compile(JavacBenchApp.java:125)
	at JavacBenchApp.main(JavacBenchApp.java:233)

[2025-12-11T20:53:26.468802Z] Waiting for completion for process 88646
[2025-12-11T20:53:26.468898Z] Waiting for completion finished for process 88646
[output file: AOTCodeFlags.aotconfig 28540928 bytes]
[output file: AOTCodeFlags.aotconfig.log 2593328 bytes]
STDERR:
 stdout: [ AOTConfiguration recorded: AOTCodeFlags.aotconfig
];
 stderr: [error: class file for /modules/java.base/java/lang/Record.class uses preview features of Java SE 26.
  (use --enable-preview to allow loading of class files which contain preview features)
1 error
Exception in thread "main" java.lang.InternalError: compilation failure
	at JavacBenchApp.compile(JavacBenchApp.java:125)
	at JavacBenchApp.main(JavacBenchApp.java:233)
]
 exitValue = 1

Comments
These crash now because of a null sig_cc, so closing as a duplicate of JDK-8367408. No idea whether --enable-preview is now being passed to the subprocess as I thought was the bug.
19-12-2025

I was looking into this and the JavacBenchApp needs --enable-preview to be passed to the compile command because --enable-preview is on the command line, but not sure how to get it to work. Attempt that requires some modules like: diff --git a/test/setup_aot/JavacBenchApp.java b/test/setup_aot/JavacBenchApp.java index a32069883af..8d5ea3cf989 100644 --- a/test/setup_aot/JavacBenchApp.java +++ b/test/setup_aot/JavacBenchApp.java @@ -41,6 +41,7 @@ import javax.tools.JavaFileObject; import javax.tools.SimpleJavaFileObject; import javax.tools.ToolProvider; +import jdk.internal.misc.PreviewFeatures; /** * This program tries to compile a large number of classes that exercise a fair amount of @@ -98,8 +99,16 @@ public Map<String, byte[]> compile() { DiagnosticCollector<JavaFileObject> ds = new DiagnosticCollector<>(); Collection<SourceFile> sourceFiles = sources; + // Add in preview mode if -Dtest.java.opts + List<String> opts = new ArrayList<>(); + if (PreviewFeatures.isEnabled()) { + opts.add("--enable-preview"); + opts.add("-source"); + opts.add("26"); + } + try (FileManager fileManager = new FileManager(compiler.getStandardFileManager(ds, null, null))) { - JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, null, null, null, sourceFiles); + JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, null, opts, null, sourceFiles); if (task.call()) { return fileManager.getCompiledClasses(); } else {
11-12-2025

This still fails even with the CDS heap dump draft applied.
04-12-2025