JDK-8322982 : CTW fails to build after 8308753
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 22,23
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • CPU: generic
  • Submitted: 2024-01-04
  • Updated: 2024-01-16
  • Resolved: 2024-01-10
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.
JDK 23
23 b05Fixed
Related Reports
Relates :  
Description
Class-File API transition to preview, ModuleInfoWriter.java can't access it anymore. we have to add '--enable-preview'.

$make -C /local/home/xxinliu/Devel/jdk/test/hotspot/jtreg/testlibrary/ctw all

cd dist; /local/home/xxinliu/Devel/jdk/build/linux-x86_64-server-fastdebug/jdk/bin/../bin/jar --create --file=wb.jar jdk/test/lib/compiler/ModuleInfoMaker.class jdk/test/lib/compiler/Compiler.class jdk/test/lib/compiler/InMemoryJavaCompil
er.class jdk/test/lib/compiler/CompilerUtils.class jdk/test/whitebox/parser/DiagnosticCommand.class jdk/test/whitebox/WhiteBox.class jdk/test/whitebox/cpuinfo/CPUInfo.class jdk/test/whitebox/gc/GC.class jdk/test/whitebox/code/NMethod.clas
s jdk/test/whitebox/code/Compiler.class jdk/test/whitebox/code/BlobType.class jdk/test/whitebox/code/CodeBlob.class
/local/home/xxinliu/Devel/jdk/build/linux-x86_64-server-fastdebug/jdk/bin/../bin/javac --add-exports java.base/jdk.internal.jimage=ALL-UNNAMED --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-exports java.base/jdk.internal.modu
le=ALL-UNNAMED --add-exports java.base/jdk.internal.reflect=ALL-UNNAMED --add-exports java.base/jdk.internal.classfile=ALL-UNNAMED --add-exports java.base/jdk.internal.classfile.attribute=ALL-UNNAMED --add-exports java.base/jdk.internal.c
lassfile.constantpool=ALL-UNNAMED --add-exports java.base/jdk.internal.access=ALL-UNNAMED -sourcepath src -d build/classes -cp dist/wb.jar @filelist
../../../../../test/lib/jdk/test/lib/util/ModuleInfoWriter.java:33: error: ClassFile is a preview API and is disabled by default.
import java.lang.classfile.ClassFile;
                          ^
  (use --enable-preview to enable preview APIs)
../../../../../test/lib/jdk/test/lib/util/ModuleInfoWriter.java:35: error: ModuleAttribute is a preview API and is disabled by default.
import java.lang.classfile.attribute.ModuleAttribute;


Comments
Changeset: d89602a5 Author: Xin Liu <xliu@openjdk.org> Date: 2024-01-10 19:42:03 +0000 URL: https://git.openjdk.org/jdk/commit/d89602a53f173e4fc1e0aa10bb0ffdf7232456cb
10-01-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/17292 Date: 2024-01-08 03:19:52 +0000
08-01-2024

ILW = Build failure, CTW test library, add '--enable-preview' = HLM = P3
04-01-2024

diff --git a/test/hotspot/jtreg/testlibrary/ctw/Makefile b/test/hotspot/jtreg/testlibrary/ctw/Makefile index 5ba3bbb659a..4cf0a1c899b 100644 --- a/test/hotspot/jtreg/testlibrary/ctw/Makefile +++ b/test/hotspot/jtreg/testlibrary/ctw/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -42,11 +42,12 @@ JAVAC = $(JDK_HOME)/bin/javac JAR = $(JDK_HOME)/bin/jar SRC_FILES = $(shell find $(SRC_DIR) -name '*.java') -LIB_FILES = $(shell find $(TESTLIBRARY_DIR)/jdk/test/lib/ \ +LIB_FILES_ORIG= $(shell find $(TESTLIBRARY_DIR)/jdk/test/lib/ \ $(TESTLIBRARY_DIR)/jdk/test/lib/process \ $(TESTLIBRARY_DIR)/jdk/test/lib/util \ $(TESTLIBRARY_DIR)/jtreg \ -maxdepth 1 -name '*.java') +LIB_FILES=$(filter-out %ModuleInfoWriter.java, $(LIB_FILES_ORIG)) WB_SRC_FILES = $(shell find $(TESTLIBRARY_DIR)/jdk/test/lib/compiler $(TESTLIBRARY_DIR)/jdk/test/whitebox -name '*.java') WB_CLASS_FILES := $(subst $(TESTLIBRARY_DIR)/,,$(WB_SRC_FILES)) WB_CLASS_FILES := $(patsubst %.java,%.class,$(WB_CLASS_FILES))
04-01-2024

if we incorporate ' --enable-preview' into javac command, we also need to attach --source. we can't use --release here with because of add-exports. the problem is we have to specify source-level N here. it's painful to maintain it. I found that the problem only comes from ModuleInfoWriter.java. it's not required by CTW. it's possible to filter it out in compilation.
04-01-2024