From c4408278d1012746c91ba4c31068538850c68d30 Mon Sep 17 00:00:00 2001 From: Adam Sotona Date: Tue, 23 May 2023 07:23:37 +0000 Subject: [PATCH] 8308093: Disable language preview features use in JDK Reviewed-by: liach, erikj, alanb, darcy --- make/Docs.gmk | 2 -- make/modules/java.base/Java.gmk | 4 +--- make/modules/jdk.jartool/Java.gmk | 2 -- src/java.base/share/classes/module-info.java | 1 - .../share/classes/com/sun/tools/javac/jvm/ClassWriter.java | 7 +------ src/jdk.jartool/share/classes/module-info.java | 3 --- test/jdk/jdk/classfile/TEST.properties | 2 -- .../bench/jdk/classfile/AbstractCorpusBenchmark.java | 1 - .../org/openjdk/bench/jdk/classfile/GenerateStackMaps.java | 1 - .../openjdk/bench/jdk/classfile/RebuildMethodBodies.java | 1 - .../bench/jdk/classfile/RepeatedModelTraversal.java | 1 - test/micro/org/openjdk/bench/jdk/classfile/Write.java | 1 - 12 files changed, 2 insertions(+), 24 deletions(-) diff --git a/make/Docs.gmk b/make/Docs.gmk index b7014b12acc..183318ec435 100644 --- a/make/Docs.gmk +++ b/make/Docs.gmk @@ -110,7 +110,6 @@ JAVA_WARNINGS_ARE_ERRORS ?= -Werror JAVADOC_OPTIONS := -use -keywords -notimestamp \ -encoding ISO-8859-1 -docencoding UTF-8 -breakiterator \ -splitIndex --system none -javafx --expand-requires transitive \ - --enable-preview -source $(JDK_SOURCE_TARGET_VERSION) \ --override-methods=summary \ --no-external-specs-page @@ -118,7 +117,6 @@ JAVADOC_OPTIONS := -use -keywords -notimestamp \ # development cycle. REFERENCE_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \ -encoding ISO-8859-1 -breakiterator -splitIndex --system none \ - --enable-preview -source $(JDK_SOURCE_TARGET_VERSION) \ -html5 -javafx --expand-requires transitive \ --no-external-specs-page diff --git a/make/modules/java.base/Java.gmk b/make/modules/java.base/Java.gmk index 11fa2cac4fa..90350557b37 100644 --- a/make/modules/java.base/Java.gmk +++ b/make/modules/java.base/Java.gmk @@ -27,9 +27,7 @@ DISABLED_WARNINGS_java += this-escape DOCLINT += -Xdoclint:all/protected \ '-Xdoclint/package:java.*,javax.*' -JAVAC_FLAGS += -XDstringConcat=inline \ - --enable-preview -DISABLED_WARNINGS_java += preview +JAVAC_FLAGS += -XDstringConcat=inline COPY += .icu .dat .spp .nrm content-types.properties \ hijrah-config-Hijrah-umalqura_islamic-umalqura.properties CLEAN += intrinsic.properties diff --git a/make/modules/jdk.jartool/Java.gmk b/make/modules/jdk.jartool/Java.gmk index 016c2bc0c9f..1cf56a317e7 100644 --- a/make/modules/jdk.jartool/Java.gmk +++ b/make/modules/jdk.jartool/Java.gmk @@ -25,5 +25,3 @@ DISABLED_WARNINGS_java += missing-explicit-ctor JAVAC_FLAGS += -XDstringConcat=inline -JAVAC_FLAGS += --enable-preview -DISABLED_WARNINGS_java += preview diff --git a/src/java.base/share/classes/module-info.java b/src/java.base/share/classes/module-info.java index 2fc04de54ac..f8992e14c91 100644 --- a/src/java.base/share/classes/module-info.java +++ b/src/java.base/share/classes/module-info.java @@ -150,7 +150,6 @@ module java.base { java.compiler, jdk.compiler, jdk.incubator.vector, // participates in preview features - jdk.jartool, // participates in preview features jdk.jshell; exports jdk.internal.access to java.desktop, diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java index 3695c3cbeeb..aed63c44bb1 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java @@ -106,8 +106,6 @@ public class ClassWriter extends ClassFile { /** Type utilities. */ private Types types; - private Symtab syms; - private Check check; /** @@ -174,7 +172,6 @@ public class ClassWriter extends ClassFile { target = Target.instance(context); source = Source.instance(context); types = Types.instance(context); - syms = Symtab.instance(context); check = Check.instance(context); fileManager = context.get(JavaFileManager.class); poolWriter = Gen.instance(context).poolWriter; @@ -1676,9 +1673,7 @@ public class ClassWriter extends ClassFile { acount += writeExtraAttributes(c); poolbuf.appendInt(JAVA_MAGIC); - if (preview.isEnabled() && preview.usesPreview(c.sourcefile) - // do not write PREVIEW_MINOR_VERSION for classes participating in preview - && !preview.participatesInPreview(syms, c, syms.java_base.unnamedPackage)) { + if (preview.isEnabled() && preview.usesPreview(c.sourcefile)) { poolbuf.appendChar(ClassFile.PREVIEW_MINOR_VERSION); } else { poolbuf.appendChar(target.minorVersion); diff --git a/src/jdk.jartool/share/classes/module-info.java b/src/jdk.jartool/share/classes/module-info.java index 880e516b702..ce7f1d0ba37 100644 --- a/src/jdk.jartool/share/classes/module-info.java +++ b/src/jdk.jartool/share/classes/module-info.java @@ -23,8 +23,6 @@ * questions. */ -import jdk.internal.javac.ParticipatesInPreview; - /** * Defines tools for manipulating Java Archive (JAR) files, * including the {@index jar jar tool} and @@ -49,7 +47,6 @@ import jdk.internal.javac.ParticipatesInPreview; * @moduleGraph * @since 9 */ -@ParticipatesInPreview module jdk.jartool { requires jdk.internal.opt; diff --git a/test/jdk/jdk/classfile/TEST.properties b/test/jdk/jdk/classfile/TEST.properties index edd759404a0..d197677b3e1 100644 --- a/test/jdk/jdk/classfile/TEST.properties +++ b/test/jdk/jdk/classfile/TEST.properties @@ -1,5 +1,4 @@ maxOutputSize = 2500000 -enablePreview = true modules = \ java.base/jdk.internal.classfile \ java.base/jdk.internal.classfile.attribute \ @@ -8,6 +7,5 @@ modules = \ java.base/jdk.internal.classfile.impl \ java.base/jdk.internal.classfile.impl.verifier \ java.base/jdk.internal.classfile.components \ - java.base/jdk.internal.classfile.util \ java.base/jdk.internal.org.objectweb.asm \ java.base/jdk.internal.org.objectweb.asm.tree \ No newline at end of file diff --git a/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java b/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java index ce6ebd593f7..3fa1de47c53 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java @@ -46,7 +46,6 @@ import org.openjdk.jmh.annotations.Warmup; @Warmup(iterations = 2) @Measurement(iterations = 4) @Fork(value = 1, jvmArgsAppend = { - "--enable-preview", "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile=ALL-UNNAMED", diff --git a/test/micro/org/openjdk/bench/jdk/classfile/GenerateStackMaps.java b/test/micro/org/openjdk/bench/jdk/classfile/GenerateStackMaps.java index dc8a8e49229..e11edf16edc 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/GenerateStackMaps.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/GenerateStackMaps.java @@ -56,7 +56,6 @@ import org.openjdk.jmh.annotations.Warmup; @BenchmarkMode(Mode.Throughput) @State(Scope.Benchmark) @Fork(value = 1, jvmArgsAppend = { - "--enable-preview", "--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.classfile.constantpool=ALL-UNNAMED", diff --git a/test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java b/test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java index b55521f69c0..c18433deffa 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java @@ -40,7 +40,6 @@ import org.openjdk.jmh.annotations.*; @BenchmarkMode(Mode.Throughput) @State(Scope.Benchmark) @Fork(value = 1, jvmArgsAppend = { - "--enable-preview", "--add-exports", "java.base/jdk.internal.classfile=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile.constantpool=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile.instruction=ALL-UNNAMED"}) diff --git a/test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java b/test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java index f69cf8fa606..601dba50806 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java @@ -39,7 +39,6 @@ import org.openjdk.jmh.annotations.*; @BenchmarkMode(Mode.Throughput) @State(Scope.Benchmark) @Fork(value = 1, jvmArgsAppend = { - "--enable-preview", "--add-exports", "java.base/jdk.internal.classfile=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile.components=ALL-UNNAMED"}) @Warmup(iterations = 3) diff --git a/test/micro/org/openjdk/bench/jdk/classfile/Write.java b/test/micro/org/openjdk/bench/jdk/classfile/Write.java index 96f4217d077..485e61e39ed 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/Write.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/Write.java @@ -66,7 +66,6 @@ import static jdk.internal.org.objectweb.asm.Opcodes.V12; @Warmup(iterations = 3) @Measurement(iterations = 5) @Fork(value = 1, jvmArgsAppend = { - "--enable-preview", "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile=ALL-UNNAMED",