From ca46c3a5ba324ceb4f30df772cb73a673647323e Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Thu, 5 Dec 2024 08:36:18 +0000 Subject: [PATCH 01/27] 8343622: AesDkCrypto.stringToKey should not return null Reviewed-by: valeriep --- .../classes/sun/security/provider/MD4.java | 9 +--- .../javax/security/auth/kerberos/KeyImpl.java | 2 +- .../krb5/internal/crypto/dk/AesDkCrypto.java | 4 +- .../internal/crypto/dk/AesSha2DkCrypto.java | 4 +- .../internal/crypto/dk/ArcFourCrypto.java | 2 - .../sun/security/krb5/NullStringToKey.java | 54 +++++++++++++++++++ 6 files changed, 59 insertions(+), 16 deletions(-) create mode 100644 test/jdk/sun/security/krb5/NullStringToKey.java diff --git a/src/java.base/share/classes/sun/security/provider/MD4.java b/src/java.base/share/classes/sun/security/provider/MD4.java index 97b8a39c0d6..22c0bfe6ccf 100644 --- a/src/java.base/share/classes/sun/security/provider/MD4.java +++ b/src/java.base/share/classes/sun/security/provider/MD4.java @@ -72,13 +72,8 @@ public final class MD4 extends DigestBase { md4Provider.put("MessageDigest.MD4", "sun.security.provider.MD4"); } - public static MessageDigest getInstance() { - try { - return MessageDigest.getInstance("MD4", md4Provider); - } catch (NoSuchAlgorithmException e) { - // should never occur - throw new ProviderException(e); - } + public static MessageDigest getInstance() throws NoSuchAlgorithmException { + return MessageDigest.getInstance("MD4", md4Provider); } // Standard constructor, creates a new MD4 instance. diff --git a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyImpl.java b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyImpl.java index b18f7d8eae1..6e3ca59c0e8 100644 --- a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyImpl.java +++ b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyImpl.java @@ -96,7 +96,7 @@ public KeyImpl(KerberosPrincipal principal, this.keyBytes = key.getBytes(); this.keyType = key.getEType(); } catch (KrbException e) { - throw new IllegalArgumentException(e.getMessage()); + throw new IllegalArgumentException("key creation error", e); } } diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/AesDkCrypto.java b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/AesDkCrypto.java index ffe34ff33db..1f6e98e50e8 100644 --- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/AesDkCrypto.java +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/AesDkCrypto.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -108,8 +108,6 @@ public byte[] stringToKey(char[] password, String salt, byte[] s2kparams) try { saltUtf8 = salt.getBytes(UTF_8); return stringToKey(password, saltUtf8, s2kparams); - } catch (Exception e) { - return null; } finally { if (saltUtf8 != null) { Arrays.fill(saltUtf8, (byte)0); diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/AesSha2DkCrypto.java b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/AesSha2DkCrypto.java index 5b58d35f750..cb9e42b2dee 100644 --- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/AesSha2DkCrypto.java +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/AesSha2DkCrypto.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -111,8 +111,6 @@ public byte[] stringToKey(char[] password, String salt, byte[] s2kparams) try { saltUtf8 = salt.getBytes(UTF_8); return stringToKey(password, saltUtf8, s2kparams); - } catch (Exception e) { - return null; } finally { if (saltUtf8 != null) { Arrays.fill(saltUtf8, (byte)0); diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/ArcFourCrypto.java b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/ArcFourCrypto.java index 4b587431255..40044e636e2 100644 --- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/ArcFourCrypto.java +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/ArcFourCrypto.java @@ -89,8 +89,6 @@ private byte[] stringToKey(char[] secret, byte[] opaque) MessageDigest md = sun.security.provider.MD4.getInstance(); md.update(passwd); digest = md.digest(); - } catch (Exception e) { - return null; } finally { if (passwd != null) { Arrays.fill(passwd, (byte)0); diff --git a/test/jdk/sun/security/krb5/NullStringToKey.java b/test/jdk/sun/security/krb5/NullStringToKey.java new file mode 100644 index 00000000000..93ee704156c --- /dev/null +++ b/test/jdk/sun/security/krb5/NullStringToKey.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * @test + * @bug 8343622 + * @summary KerberosKey created with null key bytes + * @library /test/lib + * @run main/othervm NullStringToKey + */ + +import jdk.test.lib.Utils; + +import javax.security.auth.kerberos.KerberosKey; +import javax.security.auth.kerberos.KerberosPrincipal; +import java.security.Security; +import java.util.List; + +public class NullStringToKey { + public static void main(String[] args) throws Exception { + + Security.removeProvider("SUN"); + Security.removeProvider("SunJCE"); + + var name = new KerberosPrincipal("me@ME.COM"); + var pass = "password".toCharArray(); + for (var alg : List.of( + "aes128-cts-hmac-sha1-96", "aes256-cts-hmac-sha1-96", + "aes128-cts-hmac-sha256-128", "aes256-cts-hmac-sha384-192")) { + System.out.println(alg); + Utils.runAndCheckException(() -> new KerberosKey(name, pass, alg), + IllegalArgumentException.class); + } + } +} From 3b7571d37812472a2152f9c8cbfd2a4abdb35016 Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Thu, 5 Dec 2024 09:07:15 +0000 Subject: [PATCH 02/27] 8345398: Avoid redundant Properties.containsKey call in Cursor.getSystemCustomCursor Reviewed-by: aivanov, prr --- src/java.desktop/share/classes/java/awt/Cursor.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/java.desktop/share/classes/java/awt/Cursor.java b/src/java.desktop/share/classes/java/awt/Cursor.java index 396165e7ec8..26c4a9831c9 100644 --- a/src/java.desktop/share/classes/java/awt/Cursor.java +++ b/src/java.desktop/share/classes/java/awt/Cursor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -295,19 +295,18 @@ public static Cursor getSystemCustomCursor(final String name) loadSystemCustomCursorProperties(); String prefix = CURSOR_DOT_PREFIX + name; - String key = prefix + DOT_FILE_SUFFIX; - if (!systemCustomCursorProperties.containsKey(key)) { + String fileName = + systemCustomCursorProperties.getProperty(prefix + DOT_FILE_SUFFIX); + + if (fileName == null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Cursor.getSystemCustomCursor(" + name + ") returned null"); } return null; } - final String fileName = - systemCustomCursorProperties.getProperty(key); - - final String localized = systemCustomCursorProperties.getProperty( + String localized = systemCustomCursorProperties.getProperty( prefix + DOT_NAME_SUFFIX, name); String hotspot = systemCustomCursorProperties.getProperty(prefix + DOT_HOTSPOT_SUFFIX); From f3807d6a84101b2b0e55409e643cb323d7db8a94 Mon Sep 17 00:00:00 2001 From: Raffaello Giulietti Date: Thu, 5 Dec 2024 09:50:28 +0000 Subject: [PATCH 03/27] 8345403: Add more randomized tests to better cover FloatingDecimal parsing Reviewed-by: darcy --- .../TestRandomFloatingDecimal.java | 276 ++++++++++++++++++ 1 file changed, 276 insertions(+) create mode 100644 test/jdk/jdk/internal/math/FloatingDecimal/TestRandomFloatingDecimal.java diff --git a/test/jdk/jdk/internal/math/FloatingDecimal/TestRandomFloatingDecimal.java b/test/jdk/jdk/internal/math/FloatingDecimal/TestRandomFloatingDecimal.java new file mode 100644 index 00000000000..ff904474c2c --- /dev/null +++ b/test/jdk/jdk/internal/math/FloatingDecimal/TestRandomFloatingDecimal.java @@ -0,0 +1,276 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8345403 + * @summary FloatingDecimal parsing methods (use -Dseed=X to set seed) + * @modules java.base/jdk.internal.math + * @library /test/lib + * @build jdk.test.lib.RandomFactory + * @run junit TestRandomFloatingDecimal + * @key randomness + */ + +import jdk.internal.math.FloatingDecimal; +import jdk.test.lib.RandomFactory; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Random; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class TestRandomFloatingDecimal { + + /* + * This class relies on the correctness of + * BigInteger string parsing, both decimal and hexadecimal + * BigDecimal floatValue() and doubleValue() conversions + * and on the fact that the implementation of the BigDecimal conversions is + * independent of the implementation in FloatingDecimal. + * Hence, the expected values are those computed by BigDecimal, + * while the actual values are those returned by FloatingDecimal. + */ + private static final int COUNT = 10_000; // random samples per test + + private static final Random RANDOM = RandomFactory.getRandom(); + + static Stream testRandomDecForFloat() { + return Stream.generate(() -> randomDec(false)).limit(COUNT); + } + + static Stream testRandomDecForDouble() { + return Stream.generate(() -> randomDec(true)).limit(COUNT); + } + + static Stream testRandomHexForFloat() { + return Stream.generate(() -> randomHex(false)).limit(COUNT); + } + + static Stream testRandomHexForDouble() { + return Stream.generate(() -> randomHex(true)).limit(COUNT); + } + + @ParameterizedTest + @MethodSource + void testRandomDecForFloat(Args args) { + float expected = args.decimal().floatValue(); + float actual = FloatingDecimal.parseFloat(args.s()); + assertEquals(expected, actual); + } + + @ParameterizedTest + @MethodSource + void testRandomDecForDouble(Args args) { + double expected = args.decimal().doubleValue(); + double actual = FloatingDecimal.parseDouble(args.s()); + assertEquals(expected, actual); + } + + @ParameterizedTest + @MethodSource + void testRandomHexForFloat(Args args) { + float expected = args.decimal().floatValue(); + float actual = FloatingDecimal.parseFloat(args.s()); + assertEquals(expected, actual); + } + + @ParameterizedTest + @MethodSource + void testRandomHexForDouble(Args args) { + double expected = args.decimal().doubleValue(); + double actual = FloatingDecimal.parseDouble(args.s()); + assertEquals(expected, actual); + } + + private record Args(String s, BigDecimal decimal) {} + + private static Args randomDec(boolean forDouble) { + StringBuilder sb = new StringBuilder(); + int leadingWhites = RANDOM.nextInt(4); + appendRandomWhitespace(sb, leadingWhites); + int signLen = appendRandomSign(sb); + int leadingZeros = RANDOM.nextInt(4); + appendZeros(sb, leadingZeros); + int digits = RANDOM.nextInt(forDouble ? 24 : 12) + 1; + appendRandomDecDigits(sb, digits); + int trailingZeros = RANDOM.nextInt(4); + appendZeros(sb, trailingZeros); + BigDecimal bd = new BigDecimal(new BigInteger( + sb.substring( + leadingWhites, + leadingWhites + signLen + leadingZeros + digits + trailingZeros), + 10)); + + int p = 0; + if (RANDOM.nextInt(8) != 0) { // 87.5% chance of point presence + int pointPos = RANDOM.nextInt(leadingZeros + digits + trailingZeros + 1); + sb.insert(leadingWhites + signLen + pointPos, '.'); + p = -(leadingZeros + digits + trailingZeros - pointPos); + } + int e = 0; + if (RANDOM.nextInt(4) != 0) { // 75% chance of explicit exponent + int emax = forDouble ? 325 : 46; + e = RANDOM.nextInt(-emax, emax); + appendExponent(sb, e, true); + } + appendRandomSuffix(sb); + int trailingWhites = RANDOM.nextInt(4); + appendRandomWhitespace(sb, trailingWhites); + if (e + p >= 0) { + bd = bd .multiply(BigDecimal.TEN.pow(e + p)); + } else { + bd = bd .divide(BigDecimal.TEN.pow(-(e + p))); + } + return new Args(sb.toString(), bd); + } + + private static Args randomHex(boolean forDouble) { + StringBuilder sb = new StringBuilder(); + int leadingWhites = RANDOM.nextInt(4); + appendRandomWhitespace(sb, leadingWhites); + int signLen = appendRandomSign(sb); + appendHexPrefix(sb); + int leadingZeros = RANDOM.nextInt(4); + appendZeros(sb, leadingZeros); + int digits = RANDOM.nextInt(forDouble ? 24 : 12) + 1; + appendRandomHexDigits(sb, digits); + int trailingZeros = RANDOM.nextInt(4); + appendZeros(sb, trailingZeros); + BigDecimal bd = new BigDecimal(new BigInteger( // don't include 0x or 0X + sb.substring(leadingWhites, leadingWhites + signLen) + + sb.substring( + leadingWhites + signLen + 2, + leadingWhites + signLen + 2 + leadingZeros + digits + trailingZeros), + 0x10)); + + int p = 0; + if (RANDOM.nextInt(8) != 0) { // 87.5% chance of point presence + int pointPos = RANDOM.nextInt(leadingZeros + digits + trailingZeros + 1); + sb.insert(leadingWhites + signLen + 2 + pointPos, '.'); + p = -4 * (leadingZeros + digits + trailingZeros - pointPos); + } + int emax = forDouble ? 1075 : 150; + int e = RANDOM.nextInt(-emax, emax); + appendExponent(sb, e, false); + appendRandomSuffix(sb); + int trailingWhites = RANDOM.nextInt(4); + appendRandomWhitespace(sb, trailingWhites); + if (e + p >= 0) { + bd = bd .multiply(BigDecimal.TWO.pow(e + p)); + } else { + bd = bd .divide(BigDecimal.TWO.pow(-(e + p))); + } + return new Args(sb.toString(), bd); + } + + private static int appendRandomSign(StringBuilder sb) { + return switch (RANDOM.nextInt(4)) { // 50% chance of tacit sign + case 0 -> { + sb.append('-'); + yield 1; + } + case 1 -> { + sb.append('+'); + yield 1; + } + default -> 0; + }; + } + + private static void appendExponent(StringBuilder sb, int e, boolean forDec) { + if (forDec) { + sb.append(RANDOM.nextBoolean() ? 'e' : 'E'); + } else { + sb.append(RANDOM.nextBoolean() ? 'p' : 'P'); + } + if (e < 0) { + sb.append('-'); + } else if (e == 0) { + appendRandomSign(sb); + } else if (RANDOM.nextBoolean()) { + sb.append('+'); + } + appendZeros(sb, RANDOM.nextInt(2)); + sb.append(Math.abs(e)); + } + + private static void appendRandomSuffix(StringBuilder sb) { + switch (RANDOM.nextInt(8)) { // 50% chance of no suffix + case 0 -> sb.append('D'); + case 1 -> sb.append('F'); + case 2 -> sb.append('d'); + case 3 -> sb.append('f'); + } + } + + private static void appendHexPrefix(StringBuilder sb) { + /* Randomize case of x. */ + sb.append('0').append(RANDOM.nextBoolean() ? 'x' : 'X'); + } + + private static void appendZeros(StringBuilder sb, int count) { + sb.repeat('0', count); + } + + private static void appendRandomDecDigits(StringBuilder sb, int count) { + sb.append(randomDecDigit(1)); + for (; count > 1; --count) { + sb.append(randomDecDigit(0)); + } + } + + private static void appendRandomHexDigits(StringBuilder sb, int count) { + sb.append(randomHexDigit(1)); + for (; count > 1; --count) { + sb.append(randomHexDigit(0)); + } + } + + private static char randomHexDigit(int min) { + char c = Character.forDigit(RANDOM.nextInt(min, 0x10), 0x10); + /* Randomize letter case as well. */ + return RANDOM.nextBoolean() ? Character.toLowerCase(c) : Character.toUpperCase(c); + } + + private static char randomDecDigit(int min) { + int c = Character.forDigit(RANDOM.nextInt(min, 10), 10); + return (char) c; + } + + private static void appendRandomWhitespace(StringBuilder sb, int count) { + /* Randomize all whitespace chars. */ + for (; count > 0; --count) { + sb.append(randomWhitespace()); + } + } + + private static char randomWhitespace() { + return (char) (RANDOM.nextInt(0x20 + 1)); + } + +} From bcd1018585ca7a14954208ae23ba2b214db7cf0c Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Thu, 5 Dec 2024 10:15:05 +0000 Subject: [PATCH 04/27] 8344540: Remove superseded wildcard description from java manpage Reviewed-by: dholmes, jpai --- src/java.base/share/man/java.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/java.base/share/man/java.md b/src/java.base/share/man/java.md index f1f1cc27e4c..f6b7fd44917 100644 --- a/src/java.base/share/man/java.md +++ b/src/java.base/share/man/java.md @@ -279,7 +279,8 @@ contain whitespace characters. All content between the open quote and the first matching close quote are preserved by simply removing the pair of quotes. In case a matching quote is not found, the launcher will abort with an error message. `@`-files are supported as they are specified in the command line. -However, as in `@`-files, use of a wildcard is not supported. In order to +Any wildcard literal `*` in the `JDK_JAVA_OPTIONS` environment variable +content isn't expanded and is passed as-is to the starting VM. In order to mitigate potential misuse of `JDK_JAVA_OPTIONS` behavior, options that specify the main class (such as `-jar`) or cause the `java` launcher to exit without executing the main class (such as `-h`) are disallowed in the environment @@ -3073,9 +3074,9 @@ The following items describe the syntax of `java` argument files: - The argument file size must not exceed MAXINT (2,147,483,647) bytes. - The launcher doesn't expand wildcards that are present within an argument - file. That means, an asterisk `*` is passed on as-is to the starting VM. - For example `*.java` stays `*.java` and is not expanded to `Foo.java`, - `Bar.java`, etc. like on some command line shell. + file. That means an asterisk (`*`) is passed on as-is to the starting VM. + For example `*.java` stays `*.java` and is not expanded to + `Foo.java Bar.java ...`, as would happen with some command line shells. - Use white space or new line characters to separate arguments included in the file. @@ -3118,8 +3119,6 @@ The following items describe the syntax of `java` argument files: - An open quote stops at end-of-line unless `\` is the last character, which then joins the next line by removing all leading white space characters. -- Wildcards (\*) aren't allowed in these lists (such as specifying `*.java`). - - Use of the at sign (`@`) to recursively interpret files isn't supported. ### Example of Open or Partial Quotes in an Argument File From 01307a7bafc27a3d0bb8e2a5b75851d58f041f88 Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Thu, 5 Dec 2024 11:19:38 +0000 Subject: [PATCH 05/27] 8341551: Revisit jdk.internal.loader.URLClassPath.JarLoader after JEP 486 Reviewed-by: dfuchs, lancea, rriggs, alanb --- .../jdk/internal/loader/URLClassPath.java | 16 +- .../loader/URLClassPath/JarCheckTest.java | 141 ++++++++++++++++++ 2 files changed, 150 insertions(+), 7 deletions(-) create mode 100644 test/jdk/jdk/internal/loader/URLClassPath/JarCheckTest.java diff --git a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java index 06e3442c244..3504ce7e8b3 100644 --- a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java +++ b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java @@ -75,7 +75,7 @@ public class URLClassPath { private static final String USER_AGENT_JAVA_VERSION = "UA-Java-Version"; private static final String JAVA_VERSION; private static final boolean DEBUG; - private static final boolean DISABLE_JAR_CHECKING; + private static final boolean JAR_CHECKING_ENABLED; private static final boolean DISABLE_CP_URL_CHECK; private static final boolean DEBUG_CP_URL_CHECK; @@ -84,7 +84,9 @@ public class URLClassPath { JAVA_VERSION = props.getProperty("java.version"); DEBUG = (props.getProperty("sun.misc.URLClassPath.debug") != null); String p = props.getProperty("sun.misc.URLClassPath.disableJarChecking"); - DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.isEmpty() : false; + // JAR check is disabled by default and will be enabled only if the "disable JAR check" + // system property has been set to "false". + JAR_CHECKING_ENABLED = "false".equals(p); // This property will be removed in a later release p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck"); @@ -652,11 +654,12 @@ private void ensureOpen() throws IOException { } } - /* Throws if the given jar file is does not start with the correct LOC */ - @SuppressWarnings("removal") + /* + * Throws an IOException if the LOC file Header Signature (0x04034b50), + * is not found starting at byte 0 of the given jar. + */ static JarFile checkJar(JarFile jar) throws IOException { - if (System.getSecurityManager() != null && !DISABLE_JAR_CHECKING - && !zipAccess.startsWithLocHeader(jar)) { + if (JAR_CHECKING_ENABLED && !zipAccess.startsWithLocHeader(jar)) { IOException x = new IOException("Invalid Jar file"); try { jar.close(); @@ -665,7 +668,6 @@ static JarFile checkJar(JarFile jar) throws IOException { } throw x; } - return jar; } diff --git a/test/jdk/jdk/internal/loader/URLClassPath/JarCheckTest.java b/test/jdk/jdk/internal/loader/URLClassPath/JarCheckTest.java new file mode 100644 index 00000000000..0426f60610d --- /dev/null +++ b/test/jdk/jdk/internal/loader/URLClassPath/JarCheckTest.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.io.OutputStream; +import java.net.URI; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.OpenOption; +import java.nio.file.Path; +import java.nio.file.StandardOpenOption; +import java.util.Arrays; +import java.util.jar.JarEntry; +import java.util.jar.JarOutputStream; +import java.util.jar.Manifest; + +import jdk.internal.loader.URLClassPath; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import static java.nio.charset.StandardCharsets.US_ASCII; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +/* + * @test + * @bug 8341551 + * @summary verify the behaviour of URLClassPath in the presence/absence of + * sun.misc.URLClassPath.disableJarChecking system property + * + * @modules java.base/jdk.internal.loader + * + * @comment the following run is expected to run with jar checking enabled + * @run junit/othervm -Dsun.misc.URLClassPath.disableJarChecking=false JarCheckTest + * + * @comment the following runs are expected to run with jar checking disabled + * @run junit JarCheckTest + * @run junit/othervm -Dsun.misc.URLClassPath.disableJarChecking= JarCheckTest + * @run junit/othervm -Dsun.misc.URLClassPath.disableJarChecking JarCheckTest + * @run junit/othervm -Dsun.misc.URLClassPath.disableJarChecking=true JarCheckTest + * @run junit/othervm -Dsun.misc.URLClassPath.disableJarChecking=FALSE JarCheckTest + * @run junit/othervm -Dsun.misc.URLClassPath.disableJarChecking=foo JarCheckTest + */ +public class JarCheckTest { + + private static final Path SCRATCH_DIR = Path.of(".").normalize(); + private static final String SYS_PROP = "sun.misc.URLClassPath.disableJarChecking"; + private static final String RESOURCE_IN_NORMAL_JAR = "foo.txt"; + private static final String RESOURCE_IN_NOT_JUST_A_JAR = "bar.txt"; + + + private static final boolean jarCheckEnabled = "false".equals(System.getProperty(SYS_PROP)); + private static Path normalJar; + private static Path notJustAJar; // JAR file with additional prefixed bytes + + @BeforeAll + static void beforeAll() throws Exception { + final Path tmpDir = Files.createTempDirectory(SCRATCH_DIR, "8341551"); + // create a normal JAR file + normalJar = tmpDir.resolve("normal.jar"); + createJar(normalJar, RESOURCE_IN_NORMAL_JAR, false); + + // now create another JAR file and have its content prefixed with arbitrary bytes + notJustAJar = tmpDir.resolve("notjustajar.jar"); + createJar(notJustAJar, RESOURCE_IN_NOT_JUST_A_JAR, true); + } + + private static void createJar(final Path targetJarFile, final String entryName, + final boolean prefixArbitraryBytes) + throws IOException { + + Files.createFile(targetJarFile); + if (prefixArbitraryBytes) { + final byte[] arbitraryBytes = new byte[]{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}; + Files.write(targetJarFile, arbitraryBytes); + } + final Manifest manifest = new Manifest(); + manifest.getMainAttributes().putValue("Manifest-Version", "1.0"); + final OpenOption openOption = prefixArbitraryBytes + ? StandardOpenOption.APPEND + : StandardOpenOption.WRITE; + try (OutputStream fos = Files.newOutputStream(targetJarFile, openOption); + JarOutputStream jos = new JarOutputStream(fos, manifest)) { + + final JarEntry jarEntry = new JarEntry(entryName); + jos.putNextEntry(jarEntry); + jos.write("hello".getBytes(US_ASCII)); + jos.closeEntry(); + } + } + + /* + * Verifies that the URLClassPath always locates a resource from a normal JAR file + * in the classpath and only conditionally locates a resource from a byte prefixed + * JAR file in the classpath. + */ + @Test + public void testLocateResource() throws Exception { + System.out.println("JAR check enabled=" + jarCheckEnabled); + final URL[] classpath = new URL[]{ + new URI("jar:" + normalJar.toUri() + "!/").toURL(), + new URI("jar:" + notJustAJar.toUri() + "!/").toURL() + }; + final URLClassPath urlc = new URLClassPath(classpath); + try { + System.out.println(urlc + " will use classpath: " + Arrays.toString(classpath)); + // always expected to be found + assertNotNull(urlc.findResource(RESOURCE_IN_NORMAL_JAR), + "missing resource " + RESOURCE_IN_NORMAL_JAR); + // will be found only if jar check is disabled + final URL resource = urlc.findResource(RESOURCE_IN_NOT_JUST_A_JAR); + if (jarCheckEnabled) { + assertNull(resource, "unexpectedly found " + RESOURCE_IN_NOT_JUST_A_JAR + + " at " + resource); + } else { + assertNotNull(resource, "missing resource " + RESOURCE_IN_NOT_JUST_A_JAR); + } + } finally { + urlc.closeLoaders(); + } + } +} From 7ee84d8f7096ccfc4666d5bff78e7e5ac6d614bd Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Thu, 5 Dec 2024 11:51:46 +0000 Subject: [PATCH 06/27] 8345566: Deproblemlist test/jdk/javax/swing/JComboBox/6559152/bug6559152.java Reviewed-by: tr --- test/jdk/javax/swing/JComboBox/6559152/bug6559152.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/jdk/javax/swing/JComboBox/6559152/bug6559152.java b/test/jdk/javax/swing/JComboBox/6559152/bug6559152.java index 5540bb30614..c0747f8b1e4 100644 --- a/test/jdk/javax/swing/JComboBox/6559152/bug6559152.java +++ b/test/jdk/javax/swing/JComboBox/6559152/bug6559152.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -48,8 +48,8 @@ public class bug6559152 { private static JFrame frame; private static JComboBox cb; private static Robot robot; - private static Point p = null; - private static Dimension d; + private static volatile Point p = null; + private static volatile Dimension d; public static void main(String[] args) throws Exception { robot = new Robot(); @@ -84,7 +84,7 @@ static void blockTillDisplayed(JComponent comp) throws Exception { } private static void setupUI() { - frame = new JFrame(); + frame = new JFrame("bug6559152"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); DefaultTableModel model = new DefaultTableModel(1, 1); From b42d79eb6a6d497dc63718c2854609bebca4498c Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Thu, 5 Dec 2024 12:03:53 +0000 Subject: [PATCH 07/27] 8345146: [PPC64] Make intrinsic conversions between bit representations of half precision values and floats Reviewed-by: rrich, lucy --- src/hotspot/cpu/ppc/assembler_ppc.hpp | 21 ++++++++++ src/hotspot/cpu/ppc/assembler_ppc.inline.hpp | 14 +++++++ src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp | 10 ++++- src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp | 19 +++++++++ src/hotspot/cpu/ppc/macroAssembler_ppc.hpp | 3 ++ .../cpu/ppc/macroAssembler_ppc.inline.hpp | 14 +++++++ src/hotspot/cpu/ppc/ppc.ad | 31 ++++++++++++++ src/hotspot/cpu/ppc/stubGenerator_ppc.cpp | 24 +++++++++++ .../ppc/templateInterpreterGenerator_ppc.cpp | 40 ++++++++++++++++++- src/hotspot/cpu/ppc/vm_version_ppc.hpp | 2 + .../float16/Binary16Conversion.java | 1 + .../float16/Binary16ConversionNaN.java | 1 + .../float16/TestAllFloat16ToFloat.java | 1 + .../float16/TestConstFloat16ToFloat.java | 1 + .../TestFloat16VectorConvChain.java | 1 + 15 files changed, 180 insertions(+), 3 deletions(-) diff --git a/src/hotspot/cpu/ppc/assembler_ppc.hpp b/src/hotspot/cpu/ppc/assembler_ppc.hpp index d2584cc1af3..b99235371aa 100644 --- a/src/hotspot/cpu/ppc/assembler_ppc.hpp +++ b/src/hotspot/cpu/ppc/assembler_ppc.hpp @@ -506,6 +506,9 @@ class Assembler : public AbstractAssembler { LFSU_OPCODE = (49u << OPCODE_SHIFT | 00u << 1), LFSX_OPCODE = (31u << OPCODE_SHIFT | 535u << 1), + LFIWAX_OPCODE = (31u << OPCODE_SHIFT | 855u << 1), + LFIWZX_OPCODE = (31u << OPCODE_SHIFT | 887u << 1), + STFD_OPCODE = (54u << OPCODE_SHIFT | 00u << 1), STFDU_OPCODE = (55u << OPCODE_SHIFT | 00u << 1), STFDX_OPCODE = (31u << OPCODE_SHIFT | 727u << 1), @@ -513,6 +516,8 @@ class Assembler : public AbstractAssembler { STFSU_OPCODE = (53u << OPCODE_SHIFT | 00u << 1), STFSX_OPCODE = (31u << OPCODE_SHIFT | 663u << 1), + STFIWX_OPCODE = (31u << OPCODE_SHIFT | 983u << 1), + FSQRT_OPCODE = (63u << OPCODE_SHIFT | 22u << 1), // A-FORM FSQRTS_OPCODE = (59u << OPCODE_SHIFT | 22u << 1), // A-FORM @@ -555,6 +560,10 @@ class Assembler : public AbstractAssembler { XVDIVSP_OPCODE = (60u << OPCODE_SHIFT | 88u << 3), XXBRD_OPCODE = (60u << OPCODE_SHIFT | 475u << 2 | 23u << 16), // XX2-FORM XXBRW_OPCODE = (60u << OPCODE_SHIFT | 475u << 2 | 15u << 16), // XX2-FORM + XVCVHPSP_OPCODE= (60u << OPCODE_SHIFT | 475u << 2 | 24u << 16), // XX2-FORM + XVCVSPHP_OPCODE= (60u << OPCODE_SHIFT | 475u << 2 | 25u << 16), // XX2-FORM + XSCVHPDP_OPCODE= (60u << OPCODE_SHIFT | 347u << 2 | 16u << 16), // XX2-FORM + XSCVDPHP_OPCODE= (60u << OPCODE_SHIFT | 347u << 2 | 17u << 16), // XX2-FORM XXPERM_OPCODE = (60u << OPCODE_SHIFT | 26u << 3), XXSEL_OPCODE = (60u << OPCODE_SHIFT | 3u << 4), XXSPLTIB_OPCODE= (60u << OPCODE_SHIFT | 360u << 1), @@ -2076,6 +2085,9 @@ class Assembler : public AbstractAssembler { inline void lfdu( FloatRegister d, int si16, Register a); inline void lfdx( FloatRegister d, Register a, Register b); + inline void lfiwax(FloatRegister d, Register a, Register b); + inline void lfiwzx(FloatRegister d, Register a, Register b); + // PPC 1, section 4.6.3 Floating-Point Store Instructions inline void stfs( FloatRegister s, int si16, Register a); inline void stfsu( FloatRegister s, int si16, Register a); @@ -2084,6 +2096,8 @@ class Assembler : public AbstractAssembler { inline void stfdu( FloatRegister s, int si16, Register a); inline void stfdx( FloatRegister s, Register a, Register b); + inline void stfiwx(FloatRegister s, Register a, Register b); + // PPC 1, section 4.6.4 Floating-Point Move Instructions inline void fmr( FloatRegister d, FloatRegister b); inline void fmr_( FloatRegister d, FloatRegister b); @@ -2348,6 +2362,10 @@ class Assembler : public AbstractAssembler { inline void xxleqv( VectorSRegister d, VectorSRegister a, VectorSRegister b); inline void xxbrd( VectorSRegister d, VectorSRegister b); inline void xxbrw( VectorSRegister d, VectorSRegister b); + inline void xvcvhpsp( VectorSRegister d, VectorSRegister b); + inline void xvcvsphp( VectorSRegister d, VectorSRegister b); + inline void xscvhpdp( VectorSRegister d, VectorSRegister b); + inline void xscvdphp( VectorSRegister d, VectorSRegister b); inline void xxland( VectorSRegister d, VectorSRegister a, VectorSRegister b); inline void xxsel( VectorSRegister d, VectorSRegister a, VectorSRegister b, VectorSRegister c); inline void xxspltib( VectorSRegister d, int ui8); @@ -2474,10 +2492,13 @@ class Assembler : public AbstractAssembler { inline void lfsx( FloatRegister d, Register b); inline void lfd( FloatRegister d, int si16); inline void lfdx( FloatRegister d, Register b); + inline void lfiwax(FloatRegister d, Register b); + inline void lfiwzx(FloatRegister d, Register b); inline void stfs( FloatRegister s, int si16); inline void stfsx( FloatRegister s, Register b); inline void stfd( FloatRegister s, int si16); inline void stfdx( FloatRegister s, Register b); + inline void stfiwx(FloatRegister s, Register b); inline void lvebx( VectorRegister d, Register s2); inline void lvehx( VectorRegister d, Register s2); inline void lvewx( VectorRegister d, Register s2); diff --git a/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp b/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp index 07de57babfa..eae75da9fbf 100644 --- a/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp +++ b/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp @@ -741,6 +741,9 @@ inline void Assembler::lfd( FloatRegister d, int si16, Register a) { emit_int3 inline void Assembler::lfdu(FloatRegister d, int si16, Register a) { emit_int32( LFDU_OPCODE | frt(d) | ra(a) | simm(si16,16)); } inline void Assembler::lfdx(FloatRegister d, Register a, Register b) { emit_int32( LFDX_OPCODE | frt(d) | ra0mem(a) | rb(b)); } +inline void Assembler::lfiwax(FloatRegister d, Register a, Register b) { emit_int32( LFIWAX_OPCODE | frt(d) | ra0mem(a) |rb(b)); } +inline void Assembler::lfiwzx(FloatRegister d, Register a, Register b) { emit_int32( LFIWZX_OPCODE | frt(d) | ra0mem(a) |rb(b)); } + // PPC 1, section 4.6.3 Floating-Point Store Instructions // Use ra0mem instead of ra in some instructions below. inline void Assembler::stfs( FloatRegister s, int si16, Register a) { emit_int32( STFS_OPCODE | frs(s) | ra0mem(a) | simm(si16,16)); } @@ -750,6 +753,8 @@ inline void Assembler::stfd( FloatRegister s, int si16, Register a) { emit_int3 inline void Assembler::stfdu(FloatRegister s, int si16, Register a) { emit_int32( STFDU_OPCODE | frs(s) | ra(a) | simm(si16,16)); } inline void Assembler::stfdx(FloatRegister s, Register a, Register b){ emit_int32( STFDX_OPCODE | frs(s) | ra0mem(a) | rb(b)); } +inline void Assembler::stfiwx(FloatRegister s, Register a, Register b) { emit_int32( STFIWX_OPCODE | frs(s) | ra0mem(a) |rb(b)); } + // PPC 1, section 4.6.4 Floating-Point Move Instructions inline void Assembler::fmr( FloatRegister d, FloatRegister b) { emit_int32( FMR_OPCODE | frt(d) | frb(b) | rc(0)); } inline void Assembler::fmr_(FloatRegister d, FloatRegister b) { emit_int32( FMR_OPCODE | frt(d) | frb(b) | rc(1)); } @@ -871,6 +876,10 @@ inline void Assembler::xxlxor( VectorSRegister d, VectorSRegister a, VectorSReg inline void Assembler::xxleqv( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XXLEQV_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); } inline void Assembler::xxbrd( VectorSRegister d, VectorSRegister b) { emit_int32( XXBRD_OPCODE | vsrt(d) | vsrb(b) ); } inline void Assembler::xxbrw( VectorSRegister d, VectorSRegister b) { emit_int32( XXBRW_OPCODE | vsrt(d) | vsrb(b) ); } +inline void Assembler::xvcvhpsp(VectorSRegister d, VectorSRegister b) { emit_int32( XVCVHPSP_OPCODE | vsrt(d) | vsrb(b) ); } +inline void Assembler::xvcvsphp(VectorSRegister d, VectorSRegister b) { emit_int32( XVCVSPHP_OPCODE | vsrt(d) | vsrb(b) ); } +inline void Assembler::xscvhpdp(VectorSRegister d, VectorSRegister b) { emit_int32( XSCVHPDP_OPCODE | vsrt(d) | vsrb(b) ); } +inline void Assembler::xscvdphp(VectorSRegister d, VectorSRegister b) { emit_int32( XSCVDPHP_OPCODE | vsrt(d) | vsrb(b) ); } inline void Assembler::xvdivsp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVDIVSP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); } inline void Assembler::xvdivdp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVDIVDP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); } inline void Assembler::xvabssp( VectorSRegister d, VectorSRegister b) { emit_int32( XVABSSP_OPCODE | vsrt(d) | vsrb(b)); } @@ -1150,12 +1159,17 @@ inline void Assembler::lfsx(FloatRegister d, Register b) { emit_int32( LFSX_OPCO inline void Assembler::lfd( FloatRegister d, int si16) { emit_int32( LFD_OPCODE | frt(d) | simm(si16,16)); } inline void Assembler::lfdx(FloatRegister d, Register b) { emit_int32( LFDX_OPCODE | frt(d) | rb(b)); } +inline void Assembler::lfiwax(FloatRegister d, Register b) { emit_int32( LFIWAX_OPCODE | frt(d) | rb(b)); } +inline void Assembler::lfiwzx(FloatRegister d, Register b) { emit_int32( LFIWZX_OPCODE | frt(d) | rb(b)); } + // ra0 version inline void Assembler::stfs( FloatRegister s, int si16) { emit_int32( STFS_OPCODE | frs(s) | simm(si16, 16)); } inline void Assembler::stfsx(FloatRegister s, Register b) { emit_int32( STFSX_OPCODE | frs(s) | rb(b)); } inline void Assembler::stfd( FloatRegister s, int si16) { emit_int32( STFD_OPCODE | frs(s) | simm(si16, 16)); } inline void Assembler::stfdx(FloatRegister s, Register b) { emit_int32( STFDX_OPCODE | frs(s) | rb(b)); } +inline void Assembler::stfiwx(FloatRegister s, Register b) { emit_int32( STFIWX_OPCODE | frs(s) |rb(b)); } + // ra0 version inline void Assembler::lvebx( VectorRegister d, Register s2) { emit_int32( LVEBX_OPCODE | vrt(d) | rb(s2)); } inline void Assembler::lvehx( VectorRegister d, Register s2) { emit_int32( LVEHX_OPCODE | vrt(d) | rb(s2)); } diff --git a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp index b8a271ffc3b..af426935b2f 100644 --- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp @@ -1713,7 +1713,7 @@ void LIR_Assembler::arith_op(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr } -void LIR_Assembler::intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr thread, LIR_Opr dest, LIR_Op* op) { +void LIR_Assembler::intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr tmp, LIR_Opr dest, LIR_Op* op) { switch (code) { case lir_sqrt: { __ fsqrt(dest->as_double_reg(), value->as_double_reg()); @@ -1723,6 +1723,14 @@ void LIR_Assembler::intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr thread, L __ fabs(dest->as_double_reg(), value->as_double_reg()); break; } + case lir_f2hf: { + __ f2hf(dest.as_register(), value.as_float_reg(), tmp.as_float_reg()); + break; + } + case lir_hf2f: { + __ hf2f(dest->as_float_reg(), value.as_register()); + break; + } default: { ShouldNotReachHere(); break; diff --git a/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp index 7973e9d0545..4e0908d6e61 100644 --- a/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp @@ -690,6 +690,25 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { __ abs(value.result(), dst, LIR_OprFact::illegalOpr); break; } + case vmIntrinsics::_floatToFloat16: { + assert(x->number_of_arguments() == 1, "wrong type"); + LIRItem value(x->argument_at(0), this); + value.load_item(); + LIR_Opr dst = rlock_result(x); + LIR_Opr tmp = new_register(T_FLOAT); + // f2hf treats tmp as live_in. Workaround: initialize to some value. + __ move(LIR_OprFact::floatConst(-0.0), tmp); // just to satisfy LinearScan + __ f2hf(value.result(), dst, tmp); + break; + } + case vmIntrinsics::_float16ToFloat: { + assert(x->number_of_arguments() == 1, "wrong type"); + LIRItem value(x->argument_at(0), this); + value.load_item(); + LIR_Opr dst = rlock_result(x); + __ hf2f(value.result(), dst, LIR_OprFact::illegalOpr); + break; + } case vmIntrinsics::_dsqrt: case vmIntrinsics::_dsqrt_strict: { if (VM_Version::has_fsqrt()) { diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp index 237024fa05e..3e82c1c6785 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp @@ -186,6 +186,9 @@ class MacroAssembler: public Assembler { void inline set_cmpu3(Register dst, bool treat_unordered_like_less); // Branch-free implementation to convert !=0 to 1. void inline normalize_bool(Register dst, Register temp = R0, bool is_64bit = false); + // Convert between half precision float encoded into a short and a float in a FloatRegister. + void inline f2hf(Register dst, FloatRegister src, FloatRegister tmp); + void inline hf2f(FloatRegister dst, Register src); inline void pd_patch_instruction(address branch, address target, const char* file, int line); NOT_PRODUCT(static void pd_print_patched_instruction(address branch);) diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp index f98ad592388..6f5cd8fbd96 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp @@ -297,6 +297,20 @@ inline void MacroAssembler::normalize_bool(Register dst, Register temp, bool is_ } } +inline void MacroAssembler::f2hf(Register dst, FloatRegister src, FloatRegister tmp) { + // Single precision values in FloatRegisters use double precision format on PPC64. + xscvdphp(tmp->to_vsr(), src->to_vsr()); + mffprd(dst, tmp); + // Make it a proper short (sign-extended). + extsh(dst, dst); +} + +inline void MacroAssembler::hf2f(FloatRegister dst, Register src) { + mtfprd(dst, src); + // Single precision values in FloatRegisters use double precision format on PPC64. + xscvhpdp(dst->to_vsr(), dst->to_vsr()); +} + // Convenience bc_far versions inline void MacroAssembler::blt_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs1, bi0(crx, less), L, optimize); } inline void MacroAssembler::bgt_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs1, bi0(crx, greater), L, optimize); } diff --git a/src/hotspot/cpu/ppc/ppc.ad b/src/hotspot/cpu/ppc/ppc.ad index cfed8674e89..549ae0740e2 100644 --- a/src/hotspot/cpu/ppc/ppc.ad +++ b/src/hotspot/cpu/ppc/ppc.ad @@ -2077,6 +2077,9 @@ bool Matcher::match_rule_supported(int opcode) { case Op_PopCountI: case Op_PopCountL: return (UsePopCountInstruction && VM_Version::has_popcntw()); + case Op_ConvF2HF: + case Op_ConvHF2F: + return VM_Version::supports_float16(); case Op_AddVB: case Op_AddVS: @@ -11245,6 +11248,34 @@ instruct convF2D_reg(regD dst, regF src) %{ ins_pipe(pipe_class_default); %} +instruct convF2HF_reg_reg(iRegIdst dst, regF src, regF tmp) %{ + match(Set dst (ConvF2HF src)); + effect(TEMP tmp); + ins_cost(3 * DEFAULT_COST); + size(12); + format %{ "xscvdphp $tmp, $src\t# convert to half precision\n\t" + "mffprd $dst, $tmp\t# move result from $tmp to $dst\n\t" + "extsh $dst, $dst\t# make it a proper short" + %} + ins_encode %{ + __ f2hf($dst$$Register, $src$$FloatRegister, $tmp$$FloatRegister); + %} + ins_pipe(pipe_class_default); +%} + +instruct convHF2F_reg_reg(regF dst, iRegIsrc src) %{ + match(Set dst (ConvHF2F src)); + ins_cost(2 * DEFAULT_COST); + size(8); + format %{ "mtfprd $dst, $src\t# move source from $src to $dst\n\t" + "xscvhpdp $dst, $dst\t# convert from half precision" + %} + ins_encode %{ + __ hf2f($dst$$FloatRegister, $src$$Register); + %} + ins_pipe(pipe_class_default); +%} + //----------Control Flow Instructions------------------------------------------ // Compare Instructions diff --git a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp index 9f2b668b9c8..00d2e206bf9 100644 --- a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp @@ -3451,6 +3451,24 @@ class StubGenerator: public StubCodeGenerator { return start; } + address generate_floatToFloat16() { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", "floatToFloat16"); + address start = __ function_entry(); + __ f2hf(R3_RET, F1_ARG1, F0); + __ blr(); + return start; + } + + address generate_float16ToFloat() { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", "float16ToFloat"); + address start = __ function_entry(); + __ hf2f(F1_RET, R3_ARG1); + __ blr(); + return start; + } + address generate_method_entry_barrier() { __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier"); @@ -4678,6 +4696,12 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) { StubRoutines::_crc32c_table_addr = StubRoutines::ppc::generate_crc_constants(REVERSE_CRC32C_POLY); StubRoutines::_updateBytesCRC32C = generate_CRC32_updateBytes(true); } + + if (VM_Version::supports_float16()) { + // For results consistency both intrinsics should be enabled. + StubRoutines::_hf2f = generate_float16ToFloat(); + StubRoutines::_f2hf = generate_floatToFloat16(); + } } void generate_continuation_stubs() { diff --git a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp index e320349583d..9147dfc1677 100644 --- a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp @@ -1155,6 +1155,44 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M return entry; } +address TemplateInterpreterGenerator::generate_Float_floatToFloat16_entry() { + if (!VM_Version::supports_float16()) return nullptr; + + address entry = __ pc(); + + __ lfs(F1, Interpreter::stackElementSize, R15_esp); + __ f2hf(R3_RET, F1, F0); + + // Restore caller sp for c2i case (from compiled) and for resized sender frame (from interpreted). + __ resize_frame_absolute(R21_sender_SP, R11_scratch1, R0); + __ blr(); + + __ flush(); + + return entry; +} + +address TemplateInterpreterGenerator::generate_Float_float16ToFloat_entry() { + if (!VM_Version::supports_float16()) return nullptr; + + address entry = __ pc(); + + // Note: Could also use: + //__ li(R3, Interpreter::stackElementSize); + //__ lfiwax(F1_RET, R15_esp, R3); // short stored as 32 bit integer + //__ xscvhpdp(F1_RET->to_vsr(), F1_RET->to_vsr()); + __ lwa(R3, Interpreter::stackElementSize, R15_esp); + __ hf2f(F1_RET, R3); + + // Restore caller sp for c2i case (from compiled) and for resized sender frame (from interpreted). + __ resize_frame_absolute(R21_sender_SP, R11_scratch1, R0); + __ blr(); + + __ flush(); + + return entry; +} + void TemplateInterpreterGenerator::bang_stack_shadow_pages(bool native_call) { // Quick & dirty stack overflow checking: bang the stack & handle trap. // Note that we do the banging after the frame is setup, since the exception @@ -1965,8 +2003,6 @@ address TemplateInterpreterGenerator::generate_Float_intBitsToFloat_entry() { re address TemplateInterpreterGenerator::generate_Float_floatToRawIntBits_entry() { return nullptr; } address TemplateInterpreterGenerator::generate_Double_longBitsToDouble_entry() { return nullptr; } address TemplateInterpreterGenerator::generate_Double_doubleToRawLongBits_entry() { return nullptr; } -address TemplateInterpreterGenerator::generate_Float_float16ToFloat_entry() { return nullptr; } -address TemplateInterpreterGenerator::generate_Float_floatToFloat16_entry() { return nullptr; } // ============================================================================= // Exceptions diff --git a/src/hotspot/cpu/ppc/vm_version_ppc.hpp b/src/hotspot/cpu/ppc/vm_version_ppc.hpp index 9d8e4b88ee2..25dd07c9668 100644 --- a/src/hotspot/cpu/ppc/vm_version_ppc.hpp +++ b/src/hotspot/cpu/ppc/vm_version_ppc.hpp @@ -97,6 +97,8 @@ class VM_Version: public Abstract_VM_Version { constexpr static bool supports_recursive_lightweight_locking() { return true; } constexpr static bool supports_secondary_supers_table() { return true; } + static bool supports_float16() { return PowerArchitecturePPC64 >= 9; } + static bool is_determine_features_test_running() { return _is_determine_features_test_running; } // CPU instruction support static bool has_fsqrt() { return (_features & fsqrt_m) != 0; } diff --git a/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16Conversion.java b/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16Conversion.java index cd0f0b636a7..4fb04f0be45 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16Conversion.java +++ b/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16Conversion.java @@ -27,6 +27,7 @@ * @summary Verify conversion between float and the binary16 format * @requires (vm.cpu.features ~= ".*avx512vl.*" | vm.cpu.features ~= ".*f16c.*") | os.arch=="aarch64" * | (os.arch == "riscv64" & vm.cpu.features ~= ".*zfh.*") + * | ((os.arch == "ppc64" | os.arch == "ppc64le") & vm.cpu.features ~= ".*darn.*") * @requires vm.compiler1.enabled & vm.compiler2.enabled * @requires vm.compMode != "Xcomp" * @comment default run diff --git a/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16ConversionNaN.java b/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16ConversionNaN.java index 8aa83544f9f..b80e8fecc9f 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16ConversionNaN.java +++ b/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16ConversionNaN.java @@ -27,6 +27,7 @@ * @summary Verify NaN sign and significand bits are preserved across conversions * @requires (vm.cpu.features ~= ".*avx512vl.*" | vm.cpu.features ~= ".*f16c.*") | os.arch=="aarch64" * | (os.arch == "riscv64" & vm.cpu.features ~= ".*zfh.*") + * | ((os.arch == "ppc64" | os.arch == "ppc64le") & vm.cpu.features ~= ".*darn.*") * @requires vm.compiler1.enabled & vm.compiler2.enabled * @requires vm.compMode != "Xcomp" * @library /test/lib / diff --git a/test/hotspot/jtreg/compiler/intrinsics/float16/TestAllFloat16ToFloat.java b/test/hotspot/jtreg/compiler/intrinsics/float16/TestAllFloat16ToFloat.java index acf5b3c4aea..a6a13617d80 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/float16/TestAllFloat16ToFloat.java +++ b/test/hotspot/jtreg/compiler/intrinsics/float16/TestAllFloat16ToFloat.java @@ -27,6 +27,7 @@ * @summary Verify conversion between float and the binary16 format * @requires (vm.cpu.features ~= ".*avx512vl.*" | vm.cpu.features ~= ".*f16c.*") | os.arch == "aarch64" * | (os.arch == "riscv64" & vm.cpu.features ~= ".*zfh.*") + * | ((os.arch == "ppc64" | os.arch == "ppc64le") & vm.cpu.features ~= ".*darn.*") * @requires vm.compiler1.enabled & vm.compiler2.enabled * @requires vm.compMode != "Xcomp" * @comment default run: diff --git a/test/hotspot/jtreg/compiler/intrinsics/float16/TestConstFloat16ToFloat.java b/test/hotspot/jtreg/compiler/intrinsics/float16/TestConstFloat16ToFloat.java index af89d353ab2..ce91107ed74 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/float16/TestConstFloat16ToFloat.java +++ b/test/hotspot/jtreg/compiler/intrinsics/float16/TestConstFloat16ToFloat.java @@ -27,6 +27,7 @@ * @summary Verify conversion cons between float and the binary16 format * @requires (vm.cpu.features ~= ".*avx512vl.*" | vm.cpu.features ~= ".*f16c.*") | os.arch=="aarch64" * | (os.arch == "riscv64" & vm.cpu.features ~= ".*zfh.*") + * | ((os.arch == "ppc64" | os.arch == "ppc64le") & vm.cpu.features ~= ".*darn.*") * @requires vm.compiler1.enabled & vm.compiler2.enabled * @requires vm.compMode != "Xcomp" * @comment default run: diff --git a/test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorConvChain.java b/test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorConvChain.java index a2ff267f937..20401a98938 100644 --- a/test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorConvChain.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorConvChain.java @@ -26,6 +26,7 @@ * @summary Test Float16 vector conversion chain. * @requires (vm.cpu.features ~= ".*avx512vl.*" | vm.cpu.features ~= ".*f16c.*") | os.arch == "aarch64" * | (os.arch == "riscv64" & vm.cpu.features ~= ".*zvfh.*") +* | ((os.arch == "ppc64" | os.arch == "ppc64le") & vm.cpu.features ~= ".*darn.*") * @library /test/lib / * @run driver compiler.vectorization.TestFloat16VectorConvChain */ From 92e9ac6dc7302a140772443f95cc11deb8e3ddcb Mon Sep 17 00:00:00 2001 From: Doug Lea Date: Thu, 5 Dec 2024 12:15:58 +0000 Subject: [PATCH 08/27] 8345294: test/jdk/java/lang/Thread/virtual/RetryMonitorEnterWhenPinned.java timeout with JTREG_TEST_THREAD_FACTORY=Virtual Reviewed-by: alanb --- .../java/util/concurrent/ForkJoinPool.java | 27 +++--- .../java/lang/Thread/virtual/Starvation.java | 84 +++++++++++++++++++ 2 files changed, 97 insertions(+), 14 deletions(-) create mode 100644 test/jdk/java/lang/Thread/virtual/Starvation.java diff --git a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java index d51b4ba0770..73fa3eea1bd 100644 --- a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java +++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java @@ -610,12 +610,11 @@ public class ForkJoinPool extends AbstractExecutorService { * it tries to deactivate()), giving up (and rescanning) on "ctl" * contention. To avoid missed signals during deactivation, the * method rescans and reactivates if there may have been a missed - * (external) signal during deactivation. To reduce false-alarm - * reactivations while doing so, we scan multiple times - * (analogously to method quiescent()) before trying to - * reactivate. Because idle workers are often not yet blocked - * (parked), we use a WorkQueue field to advertise that a waiter - * actually needs unparking upon signal. + * signal during deactivation. To reduce false-alarm reactivations + * while doing so, we scan multiple times (analogously to method + * quiescent()) before trying to reactivate. Because idle workers + * are often not yet blocked (parked), we use a WorkQueue field to + * advertise that a waiter actually needs unparking upon signal. * * Quiescence. Workers scan looking for work, giving up when they * don't find any, without being sure that none are available. @@ -1996,7 +1995,7 @@ private int deactivate(WorkQueue w, int phase) { return IDLE; int p = phase | IDLE, activePhase = phase + (IDLE << 1); long pc = ctl, qc = (activePhase & LMASK) | ((pc - RC_UNIT) & UMASK); - w.stackPred = (int)pc; // set ctl stack link + int sp = w.stackPred = (int)pc; // set ctl stack link w.phase = p; if (!compareAndSetCtl(pc, qc)) // try to enqueue return w.phase = phase; // back out on possible signal @@ -2006,18 +2005,18 @@ private int deactivate(WorkQueue w, int phase) { (qs = queues) == null || (n = qs.length) <= 0) return IDLE; // terminating int prechecks = Math.min(ac, 2); // reactivation threshold - for (int k = Math.max(n + (n << 1), SPIN_WAITS << 1);;) { - WorkQueue q; int cap; ForkJoinTask[] a; + for (int k = Math.max(n << 2, SPIN_WAITS << 1);;) { + WorkQueue q; int cap; ForkJoinTask[] a; long c; if (w.phase == activePhase) return activePhase; if (--k < 0) return awaitWork(w, p); // block, drop, or exit - if ((k & 1) != 0) - Thread.onSpinWait(); // interleave spins and rechecks - else if ((q = qs[k & (n - 1)]) != null && - (a = q.array) != null && (cap = a.length) > 0 && + if ((q = qs[k & (n - 1)]) == null) + Thread.onSpinWait(); + else if ((a = q.array) != null && (cap = a.length) > 0 && a[q.base & (cap - 1)] != null && --prechecks < 0 && - ctl == qc && compareAndSetCtl(qc, pc)) + (int)(c = ctl) == activePhase && + compareAndSetCtl(c, (sp & LMASK) | ((c + RC_UNIT) & UMASK))) return w.phase = activePhase; // reactivate } } diff --git a/test/jdk/java/lang/Thread/virtual/Starvation.java b/test/jdk/java/lang/Thread/virtual/Starvation.java new file mode 100644 index 00000000000..c767cffbdf5 --- /dev/null +++ b/test/jdk/java/lang/Thread/virtual/Starvation.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @library /test/lib + * @bug 8345294 + * @run main/othervm --enable-native-access=ALL-UNNAMED Starvation 100000 + */ + +import java.time.Duration; +import java.time.Instant; +import java.util.ArrayList; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicReference; +import jdk.test.lib.thread.VThreadPinner; + +public class Starvation { + public static void main(String[] args) throws Exception { + int iterations = Integer.parseInt(args[0]); + + for (int i = 0; i < iterations; i++) { + var exRef = new AtomicReference(); + Thread thread = Thread.startVirtualThread(() -> { + try { + runTest(); + } catch (Exception e) { + exRef.set(e); + } + }); + while (!thread.join(Duration.ofSeconds(1))) { + System.out.format("%s iteration %d waiting for %s%n", Instant.now(), i, thread); + } + Exception ex = exRef.get(); + if (ex != null) { + throw ex; + } + } + } + + static void runTest() throws InterruptedException { + int nprocs = Runtime.getRuntime().availableProcessors(); + + var threads = new ArrayList(); + Object lock = new Object(); + synchronized (lock) { + for (int i = 0; i < nprocs - 1; i++) { + var started = new CountDownLatch(1); + Thread thread = Thread.startVirtualThread(() -> { + started.countDown(); + VThreadPinner.runPinned(() -> { + synchronized (lock) { + } + }); + }); + started.await(); + threads.add(thread); + } + } + + for (Thread t : threads) { + t.join(); + } + } +} From 84240cc8e01663196cf883efec4c0eb4ea590c27 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Thu, 5 Dec 2024 12:37:54 +0000 Subject: [PATCH 09/27] 8344831: [REDO] CDS: Parallel relocation Reviewed-by: dholmes, stuefe --- src/hotspot/os/aix/os_aix.cpp | 6 +- src/hotspot/os/bsd/os_bsd.cpp | 6 +- src/hotspot/os/linux/os_linux.cpp | 6 +- src/hotspot/os/windows/os_windows.cpp | 6 +- src/hotspot/share/cds/archiveUtils.cpp | 160 ++++++++++++++++++ src/hotspot/share/cds/archiveUtils.hpp | 72 ++++++++ src/hotspot/share/cds/cds_globals.hpp | 5 +- src/hotspot/share/cds/filemap.cpp | 37 +++- .../hotspot/gtest/cds/test_archiveWorkers.cpp | 69 ++++++++ 9 files changed, 352 insertions(+), 15 deletions(-) create mode 100644 test/hotspot/gtest/cds/test_archiveWorkers.cpp diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 44b9571e102..26627c2f8fb 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -856,9 +856,9 @@ void os::pd_start_thread(Thread* thread) { void os::free_thread(OSThread* osthread) { assert(osthread != nullptr, "osthread not set"); - // We are told to free resources of the argument thread, - // but we can only really operate on the current thread. - assert(Thread::current()->osthread() == osthread, + // We are told to free resources of the argument thread, but we can only really operate + // on the current thread. The current thread may be already detached at this point. + assert(Thread::current_or_null() == nullptr || Thread::current()->osthread() == osthread, "os::free_thread but not current thread"); // Restore caller's signal mask diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 8185797563c..5db846275d4 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -763,9 +763,9 @@ void os::pd_start_thread(Thread* thread) { void os::free_thread(OSThread* osthread) { assert(osthread != nullptr, "osthread not set"); - // We are told to free resources of the argument thread, - // but we can only really operate on the current thread. - assert(Thread::current()->osthread() == osthread, + // We are told to free resources of the argument thread, but we can only really operate + // on the current thread. The current thread may be already detached at this point. + assert(Thread::current_or_null() == nullptr || Thread::current()->osthread() == osthread, "os::free_thread but not current thread"); // Restore caller's signal mask diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index d85120f3f1d..d159118016a 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -1190,9 +1190,9 @@ void os::pd_start_thread(Thread* thread) { void os::free_thread(OSThread* osthread) { assert(osthread != nullptr, "osthread not set"); - // We are told to free resources of the argument thread, - // but we can only really operate on the current thread. - assert(Thread::current()->osthread() == osthread, + // We are told to free resources of the argument thread, but we can only really operate + // on the current thread. The current thread may be already detached at this point. + assert(Thread::current_or_null() == nullptr || Thread::current()->osthread() == osthread, "os::free_thread but not current thread"); #ifdef ASSERT diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 849fc0c29f0..afd8fe01752 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -788,9 +788,9 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, void os::free_thread(OSThread* osthread) { assert(osthread != nullptr, "osthread not set"); - // We are told to free resources of the argument thread, - // but we can only really operate on the current thread. - assert(Thread::current()->osthread() == osthread, + // We are told to free resources of the argument thread, but we can only really operate + // on the current thread. The current thread may be already detached at this point. + assert(Thread::current_or_null() == nullptr || Thread::current()->osthread() == osthread, "os::free_thread but not current thread"); CloseHandle(osthread->thread_handle()); diff --git a/src/hotspot/share/cds/archiveUtils.cpp b/src/hotspot/share/cds/archiveUtils.cpp index 4d717879e0f..3530fcff2b3 100644 --- a/src/hotspot/share/cds/archiveUtils.cpp +++ b/src/hotspot/share/cds/archiveUtils.cpp @@ -45,6 +45,7 @@ #include "utilities/debug.hpp" #include "utilities/formatBuffer.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/spinYield.hpp" CHeapBitMap* ArchivePtrMarker::_ptrmap = nullptr; CHeapBitMap* ArchivePtrMarker::_rw_ptrmap = nullptr; @@ -399,3 +400,162 @@ size_t HeapRootSegments::segment_offset(size_t seg_idx) { return _base_offset + seg_idx * _max_size_in_bytes; } +ArchiveWorkers::ArchiveWorkers() : + _end_semaphore(0), + _num_workers(max_workers()), + _started_workers(0), + _finish_tokens(0), + _state(UNUSED), + _task(nullptr) {} + +ArchiveWorkers::~ArchiveWorkers() { + assert(Atomic::load(&_state) != WORKING, "Should not be working"); +} + +int ArchiveWorkers::max_workers() { + // The pool is used for short-lived bursty tasks. We do not want to spend + // too much time creating and waking up threads unnecessarily. Plus, we do + // not want to overwhelm large machines. This is why we want to be very + // conservative about the number of workers actually needed. + return MAX2(0, log2i_graceful(os::active_processor_count())); +} + +bool ArchiveWorkers::is_parallel() { + return _num_workers > 0; +} + +void ArchiveWorkers::start_worker_if_needed() { + while (true) { + int cur = Atomic::load(&_started_workers); + if (cur >= _num_workers) { + return; + } + if (Atomic::cmpxchg(&_started_workers, cur, cur + 1, memory_order_relaxed) == cur) { + new ArchiveWorkerThread(this); + return; + } + } +} + +void ArchiveWorkers::run_task(ArchiveWorkerTask* task) { + assert(Atomic::load(&_state) == UNUSED, "Should be unused yet"); + assert(Atomic::load(&_task) == nullptr, "Should not have running tasks"); + Atomic::store(&_state, WORKING); + + if (is_parallel()) { + run_task_multi(task); + } else { + run_task_single(task); + } + + assert(Atomic::load(&_state) == WORKING, "Should be working"); + Atomic::store(&_state, SHUTDOWN); +} + +void ArchiveWorkers::run_task_single(ArchiveWorkerTask* task) { + // Single thread needs no chunking. + task->configure_max_chunks(1); + + // Execute the task ourselves, as there are no workers. + task->work(0, 1); +} + +void ArchiveWorkers::run_task_multi(ArchiveWorkerTask* task) { + // Multiple threads can work with multiple chunks. + task->configure_max_chunks(_num_workers * CHUNKS_PER_WORKER); + + // Set up the run and publish the task. Issue one additional finish token + // to cover the semaphore shutdown path, see below. + Atomic::store(&_finish_tokens, _num_workers + 1); + Atomic::release_store(&_task, task); + + // Kick off pool startup by starting a single worker, and proceed + // immediately to executing the task locally. + start_worker_if_needed(); + + // Execute the task ourselves, while workers are catching up. + // This allows us to hide parts of task handoff latency. + task->run(); + + // Done executing task locally, wait for any remaining workers to complete. + // Once all workers report, we can proceed to termination. To do this safely, + // we need to make sure every worker has left. A spin-wait alone would suffice, + // but we do not want to burn cycles on it. A semaphore alone would not be safe, + // since workers can still be inside it as we proceed from wait here. So we block + // on semaphore first, and then spin-wait for all workers to terminate. + _end_semaphore.wait(); + SpinYield spin; + while (Atomic::load(&_finish_tokens) != 0) { + spin.wait(); + } + + OrderAccess::fence(); + + assert(Atomic::load(&_finish_tokens) == 0, "All tokens are consumed"); +} + +void ArchiveWorkers::run_as_worker() { + assert(is_parallel(), "Should be in parallel mode"); + + ArchiveWorkerTask* task = Atomic::load_acquire(&_task); + task->run(); + + // All work done in threads should be visible to caller. + OrderAccess::fence(); + + // Signal the pool the work is complete, and we are exiting. + // Worker cannot do anything else with the pool after this. + if (Atomic::sub(&_finish_tokens, 1, memory_order_relaxed) == 1) { + // Last worker leaving. Notify the pool it can unblock to spin-wait. + // Then consume the last token and leave. + _end_semaphore.signal(); + int last = Atomic::sub(&_finish_tokens, 1, memory_order_relaxed); + assert(last == 0, "Should be"); + } +} + +void ArchiveWorkerTask::run() { + while (true) { + int chunk = Atomic::load(&_chunk); + if (chunk >= _max_chunks) { + return; + } + if (Atomic::cmpxchg(&_chunk, chunk, chunk + 1, memory_order_relaxed) == chunk) { + assert(0 <= chunk && chunk < _max_chunks, "Sanity"); + work(chunk, _max_chunks); + } + } +} + +void ArchiveWorkerTask::configure_max_chunks(int max_chunks) { + if (_max_chunks == 0) { + _max_chunks = max_chunks; + } +} + +ArchiveWorkerThread::ArchiveWorkerThread(ArchiveWorkers* pool) : NamedThread(), _pool(pool) { + set_name("ArchiveWorkerThread"); + if (os::create_thread(this, os::os_thread)) { + os::start_thread(this); + } else { + vm_exit_during_initialization("Unable to create archive worker", + os::native_thread_creation_failed_msg()); + } +} + +void ArchiveWorkerThread::run() { + // Avalanche startup: each worker starts two others. + _pool->start_worker_if_needed(); + _pool->start_worker_if_needed(); + + // Set ourselves up. + os::set_priority(this, NearMaxPriority); + + // Work. + _pool->run_as_worker(); +} + +void ArchiveWorkerThread::post_run() { + this->NamedThread::post_run(); + delete this; +} diff --git a/src/hotspot/share/cds/archiveUtils.hpp b/src/hotspot/share/cds/archiveUtils.hpp index 723332c40e5..a10117e9f9a 100644 --- a/src/hotspot/share/cds/archiveUtils.hpp +++ b/src/hotspot/share/cds/archiveUtils.hpp @@ -33,6 +33,8 @@ #include "utilities/bitMap.hpp" #include "utilities/exceptions.hpp" #include "utilities/macros.hpp" +#include "runtime/nonJavaThread.hpp" +#include "runtime/semaphore.hpp" class BootstrapInfo; class ReservedSpace; @@ -344,4 +346,74 @@ class HeapRootSegments { HeapRootSegments& operator=(const HeapRootSegments&) = default; }; +class ArchiveWorkers; + +// A task to be worked on by worker threads +class ArchiveWorkerTask : public CHeapObj { + friend class ArchiveWorkers; +private: + const char* _name; + int _max_chunks; + volatile int _chunk; + + void run(); + + void configure_max_chunks(int max_chunks); + +public: + ArchiveWorkerTask(const char* name) : + _name(name), _max_chunks(0), _chunk(0) {} + const char* name() const { return _name; } + virtual void work(int chunk, int max_chunks) = 0; +}; + +class ArchiveWorkerThread : public NamedThread { + friend class ArchiveWorkers; +private: + ArchiveWorkers* const _pool; + + void post_run() override; + +public: + ArchiveWorkerThread(ArchiveWorkers* pool); + const char* type_name() const override { return "Archive Worker Thread"; } + void run() override; +}; + +// Special archive workers. The goal for this implementation is to startup fast, +// distribute spiky workloads efficiently, and shutdown immediately after use. +// This makes the implementation quite different from the normal GC worker pool. +class ArchiveWorkers : public StackObj { + friend class ArchiveWorkerThread; +private: + // Target number of chunks per worker. This should be large enough to even + // out work imbalance, and small enough to keep bookkeeping overheads low. + static constexpr int CHUNKS_PER_WORKER = 4; + static int max_workers(); + + Semaphore _end_semaphore; + + int _num_workers; + int _started_workers; + int _finish_tokens; + + typedef enum { UNUSED, WORKING, SHUTDOWN } State; + volatile State _state; + + ArchiveWorkerTask* _task; + + void run_as_worker(); + void start_worker_if_needed(); + + void run_task_single(ArchiveWorkerTask* task); + void run_task_multi(ArchiveWorkerTask* task); + + bool is_parallel(); + +public: + ArchiveWorkers(); + ~ArchiveWorkers(); + void run_task(ArchiveWorkerTask* task); +}; + #endif // SHARE_CDS_ARCHIVEUTILS_HPP diff --git a/src/hotspot/share/cds/cds_globals.hpp b/src/hotspot/share/cds/cds_globals.hpp index 38f5d8f46a6..811740cfbcb 100644 --- a/src/hotspot/share/cds/cds_globals.hpp +++ b/src/hotspot/share/cds/cds_globals.hpp @@ -117,7 +117,10 @@ product(bool, AOTClassLinking, false, \ "Load/link all archived classes for the boot/platform/app " \ "loaders before application main") \ - + \ + product(bool, AOTCacheParallelRelocation, true, DIAGNOSTIC, \ + "Use parallel relocation code to speed up startup.") \ + \ // end of CDS_FLAGS DECLARE_FLAGS(CDS_FLAGS) diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index 91a2a57dee5..b7b08009dcc 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -1975,6 +1975,32 @@ char* FileMapInfo::map_bitmap_region() { return bitmap_base; } +class SharedDataRelocationTask : public ArchiveWorkerTask { +private: + BitMapView* const _rw_bm; + BitMapView* const _ro_bm; + SharedDataRelocator* const _rw_reloc; + SharedDataRelocator* const _ro_reloc; + +public: + SharedDataRelocationTask(BitMapView* rw_bm, BitMapView* ro_bm, SharedDataRelocator* rw_reloc, SharedDataRelocator* ro_reloc) : + ArchiveWorkerTask("Shared Data Relocation"), + _rw_bm(rw_bm), _ro_bm(ro_bm), _rw_reloc(rw_reloc), _ro_reloc(ro_reloc) {} + + void work(int chunk, int max_chunks) override { + work_on(chunk, max_chunks, _rw_bm, _rw_reloc); + work_on(chunk, max_chunks, _ro_bm, _ro_reloc); + } + + void work_on(int chunk, int max_chunks, BitMapView* bm, SharedDataRelocator* reloc) { + BitMap::idx_t size = bm->size(); + BitMap::idx_t start = MIN2(size, size * chunk / max_chunks); + BitMap::idx_t end = MIN2(size, size * (chunk + 1) / max_chunks); + assert(end > start, "Sanity: no empty slices"); + bm->iterate(reloc, start, end); + } +}; + // This is called when we cannot map the archive at the requested[ base address (usually 0x800000000). // We relocate all pointers in the 2 core regions (ro, rw). bool FileMapInfo::relocate_pointers_in_core_regions(intx addr_delta) { @@ -2013,8 +2039,15 @@ bool FileMapInfo::relocate_pointers_in_core_regions(intx addr_delta) { valid_new_base, valid_new_end, addr_delta); SharedDataRelocator ro_patcher((address*)ro_patch_base + header()->ro_ptrmap_start_pos(), (address*)ro_patch_end, valid_old_base, valid_old_end, valid_new_base, valid_new_end, addr_delta); - rw_ptrmap.iterate(&rw_patcher); - ro_ptrmap.iterate(&ro_patcher); + + if (AOTCacheParallelRelocation) { + ArchiveWorkers workers; + SharedDataRelocationTask task(&rw_ptrmap, &ro_ptrmap, &rw_patcher, &ro_patcher); + workers.run_task(&task); + } else { + rw_ptrmap.iterate(&rw_patcher); + ro_ptrmap.iterate(&ro_patcher); + } // The MetaspaceShared::bm region will be unmapped in MetaspaceShared::initialize_shared_spaces(). diff --git a/test/hotspot/gtest/cds/test_archiveWorkers.cpp b/test/hotspot/gtest/cds/test_archiveWorkers.cpp new file mode 100644 index 00000000000..eb5a4ad83e9 --- /dev/null +++ b/test/hotspot/gtest/cds/test_archiveWorkers.cpp @@ -0,0 +1,69 @@ +/* + * Copyright Amazon.com Inc. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "cds/archiveUtils.hpp" +#include "unittest.hpp" + +class TestArchiveWorkerTask : public ArchiveWorkerTask { +private: + volatile int _sum; + int _max; +public: + TestArchiveWorkerTask() : ArchiveWorkerTask("Test"), _sum(0), _max(0) {} + void work(int chunk, int max_chunks) override { + Atomic::add(&_sum, chunk); + Atomic::store(&_max, max_chunks); + } + int sum() { return Atomic::load(&_sum); } + int max() { return Atomic::load(&_max); } +}; + +// Test a repeated cycle of workers init/shutdown without task works. +TEST_VM(ArchiveWorkersTest, continuous_restart) { + for (int c = 0; c < 1000; c++) { + ArchiveWorkers workers; + } +} + +// Test a repeated cycle of sample task works. +TEST_VM(ArchiveWorkersTest, single_task) { + for (int c = 0; c < 1000; c++) { + TestArchiveWorkerTask task; + ArchiveWorkers workers; + workers.run_task(&task); + ASSERT_EQ(task.max() * (task.max() - 1) / 2, task.sum()); + } +} + +// Test that reusing the workers fails. +#ifdef ASSERT +TEST_VM_ASSERT_MSG(ArchiveWorkersTest, multiple_tasks, ".* Should be unused yet") { + TestArchiveWorkerTask task; + ArchiveWorkers workers; + workers.run_task(&task); + workers.run_task(&task); +} +#endif // ASSERT + From 308357cba706478598ef231887e0584eaae839e0 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Thu, 5 Dec 2024 13:15:26 +0000 Subject: [PATCH 10/27] 8345578: New test in JDK-8343622 fails with a promoted build Reviewed-by: mullan --- test/jdk/sun/security/krb5/NullStringToKey.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/jdk/sun/security/krb5/NullStringToKey.java b/test/jdk/sun/security/krb5/NullStringToKey.java index 93ee704156c..ca6b6d5439e 100644 --- a/test/jdk/sun/security/krb5/NullStringToKey.java +++ b/test/jdk/sun/security/krb5/NullStringToKey.java @@ -24,12 +24,9 @@ * @test * @bug 8343622 * @summary KerberosKey created with null key bytes - * @library /test/lib * @run main/othervm NullStringToKey */ -import jdk.test.lib.Utils; - import javax.security.auth.kerberos.KerberosKey; import javax.security.auth.kerberos.KerberosPrincipal; import java.security.Security; @@ -47,8 +44,16 @@ public static void main(String[] args) throws Exception { "aes128-cts-hmac-sha1-96", "aes256-cts-hmac-sha1-96", "aes128-cts-hmac-sha256-128", "aes256-cts-hmac-sha384-192")) { System.out.println(alg); - Utils.runAndCheckException(() -> new KerberosKey(name, pass, alg), - IllegalArgumentException.class); + // Do not use Utils.runAndCheckException as it might call + // MessageDigest.getInstance("MD5") at class initialization + // and we have already removed the SUN provider. + try { + new KerberosKey(name, pass, alg); + throw new RuntimeException("Didn't get expected exception"); + } catch (IllegalArgumentException e) { + // expected + System.out.println(e); + } } } } From 456c71d1ff64d31445b68d792fdaa9887f3499da Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Thu, 5 Dec 2024 14:07:39 +0000 Subject: [PATCH 11/27] 8343699: [aarch64] Bug in MacroAssembler::klass_decode_mode() Reviewed-by: adinn, coleenp --- src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index ce71d3a2262..66742c1c82e 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -5305,7 +5305,7 @@ MacroAssembler::KlassDecodeMode MacroAssembler::klass_decode_mode() { if (operand_valid_for_logical_immediate( /*is32*/false, (uint64_t)CompressedKlassPointers::base())) { const size_t range = CompressedKlassPointers::klass_range_end() - CompressedKlassPointers::base(); - const uint64_t range_mask = (1ULL << log2i(range)) - 1; + const uint64_t range_mask = right_n_bits(ceil_log2(range)); if (((uint64_t)CompressedKlassPointers::base() & range_mask) == 0) { return (_klass_decode_mode = KlassDecodeXor); } From 97b8a09bda92fab38b97acd49b6a5e4607b396e6 Mon Sep 17 00:00:00 2001 From: Erik Gahlin Date: Thu, 5 Dec 2024 14:50:30 +0000 Subject: [PATCH 12/27] 8345339: JFR: Missing javadoc for RecordingStream::onMetadata Reviewed-by: nbenalla, liach --- .../jdk/jfr/consumer/RecordingStream.java | 21 +++++++++++++++++ .../jfr/consumer/snippet-files/Snippets.java | 23 ++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.java b/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.java index 564b97797fc..2e7d23bb84c 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.java @@ -455,6 +455,27 @@ public void awaitTermination() throws InterruptedException { directoryStream.awaitTermination(); } + /** + * Registers an action to perform when new metadata arrives in the stream. + * + * The event type of an event always arrives sometime before the actual event. + * The action must be registered before the stream is started. + *

+ * The following example shows how to listen to new event types, register + * an action if the event type name matches a regular expression and increase a + * counter if a matching event is found. A benefit of using an action per + * event type, instead of the generic {@link #onEvent(Consumer)} method, + * is that a stream implementation can avoid reading events that are of no + * interest. + * + * {@snippet class = "Snippets" region = "RecordingStreamMetadata"} + * + * @param action to perform, not {@code null} + * + * @throws IllegalStateException if an action is added after the stream has + * started + * @since 16 + */ @Override public void onMetadata(Consumer action) { directoryStream.onMetadata(action); diff --git a/src/jdk.jfr/share/classes/jdk/jfr/consumer/snippet-files/Snippets.java b/src/jdk.jfr/share/classes/jdk/jfr/consumer/snippet-files/Snippets.java index 1aa45fa52c6..3f363c4536a 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/consumer/snippet-files/Snippets.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/consumer/snippet-files/Snippets.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 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 @@ -109,6 +109,27 @@ public static void main(String... args) throws IOException { // @end } + class RecordingStreamMetadata { + // @start region="RecordingStreamMetadata" + static long count = 0; + public static void main(String... args) throws Exception { + String regExp = args[0]; + var pr = Pattern.compile(regExp).asMatchPredicate(); + Configuration c = Configuration.getConfiguration("default"); + try (var s = new RecordingStream(c)) { + s.setOrdered(false); + s.onMetadata(metadata -> metadata.getAddedEventTypes() + .stream().map(EventType::getName).filter(pr) + .forEach(eventName -> s.onEvent(eventName, event -> count++))); + s.startAsync(); + System.out.println("Running recording for 5 s. Please wait."); + s.awaitTermination(Duration.ofSeconds(5)); + System.out.println(count + " events matches " + regExp); + } + } + // @end + } + void RecordingFileOverview() throws Exception { // @start region="RecordingFileOverview" try (RecordingFile recordingFile = new RecordingFile(Paths.get("recording.jfr"))) { From 691e692149c105b4ca34aaaba779675b6bcc7c65 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Thu, 5 Dec 2024 15:22:00 +0000 Subject: [PATCH 13/27] 8345565: Remove remaining SecurityManager motivated APIs from sun.reflect.util Reviewed-by: mullan, rriggs, liach --- .../classes/java/io/ObjectInputStream.java | 16 --- .../classes/java/io/ObjectOutputStream.java | 13 -- .../share/classes/java/lang/Class.java | 2 - .../classes/java/lang/reflect/Proxy.java | 3 +- .../reflectiveObjects/TypeVariableImpl.java | 14 +-- .../sun/reflect/misc/ConstructorUtil.java | 45 ------- .../classes/sun/reflect/misc/FieldUtil.java | 48 -------- .../classes/sun/reflect/misc/MethodUtil.java | 9 +- .../classes/sun/reflect/misc/ReflectUtil.java | 112 ------------------ .../jmx/mbeanserver/MBeanInstantiator.java | 3 +- 10 files changed, 7 insertions(+), 258 deletions(-) delete mode 100644 src/java.base/share/classes/sun/reflect/misc/ConstructorUtil.java delete mode 100644 src/java.base/share/classes/sun/reflect/misc/FieldUtil.java diff --git a/src/java.base/share/classes/java/io/ObjectInputStream.java b/src/java.base/share/classes/java/io/ObjectInputStream.java index 31d0aecf831..a47d2d5a325 100644 --- a/src/java.base/share/classes/java/io/ObjectInputStream.java +++ b/src/java.base/share/classes/java/io/ObjectInputStream.java @@ -42,7 +42,6 @@ import jdk.internal.event.DeserializationEvent; import jdk.internal.misc.Unsafe; import jdk.internal.util.ByteArray; -import sun.reflect.misc.ReflectUtil; /** * An ObjectInputStream deserializes primitive data and objects previously @@ -1828,12 +1827,6 @@ private ObjectStreamClass readClassDesc(boolean unshared) }; } - private boolean isCustomSubclass() { - // Return true if this class is a custom subclass of ObjectInputStream - return getClass().getClassLoader() - != ObjectInputStream.class.getClassLoader(); - } - /** * Reads in and returns class descriptor for a dynamic proxy class. Sets * passHandle to proxy class descriptor's assigned handle. If proxy class @@ -1879,12 +1872,6 @@ private ObjectStreamClass readProxyDesc(boolean unshared) } else if (!Proxy.isProxyClass(cl)) { throw new InvalidClassException("Not a proxy"); } else { - // ReflectUtil.checkProxyPackageAccess makes a test - // equivalent to isCustomSubclass so there's no need - // to condition this call to isCustomSubclass == true here. - ReflectUtil.checkProxyPackageAccess( - getClass().getClassLoader(), - cl.getInterfaces()); // Filter the interfaces for (Class clazz : cl.getInterfaces()) { filterCheck(clazz, -1); @@ -1954,12 +1941,9 @@ private ObjectStreamClass readNonProxyDesc(boolean unshared) Class cl = null; ClassNotFoundException resolveEx = null; bin.setBlockDataMode(true); - final boolean checksRequired = isCustomSubclass(); try { if ((cl = resolveClass(readDesc)) == null) { resolveEx = new ClassNotFoundException("null class"); - } else if (checksRequired) { - ReflectUtil.checkPackageAccess(cl); } } catch (ClassNotFoundException ex) { resolveEx = ex; diff --git a/src/java.base/share/classes/java/io/ObjectOutputStream.java b/src/java.base/share/classes/java/io/ObjectOutputStream.java index 5225c673705..71bda09bd8c 100644 --- a/src/java.base/share/classes/java/io/ObjectOutputStream.java +++ b/src/java.base/share/classes/java/io/ObjectOutputStream.java @@ -35,7 +35,6 @@ import jdk.internal.util.ByteArray; import jdk.internal.access.JavaLangAccess; import jdk.internal.access.SharedSecrets; -import sun.reflect.misc.ReflectUtil; import static jdk.internal.util.ModifiedUtf.putChar; import static jdk.internal.util.ModifiedUtf.utfLen; @@ -1170,12 +1169,6 @@ private void writeClassDesc(ObjectStreamClass desc, boolean unshared) } } - private boolean isCustomSubclass() { - // Return true if this class is a custom subclass of ObjectOutputStream - return getClass().getClassLoader() - != ObjectOutputStream.class.getClassLoader(); - } - /** * Writes class descriptor representing a dynamic proxy class to stream. */ @@ -1193,9 +1186,6 @@ private void writeProxyDesc(ObjectStreamClass desc, boolean unshared) } bout.setBlockDataMode(true); - if (isCustomSubclass()) { - ReflectUtil.checkPackageAccess(cl); - } annotateProxyClass(cl); bout.setBlockDataMode(false); bout.writeByte(TC_ENDBLOCKDATA); @@ -1222,9 +1212,6 @@ private void writeNonProxyDesc(ObjectStreamClass desc, boolean unshared) Class cl = desc.forClass(); bout.setBlockDataMode(true); - if (cl != null && isCustomSubclass()) { - ReflectUtil.checkPackageAccess(cl); - } annotateClass(cl); bout.setBlockDataMode(false); bout.writeByte(TC_ENDBLOCKDATA); diff --git a/src/java.base/share/classes/java/lang/Class.java b/src/java.base/share/classes/java/lang/Class.java index 23b8ac3fb90..7929dd1a09f 100644 --- a/src/java.base/share/classes/java/lang/Class.java +++ b/src/java.base/share/classes/java/lang/Class.java @@ -60,7 +60,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; @@ -91,7 +90,6 @@ import sun.reflect.generics.repository.ConstructorRepository; import sun.reflect.generics.scope.ClassScope; import sun.reflect.annotation.*; -import sun.reflect.misc.ReflectUtil; /** * Instances of the class {@code Class} represent classes and diff --git a/src/java.base/share/classes/java/lang/reflect/Proxy.java b/src/java.base/share/classes/java/lang/reflect/Proxy.java index 77f3d3e1e71..83a1520ce08 100644 --- a/src/java.base/share/classes/java/lang/reflect/Proxy.java +++ b/src/java.base/share/classes/java/lang/reflect/Proxy.java @@ -52,7 +52,6 @@ import jdk.internal.misc.VM; import jdk.internal.loader.ClassLoaderValue; import jdk.internal.vm.annotation.Stable; -import sun.reflect.misc.ReflectUtil; import static java.lang.invoke.MethodType.methodType; import static java.lang.module.ModuleDescriptor.Modifier.SYNTHETIC; @@ -984,7 +983,7 @@ public static InvocationHandler getInvocationHandler(Object proxy) return ih; } - private static final String PROXY_PACKAGE_PREFIX = ReflectUtil.PROXY_PACKAGE; + private static final String PROXY_PACKAGE_PREFIX = "com.sun.proxy"; /** * A cache of Method -> MethodHandle for default methods. diff --git a/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java b/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java index 7f2829eda20..75750d38f2f 100644 --- a/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java +++ b/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -29,7 +29,6 @@ import java.lang.reflect.AnnotatedType; import java.lang.reflect.Constructor; import java.lang.reflect.GenericDeclaration; -import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; @@ -41,7 +40,6 @@ import sun.reflect.annotation.AnnotationType; import sun.reflect.generics.factory.GenericsFactory; import sun.reflect.generics.tree.FieldTypeSignature; -import sun.reflect.misc.ReflectUtil; /** * Implementation of {@code java.lang.reflect.TypeVariable} interface @@ -135,13 +133,9 @@ public Type[] getBounds() { * @since 1.5 */ public D getGenericDeclaration() { - if (genericDeclaration instanceof Class c) - ReflectUtil.checkPackageAccess(c); - else if ((genericDeclaration instanceof Method) || - (genericDeclaration instanceof Constructor)) - ReflectUtil.conservativeCheckMemberAccess((Member)genericDeclaration); - else - throw new AssertionError("Unexpected kind of GenericDeclaration"); + assert genericDeclaration instanceof Class || + genericDeclaration instanceof Method || + genericDeclaration instanceof Constructor : "Unexpected kind of GenericDeclaration"; return genericDeclaration; } diff --git a/src/java.base/share/classes/sun/reflect/misc/ConstructorUtil.java b/src/java.base/share/classes/sun/reflect/misc/ConstructorUtil.java deleted file mode 100644 index e0e4233c8a5..00000000000 --- a/src/java.base/share/classes/sun/reflect/misc/ConstructorUtil.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2005, 2011, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.reflect.misc; - -import java.lang.reflect.Constructor; - -public final class ConstructorUtil { - - private ConstructorUtil() { - } - - public static Constructor getConstructor(Class cls, Class[] params) - throws NoSuchMethodException { - ReflectUtil.checkPackageAccess(cls); - return cls.getConstructor(params); - } - - public static Constructor[] getConstructors(Class cls) { - ReflectUtil.checkPackageAccess(cls); - return cls.getConstructors(); - } -} diff --git a/src/java.base/share/classes/sun/reflect/misc/FieldUtil.java b/src/java.base/share/classes/sun/reflect/misc/FieldUtil.java deleted file mode 100644 index 705597c5ecb..00000000000 --- a/src/java.base/share/classes/sun/reflect/misc/FieldUtil.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2005, 2011, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.reflect.misc; - -import java.lang.reflect.Field; - -/* - * Create a trampoline class. - */ -public final class FieldUtil { - - private FieldUtil() { - } - - public static Field getField(Class cls, String name) - throws NoSuchFieldException { - ReflectUtil.checkPackageAccess(cls); - return cls.getField(name); - } - - public static Field[] getFields(Class cls) { - ReflectUtil.checkPackageAccess(cls); - return cls.getFields(); - } -} diff --git a/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java b/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java index fb03b68db1c..8d950c9a818 100644 --- a/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java +++ b/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -79,15 +79,9 @@ private MethodUtil() { public static Method getMethod(Class cls, String name, Class[] args) throws NoSuchMethodException { - ReflectUtil.checkPackageAccess(cls); return cls.getMethod(name, args); } - public static Method[] getMethods(Class cls) { - ReflectUtil.checkPackageAccess(cls); - return cls.getMethods(); - } - /* * Bounce through the trampoline. */ @@ -140,7 +134,6 @@ protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { // First, check if the class has already been loaded - ReflectUtil.checkPackageAccess(name); Class c = findLoadedClass(name); if (c == null) { try { diff --git a/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java b/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java index 86eadc2b2ee..812e77a0a82 100644 --- a/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java +++ b/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java @@ -25,10 +25,6 @@ package sun.reflect.misc; -import java.lang.reflect.Member; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.Proxy; import jdk.internal.reflect.Reflection; public final class ReflectUtil { @@ -67,112 +63,4 @@ public static void ensureMemberAccess(Class currentClass, target == null ? null : target.getClass(), modifiers); } - - /** - * Does nothing. - */ - public static void conservativeCheckMemberAccess(Member m) { - } - - /** - * Does nothing. - */ - public static void checkPackageAccess(Class clazz) { - } - - /** - * Does nothing - */ - public static void checkPackageAccess(String name) { - } - - /** - * Returns true. - */ - public static boolean isPackageAccessible(Class clazz) { - return true; - } - - /** - * Returns false. - */ - public static boolean needsPackageAccessCheck(ClassLoader from, ClassLoader to) { - return false; - } - - /** - * Does nothing - */ - public static void checkProxyPackageAccess(Class clazz) { - } - - /** - * Does nothing. - */ - public static void checkProxyPackageAccess(ClassLoader ccl, - Class... interfaces) { - } - - // Note that bytecode instrumentation tools may exclude 'sun.*' - // classes but not generated proxy classes and so keep it in com.sun.* - public static final String PROXY_PACKAGE = "com.sun.proxy"; - - /** - * Test if the given class is a proxy class that implements - * non-public interface. Such proxy class may be in a non-restricted - * package that bypasses checkPackageAccess. - */ - public static boolean isNonPublicProxyClass(Class cls) { - if (!Proxy.isProxyClass(cls)) { - return false; - } - return !Modifier.isPublic(cls.getModifiers()); - } - - /** - * Check if the given method is a method declared in the proxy interface - * implemented by the given proxy instance. - * - * @param proxy a proxy instance - * @param method an interface method dispatched to a InvocationHandler - * - * @throws IllegalArgumentException if the given proxy or method is invalid. - */ - public static void checkProxyMethod(Object proxy, Method method) { - // check if it is a valid proxy instance - if (proxy == null || !Proxy.isProxyClass(proxy.getClass())) { - throw new IllegalArgumentException("Not a Proxy instance"); - } - if (Modifier.isStatic(method.getModifiers())) { - throw new IllegalArgumentException("Can't handle static method"); - } - - Class c = method.getDeclaringClass(); - if (c == Object.class) { - String name = method.getName(); - if (name.equals("hashCode") || name.equals("equals") || name.equals("toString")) { - return; - } - } - - if (isSuperInterface(proxy.getClass(), c)) { - return; - } - - // disallow any method not declared in one of the proxy interfaces - throw new IllegalArgumentException("Can't handle: " + method); - } - - private static boolean isSuperInterface(Class c, Class intf) { - for (Class i : c.getInterfaces()) { - if (i == intf) { - return true; - } - if (isSuperInterface(i, intf)) { - return true; - } - } - return false; - } - } diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java index 53eeb721a13..b1fcf7999c6 100644 --- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java +++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java @@ -46,7 +46,6 @@ import javax.management.RuntimeErrorException; import javax.management.RuntimeMBeanException; import javax.management.RuntimeOperationsException; -import sun.reflect.misc.ConstructorUtil; /** * Implements the MBeanInstantiator interface. Provides methods for @@ -681,7 +680,7 @@ static Class[] loadSignatureClasses(String signature[], private Constructor findConstructor(Class c, Class[] params) { try { - return ConstructorUtil.getConstructor(c, params); + return c.getConstructor(params); } catch (Exception e) { return null; } From 7513b1378de4fc2270d8e144a9c3b75859e6fe5f Mon Sep 17 00:00:00 2001 From: Gerard Ziemski Date: Thu, 5 Dec 2024 15:28:30 +0000 Subject: [PATCH 14/27] 8328944: NMT reports "unknown" memory Reviewed-by: jsjolen, coleenp --- .../bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp | 4 +- src/hotspot/os/linux/os_linux.cpp | 6 +-- src/hotspot/share/cds/metaspaceShared.cpp | 2 +- .../share/gc/parallel/objectStartArray.cpp | 3 +- .../gc/serial/serialBlockOffsetTable.cpp | 4 +- src/hotspot/share/memory/heap.cpp | 4 +- src/hotspot/share/memory/virtualspace.cpp | 45 +++++++++---------- src/hotspot/share/memory/virtualspace.hpp | 7 +-- src/hotspot/share/prims/jni.cpp | 3 +- src/hotspot/share/prims/whitebox.cpp | 12 +---- .../share/runtime/safepointMechanism.cpp | 5 +-- src/hotspot/share/utilities/debug.cpp | 5 +-- .../gtest/gc/g1/test_freeRegionList.cpp | 2 +- .../gtest/memory/test_virtualspace.cpp | 8 ++-- .../runtime/test_virtualMemoryTracker.cpp | 8 ++-- 15 files changed, 49 insertions(+), 69 deletions(-) diff --git a/src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp b/src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp index 2e56c092a79..16835c83039 100644 --- a/src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp +++ b/src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -79,7 +79,7 @@ ZPhysicalMemoryBacking::ZPhysicalMemoryBacking(size_t max_capacity) _initialized(false) { // Reserve address space for backing memory - _base = (uintptr_t)os::reserve_memory(max_capacity); + _base = (uintptr_t)os::reserve_memory(max_capacity, false, mtJavaHeap); if (_base == 0) { // Failed ZInitialize::error("Failed to reserve address space for backing memory"); diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index d159118016a..ed832f37bdf 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -4582,7 +4582,7 @@ static void workaround_expand_exec_shield_cs_limit() { */ char* hint = (char*)(os::Linux::initial_thread_stack_bottom() - (StackOverflow::stack_guard_zone_size() + page_size)); - char* codebuf = os::attempt_reserve_memory_at(hint, page_size); + char* codebuf = os::attempt_reserve_memory_at(hint, page_size, false, mtThread); if (codebuf == nullptr) { // JDK-8197429: There may be a stack gap of one megabyte between @@ -4590,15 +4590,13 @@ static void workaround_expand_exec_shield_cs_limit() { // Linux kernel workaround for CVE-2017-1000364. If we failed to // map our codebuf, try again at an address one megabyte lower. hint -= 1 * M; - codebuf = os::attempt_reserve_memory_at(hint, page_size); + codebuf = os::attempt_reserve_memory_at(hint, page_size, false, mtThread); } if ((codebuf == nullptr) || (!os::commit_memory(codebuf, page_size, true))) { return; // No matter, we tried, best effort. } - MemTracker::record_virtual_memory_tag((address)codebuf, mtInternal); - log_info(os)("[CS limit NX emulation work-around, exec code at: %p]", codebuf); // Some code to exec: the 'ret' instruction diff --git a/src/hotspot/share/cds/metaspaceShared.cpp b/src/hotspot/share/cds/metaspaceShared.cpp index ba17ccddb52..f21b9c9060d 100644 --- a/src/hotspot/share/cds/metaspaceShared.cpp +++ b/src/hotspot/share/cds/metaspaceShared.cpp @@ -281,7 +281,7 @@ void MetaspaceShared::initialize_for_static_dump() { SharedBaseAddress = (size_t)_requested_base_address; size_t symbol_rs_size = LP64_ONLY(3 * G) NOT_LP64(128 * M); - _symbol_rs = ReservedSpace(symbol_rs_size); + _symbol_rs = ReservedSpace(symbol_rs_size, mtClassShared); if (!_symbol_rs.is_reserved()) { log_error(cds)("Unable to reserve memory for symbols: " SIZE_FORMAT " bytes.", symbol_rs_size); MetaspaceShared::unrecoverable_writing_error(); diff --git a/src/hotspot/share/gc/parallel/objectStartArray.cpp b/src/hotspot/share/gc/parallel/objectStartArray.cpp index ef9de7abfd7..2a0f12ec70e 100644 --- a/src/hotspot/share/gc/parallel/objectStartArray.cpp +++ b/src/hotspot/share/gc/parallel/objectStartArray.cpp @@ -47,11 +47,10 @@ void ObjectStartArray::initialize(MemRegion reserved_region) { // Do not use large-pages for the backing store. The one large page region // will be used for the heap proper. - ReservedSpace backing_store(bytes_to_reserve); + ReservedSpace backing_store(bytes_to_reserve, mtGC); if (!backing_store.is_reserved()) { vm_exit_during_initialization("Could not reserve space for ObjectStartArray"); } - MemTracker::record_virtual_memory_tag(backing_store.base(), mtGC); // We do not commit any memory initially _virtual_space.initialize(backing_store); diff --git a/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp b/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp index 31f18652c63..7ac0fcc8b53 100644 --- a/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp +++ b/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp @@ -37,13 +37,11 @@ SerialBlockOffsetTable::SerialBlockOffsetTable(MemRegion reserved, size_t init_word_size): _reserved(reserved) { size_t size = compute_size(reserved.word_size()); - ReservedSpace rs(size); + ReservedSpace rs(size, mtGC); if (!rs.is_reserved()) { vm_exit_during_initialization("Could not reserve enough space for heap offset array"); } - MemTracker::record_virtual_memory_tag((address)rs.base(), mtGC); - if (!_vs.initialize(rs, 0)) { vm_exit_during_initialization("Could not reserve enough space for heap offset array"); } diff --git a/src/hotspot/share/memory/heap.cpp b/src/hotspot/share/memory/heap.cpp index 658ec3e8de7..92a376defa5 100644 --- a/src/hotspot/share/memory/heap.cpp +++ b/src/hotspot/share/memory/heap.cpp @@ -227,13 +227,11 @@ bool CodeHeap::reserve(ReservedSpace rs, size_t committed_size, size_t segment_s const size_t committed_segments_size = align_to_page_size(_number_of_committed_segments); // reserve space for _segmap - ReservedSpace seg_rs(reserved_segments_size); + ReservedSpace seg_rs(reserved_segments_size, mtCode); if (!_segmap.initialize(seg_rs, committed_segments_size)) { return false; } - MemTracker::record_virtual_memory_tag((address)_segmap.low_boundary(), mtCode); - assert(_segmap.committed_size() >= (size_t) _number_of_committed_segments, "could not commit enough space for segment map"); assert(_segmap.reserved_size() >= (size_t) _number_of_reserved_segments , "could not reserve enough space for segment map"); assert(_segmap.reserved_size() >= _segmap.committed_size() , "just checking"); diff --git a/src/hotspot/share/memory/virtualspace.cpp b/src/hotspot/share/memory/virtualspace.cpp index 614a3ab784b..33574f7f5d1 100644 --- a/src/hotspot/share/memory/virtualspace.cpp +++ b/src/hotspot/share/memory/virtualspace.cpp @@ -45,20 +45,20 @@ ReservedSpace::ReservedSpace() : _base(nullptr), _size(0), _noaccess_prefix(0), _alignment(0), _special(false), _fd_for_heap(-1), _executable(false) { } -ReservedSpace::ReservedSpace(size_t size) : _fd_for_heap(-1) { +ReservedSpace::ReservedSpace(size_t size, MemTag mem_tag) : _fd_for_heap(-1) { // Want to use large pages where possible. If the size is // not large page aligned the mapping will be a mix of // large and normal pages. size_t page_size = os::page_size_for_region_unaligned(size, 1); size_t alignment = os::vm_allocation_granularity(); - initialize(size, alignment, page_size, nullptr, false); + initialize(size, alignment, page_size, nullptr, false, mem_tag); } ReservedSpace::ReservedSpace(size_t size, size_t preferred_page_size) : _fd_for_heap(-1) { // When a page size is given we don't want to mix large // and normal pages. If the size is not a multiple of the // page size it will be aligned up to achieve this. - size_t alignment = os::vm_allocation_granularity();; + size_t alignment = os::vm_allocation_granularity(); if (preferred_page_size != os::vm_page_size()) { alignment = MAX2(preferred_page_size, alignment); size = align_up(size, alignment); @@ -81,19 +81,19 @@ ReservedSpace::ReservedSpace(char* base, size_t size, size_t alignment, size_t p } // Helper method -static char* attempt_map_or_reserve_memory_at(char* base, size_t size, int fd, bool executable) { +static char* attempt_map_or_reserve_memory_at(char* base, size_t size, int fd, bool executable, MemTag mem_tag) { if (fd != -1) { return os::attempt_map_memory_to_file_at(base, size, fd); } - return os::attempt_reserve_memory_at(base, size, executable); + return os::attempt_reserve_memory_at(base, size, executable, mem_tag); } // Helper method -static char* map_or_reserve_memory(size_t size, int fd, bool executable) { +static char* map_or_reserve_memory(size_t size, int fd, bool executable, MemTag mem_tag) { if (fd != -1) { return os::map_memory_to_file(size, fd); } - return os::reserve_memory(size, executable); + return os::reserve_memory(size, executable, mem_tag); } // Helper method @@ -154,7 +154,7 @@ static void log_on_large_pages_failure(char* req_addr, size_t bytes) { } static char* reserve_memory(char* requested_address, const size_t size, - const size_t alignment, int fd, bool exec) { + const size_t alignment, int fd, bool exec, MemTag mem_tag) { char* base; // If the memory was requested at a particular address, use // os::attempt_reserve_memory_at() to avoid mapping over something @@ -163,12 +163,12 @@ static char* reserve_memory(char* requested_address, const size_t size, assert(is_aligned(requested_address, alignment), "Requested address " PTR_FORMAT " must be aligned to " SIZE_FORMAT, p2i(requested_address), alignment); - base = attempt_map_or_reserve_memory_at(requested_address, size, fd, exec); + base = attempt_map_or_reserve_memory_at(requested_address, size, fd, exec, mem_tag); } else { // Optimistically assume that the OS returns an aligned base pointer. // When reserving a large address range, most OSes seem to align to at // least 64K. - base = map_or_reserve_memory(size, fd, exec); + base = map_or_reserve_memory(size, fd, exec, mem_tag); // Check alignment constraints. This is only needed when there is // no requested address. if (!is_aligned(base, alignment)) { @@ -220,7 +220,8 @@ void ReservedSpace::reserve(size_t size, size_t alignment, size_t page_size, char* requested_address, - bool executable) { + bool executable, + MemTag mem_tag) { assert(is_aligned(size, alignment), "Size must be aligned to the requested alignment"); // There are basically three different cases that we need to handle below: @@ -235,7 +236,7 @@ void ReservedSpace::reserve(size_t size, // When there is a backing file directory for this space then whether // large pages are allocated is up to the filesystem of the backing file. // So UseLargePages is not taken into account for this reservation. - char* base = reserve_memory(requested_address, size, alignment, _fd_for_heap, executable); + char* base = reserve_memory(requested_address, size, alignment, _fd_for_heap, executable, mem_tag); if (base != nullptr) { initialize_members(base, size, alignment, os::vm_page_size(), true, executable); } @@ -266,7 +267,7 @@ void ReservedSpace::reserve(size_t size, } // == Case 3 == - char* base = reserve_memory(requested_address, size, alignment, -1, executable); + char* base = reserve_memory(requested_address, size, alignment, -1, executable, mem_tag); if (base != nullptr) { // Successful mapping. initialize_members(base, size, alignment, page_size, false, executable); @@ -277,7 +278,8 @@ void ReservedSpace::initialize(size_t size, size_t alignment, size_t page_size, char* requested_address, - bool executable) { + bool executable, + MemTag mem_tag) { const size_t granularity = os::vm_allocation_granularity(); assert((size & (granularity - 1)) == 0, "size not aligned to os::vm_allocation_granularity()"); @@ -298,7 +300,7 @@ void ReservedSpace::initialize(size_t size, alignment = MAX2(alignment, os::vm_page_size()); // Reserve the memory. - reserve(size, alignment, page_size, requested_address, executable); + reserve(size, alignment, page_size, requested_address, executable, mem_tag); // Check that the requested address is used if given. if (failed_to_reserve_as_requested(_base, requested_address)) { @@ -424,7 +426,7 @@ void ReservedHeapSpace::try_reserve_heap(size_t size, p2i(requested_address), size); - reserve(size, alignment, page_size, requested_address, false); + reserve(size, alignment, page_size, requested_address, false, mtJavaHeap); // Check alignment constraints. if (is_reserved() && !is_aligned(_base, _alignment)) { @@ -610,7 +612,7 @@ void ReservedHeapSpace::initialize_compressed_heap(const size_t size, size_t ali // Last, desperate try without any placement. if (_base == nullptr) { log_trace(gc, heap, coops)("Trying to allocate at address null heap of size " SIZE_FORMAT_X, size + noaccess_prefix); - initialize(size + noaccess_prefix, alignment, page_size, nullptr, false); + initialize(size + noaccess_prefix, alignment, page_size, nullptr, false, mtJavaHeap); } } } @@ -653,7 +655,7 @@ ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment, size_t page_ ShouldNotReachHere(); #endif // _LP64 } else { - initialize(size, alignment, page_size, nullptr, false); + initialize(size, alignment, page_size, nullptr, false, mtJavaHeap); } assert(markWord::encode_pointer_as_mark(_base).decode_pointer() == _base, @@ -661,10 +663,6 @@ ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment, size_t page_ assert(markWord::encode_pointer_as_mark(&_base[size]).decode_pointer() == &_base[size], "area must be distinguishable from marks for mark-sweep"); - if (base() != nullptr) { - MemTracker::record_virtual_memory_tag((address)base(), mtJavaHeap); - } - if (_fd_for_heap != -1) { ::close(_fd_for_heap); } @@ -679,8 +677,7 @@ MemRegion ReservedHeapSpace::region() const { ReservedCodeSpace::ReservedCodeSpace(size_t r_size, size_t rs_align, size_t rs_page_size) : ReservedSpace() { - initialize(r_size, rs_align, rs_page_size, /*requested address*/ nullptr, /*executable*/ true); - MemTracker::record_virtual_memory_tag((address)base(), mtCode); + initialize(r_size, rs_align, rs_page_size, /*requested address*/ nullptr, /*executable*/ true, mtCode); } // VirtualSpace diff --git a/src/hotspot/share/memory/virtualspace.hpp b/src/hotspot/share/memory/virtualspace.hpp index 022bcabe753..6139c3a413f 100644 --- a/src/hotspot/share/memory/virtualspace.hpp +++ b/src/hotspot/share/memory/virtualspace.hpp @@ -26,6 +26,7 @@ #define SHARE_MEMORY_VIRTUALSPACE_HPP #include "memory/memRegion.hpp" +#include "nmt/memTag.hpp" #include "utilities/globalDefinitions.hpp" class outputStream; @@ -61,16 +62,16 @@ class ReservedSpace { size_t page_size, bool special, bool executable); void initialize(size_t size, size_t alignment, size_t page_size, - char* requested_address, bool executable); + char* requested_address, bool executable, MemTag mem_tag = mtNone); void reserve(size_t size, size_t alignment, size_t page_size, - char* requested_address, bool executable); + char* requested_address, bool executable, MemTag mem_tag); public: // Constructor ReservedSpace(); // Initialize the reserved space with the given size. Depending on the size // a suitable page size and alignment will be used. - explicit ReservedSpace(size_t size); + ReservedSpace(size_t size, MemTag mem_tag); // Initialize the reserved space with the given size. The preferred_page_size // is used as the minimum page size/alignment. This may waste some space if // the given size is not aligned to that value, as the reservation will be diff --git a/src/hotspot/share/prims/jni.cpp b/src/hotspot/share/prims/jni.cpp index 7bea3441fa5..40d3b506258 100644 --- a/src/hotspot/share/prims/jni.cpp +++ b/src/hotspot/share/prims/jni.cpp @@ -2402,11 +2402,10 @@ static char* get_bad_address() { static char* bad_address = nullptr; if (bad_address == nullptr) { size_t size = os::vm_allocation_granularity(); - bad_address = os::reserve_memory(size); + bad_address = os::reserve_memory(size, false, mtInternal); if (bad_address != nullptr) { os::protect_memory(bad_address, size, os::MEM_PROT_READ, /*is_committed*/false); - MemTracker::record_virtual_memory_tag((void*)bad_address, mtInternal); } } return bad_address; diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index af5f3cf79ca..d25ee27c0e1 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -711,19 +711,11 @@ WB_ENTRY(void, WB_NMTFree(JNIEnv* env, jobject o, jlong mem)) WB_END WB_ENTRY(jlong, WB_NMTReserveMemory(JNIEnv* env, jobject o, jlong size)) - jlong addr = 0; - - addr = (jlong)(uintptr_t)os::reserve_memory(size); - MemTracker::record_virtual_memory_tag((address)addr, mtTest); - - return addr; + return (jlong)(uintptr_t)os::reserve_memory(size, false, mtTest); WB_END WB_ENTRY(jlong, WB_NMTAttemptReserveMemoryAt(JNIEnv* env, jobject o, jlong addr, jlong size)) - addr = (jlong)(uintptr_t)os::attempt_reserve_memory_at((char*)(uintptr_t)addr, (size_t)size); - MemTracker::record_virtual_memory_tag((address)addr, mtTest); - - return addr; + return (jlong)(uintptr_t)os::attempt_reserve_memory_at((char*)(uintptr_t)addr, (size_t)size, false, mtTest); WB_END WB_ENTRY(void, WB_NMTCommitMemory(JNIEnv* env, jobject o, jlong addr, jlong size)) diff --git a/src/hotspot/share/runtime/safepointMechanism.cpp b/src/hotspot/share/runtime/safepointMechanism.cpp index a6aadf5ebc4..c7e3f55eba3 100644 --- a/src/hotspot/share/runtime/safepointMechanism.cpp +++ b/src/hotspot/share/runtime/safepointMechanism.cpp @@ -58,9 +58,8 @@ void SafepointMechanism::default_initialize() { // Polling page const size_t page_size = os::vm_page_size(); const size_t allocation_size = 2 * page_size; - char* polling_page = os::reserve_memory(allocation_size); - os::commit_memory_or_exit(polling_page, allocation_size, false, "Unable to commit Safepoint polling page"); - MemTracker::record_virtual_memory_tag((address)polling_page, mtSafepoint); + char* polling_page = os::reserve_memory(allocation_size, !ExecMem, mtSafepoint); + os::commit_memory_or_exit(polling_page, allocation_size, !ExecMem, "Unable to commit Safepoint polling page"); char* bad_page = polling_page; char* good_page = polling_page + page_size; diff --git a/src/hotspot/share/utilities/debug.cpp b/src/hotspot/share/utilities/debug.cpp index 7286f70412a..07e93ca5710 100644 --- a/src/hotspot/share/utilities/debug.cpp +++ b/src/hotspot/share/utilities/debug.cpp @@ -715,10 +715,9 @@ struct TestMultipleStaticAssertFormsInClassScope { // Support for showing register content on asserts/guarantees. #ifdef CAN_SHOW_REGISTERS_ON_ASSERT void initialize_assert_poison() { - char* page = os::reserve_memory(os::vm_page_size()); + char* page = os::reserve_memory(os::vm_page_size(), !ExecMem, mtInternal); if (page) { - MemTracker::record_virtual_memory_tag(page, mtInternal); - if (os::commit_memory(page, os::vm_page_size(), false) && + if (os::commit_memory(page, os::vm_page_size(), !ExecMem) && os::protect_memory(page, os::vm_page_size(), os::MEM_PROT_NONE)) { g_assert_poison = page; g_assert_poison_read_only = page; diff --git a/test/hotspot/gtest/gc/g1/test_freeRegionList.cpp b/test/hotspot/gtest/gc/g1/test_freeRegionList.cpp index bc45626deec..b3078c507be 100644 --- a/test/hotspot/gtest/gc/g1/test_freeRegionList.cpp +++ b/test/hotspot/gtest/gc/g1/test_freeRegionList.cpp @@ -50,7 +50,7 @@ TEST_OTHER_VM(G1FreeRegionList, length) { // the BOT. size_t bot_size = G1BlockOffsetTable::compute_size(heap.word_size()); HeapWord* bot_data = NEW_C_HEAP_ARRAY(HeapWord, bot_size, mtGC); - ReservedSpace bot_rs(G1BlockOffsetTable::compute_size(heap.word_size())); + ReservedSpace bot_rs(G1BlockOffsetTable::compute_size(heap.word_size()), mtGC); G1RegionToSpaceMapper* bot_storage = G1RegionToSpaceMapper::create_mapper(bot_rs, bot_rs.size(), diff --git a/test/hotspot/gtest/memory/test_virtualspace.cpp b/test/hotspot/gtest/memory/test_virtualspace.cpp index 2240f0f4cb3..da91c751892 100644 --- a/test/hotspot/gtest/memory/test_virtualspace.cpp +++ b/test/hotspot/gtest/memory/test_virtualspace.cpp @@ -64,7 +64,7 @@ namespace { static void test_reserved_size(size_t size) { ASSERT_PRED2(is_size_aligned, size, os::vm_allocation_granularity()); - ReservedSpace rs(size); + ReservedSpace rs(size, mtTest); MemoryReleaser releaser(&rs); EXPECT_TRUE(rs.base() != nullptr) << "rs.special: " << rs.special(); @@ -215,7 +215,7 @@ namespace { default: case Default: case Reserve: - return ReservedSpace(reserve_size_aligned); + return ReservedSpace(reserve_size_aligned, mtTest); case Disable: case Commit: return ReservedSpace(reserve_size_aligned, @@ -387,7 +387,7 @@ class TestReservedSpace : AllStatic { static void test_reserved_space2(size_t size) { ASSERT_TRUE(is_aligned(size, os::vm_allocation_granularity())) << "Must be at least AG aligned"; - ReservedSpace rs(size); + ReservedSpace rs(size, mtTest); EXPECT_TRUE(rs.base() != nullptr); EXPECT_EQ(rs.size(), size) << "rs.size: " << rs.size(); @@ -516,7 +516,7 @@ class TestVirtualSpace : AllStatic { default: case Default: case Reserve: - return ReservedSpace(reserve_size_aligned); + return ReservedSpace(reserve_size_aligned, mtTest); case Disable: case Commit: return ReservedSpace(reserve_size_aligned, diff --git a/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp b/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp index b098416456d..f2b3b843c23 100644 --- a/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp +++ b/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp @@ -93,7 +93,7 @@ class VirtualMemoryTrackerTest { static void test_add_committed_region_adjacent() { size_t size = 0x01000000; - ReservedSpace rs(size); + ReservedSpace rs(size, mtTest); address addr = (address)rs.base(); address frame1 = (address)0x1234; @@ -167,7 +167,7 @@ class VirtualMemoryTrackerTest { static void test_add_committed_region_adjacent_overlapping() { size_t size = 0x01000000; - ReservedSpace rs(size); + ReservedSpace rs(size, mtTest); address addr = (address)rs.base(); address frame1 = (address)0x1234; @@ -254,7 +254,7 @@ class VirtualMemoryTrackerTest { static void test_add_committed_region_overlapping() { size_t size = 0x01000000; - ReservedSpace rs(size); + ReservedSpace rs(size, mtTest); address addr = (address)rs.base(); address frame1 = (address)0x1234; @@ -425,7 +425,7 @@ class VirtualMemoryTrackerTest { static void test_remove_uncommitted_region() { size_t size = 0x01000000; - ReservedSpace rs(size); + ReservedSpace rs(size, mtTest); address addr = (address)rs.base(); address frame1 = (address)0x1234; From ef8da28487f918c38fab3096eaeed572d5ea5b90 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Thu, 5 Dec 2024 15:31:43 +0000 Subject: [PATCH 15/27] 8345591: [aarch64] macroAssembler_aarch64.cpp compile fails ceil_log2 not declared Reviewed-by: coleenp, alanb, syan --- src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index 66742c1c82e..a836d71205e 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -5305,7 +5305,7 @@ MacroAssembler::KlassDecodeMode MacroAssembler::klass_decode_mode() { if (operand_valid_for_logical_immediate( /*is32*/false, (uint64_t)CompressedKlassPointers::base())) { const size_t range = CompressedKlassPointers::klass_range_end() - CompressedKlassPointers::base(); - const uint64_t range_mask = right_n_bits(ceil_log2(range)); + const uint64_t range_mask = right_n_bits(log2i_ceil(range)); if (((uint64_t)CompressedKlassPointers::base() & range_mask) == 0) { return (_klass_decode_mode = KlassDecodeXor); } From 1ece4f9d93c20e71a28d5df06dff546c87342782 Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Thu, 5 Dec 2024 15:40:12 +0000 Subject: [PATCH 16/27] 8345514: Should use internal class name when calling ClassLoader.getResourceAsByteArray Reviewed-by: iklam, matsaave --- src/hotspot/share/cds/filemap.cpp | 6 ++-- .../appcds/jvmti/CFLH/MultiReleaseJars.java | 29 ++++++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index b7b08009dcc..594d8817322 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -2731,8 +2731,8 @@ ClassFileStream* FileMapInfo::get_stream_from_class_loader(Handle class_loader, const char* file_name, TRAPS) { JavaValue result(T_OBJECT); - TempNewSymbol class_name_sym = SymbolTable::new_symbol(file_name); - Handle ext_class_name = java_lang_String::externalize_classname(class_name_sym, CHECK_NULL); + oop class_name = java_lang_String::create_oop_from_str(file_name, THREAD); + Handle h_class_name = Handle(THREAD, class_name); // byte[] ClassLoader.getResourceAsByteArray(String name) JavaCalls::call_virtual(&result, @@ -2740,7 +2740,7 @@ ClassFileStream* FileMapInfo::get_stream_from_class_loader(Handle class_loader, vmClasses::ClassLoader_klass(), vmSymbols::getResourceAsByteArray_name(), vmSymbols::getResourceAsByteArray_signature(), - ext_class_name, + h_class_name, CHECK_NULL); assert(result.get_type() == T_OBJECT, "just checking"); oop obj = result.get_oop(); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jvmti/CFLH/MultiReleaseJars.java b/test/hotspot/jtreg/runtime/cds/appcds/jvmti/CFLH/MultiReleaseJars.java index 92c5e3d5f02..2997beeb155 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jvmti/CFLH/MultiReleaseJars.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jvmti/CFLH/MultiReleaseJars.java @@ -49,8 +49,8 @@ static String getMain() { String sts = """ public class Main { public static void main(String[] args) throws Exception { - System.out.println(Class.forName(\"Foo\")); - System.out.println(Class.forName(\"Bar\")); + System.out.println(Class.forName("pkg1.Foo")); + System.out.println(Class.forName("pkg2.Bar")); } } """; @@ -59,6 +59,7 @@ public static void main(String[] args) throws Exception { static String getFoo() { String sts = """ + package pkg1; class Foo { static { System.out.println("Hello from Foo old version"); @@ -70,6 +71,7 @@ class Foo { static String getFooNewVersion() { String sts = """ + package pkg1; class Foo { static { System.out.println("Hello from Foo new version"); @@ -81,6 +83,7 @@ class Foo { static String getBar() { String sts = """ + package pkg2; class Bar { static { System.out.println("Hello from Bar"); @@ -107,13 +110,17 @@ static void writeFile(File file, String... contents) throws Exception { /* version.jar entries and files: * META-INF/ * META-INF/MANIFEST.MF - * Bar.class * Main.class + * pkg2/ + * pkg2/Bar.class * META-INF/versions/9/ - * META-INF/versions/9/Bar.class - * META-INF/versions/9/Foo.class + * META-INF/versions/9/pkg1 + * META-INF/versions/9/pkg1/Foo.class + * META-INF/versions/9/pkg2 + * META-INF/versions/9/pkg2/Bar.class * META-INF/versions/24/ - * META-INF/versions/24/Foo.class + * META-INF/versions/24/pkg1 + * META-INF/versions/24/pkg1Foo.class */ static void createClassFilesAndJar() throws Exception { String tempDir = CDSTestUtils.getOutputDir(); @@ -163,25 +170,25 @@ public static void main(String... args) throws Exception { String mainClass = "Main"; String appJar = TestCommon.getTestJar("multi-version.jar"); - String appClasses[] = {"Foo", "Bar"}; + String appClasses[] = {"pkg1/Foo", "pkg2/Bar"}; OutputAnalyzer output = TestCommon.dump(appJar, appClasses); output.shouldContain("Loading classes to share: done.") .shouldHaveExitValue(0); - String agentCmdArg = "-agentlib:SimpleClassFileLoadHook=Foo,Hello,HELLO"; + String agentCmdArg = "-agentlib:SimpleClassFileLoadHook=pkg1/Foo,Hello,HELLO"; output = TestCommon.execAuto("-cp", appJar, "-Xlog:cds=info,class+load", agentCmdArg, mainClass); - output.shouldMatch(".*Foo.source:.*multi-version.jar") + output.shouldMatch(".*pkg1.Foo.source:.*multi-version.jar") // New version of Foo is loaded from jar since it was modified by CFLH .shouldContain("HELLO from Foo new version") // CFLH changed "Hello" to "HELLO" - .shouldContain("class Foo") // output from Main + .shouldContain("class pkg1.Foo") // output from Main // Bar is loaded from archive .shouldContain("Bar source: shared objects file") .shouldContain("Hello from Bar") - .shouldContain("class Bar"); // output from Main + .shouldContain("class pkg2.Bar"); // output from Main } } From 5a0899fc09966149044f746b3a613cd97a5265b4 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Thu, 5 Dec 2024 16:17:17 +0000 Subject: [PATCH 17/27] 8345302: Building microbenchmarks require larger Java heap Reviewed-by: shade, mcimadamore --- make/autoconf/boot-jdk.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make/autoconf/boot-jdk.m4 b/make/autoconf/boot-jdk.m4 index d729012ad6a..d39e6e75a94 100644 --- a/make/autoconf/boot-jdk.m4 +++ b/make/autoconf/boot-jdk.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -470,7 +470,7 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS], # Maximum amount of heap memory. JVM_HEAP_LIMIT_32="768" # Running a 64 bit JVM allows for and requires a bigger heap - JVM_HEAP_LIMIT_64="1600" + JVM_HEAP_LIMIT_64="2048" JVM_HEAP_LIMIT_GLOBAL=`expr $MEMORY_SIZE / 2` if test "$JVM_HEAP_LIMIT_GLOBAL" -lt "$JVM_HEAP_LIMIT_32"; then JVM_HEAP_LIMIT_32=$JVM_HEAP_LIMIT_GLOBAL From 85fedbf668023fd00d70ec649504c2f80e4c84bb Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Thu, 5 Dec 2024 16:44:18 +0000 Subject: [PATCH 18/27] 8344607: Link Time Optimization - basic support for clang Reviewed-by: lucy, jkern, ihse --- make/hotspot/lib/JvmFeatures.gmk | 6 ++++++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/make/hotspot/lib/JvmFeatures.gmk b/make/hotspot/lib/JvmFeatures.gmk index b94031515f7..09a48508eff 100644 --- a/make/hotspot/lib/JvmFeatures.gmk +++ b/make/hotspot/lib/JvmFeatures.gmk @@ -174,6 +174,12 @@ ifeq ($(call check-jvm-feature, link-time-opt), true) -fno-fat-lto-objects JVM_LDFLAGS_FEATURES += $(CXX_O_FLAG_HIGHEST_JVM) -flto=auto \ -fuse-linker-plugin -fno-strict-aliasing + else ifeq ($(call isCompiler, clang), true) + JVM_CFLAGS_FEATURES += -flto -fno-strict-aliasing + ifeq ($(call isBuildOs, aix), true) + JVM_CFLAGS_FEATURES += -ffat-lto-objects + endif + JVM_LDFLAGS_FEATURES += $(CXX_O_FLAG_HIGHEST_JVM) -flto -fno-strict-aliasing else ifeq ($(call isCompiler, microsoft), true) JVM_CFLAGS_FEATURES += -GL JVM_LDFLAGS_FEATURES += -LTCG:INCREMENTAL diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp index 7702dbd17ad..1e3602d08f4 100644 --- a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp +++ b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp @@ -501,6 +501,7 @@ static inline void atomic_copy64(const volatile void *src, volatile void *dst) { } extern "C" { + // needs local assembler label '1:' to avoid trouble when using linktime optimization int SpinPause() { // We don't use StubRoutines::aarch64::spin_wait stub in order to // avoid a costly call to os::current_thread_enable_wx() on MacOS. @@ -523,14 +524,14 @@ extern "C" { // to entry for case SpinWait::NOP " add %[d], %[d], %[o] \n" " br %[d] \n" - " b SpinPause_return \n" // case SpinWait::NONE (-1) + " b 1f \n" // case SpinWait::NONE (-1) " nop \n" // padding " nop \n" // case SpinWait::NOP ( 0) - " b SpinPause_return \n" + " b 1f \n" " isb \n" // case SpinWait::ISB ( 1) - " b SpinPause_return \n" + " b 1f \n" " yield \n" // case SpinWait::YIELD ( 2) - "SpinPause_return: \n" + "1: \n" : [d]"=&r"(br_dst) : [o]"r"(off) : "memory"); From 3aa07dbf14e800682ab37b3fcbc597c4d0d17a48 Mon Sep 17 00:00:00 2001 From: Matias Saavedra Silva Date: Thu, 5 Dec 2024 22:01:31 +0000 Subject: [PATCH 19/27] 8343890: SEGV crash in RunTimeClassInfo::klass Reviewed-by: ccheung Backport-of: bf0debc023a42ccdf2f589039e4d98e11424b4dd --- src/hotspot/share/cds/runTimeClassInfo.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/cds/runTimeClassInfo.cpp b/src/hotspot/share/cds/runTimeClassInfo.cpp index 0acd89b5bce..e2d41cd1de2 100644 --- a/src/hotspot/share/cds/runTimeClassInfo.cpp +++ b/src/hotspot/share/cds/runTimeClassInfo.cpp @@ -76,10 +76,13 @@ void RunTimeClassInfo::init(DumpTimeClassInfo& info) { } InstanceKlass* RunTimeClassInfo::klass() const { - if (ArchiveBuilder::is_active() && ArchiveBuilder::current()->is_in_buffer_space((address)this)) { - return ArchiveBuilder::current()->offset_to_buffered(_klass_offset); - } else { + if (MetaspaceShared::is_in_shared_metaspace(this)) { + // is inside a mmaped CDS archive. return ArchiveUtils::offset_to_archived_address(_klass_offset); + } else { + // is a temporary copy of a RunTimeClassInfo that's being initialized + // by the ArchiveBuilder. + return ArchiveBuilder::current()->offset_to_buffered(_klass_offset); } } From 8e9ba788ae04a9a617a393709bf2c51a0c157206 Mon Sep 17 00:00:00 2001 From: Fernando Guallini Date: Fri, 6 Dec 2024 18:41:47 +0000 Subject: [PATCH 20/27] 8345414: Google CAInterop test failures Reviewed-by: rhalade --- .../certification/CAInterop.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java index 2bfd3ea7603..5612ad4a8a2 100644 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java +++ b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java @@ -635,20 +635,20 @@ private CATestURLs getTestURLs(String alias) { "https://revoked.sfig2.catest.starfieldtech.com"); case "globalsigneccrootcar4" -> - new CATestURLs("https://good.gsr4.demo.pki.goog", - "https://revoked.gsr4.demo.pki.goog"); + new CATestURLs("https://good.gsr4.demosite.pki.goog", + "https://revoked.gsr4.demosite.pki.goog"); case "gtsrootcar1" -> - new CATestURLs("https://good.gtsr1.demo.pki.goog", - "https://revoked.gtsr1.demo.pki.goog"); + new CATestURLs("https://good.gtsr1.demosite.pki.goog", + "https://revoked.gtsr1.demosite.pki.goog"); case "gtsrootcar2" -> - new CATestURLs("https://good.gtsr2.demo.pki.goog", - "https://revoked.gtsr2.demo.pki.goog"); + new CATestURLs("https://good.gtsr2.demosite.pki.goog", + "https://revoked.gtsr2.demosite.pki.goog"); case "gtsrootecccar3" -> - new CATestURLs("https://good.gtsr3.demo.pki.goog", - "https://revoked.gtsr3.demo.pki.goog"); + new CATestURLs("https://good.gtsr3.demosite.pki.goog", + "https://revoked.gtsr3.demosite.pki.goog"); case "gtsrootecccar4" -> - new CATestURLs("https://good.gtsr4.demo.pki.goog", - "https://revoked.gtsr4.demo.pki.goog"); + new CATestURLs("https://good.gtsr4.demosite.pki.goog", + "https://revoked.gtsr4.demosite.pki.goog"); case "microsoftecc2017" -> new CATestURLs("https://acteccroot2017.pki.microsoft.com", From 203422a8ed7bd30ca300960a7540977349866d25 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 9 Dec 2024 15:57:55 +0000 Subject: [PATCH 21/27] 8345424: Move FindDebuginfoFiles out of FileUtils.gmk Reviewed-by: erikj Backport-of: 5f30a8d90cbc3f163e2328cda5a9eb6ad0f1787a --- make/Images.gmk | 1 + make/StaticLibs.gmk | 1 + make/common/DebugInfoUtils.gmk | 58 ++++++++++++++++++++++++++++++++++ make/common/FileUtils.gmk | 23 -------------- 4 files changed, 60 insertions(+), 23 deletions(-) create mode 100644 make/common/DebugInfoUtils.gmk diff --git a/make/Images.gmk b/make/Images.gmk index 5f987a2f71a..c5d0ef11b5d 100644 --- a/make/Images.gmk +++ b/make/Images.gmk @@ -29,6 +29,7 @@ include $(SPEC) include MakeBase.gmk include CopyFiles.gmk +include DebugInfoUtils.gmk include Execute.gmk include Modules.gmk include Utils.gmk diff --git a/make/StaticLibs.gmk b/make/StaticLibs.gmk index 78918c456ee..cfca2a77411 100644 --- a/make/StaticLibs.gmk +++ b/make/StaticLibs.gmk @@ -29,6 +29,7 @@ include $(SPEC) include MakeBase.gmk include CopyFiles.gmk +include DebugInfoUtils.gmk include Modules.gmk include modules/LauncherCommon.gmk diff --git a/make/common/DebugInfoUtils.gmk b/make/common/DebugInfoUtils.gmk new file mode 100644 index 00000000000..69d6c24b5e0 --- /dev/null +++ b/make/common/DebugInfoUtils.gmk @@ -0,0 +1,58 @@ +# +# Copyright (c) 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +ifeq ($(_MAKEBASE_GMK), ) + $(error You must include MakeBase.gmk prior to including DebugInfoUtils.gmk) +endif + +################################################################################ +# +# Common debuginfo utility functions +# +################################################################################ + +################################################################################ +# Find native debuginfo files in a directory +# +# Param 1 - dir to find debuginfo files in +FindDebuginfoFiles = \ + $(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \ + $(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \ + $(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES))) + +# Pick the correct debug info files to copy, either zipped or not. +ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true) + DEBUGINFO_SUFFIXES += .diz +else + DEBUGINFO_SUFFIXES := .debuginfo .pdb .map + # On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM + # dirs. + ifeq ($(call isTargetOs, macosx), true) + $(call FillFindCache, \ + $(SUPPORT_OUTPUTDIR)/modules_libs $(SUPPORT_OUTPUTDIR)/modules_cmds) + FindDebuginfoFiles = \ + $(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1))) + endif +endif diff --git a/make/common/FileUtils.gmk b/make/common/FileUtils.gmk index d546ab94a58..d3cc4872ebb 100644 --- a/make/common/FileUtils.gmk +++ b/make/common/FileUtils.gmk @@ -307,26 +307,3 @@ ifeq ($(DISABLE_CACHE_FIND), true) else FindFiles = $(CacheFindFiles) endif - -# Find native debuginfo files in a directory -# -# Param 1 - dir to find debuginfo files in -FindDebuginfoFiles = \ - $(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \ - $(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \ - $(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES))) - -# Pick the correct debug info files to copy, either zipped or not. -ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true) - DEBUGINFO_SUFFIXES += .diz -else - DEBUGINFO_SUFFIXES := .debuginfo .pdb .map - # On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM - # dirs. - ifeq ($(call isTargetOs, macosx), true) - $(call FillFindCache, \ - $(SUPPORT_OUTPUTDIR)/modules_libs $(SUPPORT_OUTPUTDIR)/modules_cmds) - FindDebuginfoFiles = \ - $(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1))) - endif -endif From a81325433d7da6b73abb37ea3e33489d0a3afbae Mon Sep 17 00:00:00 2001 From: Chen Liang Date: Mon, 9 Dec 2024 18:35:16 +0000 Subject: [PATCH 22/27] 8334733: Remove obsolete @enablePreview from tests after JDK-8334714 Reviewed-by: mchung Backport-of: 496641955041c5e48359e6256a4a61812653d900 --- .../runtime/test/TestResolvedJavaMethod.java | 1 - .../dcmd/framework/VMVersionTest.java | 1 - test/hotspot/jtreg/testlibrary/ctw/Makefile | 4 ++-- .../records/BadCanonicalCtrTest.java | 1 - .../records/ProhibitedMethods.java | 1 - .../records/SerialPersistentFieldsTest.java | 1 - .../getSimpleName/GetSimpleNameTest.java | 1 - .../lang/ModuleTests/AnnotationsTest.java | 1 - test/jdk/java/lang/StackWalker/TestBCI.java | 1 - .../AnnotationTypeMismatchTest.java | 1 - .../ArityTypeMismatchTest.java | 1 - .../ArrayTypeMismatchTest.java | 1 - .../EnumTypeMismatchTest.java | 1 - .../lang/annotation/AnnotationVerifier.java | 1 - .../instrument/NativeMethodPrefixApp.java | 3 --- .../java/lang/instrument/RetransformApp.java | 3 --- .../lang/invoke/8022701/MHIllegalAccess.java | 1 - .../jdk/java/lang/invoke/DefineClassTest.java | 1 - .../invoke/MethodHandleProxies/BasicTest.java | 1 - .../WrapperHiddenClassTest.java | 1 - .../classData/ClassDataTest.java | 1 - .../invoke/accessProtectedSuper/Test.java | 1 - .../condy/BootstrapMethodJumboArgsTest.java | 1 - .../lang/invoke/condy/CondyBSMException.java | 1 - .../lang/invoke/condy/CondyBSMInvocation.java | 1 - .../invoke/condy/CondyBSMValidationTest.java | 1 - .../CondyInterfaceWithOverpassMethods.java | 1 - .../invoke/condy/CondyNameValidationTest.java | 1 - .../lang/invoke/condy/CondyNestedTest.java | 1 - .../condy/CondyRepeatFailedResolution.java | 1 - .../condy/CondyReturnPrimitiveTest.java | 1 - .../condy/CondyStaticArgumentsTest.java | 1 - .../invoke/condy/CondyTypeValidationTest.java | 1 - .../invoke/condy/CondyWithGarbageTest.java | 1 - .../lang/invoke/condy/CondyWrongType.java | 1 - .../invoke/condy/ConstantBootstrapsTest.java | 1 - .../invoke/defineHiddenClass/BasicTest.java | 5 +---- .../defineHiddenClass/HiddenNestmateTest.java | 1 - .../StaticInvocableTest.java | 1 - .../java/lang/invoke/lambda/LambdaAsm.java | 1 - .../lang/invoke/lambda/LambdaStackTrace.java | 1 - .../lang/invoke/lookup/SpecialStatic.java | 1 - .../lang/module/ClassFileVersionsTest.java | 1 - .../java/lang/module/ConfigurationTest.java | 1 - .../lang/module/ModuleDescriptorTest.java | 1 - .../java/lang/module/ModuleFinderTest.java | 1 - .../jdk/java/lang/module/ModuleNamesTest.java | 1 - .../java/lang/module/MultiReleaseJarTest.java | 1 - .../Generics/TestMissingTypeVariable.java | 1 - .../TestPrivateInterfaceMethodReflect.java | 1 - .../lang/reflect/records/IsRecordTest.java | 1 - .../ExactnessConversionsSupportTest.java | 2 -- .../lang/runtime/SwitchBootstrapsTest.java | 1 - .../Provider/SecurityProviderModularTest.java | 1 - .../java/time/chrono/HijrahConfigTest.java | 1 - .../util/ServiceLoader/BadProvidersTest.java | 1 - .../login/modules/JaasModularClientTest.java | 1 - .../jdk/classfile/ClassHierarchyInfoTest.java | 1 - test/jdk/jdk/classfile/SnippetsTest.java | 3 +-- test/jdk/jdk/classfile/TEST.properties | 1 - test/jdk/jdk/classfile/VerifierSelfTest.java | 1 - .../CallerSensitiveFinder.java | 1 - .../reflect/CallerSensitive/CheckCSMs.java | 1 - .../MissingCallerSensitive.java | 1 - .../event/compiler/TestCompilerInlining.java | 1 - .../jdk/jfr/event/io/TestInstrumentation.java | 3 --- .../javaagent/TestEventInstrumentation.java | 1 - test/jdk/jdk/lambda/TEST.properties | 1 - .../jdk/modules/incubator/ServiceBinding.java | 1 - .../jdk/sun/tools/jcmd/TestProcessHelper.java | 1 - .../tools/jimage/JImageNonAsciiNameTest.java | 1 - test/jdk/tools/jimage/JImageTest.java | 1 - test/jdk/tools/jlink/DefaultProviderTest.java | 1 - .../tools/jlink/ExplodedModuleNameTest.java | 1 - test/jdk/tools/jlink/IntegrationTest.java | 1 - test/jdk/tools/jlink/JLink100Modules.java | 1 - test/jdk/tools/jlink/JLink2Test.java | 1 - .../jlink/JLinkDedupTestBatchSizeOne.java | 1 - test/jdk/tools/jlink/JLinkNegativeTest.java | 1 - test/jdk/tools/jlink/JLinkOptionsTest.java | 1 - test/jdk/tools/jlink/JLinkPluginsTest.java | 1 - test/jdk/tools/jlink/JLinkTest.java | 1 - .../jdk/tools/jlink/ModuleNamesOrderTest.java | 1 - test/jdk/tools/jlink/NativeTest.java | 1 - .../jlink/plugins/AddOptionsPluginTest.java | 1 - .../tools/jlink/plugins/CDSPluginTest.java | 1 - .../plugins/GenerateJLIClassesPluginTest.java | 1 - .../plugins/IncludeLocalesPluginTest.java | 1 - .../plugins/SaveJlinkArgfilesPluginTest.java | 1 - .../plugins/StringSharingPluginTest.java | 1 - .../StripJavaDebugAttributesPluginTest.java | 1 - .../jlink/plugins/VendorInfoPluginsTest.java | 1 - .../jdk/javadoc/tool/CheckResourceKeys.java | 1 - .../tools/javac/4241573/T4241573.java | 2 -- .../tools/javac/7003595/T7003595.java | 4 +--- .../CPoolRefClassContainingInlinedCts.java | 2 -- .../CheckACC_STRICTFlagOnclinitTest.java | 1 - .../8000518/DuplicateConstantPoolEntry.java | 2 -- ...eckACC_STRICTFlagOnPkgAccessClassTest.java | 2 -- .../8009170/RedundantByteCodeInArrayTest.java | 1 - .../AnonymousClass/AnonymousClassFlags.java | 2 -- .../MethodParameters/AnnotationTest.java | 2 -- .../MethodParameters/AnonymousClass.java | 2 -- .../MethodParameters/ClassFileVisitor.java | 2 +- .../javac/MethodParameters/Constructors.java | 2 -- .../javac/MethodParameters/EnumTest.java | 2 -- .../MethodParameters/InstanceMethods.java | 2 -- .../javac/MethodParameters/LambdaTest.java | 2 -- .../LegacyOutputTest/LegacyOutputTest.java | 2 -- .../MethodParameters/LocalClassTest.java | 2 -- .../MethodParameters/MemberClassTest.java | 2 -- .../javac/MethodParameters/StaticMethods.java | 2 -- .../MethodParameters/UncommonParamNames.java | 2 -- .../tools/javac/MethodParametersTest.java | 4 +--- .../tools/javac/NoStringToLower.java | 3 +-- .../ImplicitParameters.java | 2 -- .../StringConcat/TestIndyStringConcat.java | 1 - .../StringConcat/WellKnownTypeSignatures.java | 2 -- .../javac/StringConcat/WellKnownTypes.java | 1 - .../tools/javac/StringConcat/access/Test.java | 1 - ...ationsAreNotCopiedToBridgeMethodsTest.java | 4 +--- .../DebugPointerAtBadPositionTest.java | 4 +--- .../InlinedFinallyConfuseDebuggersTest.java | 4 +--- .../tools/javac/T7053059/DoubleCastTest.java | 4 +--- test/langtools/tools/javac/T7093325.java | 4 +--- ...rClassAttrMustNotHaveStrictFPFlagTest.java | 1 - .../T8003967/DetectMutableStaticFields.java | 14 ++++++-------- ...rNamesAreNotCopiedToAnonymousInitTest.java | 7 +------ .../EmptyUTF8ForInnerClassNameTest.java | 1 - .../javac/T8019486/WrongLNTForLambdaTest.java | 2 -- .../DeadCodeGeneratedForEmptyTryTest.java | 4 +--- .../NoDeadCodeGenerationOnTrySmtTest.java | 2 -- .../DontGenerateLVTForGNoneOpTest.java | 1 - .../MissingLNTEntryForBreakContinueTest.java | 4 +--- .../MissingLNTEntryForFinalizerTest.java | 4 +--- .../T8187805/BogusRTTAForUnusedVarTest.java | 4 +--- ...TargetIsNotAddedAsMarkerInterfaceTest.java | 4 +--- .../T8209173/CodeCompletionExceptTest.java | 4 +--- ...oLocalsMustBeReservedForDCEedVarsTest.java | 1 - .../javac/T8222949/TestConstantDynamic.java | 4 +--- .../TryWithResources/TwrSimpleClose.java | 2 -- .../ApplicableAnnotationsOnRecords.java | 2 -- .../annotations/SyntheticParameters.java | 2 -- .../parameter/ParameterAnnotations.java | 5 ++--- .../TypeAnnotationsPositionsOnRecords.java | 2 -- .../VariablesDeclaredWithVarTest.java | 2 -- .../classfile/AnonymousClassTest.java | 2 -- .../classfile/CombinationsTargetTest1.java | 2 -- .../classfile/CombinationsTargetTest2.java | 2 -- .../classfile/CombinationsTargetTest3.java | 2 -- .../typeAnnotations/classfile/DeadCode.java | 2 -- .../classfile/InstanceInitializer.java | 2 -- .../classfile/NewTypeArguments.java | 2 -- .../classfile/NoTargetAnnotations.java | 2 -- .../typeAnnotations/classfile/Scopes.java | 2 -- .../classfile/StaticInitializer.java | 2 -- .../classfile/SyntheticParameters.java | 2 -- .../typeAnnotations/classfile/T8008762.java | 2 -- .../typeAnnotations/classfile/T8008769.java | 2 -- .../typeAnnotations/classfile/T8010015.java | 2 -- .../classfile/TestAnonInnerClasses.java | 3 --- .../classfile/TestNewCastArray.java | 2 -- .../TypeAnnotationPropagationTest.java | 2 -- .../typeAnnotations/classfile/TypeCasts.java | 1 - .../typeAnnotations/classfile/Wildcards.java | 1 - .../referenceinfos/ClassExtends.java | 2 -- .../referenceinfos/ClassTypeParam.java | 2 -- .../ConstructorInvocationTypeArgument.java | 2 -- .../referenceinfos/Constructors.java | 2 -- .../referenceinfos/ExceptionParameters.java | 2 -- .../referenceinfos/Fields.java | 2 -- .../referenceinfos/FromSpecification.java | 2 -- .../referenceinfos/Initializers.java | 2 -- .../referenceinfos/Lambda.java | 2 -- .../MethodInvocationTypeArgument.java | 2 -- .../referenceinfos/MethodParameters.java | 2 -- .../referenceinfos/MethodReceivers.java | 2 -- .../referenceinfos/MethodReturns.java | 2 -- .../referenceinfos/MethodThrows.java | 2 -- .../referenceinfos/MethodTypeParam.java | 2 -- .../referenceinfos/MultiCatch.java | 2 -- .../referenceinfos/NestedTypes.java | 2 -- .../referenceinfos/NewObjects.java | 2 -- .../RepeatingTypeAnnotations.java | 2 -- .../referenceinfos/ResourceVariable.java | 2 -- .../referenceinfos/TypeCasts.java | 2 -- .../referenceinfos/TypeTests.java | 2 -- .../intersection/DuplicatedCheckcastTest.java | 4 +--- .../InnerClasses/SyntheticClasses.java | 2 -- .../javac/classfiles/T8255757/T8255757.java | 2 -- .../AnnotationDefaultTest.java | 1 - .../EnclosingMethod/EnclosingMethodTest.java | 1 - .../LineNumberTable/LineNumberTest.java | 1 - .../MultipleRecordPatterns.java | 1 - .../LineNumberTable/RuleSwitchBreaks.java | 1 - .../LineNumberTable/StringSwitchBreaks.java | 1 - .../attributes/LineNumberTable/T8050993.java | 2 -- .../attributes/LineNumberTable/T8314275.java | 1 - .../LocalVariableTableTest.java | 1 - .../LocalVariableTypeTableTest.java | 1 - .../attributes/Module/ModuleFlagTest.java | 2 -- .../attributes/Module/ModuleTest.java | 2 -- .../attributes/Signature/ConstructorTest.java | 1 - .../attributes/Signature/EnumTest.java | 1 - .../attributes/Signature/ExceptionTest.java | 1 - .../attributes/Signature/FieldTest.java | 1 - .../attributes/Signature/InnerClassTest.java | 1 - .../Signature/MethodParameterTest.java | 1 - .../Signature/MethodTypeBoundTest.java | 1 - .../attributes/Signature/ReturnTypeTest.java | 1 - .../SourceFile/AnonymousClassTest.java | 1 - .../attributes/SourceFile/InnerClassTest.java | 1 - .../attributes/SourceFile/LocalClassTest.java | 1 - .../attributes/SourceFile/MixTest.java | 1 - .../attributes/SourceFile/ModuleInfoTest.java | 1 - .../SourceFile/NoSourceFileAttribute.java | 1 - .../SourceFile/SyntheticClassTest.java | 1 - .../TopLevelClassesOneFileTest.java | 1 - ...ssToPrivateInnerClassConstructorsTest.java | 2 -- .../AccessToPrivateInnerClassMembersTest.java | 2 -- .../AccessToPrivateSiblingsTest.java | 2 -- .../attributes/Synthetic/AssertFieldTest.java | 2 -- .../BridgeMethodForGenericMethodTest.java | 2 -- ...geMethodsForLambdaTargetRelease14Test.java | 5 ++--- .../Synthetic/BridgeMethodsForLambdaTest.java | 2 -- .../attributes/Synthetic/EnumTest.java | 2 -- .../attributes/Synthetic/PackageInfoTest.java | 2 -- .../attributes/Synthetic/ThisFieldTest.java | 2 -- ...untimeAnnotationsForGenericMethodTest.java | 4 +--- ...timeAnnotationsForInnerAnnotationTest.java | 4 +--- .../RuntimeAnnotationsForInnerClassTest.java | 4 +--- .../RuntimeAnnotationsForInnerEnumTest.java | 4 +--- ...ntimeAnnotationsForInnerInterfaceTest.java | 4 +--- ...untimeAnnotationsForTopLevelClassTest.java | 4 +--- ...ameterAnnotationsForGenericMethodTest.java | 4 +--- ...timeParameterAnnotationsForLambdaTest.java | 4 +--- .../RuntimeParameterAnnotationsTest.java | 4 +--- .../deprecated/DeprecatedPackageTest.java | 2 -- .../attributes/deprecated/DeprecatedTest.java | 1 - ...InnerAnnotationsInInnerAnnotationTest.java | 1 - .../InnerAnnotationsInInnerClassTest.java | 1 - .../InnerAnnotationsInInnerEnumTest.java | 1 - .../InnerAnnotationsInInnerInterfaceTest.java | 1 - .../InnerClassesHierarchyTest.java | 2 -- .../InnerClassesInAnonymousClassTest.java | 1 - .../InnerClassesInInnerAnnotationTest.java | 1 - .../InnerClassesInInnerClassTest.java | 1 - .../InnerClassesInInnerEnumTest.java | 1 - .../InnerClassesInInnerInterfaceTest.java | 1 - .../InnerClassesInLocalClassTest.java | 1 - .../innerclasses/InnerClassesIndexTest.java | 2 -- .../innerclasses/InnerClassesTest.java | 1 - .../InnerEnumInInnerAnnotationTest.java | 1 - .../InnerEnumInInnerEnumTest.java | 1 - .../InnerEnumInInnerInterfaceTest.java | 1 - .../InnerEnumsInInnerClassTest.java | 1 - .../InnerInterfacesInInnerAnnotationTest.java | 1 - .../InnerInterfacesInInnerClassTest.java | 1 - .../InnerInterfacesInInnerEnumTest.java | 1 - .../InnerInterfacesInInnerInterfaceTest.java | 1 - .../innerclasses/NoInnerClassesTest.java | 2 -- .../classreader/8171132/BadConstantValue.java | 4 +--- .../javac/classreader/BadMethodParameter.java | 5 +---- .../IndyCorrectInvocationName.java | 2 -- .../tools/javac/code/CharImmediateValue.java | 2 -- .../javac/constDebug/ConstDebugTest.java | 1 - .../javac/defaultMethods/BadClassfile.java | 4 +--- ...heckACC_STRICTFlagOnDefaultMethodTest.java | 1 - .../javac/defaultMethods/TestDefaultBody.java | 2 -- .../TestNoBridgeOnDefaults.java | 2 -- .../super/TestDirectSuperInterfaceInvoke.java | 2 -- .../tools/javac/diags/CheckResourceKeys.java | 2 -- test/langtools/tools/javac/diags/Example.java | 11 ----------- .../BadConstantValueType.java | 1 - .../InvalidDefaultInterface.java | 1 - .../InvalidStaticInterface.java | 1 - .../_super/NonDirectSuper/NonDirectSuper.java | 2 -- .../tools/javac/file/SymLinkArchiveTest.java | 2 -- .../javac/file/SymLinkShortNameTest.java | 2 -- .../tools/javac/file/SymLinkTest.java | 2 -- .../tools/javac/flow/LVTHarness.java | 2 -- .../javac/generics/bridges/BridgeHarness.java | 4 +--- .../tools/javac/importscope/T8193717.java | 4 +--- .../jvm/ClassRefDupInConstantPoolTest.java | 1 - .../tools/javac/lambda/ByteCodeTest.java | 2 -- .../javac/lambda/LambdaTestStrictFPFlag.java | 1 - .../javac/lambda/LocalVariableTable.java | 2 -- .../lambda/TestBootstrapMethodsCount.java | 4 +--- .../tools/javac/lambda/TestInvokeDynamic.java | 4 +--- .../lambda/bytecode/TestLambdaBytecode.java | 4 +--- .../TestLambdaBytecodeTargetRelease14.java | 4 +--- .../deduplication/DeduplicationTest.java | 5 +---- ...estNonSerializableLambdaNameStability.java | 4 +--- .../tools/javac/launcher/GetResourceTest.java | 2 -- .../javac/launcher/SourceLauncherTest.java | 8 +++----- .../tools/javac/launcher/src/p/q/CLTest.java | 4 +--- .../ConditionalLineNumberTest.java | 1 - .../linenumbers/FinallyLineNumberTest.java | 1 - .../linenumbers/NestedLineNumberTest.java | 5 ++--- .../linenumbers/NullCheckLineNumberTest.java | 19 +++++++++---------- test/langtools/tools/javac/meth/TestCP.java | 2 -- .../javac/modules/AnnotationsOnModules.java | 2 -- .../tools/javac/modules/IncubatingTest.java | 2 -- .../tools/javac/modules/JavaBaseTest.java | 2 -- .../tools/javac/modules/ModuleVersion.java | 2 -- .../tools/javac/modules/OpenModulesTest.java | 2 -- .../javac/multicatch/7005371/T7005371.java | 2 -- .../tools/javac/multicatch/Pos05.java | 2 -- .../tools/javac/patterns/Annotations.java | 4 +--- .../javac/patterns/LocalVariableTable.java | 2 -- .../javac/patterns/MatchExceptionTest.java | 2 -- .../NestedPatternVariablesBytecode.java | 2 -- .../javac/patterns/NoUnnecessaryCast.java | 2 -- .../javac/platform/ModuleVersionTest.java | 1 - .../javac/platform/VerifyCTSymClassFiles.java | 1 - .../createsymbols/CreateSymbolsTest.java | 4 ---- .../javac/preview/PreviewAutoSuppress.java | 2 -- .../tools/javac/preview/PreviewErrors.java | 2 -- .../tools/javac/preview/PreviewTest.java | 2 -- .../model/element/TestFileObjectOf.java | 2 -- .../processing/model/element/TestOrigin.java | 2 -- .../javac/records/RecordCompilationTests.java | 2 -- .../RecordsBinaryCompatibilityTests.java | 2 -- .../RecordComponentTypeTest.java | 2 -- .../javac/recovery/AnnotationRecovery.java | 2 -- .../tools/javac/recovery/AttrRecovery.java | 2 -- .../tools/javac/recovery/FlowRecovery.java | 2 -- .../tools/javac/recovery/LambdaRecovery.java | 2 -- .../tools/javac/recovery/MethodModifiers.java | 2 -- .../tools/javac/resolve/NoObjectToString.java | 1 - .../sealed/BinaryCompatibilityTests.java | 2 -- .../sealed/CheckSubtypesOfSealedTest.java | 4 +--- .../sealed/SealedDiffConfigurationsTest.java | 2 -- .../tools/javac/sym/ElementStructureTest.java | 4 +--- .../tools/javac/varargs/6199075/T6199075.java | 4 +--- .../tools/javac/varargs/7042566/T7042566.java | 4 +--- test/langtools/tools/javap/T6716452.java | 1 - .../tools/javap/TestClassNameWarning.java | 1 - .../tools/javap/UndefinedAccessFlagTest.java | 1 - .../tools/javap/VerificationTest.java | 1 - .../javap/classfile/6888367/T6888367.java | 2 -- .../tools/javap/classfile/T6887895.java | 1 - .../tools/javap/classfile/deps/T6907575.java | 1 - .../typeAnnotations/JSR175Annotations.java | 1 - .../tools/javap/typeAnnotations/NewArray.java | 1 - .../tools/javap/typeAnnotations/Presence.java | 1 - .../javap/typeAnnotations/PresenceInner.java | 1 - .../javap/typeAnnotations/TypeCasts.java | 1 - .../javap/typeAnnotations/Visibility.java | 1 - .../javap/typeAnnotations/Wildcards.java | 1 - .../java/lang/classfile/TypeKindBench.java | 2 +- .../java/lang/classfile/Utf8EntryWriteTo.java | 2 +- .../java/lang/invoke/LazyStaticColdStart.java | 4 +--- .../classfile/AbstractCorpusBenchmark.java | 1 - .../jdk/classfile/ClassfileBenchmark.java | 4 +--- .../jdk/classfile/CodeAttributeTools.java | 1 - .../ConstantPoolBuildingClassEntry.java | 2 +- .../jdk/classfile/RebuildMethodBodies.java | 3 +-- .../jdk/classfile/RepeatedModelTraversal.java | 3 +-- .../openjdk/bench/jdk/classfile/Write.java | 1 - 360 files changed, 79 insertions(+), 632 deletions(-) diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java index 98d7d168ba7..75f074ad09d 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java @@ -32,7 +32,6 @@ * @clean jdk.internal.vm.test.AnnotationTestInput$Missing * @compile ../../../../../../../../../../../jdk/jdk/internal/vm/AnnotationEncodingDecoding/alt/MemberDeleted.java * ../../../../../../../../../../../jdk/jdk/internal/vm/AnnotationEncodingDecoding/alt/MemberTypeChanged.java - * @enablePreview * @modules jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime * jdk.internal.vm.ci/jdk.vm.ci.common diff --git a/test/hotspot/jtreg/serviceability/dcmd/framework/VMVersionTest.java b/test/hotspot/jtreg/serviceability/dcmd/framework/VMVersionTest.java index 23c414dfd6e..3e2de863eab 100644 --- a/test/hotspot/jtreg/serviceability/dcmd/framework/VMVersionTest.java +++ b/test/hotspot/jtreg/serviceability/dcmd/framework/VMVersionTest.java @@ -34,7 +34,6 @@ * @test * @bug 8221730 * @summary Test of diagnostic command VM.version (tests all DCMD executors) - * @enablePreview * @modules java.base/jdk.internal.misc * java.base/jdk.internal.module * java.compiler diff --git a/test/hotspot/jtreg/testlibrary/ctw/Makefile b/test/hotspot/jtreg/testlibrary/ctw/Makefile index b67500d0c5e..4cf20b12e52 100644 --- a/test/hotspot/jtreg/testlibrary/ctw/Makefile +++ b/test/hotspot/jtreg/testlibrary/ctw/Makefile @@ -42,8 +42,8 @@ JAVAC = $(JDK_HOME)/bin/javac JAR = $(JDK_HOME)/bin/jar SRC_FILES = $(shell find $(SRC_DIR) -name '*.java') -# Exclude files that need '--enable-preview' to compile. -LIB_FILES = $(filter-out %ModuleInfoWriter.java, $(shell find $(TESTLIBRARY_DIR)/jdk/test/lib/ \ +# Must exclude files that need '--enable-preview' to compile, if there is any. +LIB_FILES = $(shell find $(TESTLIBRARY_DIR)/jdk/test/lib/ \ $(TESTLIBRARY_DIR)/jdk/test/lib/process \ $(TESTLIBRARY_DIR)/jdk/test/lib/util \ $(TESTLIBRARY_DIR)/jtreg \ diff --git a/test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java b/test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java index c9b757a7b51..44959eaea87 100644 --- a/test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java +++ b/test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java @@ -27,7 +27,6 @@ * @summary InvalidClassException is thrown when the canonical constructor * cannot be found during deserialization. * @library /test/lib - * @enablePreview * @run testng BadCanonicalCtrTest */ diff --git a/test/jdk/java/io/Serializable/records/ProhibitedMethods.java b/test/jdk/java/io/Serializable/records/ProhibitedMethods.java index 3a66e46f83b..d744e9ddbad 100644 --- a/test/jdk/java/io/Serializable/records/ProhibitedMethods.java +++ b/test/jdk/java/io/Serializable/records/ProhibitedMethods.java @@ -26,7 +26,6 @@ * @bug 8246774 * @summary Basic tests for prohibited magic serialization methods * @library /test/lib - * @enablePreview * @run testng ProhibitedMethods */ diff --git a/test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java b/test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java index 12a5fe8c402..16266806850 100644 --- a/test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java +++ b/test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java @@ -26,7 +26,6 @@ * @bug 8246774 * @summary Basic tests for prohibited magic serialPersistentFields * @library /test/lib - * @enablePreview * @run testng SerialPersistentFieldsTest */ diff --git a/test/jdk/java/lang/Class/getSimpleName/GetSimpleNameTest.java b/test/jdk/java/lang/Class/getSimpleName/GetSimpleNameTest.java index 34ce8f46663..7d5ef130c82 100644 --- a/test/jdk/java/lang/Class/getSimpleName/GetSimpleNameTest.java +++ b/test/jdk/java/lang/Class/getSimpleName/GetSimpleNameTest.java @@ -24,7 +24,6 @@ /* @test * @bug 8057919 * @summary Class.getSimpleName() should work for non-JLS compliant class names - * @enablePreview */ import java.lang.classfile.ClassBuilder; diff --git a/test/jdk/java/lang/ModuleTests/AnnotationsTest.java b/test/jdk/java/lang/ModuleTests/AnnotationsTest.java index 1fffe710ce5..5ccdecd8734 100644 --- a/test/jdk/java/lang/ModuleTests/AnnotationsTest.java +++ b/test/jdk/java/lang/ModuleTests/AnnotationsTest.java @@ -49,7 +49,6 @@ /** * @test - * @enablePreview * @modules java.base/jdk.internal.module * @library /test/lib * @build jdk.test.lib.util.ModuleInfoWriter diff --git a/test/jdk/java/lang/StackWalker/TestBCI.java b/test/jdk/java/lang/StackWalker/TestBCI.java index 4d5e6a6eaf4..0379a0199c4 100644 --- a/test/jdk/java/lang/StackWalker/TestBCI.java +++ b/test/jdk/java/lang/StackWalker/TestBCI.java @@ -25,7 +25,6 @@ * @test * @bug 8140450 * @summary Basic test for the StackWalker::getByteCodeIndex method - * @enablePreview * @run main TestBCI */ diff --git a/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/AnnotationTypeMismatchTest.java b/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/AnnotationTypeMismatchTest.java index 9c6bfabf82b..51dcf1bb913 100644 --- a/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/AnnotationTypeMismatchTest.java +++ b/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/AnnotationTypeMismatchTest.java @@ -26,7 +26,6 @@ * @bug 8228988 8266598 * @summary An annotation-typed property of an annotation that is represented as an * incompatible property of another type should yield an AnnotationTypeMismatchException. - * @enablePreview * @run main AnnotationTypeMismatchTest */ diff --git a/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/ArityTypeMismatchTest.java b/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/ArityTypeMismatchTest.java index e8908b05ffa..30c2c7864c6 100644 --- a/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/ArityTypeMismatchTest.java +++ b/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/ArityTypeMismatchTest.java @@ -27,7 +27,6 @@ * @summary Annotation property which is compiled as an array property but * changed observed as a singular element should throw an * AnnotationTypeMismatchException - * @enablePreview * @run main ArityTypeMismatchTest */ diff --git a/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/ArrayTypeMismatchTest.java b/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/ArrayTypeMismatchTest.java index 15897b1ca51..4b92ea4361c 100644 --- a/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/ArrayTypeMismatchTest.java +++ b/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/ArrayTypeMismatchTest.java @@ -26,7 +26,6 @@ * @bug 8266766 * @summary An array property of a type that is no longer of a type that is a legal member of an * annotation should throw an AnnotationTypeMismatchException. - * @enablePreview * @run main ArrayTypeMismatchTest */ diff --git a/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/EnumTypeMismatchTest.java b/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/EnumTypeMismatchTest.java index 43e62c66e9b..32555aefde2 100644 --- a/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/EnumTypeMismatchTest.java +++ b/test/jdk/java/lang/annotation/AnnotationTypeMismatchException/EnumTypeMismatchTest.java @@ -26,7 +26,6 @@ * @bug 8228988 8266598 * @summary An enumeration-typed property of an annotation that is represented as an * incompatible property of another type should yield an AnnotationTypeMismatchException. - * @enablePreview * @run main EnumTypeMismatchTest */ diff --git a/test/jdk/java/lang/annotation/AnnotationVerifier.java b/test/jdk/java/lang/annotation/AnnotationVerifier.java index 012f8ef2b1c..eab3d1ffa08 100644 --- a/test/jdk/java/lang/annotation/AnnotationVerifier.java +++ b/test/jdk/java/lang/annotation/AnnotationVerifier.java @@ -40,7 +40,6 @@ * @bug 8158510 * @summary Verify valid annotation * @modules java.base/sun.reflect.annotation - * @enablePreview * @clean AnnotationWithVoidReturn AnnotationWithParameter * AnnotationWithExtraInterface AnnotationWithException * AnnotationWithHashCode AnnotationWithDefaultMember diff --git a/test/jdk/java/lang/instrument/NativeMethodPrefixApp.java b/test/jdk/java/lang/instrument/NativeMethodPrefixApp.java index 97cf4fde2f1..36f0b95d46f 100644 --- a/test/jdk/java/lang/instrument/NativeMethodPrefixApp.java +++ b/test/jdk/java/lang/instrument/NativeMethodPrefixApp.java @@ -38,8 +38,6 @@ * @library /test/lib * @build bootreporter.StringIdCallback bootreporter.StringIdCallbackReporter * asmlib.Instrumentor NativeMethodPrefixAgent - * @enablePreview - * @comment The test uses asmlib/Instrumentor.java which relies on ClassFile API PreviewFeature. * @run main/native NativeMethodPrefixApp roleDriver */ public class NativeMethodPrefixApp implements StringIdCallback { @@ -87,7 +85,6 @@ private static Path createAgentJar() throws Exception { private static void launchApp(final Path agentJar) throws Exception { final OutputAnalyzer oa = ProcessTools.executeTestJava( - "--enable-preview", // due to usage of ClassFile API PreviewFeature in the agent "-javaagent:" + agentJar.toString(), "-Djava.library.path=" + testLibraryPath, NativeMethodPrefixApp.class.getName()); diff --git a/test/jdk/java/lang/instrument/RetransformApp.java b/test/jdk/java/lang/instrument/RetransformApp.java index f3d01b17b26..a026952b29f 100644 --- a/test/jdk/java/lang/instrument/RetransformApp.java +++ b/test/jdk/java/lang/instrument/RetransformApp.java @@ -37,8 +37,6 @@ * @modules java.instrument * @library /test/lib * @build RetransformAgent asmlib.Instrumentor - * @enablePreview - * @comment The test uses asmlib/Instrumentor.java which relies on ClassFile API PreviewFeature. * @run driver/timeout=240 RetransformApp roleDriver * @comment The test uses a higher timeout to prevent test timeouts noted in JDK-6528548 */ @@ -78,7 +76,6 @@ private static Path createAgentJar() throws Exception { private static void launchApp(final Path agentJar) throws Exception { final OutputAnalyzer oa = ProcessTools.executeTestJava( - "--enable-preview", // due to usage of ClassFile API PreviewFeature in the agent "-javaagent:" + agentJar.toString(), RetransformApp.class.getName()); oa.shouldHaveExitValue(0); diff --git a/test/jdk/java/lang/invoke/8022701/MHIllegalAccess.java b/test/jdk/java/lang/invoke/8022701/MHIllegalAccess.java index 896e29439e9..23eb2ced6f4 100644 --- a/test/jdk/java/lang/invoke/8022701/MHIllegalAccess.java +++ b/test/jdk/java/lang/invoke/8022701/MHIllegalAccess.java @@ -25,7 +25,6 @@ * @test * @bug 8022701 * @summary Illegal access exceptions via methodhandle invocations threw wrong error. - * @enablePreview * @compile -XDignore.symbol.file BogoLoader.java InvokeSeveralWays.java MHIllegalAccess.java MethodSupplier.java * @run main/othervm MHIllegalAccess */ diff --git a/test/jdk/java/lang/invoke/DefineClassTest.java b/test/jdk/java/lang/invoke/DefineClassTest.java index 6a9ee82de39..9702a9f0f98 100644 --- a/test/jdk/java/lang/invoke/DefineClassTest.java +++ b/test/jdk/java/lang/invoke/DefineClassTest.java @@ -23,7 +23,6 @@ /* @test * @modules java.base/java.lang:open - * @enablePreview * @run testng/othervm test.DefineClassTest * @summary Basic test for java.lang.invoke.MethodHandles.Lookup.defineClass */ diff --git a/test/jdk/java/lang/invoke/MethodHandleProxies/BasicTest.java b/test/jdk/java/lang/invoke/MethodHandleProxies/BasicTest.java index cd013f9f543..f5453f909e6 100644 --- a/test/jdk/java/lang/invoke/MethodHandleProxies/BasicTest.java +++ b/test/jdk/java/lang/invoke/MethodHandleProxies/BasicTest.java @@ -56,7 +56,6 @@ /* * @test * @bug 6983726 8206955 8269351 - * @enablePreview * @summary Basic sanity tests for MethodHandleProxies * @build BasicTest Client * @run junit BasicTest diff --git a/test/jdk/java/lang/invoke/MethodHandleProxies/WrapperHiddenClassTest.java b/test/jdk/java/lang/invoke/MethodHandleProxies/WrapperHiddenClassTest.java index 3e1f0f41d6f..601250dcbe7 100644 --- a/test/jdk/java/lang/invoke/MethodHandleProxies/WrapperHiddenClassTest.java +++ b/test/jdk/java/lang/invoke/MethodHandleProxies/WrapperHiddenClassTest.java @@ -46,7 +46,6 @@ * @test * @bug 6983726 * @library /test/lib - * @enablePreview * @summary Tests on implementation hidden classes spinned by MethodHandleProxies * @build WrapperHiddenClassTest Client jdk.test.lib.util.ForceGC * @run junit WrapperHiddenClassTest diff --git a/test/jdk/java/lang/invoke/MethodHandles/classData/ClassDataTest.java b/test/jdk/java/lang/invoke/MethodHandles/classData/ClassDataTest.java index af35d0edd03..faedbff07db 100644 --- a/test/jdk/java/lang/invoke/MethodHandles/classData/ClassDataTest.java +++ b/test/jdk/java/lang/invoke/MethodHandles/classData/ClassDataTest.java @@ -25,7 +25,6 @@ * @test * @bug 8230501 * @library /test/lib - * @enablePreview * @run testng/othervm ClassDataTest */ diff --git a/test/jdk/java/lang/invoke/accessProtectedSuper/Test.java b/test/jdk/java/lang/invoke/accessProtectedSuper/Test.java index 4ad03bb068a..bd72583e8be 100644 --- a/test/jdk/java/lang/invoke/accessProtectedSuper/Test.java +++ b/test/jdk/java/lang/invoke/accessProtectedSuper/Test.java @@ -25,7 +25,6 @@ * @test * @bug 8022718 * @summary Runtime accessibility checking: protected class, if extended, should be accessible from another package - * @enablePreview * @compile -XDignore.symbol.file BogoLoader.java MethodInvoker.java Test.java anotherpkg/MethodSupplierOuter.java * @run main/othervm Test */ diff --git a/test/jdk/java/lang/invoke/condy/BootstrapMethodJumboArgsTest.java b/test/jdk/java/lang/invoke/condy/BootstrapMethodJumboArgsTest.java index 1dc30a8de59..5178e5b8669 100644 --- a/test/jdk/java/lang/invoke/condy/BootstrapMethodJumboArgsTest.java +++ b/test/jdk/java/lang/invoke/condy/BootstrapMethodJumboArgsTest.java @@ -27,7 +27,6 @@ * @summary Test bootstrap methods throwing an exception * @library /java/lang/invoke/common * @build test.java.lang.invoke.lib.InstructionHelper - * @enablePreview * @run testng BootstrapMethodJumboArgsTest * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 BootstrapMethodJumboArgsTest */ diff --git a/test/jdk/java/lang/invoke/condy/CondyBSMException.java b/test/jdk/java/lang/invoke/condy/CondyBSMException.java index 3b0d59c3a01..ba20b9f2619 100644 --- a/test/jdk/java/lang/invoke/condy/CondyBSMException.java +++ b/test/jdk/java/lang/invoke/condy/CondyBSMException.java @@ -27,7 +27,6 @@ * @summary Test bootstrap methods throwing an exception * @library /java/lang/invoke/common * @build test.java.lang.invoke.lib.InstructionHelper - * @enablePreview * @run testng CondyBSMException * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyBSMException */ diff --git a/test/jdk/java/lang/invoke/condy/CondyBSMInvocation.java b/test/jdk/java/lang/invoke/condy/CondyBSMInvocation.java index 14eb7560a7d..e86c6ea25f5 100644 --- a/test/jdk/java/lang/invoke/condy/CondyBSMInvocation.java +++ b/test/jdk/java/lang/invoke/condy/CondyBSMInvocation.java @@ -27,7 +27,6 @@ * @summary Test basic invocation of bootstrap methods * @library /java/lang/invoke/common * @build test.java.lang.invoke.lib.InstructionHelper - * @enablePreview * @run testng CondyBSMInvocation * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyBSMInvocation */ diff --git a/test/jdk/java/lang/invoke/condy/CondyBSMValidationTest.java b/test/jdk/java/lang/invoke/condy/CondyBSMValidationTest.java index 5cfe85d0642..16558a9772b 100644 --- a/test/jdk/java/lang/invoke/condy/CondyBSMValidationTest.java +++ b/test/jdk/java/lang/invoke/condy/CondyBSMValidationTest.java @@ -27,7 +27,6 @@ * @summary Test invalid name in name and type * @library /java/lang/invoke/common * @build test.java.lang.invoke.lib.InstructionHelper - * @enablePreview * @run testng CondyBSMValidationTest * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyBSMValidationTest */ diff --git a/test/jdk/java/lang/invoke/condy/CondyInterfaceWithOverpassMethods.java b/test/jdk/java/lang/invoke/condy/CondyInterfaceWithOverpassMethods.java index 2b2fb159e3e..8e9b2c6ae1f 100644 --- a/test/jdk/java/lang/invoke/condy/CondyInterfaceWithOverpassMethods.java +++ b/test/jdk/java/lang/invoke/condy/CondyInterfaceWithOverpassMethods.java @@ -27,7 +27,6 @@ * @summary Test for an interface using condy with default overpass methods * @library /java/lang/invoke/common * @build test.java.lang.invoke.lib.InstructionHelper - * @enablePreview * @run testng CondyInterfaceWithOverpassMethods * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyInterfaceWithOverpassMethods */ diff --git a/test/jdk/java/lang/invoke/condy/CondyNameValidationTest.java b/test/jdk/java/lang/invoke/condy/CondyNameValidationTest.java index 5f6e0dc04a2..32d7f16ac5f 100644 --- a/test/jdk/java/lang/invoke/condy/CondyNameValidationTest.java +++ b/test/jdk/java/lang/invoke/condy/CondyNameValidationTest.java @@ -27,7 +27,6 @@ * @summary Test invalid name in name and type * @library /java/lang/invoke/common * @build test.java.lang.invoke.lib.InstructionHelper - * @enablePreview * @run testng CondyNameValidationTest * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyNameValidationTest */ diff --git a/test/jdk/java/lang/invoke/condy/CondyNestedTest.java b/test/jdk/java/lang/invoke/condy/CondyNestedTest.java index 2cdbff4ffdd..9ec2a435b98 100644 --- a/test/jdk/java/lang/invoke/condy/CondyNestedTest.java +++ b/test/jdk/java/lang/invoke/condy/CondyNestedTest.java @@ -26,7 +26,6 @@ * @bug 8186046 * @summary Test nested dynamic constant declarations that are recursive * @compile CondyNestedTest_Code.jcod - * @enablePreview * @run testng CondyNestedTest * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyNestedTest */ diff --git a/test/jdk/java/lang/invoke/condy/CondyRepeatFailedResolution.java b/test/jdk/java/lang/invoke/condy/CondyRepeatFailedResolution.java index f635bbfd59b..6463b5469ad 100644 --- a/test/jdk/java/lang/invoke/condy/CondyRepeatFailedResolution.java +++ b/test/jdk/java/lang/invoke/condy/CondyRepeatFailedResolution.java @@ -26,7 +26,6 @@ * @bug 8186211 * @summary Test basic invocation of multiple ldc's of the same dynamic constant that fail resolution * @library /java/lang/invoke/common - * @enablePreview * @run testng CondyRepeatFailedResolution * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyRepeatFailedResolution */ diff --git a/test/jdk/java/lang/invoke/condy/CondyReturnPrimitiveTest.java b/test/jdk/java/lang/invoke/condy/CondyReturnPrimitiveTest.java index 057d5405516..3432ea95c4a 100644 --- a/test/jdk/java/lang/invoke/condy/CondyReturnPrimitiveTest.java +++ b/test/jdk/java/lang/invoke/condy/CondyReturnPrimitiveTest.java @@ -25,7 +25,6 @@ * @test * @bug 8186046 * @summary Test for condy BSMs returning primitive values or null - * @enablePreview * @run testng CondyReturnPrimitiveTest * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyReturnPrimitiveTest */ diff --git a/test/jdk/java/lang/invoke/condy/CondyStaticArgumentsTest.java b/test/jdk/java/lang/invoke/condy/CondyStaticArgumentsTest.java index e488c35e778..d02ede56877 100644 --- a/test/jdk/java/lang/invoke/condy/CondyStaticArgumentsTest.java +++ b/test/jdk/java/lang/invoke/condy/CondyStaticArgumentsTest.java @@ -27,7 +27,6 @@ * @summary Test bootstrap arguments for condy * @library /java/lang/invoke/common * @build test.java.lang.invoke.lib.InstructionHelper - * @enablePreview * @run testng CondyStaticArgumentsTest * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyStaticArgumentsTest */ diff --git a/test/jdk/java/lang/invoke/condy/CondyTypeValidationTest.java b/test/jdk/java/lang/invoke/condy/CondyTypeValidationTest.java index 89db90efa14..34f43b09de7 100644 --- a/test/jdk/java/lang/invoke/condy/CondyTypeValidationTest.java +++ b/test/jdk/java/lang/invoke/condy/CondyTypeValidationTest.java @@ -27,7 +27,6 @@ * @summary Test invalid name in name and type * @library /java/lang/invoke/common * @build test.java.lang.invoke.lib.InstructionHelper - * @enablePreview * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyTypeValidationTest */ diff --git a/test/jdk/java/lang/invoke/condy/CondyWithGarbageTest.java b/test/jdk/java/lang/invoke/condy/CondyWithGarbageTest.java index 766678f4686..4651b11b023 100644 --- a/test/jdk/java/lang/invoke/condy/CondyWithGarbageTest.java +++ b/test/jdk/java/lang/invoke/condy/CondyWithGarbageTest.java @@ -27,7 +27,6 @@ * @summary Stress test ldc to ensure HotSpot correctly manages oop maps * @library /java/lang/invoke/common * @build test.java.lang.invoke.lib.InstructionHelper - * @enablePreview * @run testng CondyWithGarbageTest * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyWithGarbageTest */ diff --git a/test/jdk/java/lang/invoke/condy/CondyWrongType.java b/test/jdk/java/lang/invoke/condy/CondyWrongType.java index 09ec64a3656..c2114da63f2 100644 --- a/test/jdk/java/lang/invoke/condy/CondyWrongType.java +++ b/test/jdk/java/lang/invoke/condy/CondyWrongType.java @@ -27,7 +27,6 @@ * @summary Test bootstrap methods returning the wrong type * @library /java/lang/invoke/common * @build test.java.lang.invoke.lib.InstructionHelper - * @enablePreview * @run testng CondyWrongType * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyWrongType */ diff --git a/test/jdk/java/lang/invoke/condy/ConstantBootstrapsTest.java b/test/jdk/java/lang/invoke/condy/ConstantBootstrapsTest.java index 9babd3b57d6..8b94d94663b 100644 --- a/test/jdk/java/lang/invoke/condy/ConstantBootstrapsTest.java +++ b/test/jdk/java/lang/invoke/condy/ConstantBootstrapsTest.java @@ -27,7 +27,6 @@ * @summary Test dynamic constant bootstraps * @library /java/lang/invoke/common * @build test.java.lang.invoke.lib.InstructionHelper - * @enablePreview * @run testng ConstantBootstrapsTest * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 ConstantBootstrapsTest */ diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java b/test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java index 08138a86ed0..379ae765a6b 100644 --- a/test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java +++ b/test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java @@ -26,8 +26,6 @@ * @bug 8330467 * @modules jdk.compiler * @library /test/lib - * @enablePreview - * @comment Change enablePreview with the flag in setup's compileSources * @compile BadClassFile.jcod * BadClassFile2.jcod * BadClassFileVersion.jcod @@ -79,8 +77,7 @@ public class BasicTest { @BeforeTest static void setup() throws IOException { - compileSources(SRC_DIR, CLASSES_DIR, "--enable-preview", - "--release", Integer.toString(Runtime.version().feature())); + compileSources(SRC_DIR, CLASSES_DIR); hiddenClassBytes = Files.readAllBytes(CLASSES_DIR.resolve("HiddenClass.class")); // compile with --release 10 with no NestHost and NestMembers attribute diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/HiddenNestmateTest.java b/test/jdk/java/lang/invoke/defineHiddenClass/HiddenNestmateTest.java index 9043ce0fd85..63ed6327c43 100644 --- a/test/jdk/java/lang/invoke/defineHiddenClass/HiddenNestmateTest.java +++ b/test/jdk/java/lang/invoke/defineHiddenClass/HiddenNestmateTest.java @@ -24,7 +24,6 @@ /* * @test * @library /test/lib - * @enablePreview * @build HiddenNestmateTest * @run testng/othervm HiddenNestmateTest */ diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/StaticInvocableTest.java b/test/jdk/java/lang/invoke/defineHiddenClass/StaticInvocableTest.java index 656da048db9..b6fa8e9c7aa 100644 --- a/test/jdk/java/lang/invoke/defineHiddenClass/StaticInvocableTest.java +++ b/test/jdk/java/lang/invoke/defineHiddenClass/StaticInvocableTest.java @@ -26,7 +26,6 @@ * @bug 8266925 * @summary hidden class members can't be statically invocable * @modules java.base/jdk.internal.misc - * @enablePreview * @build java.base/* * @run testng StaticInvocableTest */ diff --git a/test/jdk/java/lang/invoke/lambda/LambdaAsm.java b/test/jdk/java/lang/invoke/lambda/LambdaAsm.java index 76d091cc51d..a379c809b87 100644 --- a/test/jdk/java/lang/invoke/lambda/LambdaAsm.java +++ b/test/jdk/java/lang/invoke/lambda/LambdaAsm.java @@ -26,7 +26,6 @@ * @bug 8027232 * @library /test/lib/ * @modules jdk.zipfs - * @enablePreview * @compile LambdaAsm.java * @run main/othervm LambdaAsm * @summary ensures that j.l.i.InvokerByteCodeGenerator and Class-File API diff --git a/test/jdk/java/lang/invoke/lambda/LambdaStackTrace.java b/test/jdk/java/lang/invoke/lambda/LambdaStackTrace.java index 0aa6d542588..97b13fea6c4 100644 --- a/test/jdk/java/lang/invoke/lambda/LambdaStackTrace.java +++ b/test/jdk/java/lang/invoke/lambda/LambdaStackTrace.java @@ -26,7 +26,6 @@ * @bug 8025636 * @library /test/lib/ * @modules jdk.compiler - * @enablePreview * @compile LambdaStackTrace.java * @run main LambdaStackTrace * @summary Synthetic frames should be hidden in exceptions diff --git a/test/jdk/java/lang/invoke/lookup/SpecialStatic.java b/test/jdk/java/lang/invoke/lookup/SpecialStatic.java index 4a44a898a77..f8c109d31f0 100644 --- a/test/jdk/java/lang/invoke/lookup/SpecialStatic.java +++ b/test/jdk/java/lang/invoke/lookup/SpecialStatic.java @@ -24,7 +24,6 @@ /* @test * @bug 8032400 * @summary JSR292: invokeSpecial: InternalError attempting to lookup a method - * @enablePreview * @compile -XDignore.symbol.file SpecialStatic.java * @run testng test.java.lang.invoke.lookup.SpecialStatic */ diff --git a/test/jdk/java/lang/module/ClassFileVersionsTest.java b/test/jdk/java/lang/module/ClassFileVersionsTest.java index 1ffc5878651..683ec0b0ea2 100644 --- a/test/jdk/java/lang/module/ClassFileVersionsTest.java +++ b/test/jdk/java/lang/module/ClassFileVersionsTest.java @@ -23,7 +23,6 @@ /** * @test - * @enablePreview * @modules java.base/jdk.internal.module * @library /test/lib * @build jdk.test.lib.util.ModuleInfoWriter diff --git a/test/jdk/java/lang/module/ConfigurationTest.java b/test/jdk/java/lang/module/ConfigurationTest.java index 2f2131b3fc2..81a2b155ea1 100644 --- a/test/jdk/java/lang/module/ConfigurationTest.java +++ b/test/jdk/java/lang/module/ConfigurationTest.java @@ -23,7 +23,6 @@ /** * @test - * @enablePreview * @modules java.base/jdk.internal.access * java.base/jdk.internal.module * @library /test/lib diff --git a/test/jdk/java/lang/module/ModuleDescriptorTest.java b/test/jdk/java/lang/module/ModuleDescriptorTest.java index c46bb4a1e9e..f8f7eb8a1f4 100644 --- a/test/jdk/java/lang/module/ModuleDescriptorTest.java +++ b/test/jdk/java/lang/module/ModuleDescriptorTest.java @@ -24,7 +24,6 @@ /** * @test * @bug 8142968 8158456 8298875 - * @enablePreview * @modules java.base/jdk.internal.access * java.base/jdk.internal.module * @library /test/lib diff --git a/test/jdk/java/lang/module/ModuleFinderTest.java b/test/jdk/java/lang/module/ModuleFinderTest.java index df7a17954b6..a98645123a0 100644 --- a/test/jdk/java/lang/module/ModuleFinderTest.java +++ b/test/jdk/java/lang/module/ModuleFinderTest.java @@ -23,7 +23,6 @@ /** * @test - * @enablePreview * @modules java.base/jdk.internal.module * @library /test/lib * @build ModuleFinderTest jdk.test.lib.util.ModuleInfoWriter diff --git a/test/jdk/java/lang/module/ModuleNamesTest.java b/test/jdk/java/lang/module/ModuleNamesTest.java index 3b8b9ddcafc..30374bf8bfb 100644 --- a/test/jdk/java/lang/module/ModuleNamesTest.java +++ b/test/jdk/java/lang/module/ModuleNamesTest.java @@ -23,7 +23,6 @@ /** * @test - * @enablePreview * @modules java.base/jdk.internal.access * java.base/jdk.internal.module * @library /test/lib diff --git a/test/jdk/java/lang/module/MultiReleaseJarTest.java b/test/jdk/java/lang/module/MultiReleaseJarTest.java index 53180174b85..93d25cc06a3 100644 --- a/test/jdk/java/lang/module/MultiReleaseJarTest.java +++ b/test/jdk/java/lang/module/MultiReleaseJarTest.java @@ -23,7 +23,6 @@ /** * @test - * @enablePreview * @modules java.base/jdk.internal.module * @library /test/lib * @build MultiReleaseJarTest diff --git a/test/jdk/java/lang/reflect/Generics/TestMissingTypeVariable.java b/test/jdk/java/lang/reflect/Generics/TestMissingTypeVariable.java index 64f1457bdf7..426b005a4cc 100644 --- a/test/jdk/java/lang/reflect/Generics/TestMissingTypeVariable.java +++ b/test/jdk/java/lang/reflect/Generics/TestMissingTypeVariable.java @@ -25,7 +25,6 @@ * @test * @library /test/lib * @bug 8337302 - * @enablePreview * @summary Tests that an exception is thrown if a type variable is not declared */ diff --git a/test/jdk/java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java b/test/jdk/java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java index 2b19189ceed..6c5e55aae18 100644 --- a/test/jdk/java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java +++ b/test/jdk/java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java @@ -26,7 +26,6 @@ * @bug 8026213 * @summary Reflection support for private methods in interfaces * @author Robert Field - * @enablePreview * @run main TestPrivateInterfaceMethodReflect */ diff --git a/test/jdk/java/lang/reflect/records/IsRecordTest.java b/test/jdk/java/lang/reflect/records/IsRecordTest.java index fc5f9e28364..4888e6d506e 100644 --- a/test/jdk/java/lang/reflect/records/IsRecordTest.java +++ b/test/jdk/java/lang/reflect/records/IsRecordTest.java @@ -25,7 +25,6 @@ * @test * @bug 8255560 * @summary Class::isRecord should check that the current class is final and not abstract - * @enablePreview * @library /test/lib * @run testng/othervm IsRecordTest */ diff --git a/test/jdk/java/lang/runtime/ExactnessConversionsSupportTest.java b/test/jdk/java/lang/runtime/ExactnessConversionsSupportTest.java index 8c862ae729b..6e1ef8e4c9f 100644 --- a/test/jdk/java/lang/runtime/ExactnessConversionsSupportTest.java +++ b/test/jdk/java/lang/runtime/ExactnessConversionsSupportTest.java @@ -44,8 +44,6 @@ * @test * @bug 8304487 * @summary Verify boundary and special cases of exact conversion predicates - * @enablePreview - * @modules java.base/jdk.internal.classfile * @compile ExactnessConversionsSupportTest.java * @run testng/othervm ExactnessConversionsSupportTest */ diff --git a/test/jdk/java/lang/runtime/SwitchBootstrapsTest.java b/test/jdk/java/lang/runtime/SwitchBootstrapsTest.java index 4d79f62a01d..f02b6b5f6e9 100644 --- a/test/jdk/java/lang/runtime/SwitchBootstrapsTest.java +++ b/test/jdk/java/lang/runtime/SwitchBootstrapsTest.java @@ -46,7 +46,6 @@ * @test * @bug 8318144 * @enablePreview - * @modules java.base/jdk.internal.classfile * @compile SwitchBootstrapsTest.java * @run testng/othervm SwitchBootstrapsTest */ diff --git a/test/jdk/java/security/Provider/SecurityProviderModularTest.java b/test/jdk/java/security/Provider/SecurityProviderModularTest.java index 5bcf9a73301..b803354757f 100644 --- a/test/jdk/java/security/Provider/SecurityProviderModularTest.java +++ b/test/jdk/java/security/Provider/SecurityProviderModularTest.java @@ -47,7 +47,6 @@ * @bug 8130360 8183310 * @summary Test security provider in different combination of modular option * defined with(out) service description. - * @enablePreview * @modules java.base/jdk.internal.module * @library /test/lib * @build jdk.test.lib.util.JarUtils diff --git a/test/jdk/java/time/nontestng/java/time/chrono/HijrahConfigTest.java b/test/jdk/java/time/nontestng/java/time/chrono/HijrahConfigTest.java index b76848e4bb1..6a63fc46226 100644 --- a/test/jdk/java/time/nontestng/java/time/chrono/HijrahConfigTest.java +++ b/test/jdk/java/time/nontestng/java/time/chrono/HijrahConfigTest.java @@ -35,7 +35,6 @@ * @bug 8187987 * @requires (vm.compMode != "Xcomp" & os.maxMemory >= 2g) * @library /tools/lib /test/lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jimage * jdk.compiler diff --git a/test/jdk/java/util/ServiceLoader/BadProvidersTest.java b/test/jdk/java/util/ServiceLoader/BadProvidersTest.java index 7a42854cb9e..6a1b3a72004 100644 --- a/test/jdk/java/util/ServiceLoader/BadProvidersTest.java +++ b/test/jdk/java/util/ServiceLoader/BadProvidersTest.java @@ -25,7 +25,6 @@ * @test * @library /test/lib * @modules jdk.compiler - * @enablePreview * @build jdk.test.lib.compiler.CompilerUtils * @run testng/othervm BadProvidersTest * @summary Basic test of ServiceLoader with bad provider and bad provider diff --git a/test/jdk/javax/security/auth/login/modules/JaasModularClientTest.java b/test/jdk/javax/security/auth/login/modules/JaasModularClientTest.java index 7869c10282a..34c08c410aa 100644 --- a/test/jdk/javax/security/auth/login/modules/JaasModularClientTest.java +++ b/test/jdk/javax/security/auth/login/modules/JaasModularClientTest.java @@ -43,7 +43,6 @@ * @test * @bug 8078813 8183310 * @summary Test custom JAAS login module with all possible modular option. - * @enablePreview * @modules java.base/jdk.internal.module * @library /test/lib * @build jdk.test.lib.util.JarUtils jdk.test.lib.util.ModuleInfoWriter diff --git a/test/jdk/jdk/classfile/ClassHierarchyInfoTest.java b/test/jdk/jdk/classfile/ClassHierarchyInfoTest.java index d4a9e3a4297..464400c5e8a 100644 --- a/test/jdk/jdk/classfile/ClassHierarchyInfoTest.java +++ b/test/jdk/jdk/classfile/ClassHierarchyInfoTest.java @@ -23,7 +23,6 @@ /* * @test - * @enablePreview * @modules java.base/jdk.internal.classfile.impl * java.base/java.util:open * @comment Opens java.util so HashMap bytecode generation can access its nested diff --git a/test/jdk/jdk/classfile/SnippetsTest.java b/test/jdk/jdk/classfile/SnippetsTest.java index 51a73b93d67..f6fa2281e14 100644 --- a/test/jdk/jdk/classfile/SnippetsTest.java +++ b/test/jdk/jdk/classfile/SnippetsTest.java @@ -53,8 +53,7 @@ void testSnippet(String source) throws Exception { var compilationUnits = fileManager.getJavaFileObjectsFromFiles(List.of(src)); fileManager.setLocation(StandardLocation.CLASS_OUTPUT, List.of(Paths.get(System.getProperty("test.classes", ".")).toFile())); - List flags = List.of( - "--source", String.valueOf(Runtime.version().feature())); + List flags = List.of(); if (source.contains("jdk/internal/classfile/components")) { flags = new ArrayList<>(flags); flags.add("--add-exports"); diff --git a/test/jdk/jdk/classfile/TEST.properties b/test/jdk/jdk/classfile/TEST.properties index 296312b258f..62414b36eae 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.components \ java.base/jdk.internal.classfile.impl \ diff --git a/test/jdk/jdk/classfile/VerifierSelfTest.java b/test/jdk/jdk/classfile/VerifierSelfTest.java index bc4ad5ab4ef..80ee89d5fda 100644 --- a/test/jdk/jdk/classfile/VerifierSelfTest.java +++ b/test/jdk/jdk/classfile/VerifierSelfTest.java @@ -25,7 +25,6 @@ * @test * @summary Testing ClassFile Verifier. * @bug 8333812 - * @enablePreview * @run junit VerifierSelfTest */ import java.io.IOException; diff --git a/test/jdk/jdk/internal/reflect/CallerSensitive/CallerSensitiveFinder.java b/test/jdk/jdk/internal/reflect/CallerSensitive/CallerSensitiveFinder.java index 2d5175dcf3f..65e65bf0858 100644 --- a/test/jdk/jdk/internal/reflect/CallerSensitive/CallerSensitiveFinder.java +++ b/test/jdk/jdk/internal/reflect/CallerSensitive/CallerSensitiveFinder.java @@ -51,7 +51,6 @@ * @bug 8010117 * @summary Verify if CallerSensitive methods are annotated with * CallerSensitive annotation - * @enablePreview * @build CallerSensitiveFinder * @run main/othervm/timeout=900 CallerSensitiveFinder */ diff --git a/test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.java b/test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.java index 83841fe104b..e1790e6e174 100644 --- a/test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.java +++ b/test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.java @@ -58,7 +58,6 @@ * @test * @summary CallerSensitive methods should be static or final instance * methods except the known list of non-final instance methods - * @enablePreview * @build CheckCSMs * @run main/othervm/timeout=900 CheckCSMs */ diff --git a/test/jdk/jdk/internal/reflect/CallerSensitive/MissingCallerSensitive.java b/test/jdk/jdk/internal/reflect/CallerSensitive/MissingCallerSensitive.java index 781c75b23ae..e8994c3c760 100644 --- a/test/jdk/jdk/internal/reflect/CallerSensitive/MissingCallerSensitive.java +++ b/test/jdk/jdk/internal/reflect/CallerSensitive/MissingCallerSensitive.java @@ -27,7 +27,6 @@ * @bug 8010117 * @summary Test CallerSensitiveFinder to find missing annotation * @modules java.base/jdk.internal.reflect - * @enablePreview * @compile -XDignore.symbol.file MissingCallerSensitive.java * @build CallerSensitiveFinder * @run main MissingCallerSensitive diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerInlining.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerInlining.java index b13fa714109..2d0ce579dd8 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerInlining.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerInlining.java @@ -61,7 +61,6 @@ * @requires vm.opt.Inline == true | vm.opt.Inline == null * @library /test/lib * @modules jdk.jfr - * @enablePreview * * @build jdk.test.whitebox.WhiteBox * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/io/TestInstrumentation.java b/test/jdk/jdk/jfr/event/io/TestInstrumentation.java index daa3d0162d4..beef8437a34 100644 --- a/test/jdk/jdk/jfr/event/io/TestInstrumentation.java +++ b/test/jdk/jdk/jfr/event/io/TestInstrumentation.java @@ -58,8 +58,6 @@ * @modules java.instrument * jdk.jartool/sun.tools.jar * jdk.jfr - * @enablePreview - * @comment update --enable-preview in launchTest() too * * @run main/othervm jdk.jfr.event.io.TestInstrumentation */ @@ -281,7 +279,6 @@ private static void launchTest() throws Throwable { String[] args = { "-Xbootclasspath/a:" + testClassDir + "InstrumentationCallback.jar", - "--enable-preview", "-classpath", classpath, "-javaagent:" + testClassDir + "TestInstrumentation.jar", "jdk.jfr.event.io.TestInstrumentation$TestMain" }; diff --git a/test/jdk/jdk/jfr/javaagent/TestEventInstrumentation.java b/test/jdk/jdk/jfr/javaagent/TestEventInstrumentation.java index 049a1172d0c..d5997f1ad46 100644 --- a/test/jdk/jdk/jfr/javaagent/TestEventInstrumentation.java +++ b/test/jdk/jdk/jfr/javaagent/TestEventInstrumentation.java @@ -52,7 +52,6 @@ * @requires vm.hasJFR * @library /test/lib * @modules jdk.jartool/sun.tools.jar - * @enablePreview * @build jdk.jfr.javaagent.InstrumentationEventCallback * jdk.jfr.javaagent.TestEventInstrumentation * @run driver jdk.test.lib.util.JavaAgentBuilder diff --git a/test/jdk/jdk/lambda/TEST.properties b/test/jdk/jdk/lambda/TEST.properties index d6687af079f..eaae109a7fc 100644 --- a/test/jdk/jdk/lambda/TEST.properties +++ b/test/jdk/jdk/lambda/TEST.properties @@ -4,4 +4,3 @@ TestNG.dirs = . maxOutputSize = 250000 modules = jdk.compiler jdk.zipfs -enablePreview = true \ No newline at end of file diff --git a/test/jdk/jdk/modules/incubator/ServiceBinding.java b/test/jdk/jdk/modules/incubator/ServiceBinding.java index 1252b908178..95eadfffa4c 100644 --- a/test/jdk/jdk/modules/incubator/ServiceBinding.java +++ b/test/jdk/jdk/modules/incubator/ServiceBinding.java @@ -24,7 +24,6 @@ /** * @test * @bug 8233922 - * @enablePreview * @modules java.base/jdk.internal.module * @library /test/lib * @build ServiceBinding TestBootLayer jdk.test.lib.util.ModuleInfoWriter diff --git a/test/jdk/sun/tools/jcmd/TestProcessHelper.java b/test/jdk/sun/tools/jcmd/TestProcessHelper.java index 73f04563cc9..9d9b34dad41 100644 --- a/test/jdk/sun/tools/jcmd/TestProcessHelper.java +++ b/test/jdk/sun/tools/jcmd/TestProcessHelper.java @@ -54,7 +54,6 @@ * * @requires vm.flagless * @requires os.family == "linux" - * @enablePreview * @modules jdk.jcmd/sun.tools.common:+open * java.base/jdk.internal.module * @library /test/lib diff --git a/test/jdk/tools/jimage/JImageNonAsciiNameTest.java b/test/jdk/tools/jimage/JImageNonAsciiNameTest.java index c50a10539fc..e5a961bf366 100644 --- a/test/jdk/tools/jimage/JImageNonAsciiNameTest.java +++ b/test/jdk/tools/jimage/JImageNonAsciiNameTest.java @@ -37,7 +37,6 @@ * @summary Test non-ASCII path in custom JRE * @library ../lib * /test/lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jimage * @build tests.* diff --git a/test/jdk/tools/jimage/JImageTest.java b/test/jdk/tools/jimage/JImageTest.java index 3342c566025..d36b727d872 100644 --- a/test/jdk/tools/jimage/JImageTest.java +++ b/test/jdk/tools/jimage/JImageTest.java @@ -47,7 +47,6 @@ * @summary Test jimage tool * @bug 8222100 * @library ../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jmod * jdk.jlink/jdk.tools.jimage diff --git a/test/jdk/tools/jlink/DefaultProviderTest.java b/test/jdk/tools/jlink/DefaultProviderTest.java index 3177b37666a..65d2b684313 100644 --- a/test/jdk/tools/jlink/DefaultProviderTest.java +++ b/test/jdk/tools/jlink/DefaultProviderTest.java @@ -42,7 +42,6 @@ * @author Jean-Francois Denise * @requires vm.compMode != "Xcomp" * @library ../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.plugin diff --git a/test/jdk/tools/jlink/ExplodedModuleNameTest.java b/test/jdk/tools/jlink/ExplodedModuleNameTest.java index 69a564c7538..c3b992adafa 100644 --- a/test/jdk/tools/jlink/ExplodedModuleNameTest.java +++ b/test/jdk/tools/jlink/ExplodedModuleNameTest.java @@ -38,7 +38,6 @@ * @bug 8192986 * @summary Inconsistent handling of exploded modules in jlink * @library ../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jmod diff --git a/test/jdk/tools/jlink/IntegrationTest.java b/test/jdk/tools/jlink/IntegrationTest.java index 686dd194ada..d79752f6d56 100644 --- a/test/jdk/tools/jlink/IntegrationTest.java +++ b/test/jdk/tools/jlink/IntegrationTest.java @@ -57,7 +57,6 @@ * @summary Test integration API * @author Jean-Francois Denise * @library ../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.builder * jdk.jlink/jdk.tools.jlink.internal diff --git a/test/jdk/tools/jlink/JLink100Modules.java b/test/jdk/tools/jlink/JLink100Modules.java index bb4f18cb4e8..6aa3007ed45 100644 --- a/test/jdk/tools/jlink/JLink100Modules.java +++ b/test/jdk/tools/jlink/JLink100Modules.java @@ -35,7 +35,6 @@ * @summary Make sure that 100 modules can be linked using jlink. * @bug 8240567 * @library ../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.plugin diff --git a/test/jdk/tools/jlink/JLink2Test.java b/test/jdk/tools/jlink/JLink2Test.java index 1e0fe693489..f00def47b17 100644 --- a/test/jdk/tools/jlink/JLink2Test.java +++ b/test/jdk/tools/jlink/JLink2Test.java @@ -26,7 +26,6 @@ * @summary Test image creation * @author Jean-Francois Denise * @library ../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.plugin diff --git a/test/jdk/tools/jlink/JLinkDedupTestBatchSizeOne.java b/test/jdk/tools/jlink/JLinkDedupTestBatchSizeOne.java index c7af8865a79..fbdbc6e3ba4 100644 --- a/test/jdk/tools/jlink/JLinkDedupTestBatchSizeOne.java +++ b/test/jdk/tools/jlink/JLinkDedupTestBatchSizeOne.java @@ -38,7 +38,6 @@ * @bug 8311591 * @library /test/lib * ../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.plugin diff --git a/test/jdk/tools/jlink/JLinkNegativeTest.java b/test/jdk/tools/jlink/JLinkNegativeTest.java index 6f88c02b0c8..bf7798ffa3a 100644 --- a/test/jdk/tools/jlink/JLinkNegativeTest.java +++ b/test/jdk/tools/jlink/JLinkNegativeTest.java @@ -28,7 +28,6 @@ * @bug 8174718 * @bug 8189671 * @author Andrei Eremeev - * @enablePreview * @modules java.base/jdk.internal.jimage * java.base/jdk.internal.module * jdk.jlink/jdk.tools.jlink.internal diff --git a/test/jdk/tools/jlink/JLinkOptionsTest.java b/test/jdk/tools/jlink/JLinkOptionsTest.java index 95b4268069d..892a3891d77 100644 --- a/test/jdk/tools/jlink/JLinkOptionsTest.java +++ b/test/jdk/tools/jlink/JLinkOptionsTest.java @@ -36,7 +36,6 @@ * @summary Test jlink options * @author Jean-Francois Denise * @library ../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.plugin diff --git a/test/jdk/tools/jlink/JLinkPluginsTest.java b/test/jdk/tools/jlink/JLinkPluginsTest.java index cd524db747a..f8d78475f8f 100644 --- a/test/jdk/tools/jlink/JLinkPluginsTest.java +++ b/test/jdk/tools/jlink/JLinkPluginsTest.java @@ -35,7 +35,6 @@ * @author Jean-Francois Denise * @requires (vm.compMode != "Xcomp" & os.maxMemory >= 2g) * @library ../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jmod diff --git a/test/jdk/tools/jlink/JLinkTest.java b/test/jdk/tools/jlink/JLinkTest.java index e897badad13..63863812e2a 100644 --- a/test/jdk/tools/jlink/JLinkTest.java +++ b/test/jdk/tools/jlink/JLinkTest.java @@ -51,7 +51,6 @@ * @author Jean-Francois Denise * @requires (vm.compMode != "Xcomp" & os.maxMemory >= 2g) * @library ../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.plugin diff --git a/test/jdk/tools/jlink/ModuleNamesOrderTest.java b/test/jdk/tools/jlink/ModuleNamesOrderTest.java index d8fda1387d7..bd71fcce108 100644 --- a/test/jdk/tools/jlink/ModuleNamesOrderTest.java +++ b/test/jdk/tools/jlink/ModuleNamesOrderTest.java @@ -41,7 +41,6 @@ * @bug 8168925 * @summary MODULES property should be topologically ordered and space-separated list * @library ../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jmod diff --git a/test/jdk/tools/jlink/NativeTest.java b/test/jdk/tools/jlink/NativeTest.java index 8fba7b8f699..1c117476433 100644 --- a/test/jdk/tools/jlink/NativeTest.java +++ b/test/jdk/tools/jlink/NativeTest.java @@ -26,7 +26,6 @@ * @summary Test config, cmd and lib directories of jmod. * @author Andrei Eremeev * @library ../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jmod diff --git a/test/jdk/tools/jlink/plugins/AddOptionsPluginTest.java b/test/jdk/tools/jlink/plugins/AddOptionsPluginTest.java index acb2e65fd38..a931662887f 100644 --- a/test/jdk/tools/jlink/plugins/AddOptionsPluginTest.java +++ b/test/jdk/tools/jlink/plugins/AddOptionsPluginTest.java @@ -30,7 +30,6 @@ * @summary Test the --add-options plugin * @library ../../lib * @library /test/lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jmod diff --git a/test/jdk/tools/jlink/plugins/CDSPluginTest.java b/test/jdk/tools/jlink/plugins/CDSPluginTest.java index c9766183297..46683625320 100644 --- a/test/jdk/tools/jlink/plugins/CDSPluginTest.java +++ b/test/jdk/tools/jlink/plugins/CDSPluginTest.java @@ -38,7 +38,6 @@ * @requires vm.cds * @library ../../lib * @library /test/lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jmod diff --git a/test/jdk/tools/jlink/plugins/GenerateJLIClassesPluginTest.java b/test/jdk/tools/jlink/plugins/GenerateJLIClassesPluginTest.java index 1acad93f5d3..998444b9a77 100644 --- a/test/jdk/tools/jlink/plugins/GenerateJLIClassesPluginTest.java +++ b/test/jdk/tools/jlink/plugins/GenerateJLIClassesPluginTest.java @@ -50,7 +50,6 @@ * @bug 8252919 8327499 * @library ../../lib * @summary Test --generate-jli-classes plugin - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins diff --git a/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java b/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java index e2dd3403c83..f0fe3149247 100644 --- a/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java +++ b/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java @@ -47,7 +47,6 @@ * @author Naoto Sato * @requires (vm.compMode != "Xcomp" & os.maxMemory >= 2g) * @library ../../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins diff --git a/test/jdk/tools/jlink/plugins/SaveJlinkArgfilesPluginTest.java b/test/jdk/tools/jlink/plugins/SaveJlinkArgfilesPluginTest.java index 207290d6cf7..40b30597192 100644 --- a/test/jdk/tools/jlink/plugins/SaveJlinkArgfilesPluginTest.java +++ b/test/jdk/tools/jlink/plugins/SaveJlinkArgfilesPluginTest.java @@ -27,7 +27,6 @@ * @requires vm.jvmci * @library ../../lib * @library /test/lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jmod diff --git a/test/jdk/tools/jlink/plugins/StringSharingPluginTest.java b/test/jdk/tools/jlink/plugins/StringSharingPluginTest.java index 3979c7e833b..d1c765c7c9d 100644 --- a/test/jdk/tools/jlink/plugins/StringSharingPluginTest.java +++ b/test/jdk/tools/jlink/plugins/StringSharingPluginTest.java @@ -26,7 +26,6 @@ * @summary Test StringSharingPluginTest * @author Jean-Francois Denise * @library ../../lib - * @enablePreview * @modules java.base/jdk.internal.jimage * java.base/jdk.internal.jimage.decompressor * jdk.jlink/jdk.tools.jlink.internal diff --git a/test/jdk/tools/jlink/plugins/StripJavaDebugAttributesPluginTest.java b/test/jdk/tools/jlink/plugins/StripJavaDebugAttributesPluginTest.java index 0bcb19e087c..da2670250bb 100644 --- a/test/jdk/tools/jlink/plugins/StripJavaDebugAttributesPluginTest.java +++ b/test/jdk/tools/jlink/plugins/StripJavaDebugAttributesPluginTest.java @@ -27,7 +27,6 @@ * @author Jean-Francois Denise * @library ../../lib * @build tests.* - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins diff --git a/test/jdk/tools/jlink/plugins/VendorInfoPluginsTest.java b/test/jdk/tools/jlink/plugins/VendorInfoPluginsTest.java index 2f2c52a6c17..3cffac89186 100644 --- a/test/jdk/tools/jlink/plugins/VendorInfoPluginsTest.java +++ b/test/jdk/tools/jlink/plugins/VendorInfoPluginsTest.java @@ -30,7 +30,6 @@ * @summary Test the --vendor-version --vendor-url-bug plugins * @library ../../lib * @library /test/lib - * @enablePreview * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jmod diff --git a/test/langtools/jdk/javadoc/tool/CheckResourceKeys.java b/test/langtools/jdk/javadoc/tool/CheckResourceKeys.java index f188aa036f4..ee5014a310a 100644 --- a/test/langtools/jdk/javadoc/tool/CheckResourceKeys.java +++ b/test/langtools/jdk/javadoc/tool/CheckResourceKeys.java @@ -29,7 +29,6 @@ * jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.resources:open * jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.resources:open * jdk.javadoc/jdk.javadoc.internal.tool.resources:open - * @enablePreview */ import java.io.*; diff --git a/test/langtools/tools/javac/4241573/T4241573.java b/test/langtools/tools/javac/4241573/T4241573.java index 9989ff83454..de832aef706 100644 --- a/test/langtools/tools/javac/4241573/T4241573.java +++ b/test/langtools/tools/javac/4241573/T4241573.java @@ -25,8 +25,6 @@ * @test * @bug 4241573 * @summary SourceFile attribute includes full path - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ import java.lang.classfile.*; diff --git a/test/langtools/tools/javac/7003595/T7003595.java b/test/langtools/tools/javac/7003595/T7003595.java index c5c12259c14..3aafbf74b6a 100644 --- a/test/langtools/tools/javac/7003595/T7003595.java +++ b/test/langtools/tools/javac/7003595/T7003595.java @@ -25,9 +25,7 @@ * @test * @bug 7003595 * @summary IncompatibleClassChangeError with unreferenced local class with subclass - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.file */ diff --git a/test/langtools/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java b/test/langtools/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java index cff6e774a2f..1fd3fb3fbcc 100644 --- a/test/langtools/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java +++ b/test/langtools/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java @@ -25,8 +25,6 @@ * @test * @bug 7153958 8073372 * @summary add constant pool reference to class containing inlined constants - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile pkg/ClassToBeStaticallyImportedA.java pkg/ClassToBeStaticallyImportedB.java CPoolRefClassContainingInlinedCts.java * @run main CPoolRefClassContainingInlinedCts */ diff --git a/test/langtools/tools/javac/7166455/CheckACC_STRICTFlagOnclinitTest.java b/test/langtools/tools/javac/7166455/CheckACC_STRICTFlagOnclinitTest.java index 734b1741682..66cd9e91ff2 100644 --- a/test/langtools/tools/javac/7166455/CheckACC_STRICTFlagOnclinitTest.java +++ b/test/langtools/tools/javac/7166455/CheckACC_STRICTFlagOnclinitTest.java @@ -26,7 +26,6 @@ * @bug 7166455 * @summary javac doesn't set ACC_STRICT bit on for strictfp class * @library /tools/lib /test/lib - * @enablePreview */ import jdk.test.lib.compiler.CompilerUtils; diff --git a/test/langtools/tools/javac/8000518/DuplicateConstantPoolEntry.java b/test/langtools/tools/javac/8000518/DuplicateConstantPoolEntry.java index eee423e48a8..99ad19203b5 100644 --- a/test/langtools/tools/javac/8000518/DuplicateConstantPoolEntry.java +++ b/test/langtools/tools/javac/8000518/DuplicateConstantPoolEntry.java @@ -26,8 +26,6 @@ * @bug 8000518 * @summary Javac generates duplicate name_and_type constant pool entry for * class BinaryOpValueExp.java - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @run main DuplicateConstantPoolEntry */ diff --git a/test/langtools/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java b/test/langtools/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java index de8cdbc5af3..4ba8c7a6491 100644 --- a/test/langtools/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java +++ b/test/langtools/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java @@ -25,8 +25,6 @@ * @test * @bug 8005931 * @summary javac doesn't set ACC_STRICT for classes with package access - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @run main CheckACC_STRICTFlagOnPkgAccessClassTest */ diff --git a/test/langtools/tools/javac/8009170/RedundantByteCodeInArrayTest.java b/test/langtools/tools/javac/8009170/RedundantByteCodeInArrayTest.java index 8f2ed91039c..8b8eb23be4d 100644 --- a/test/langtools/tools/javac/8009170/RedundantByteCodeInArrayTest.java +++ b/test/langtools/tools/javac/8009170/RedundantByteCodeInArrayTest.java @@ -26,7 +26,6 @@ * @bug 8009170 * @summary Regression: javac generates redundant bytecode in assignop involving * arrays - * @enablePreview * @run main RedundantByteCodeInArrayTest */ diff --git a/test/langtools/tools/javac/AnonymousClass/AnonymousClassFlags.java b/test/langtools/tools/javac/AnonymousClass/AnonymousClassFlags.java index fb78132e4f1..e163a4350cd 100644 --- a/test/langtools/tools/javac/AnonymousClass/AnonymousClassFlags.java +++ b/test/langtools/tools/javac/AnonymousClass/AnonymousClassFlags.java @@ -25,8 +25,6 @@ * @test * @bug 8161013 * @summary Verify that anonymous class binaries have the correct flags set - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @run main AnonymousClassFlags */ diff --git a/test/langtools/tools/javac/MethodParameters/AnnotationTest.java b/test/langtools/tools/javac/MethodParameters/AnnotationTest.java index e30f83f8af3..c373de15e52 100644 --- a/test/langtools/tools/javac/MethodParameters/AnnotationTest.java +++ b/test/langtools/tools/javac/MethodParameters/AnnotationTest.java @@ -25,8 +25,6 @@ * @test * @bug 8006582 * @summary javac should generate method parameters correctly. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build MethodParametersTester ClassFileVisitor ReflectionVisitor * @compile -parameters AnnotationTest.java * @run main MethodParametersTester AnnotationTest AnnotationTest.out diff --git a/test/langtools/tools/javac/MethodParameters/AnonymousClass.java b/test/langtools/tools/javac/MethodParameters/AnonymousClass.java index 3926d9623a3..d0bf322b0c6 100644 --- a/test/langtools/tools/javac/MethodParameters/AnonymousClass.java +++ b/test/langtools/tools/javac/MethodParameters/AnonymousClass.java @@ -25,8 +25,6 @@ * @test * @bug 8006582 * @summary javac should generate method parameters correctly. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build MethodParametersTester ClassFileVisitor ReflectionVisitor * @compile -parameters AnonymousClass.java * @run main MethodParametersTester AnonymousClass AnonymousClass.out diff --git a/test/langtools/tools/javac/MethodParameters/ClassFileVisitor.java b/test/langtools/tools/javac/MethodParameters/ClassFileVisitor.java index 3e2d151808f..5a2f3dfd377 100644 --- a/test/langtools/tools/javac/MethodParameters/ClassFileVisitor.java +++ b/test/langtools/tools/javac/MethodParameters/ClassFileVisitor.java @@ -29,7 +29,7 @@ /** * The {@code ClassFileVisitor} reads a class file using the - * {@code jdk.internal.classfile} library. It iterates over the methods + * {@code java.lang.classfile} library. It iterates over the methods * in a class, and checks MethodParameters attributes against JLS * requirements, as well as assumptions about the javac implementations. *

diff --git a/test/langtools/tools/javac/MethodParameters/Constructors.java b/test/langtools/tools/javac/MethodParameters/Constructors.java index a797b40db5e..27c146ad049 100644 --- a/test/langtools/tools/javac/MethodParameters/Constructors.java +++ b/test/langtools/tools/javac/MethodParameters/Constructors.java @@ -25,8 +25,6 @@ * @test * @bug 8006582 * @summary javac should generate method parameters correctly. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build MethodParametersTester ClassFileVisitor ReflectionVisitor * @compile -parameters Constructors.java * @run main MethodParametersTester Constructors Constructors.out diff --git a/test/langtools/tools/javac/MethodParameters/EnumTest.java b/test/langtools/tools/javac/MethodParameters/EnumTest.java index 0f706e7e02d..f7570644ecd 100644 --- a/test/langtools/tools/javac/MethodParameters/EnumTest.java +++ b/test/langtools/tools/javac/MethodParameters/EnumTest.java @@ -25,8 +25,6 @@ * @test * @bug 8006582 8008658 * @summary javac should generate method parameters correctly. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build MethodParametersTester ClassFileVisitor ReflectionVisitor * @compile -parameters EnumTest.java * @run main MethodParametersTester EnumTest EnumTest.out diff --git a/test/langtools/tools/javac/MethodParameters/InstanceMethods.java b/test/langtools/tools/javac/MethodParameters/InstanceMethods.java index e84f12245c7..c3d45270c8e 100644 --- a/test/langtools/tools/javac/MethodParameters/InstanceMethods.java +++ b/test/langtools/tools/javac/MethodParameters/InstanceMethods.java @@ -25,8 +25,6 @@ * @test * @bug 8006582 * @summary javac should generate method parameters correctly. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build MethodParametersTester ClassFileVisitor ReflectionVisitor * @compile -parameters InstanceMethods.java * @run main MethodParametersTester InstanceMethods InstanceMethods.out diff --git a/test/langtools/tools/javac/MethodParameters/LambdaTest.java b/test/langtools/tools/javac/MethodParameters/LambdaTest.java index 252c9487ce4..cad796a12fd 100644 --- a/test/langtools/tools/javac/MethodParameters/LambdaTest.java +++ b/test/langtools/tools/javac/MethodParameters/LambdaTest.java @@ -25,8 +25,6 @@ * @test * @bug 8006582 8037546 8138729 * @summary javac should generate method parameters correctly. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build MethodParametersTester ClassFileVisitor ReflectionVisitor * @compile -parameters LambdaTest.java * @run main MethodParametersTester LambdaTest LambdaTest.out diff --git a/test/langtools/tools/javac/MethodParameters/LegacyOutputTest/LegacyOutputTest.java b/test/langtools/tools/javac/MethodParameters/LegacyOutputTest/LegacyOutputTest.java index dad79da509e..b2e0c6eac70 100644 --- a/test/langtools/tools/javac/MethodParameters/LegacyOutputTest/LegacyOutputTest.java +++ b/test/langtools/tools/javac/MethodParameters/LegacyOutputTest/LegacyOutputTest.java @@ -26,8 +26,6 @@ * @test * @bug 8190452 * @summary javac should not add MethodParameters attributes to v51 and earlier class files - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build LegacyOutputTest * @run main LegacyOutputTest */ diff --git a/test/langtools/tools/javac/MethodParameters/LocalClassTest.java b/test/langtools/tools/javac/MethodParameters/LocalClassTest.java index 061e2213a4c..554ed798316 100644 --- a/test/langtools/tools/javac/MethodParameters/LocalClassTest.java +++ b/test/langtools/tools/javac/MethodParameters/LocalClassTest.java @@ -25,8 +25,6 @@ * @test * @bug 8006582 8008658 * @summary javac should generate method parameters correctly. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build MethodParametersTester ClassFileVisitor ReflectionVisitor * @compile -parameters LocalClassTest.java * @run main MethodParametersTester LocalClassTest LocalClassTest.out diff --git a/test/langtools/tools/javac/MethodParameters/MemberClassTest.java b/test/langtools/tools/javac/MethodParameters/MemberClassTest.java index 940d30da40c..b0ea9c9fbee 100644 --- a/test/langtools/tools/javac/MethodParameters/MemberClassTest.java +++ b/test/langtools/tools/javac/MethodParameters/MemberClassTest.java @@ -25,8 +25,6 @@ * @test * @bug 8006582 8008658 * @summary javac should generate method parameters correctly. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build MethodParametersTester ClassFileVisitor ReflectionVisitor * @compile -parameters MemberClassTest.java * @run main MethodParametersTester MemberClassTest MemberClassTest.out diff --git a/test/langtools/tools/javac/MethodParameters/StaticMethods.java b/test/langtools/tools/javac/MethodParameters/StaticMethods.java index a6c0d8aa5d0..24cadb6ca36 100644 --- a/test/langtools/tools/javac/MethodParameters/StaticMethods.java +++ b/test/langtools/tools/javac/MethodParameters/StaticMethods.java @@ -25,8 +25,6 @@ * @test * @bug 8006582 * @summary javac should generate method parameters correctly. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build MethodParametersTester ClassFileVisitor ReflectionVisitor * @compile -parameters StaticMethods.java * @run main MethodParametersTester StaticMethods StaticMethods.out diff --git a/test/langtools/tools/javac/MethodParameters/UncommonParamNames.java b/test/langtools/tools/javac/MethodParameters/UncommonParamNames.java index ae17d90150d..f531db7a09a 100644 --- a/test/langtools/tools/javac/MethodParameters/UncommonParamNames.java +++ b/test/langtools/tools/javac/MethodParameters/UncommonParamNames.java @@ -25,8 +25,6 @@ * @test * @bug 8006582 * @summary javac should generate method parameters correctly. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build MethodParametersTester ClassFileVisitor ReflectionVisitor * @compile -parameters UncommonParamNames.java * @run main MethodParametersTester UncommonParamNames UncommonParamNames.out diff --git a/test/langtools/tools/javac/MethodParametersTest.java b/test/langtools/tools/javac/MethodParametersTest.java index a4d55525e60..8636d8bfc61 100644 --- a/test/langtools/tools/javac/MethodParametersTest.java +++ b/test/langtools/tools/javac/MethodParametersTest.java @@ -25,9 +25,7 @@ * @test * @bug 8004727 * @summary javac should generate method parameters correctly. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.code + * @modules jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.comp * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.main diff --git a/test/langtools/tools/javac/NoStringToLower.java b/test/langtools/tools/javac/NoStringToLower.java index 64e68aad1de..ed787c759f4 100644 --- a/test/langtools/tools/javac/NoStringToLower.java +++ b/test/langtools/tools/javac/NoStringToLower.java @@ -25,8 +25,6 @@ * @test * @bug 8029800 * @summary String.toLowerCase()/toUpperCase is generally dangerous, check it is not used in langtools - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ import java.io.*; @@ -63,6 +61,7 @@ boolean run(String... args) throws Exception { "javax.lang.model", "javax.tools", "com.sun.source", + "java.lang.classfile", "jdk.internal.classfile", "com.sun.tools.doclint", "com.sun.tools.javac", diff --git a/test/langtools/tools/javac/RequiredParameterFlags/ImplicitParameters.java b/test/langtools/tools/javac/RequiredParameterFlags/ImplicitParameters.java index 0eb4d1b8a42..b53238ce4e5 100644 --- a/test/langtools/tools/javac/RequiredParameterFlags/ImplicitParameters.java +++ b/test/langtools/tools/javac/RequiredParameterFlags/ImplicitParameters.java @@ -26,11 +26,9 @@ * @bug 8292275 * @summary check that implicit parameter flags are available by default * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.code - * java.base/jdk.internal.classfile.impl * @run main ImplicitParameters */ diff --git a/test/langtools/tools/javac/StringConcat/TestIndyStringConcat.java b/test/langtools/tools/javac/StringConcat/TestIndyStringConcat.java index 8ec49a17c4d..f4fed6fe68b 100644 --- a/test/langtools/tools/javac/StringConcat/TestIndyStringConcat.java +++ b/test/langtools/tools/javac/StringConcat/TestIndyStringConcat.java @@ -39,7 +39,6 @@ * @bug 8148483 8151516 8151223 * @summary Test that StringConcat is working for JDK >= 9 * @library /tools/lib /test/lib - * @enablePreview * @run main TestIndyStringConcat */ public class TestIndyStringConcat { diff --git a/test/langtools/tools/javac/StringConcat/WellKnownTypeSignatures.java b/test/langtools/tools/javac/StringConcat/WellKnownTypeSignatures.java index 174e9721f3f..2d3d25dde5e 100644 --- a/test/langtools/tools/javac/StringConcat/WellKnownTypeSignatures.java +++ b/test/langtools/tools/javac/StringConcat/WellKnownTypeSignatures.java @@ -34,8 +34,6 @@ * @test * @bug 8273914 * @summary Indy string concat changes order of operations - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * * @clean * * @compile -XDstringConcat=indy WellKnownTypeSignatures.java diff --git a/test/langtools/tools/javac/StringConcat/WellKnownTypes.java b/test/langtools/tools/javac/StringConcat/WellKnownTypes.java index 470182bc04e..8c20117a756 100644 --- a/test/langtools/tools/javac/StringConcat/WellKnownTypes.java +++ b/test/langtools/tools/javac/StringConcat/WellKnownTypes.java @@ -25,7 +25,6 @@ * @test * @bug 8273914 * @summary Indy string concat changes order of operations - * @enablePreview * * @compile -XDstringConcat=indy WellKnownTypes.java * @run main WellKnownTypes diff --git a/test/langtools/tools/javac/StringConcat/access/Test.java b/test/langtools/tools/javac/StringConcat/access/Test.java index c4aa54618ea..d9d7332e876 100644 --- a/test/langtools/tools/javac/StringConcat/access/Test.java +++ b/test/langtools/tools/javac/StringConcat/access/Test.java @@ -34,7 +34,6 @@ * @test * @bug 8151223 * @summary String concatenation fails with implicit toString() on package-private class - * @enablePreview * * @clean * * @compile -XDstringConcat=indy Holder.java PublicClass.java PublicInterface.java Public_PublicClass.java Public_PublicInterface.java Public_PrivateInterface1.java Public_PrivateInterface2.java Test.java diff --git a/test/langtools/tools/javac/T6695379/AnnotationsAreNotCopiedToBridgeMethodsTest.java b/test/langtools/tools/javac/T6695379/AnnotationsAreNotCopiedToBridgeMethodsTest.java index bb486b32382..b842f1a54ff 100644 --- a/test/langtools/tools/javac/T6695379/AnnotationsAreNotCopiedToBridgeMethodsTest.java +++ b/test/langtools/tools/javac/T6695379/AnnotationsAreNotCopiedToBridgeMethodsTest.java @@ -26,9 +26,7 @@ * @bug 6695379 * @summary Copy method annotations and parameter annotations to synthetic * bridge methods - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.util + * @modules jdk.compiler/com.sun.tools.javac.util * @run main AnnotationsAreNotCopiedToBridgeMethodsTest */ diff --git a/test/langtools/tools/javac/T6970173/DebugPointerAtBadPositionTest.java b/test/langtools/tools/javac/T6970173/DebugPointerAtBadPositionTest.java index 56813905ca5..070d45d2be3 100644 --- a/test/langtools/tools/javac/T6970173/DebugPointerAtBadPositionTest.java +++ b/test/langtools/tools/javac/T6970173/DebugPointerAtBadPositionTest.java @@ -26,9 +26,7 @@ * @bug 6970173 * @summary Debug pointer at bad position * @library /tools/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util * jdk.jdeps/com.sun.tools.javap diff --git a/test/langtools/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java b/test/langtools/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java index 839c835c800..62bae68ad36 100644 --- a/test/langtools/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java +++ b/test/langtools/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java @@ -26,9 +26,7 @@ * @bug 7008643 * @summary inlined finally clauses confuse debuggers * @library /tools/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util * jdk.jdeps/com.sun.tools.javap diff --git a/test/langtools/tools/javac/T7053059/DoubleCastTest.java b/test/langtools/tools/javac/T7053059/DoubleCastTest.java index 2aaf5d40f39..4353a119ec7 100644 --- a/test/langtools/tools/javac/T7053059/DoubleCastTest.java +++ b/test/langtools/tools/javac/T7053059/DoubleCastTest.java @@ -25,9 +25,7 @@ * @test * @bug 8015499 * @summary javac, Gen is generating extra checkcast instructions in some corner cases - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.util + * @modules jdk.compiler/com.sun.tools.javac.util * @run main DoubleCastTest */ diff --git a/test/langtools/tools/javac/T7093325.java b/test/langtools/tools/javac/T7093325.java index 0a8fac0692b..0b527794c1a 100644 --- a/test/langtools/tools/javac/T7093325.java +++ b/test/langtools/tools/javac/T7093325.java @@ -27,9 +27,7 @@ * @summary Redundant entry in bytecode exception table * temporarily workaround combo tests are causing time out in several platforms * @library /tools/javac/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.util * @build combo.ComboTestHelper diff --git a/test/langtools/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java b/test/langtools/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java index d7b823d94ec..493dbab113d 100644 --- a/test/langtools/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java +++ b/test/langtools/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java @@ -25,7 +25,6 @@ * @test * @bug 7165659 * @summary javac incorrectly sets strictfp access flag on inner-classes - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.util */ diff --git a/test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java b/test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java index 2f10e510b0c..ee170ec939e 100644 --- a/test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java +++ b/test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java @@ -25,9 +25,7 @@ * @test * @bug 8003967 * @summary detect and remove all mutable implicit static enum fields in langtools - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.util + * @modules jdk.compiler/com.sun.tools.javac.util * @run main DetectMutableStaticFields */ @@ -69,11 +67,11 @@ public class DetectMutableStaticFields { "javax.tools", "javax.lang.model", "com.sun.source", - "jdk.internal.classfile", - "jdk.internal.classfile.attribute", - "jdk.internal.classfile.constantpool", - "jdk.internal.classfile.instruction", - "jdk.internal.classfile.components", + "java.lang.classfile", + "java.lang.classfile.attribute", + "java.lang.classfile.constantpool", + "java.lang.classfile.instruction", + "java.lang.classfile.components", "jdk.internal.classfile.impl", "com.sun.tools.javac", "com.sun.tools.javah", diff --git a/test/langtools/tools/javac/T8010737/ParameterNamesAreNotCopiedToAnonymousInitTest.java b/test/langtools/tools/javac/T8010737/ParameterNamesAreNotCopiedToAnonymousInitTest.java index 81879a5f2a0..a72c768aaef 100644 --- a/test/langtools/tools/javac/T8010737/ParameterNamesAreNotCopiedToAnonymousInitTest.java +++ b/test/langtools/tools/javac/T8010737/ParameterNamesAreNotCopiedToAnonymousInitTest.java @@ -26,9 +26,7 @@ * @bug 8010737 * @summary javac, known parameter's names should be copied to automatically * generated constructors for inner classes - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.tree * jdk.compiler/com.sun.tools.javac.util @@ -143,9 +141,6 @@ void checkInitSymbol( Arrays.asList(new File(System.getProperty("test.src"), this.getClass().getName() + ".java"))); java.util.List options = Arrays.asList( - "--enable-preview", - "--source", String.valueOf(Runtime.version().feature()), - "--add-exports", "java.base/jdk.internal.classfile.impl=ALL-UNNAMED", "--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", "--add-exports", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", "--add-exports", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", diff --git a/test/langtools/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java b/test/langtools/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java index 2957bdd20e7..4f32bc090c3 100644 --- a/test/langtools/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java +++ b/test/langtools/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java @@ -25,7 +25,6 @@ * @test * @bug 8011181 * @summary javac, empty UTF8 entry generated for inner class - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.util */ diff --git a/test/langtools/tools/javac/T8019486/WrongLNTForLambdaTest.java b/test/langtools/tools/javac/T8019486/WrongLNTForLambdaTest.java index 4ddc40fa231..c916089f4ed 100644 --- a/test/langtools/tools/javac/T8019486/WrongLNTForLambdaTest.java +++ b/test/langtools/tools/javac/T8019486/WrongLNTForLambdaTest.java @@ -26,11 +26,9 @@ * @bug 8019486 8026861 8027142 * @summary javac, generates erroneous LVT for a test case with lambda code * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main WrongLNTForLambdaTest */ diff --git a/test/langtools/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java b/test/langtools/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java index 8dd87820423..1870cc4cfa1 100644 --- a/test/langtools/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java +++ b/test/langtools/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java @@ -25,9 +25,7 @@ * @test * @bug 8022186 8271254 * @summary javac generates dead code if a try with an empty body has a finalizer - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.util + * @modules jdk.compiler/com.sun.tools.javac.util */ import java.lang.classfile.*; diff --git a/test/langtools/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java b/test/langtools/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java index 36afea59094..df6c32dcd48 100644 --- a/test/langtools/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java +++ b/test/langtools/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java @@ -26,11 +26,9 @@ * @bug 8024039 * @summary javac, previous solution for JDK-8022186 was incorrect * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main NoDeadCodeGenerationOnTrySmtTest */ diff --git a/test/langtools/tools/javac/T8028504/DontGenerateLVTForGNoneOpTest.java b/test/langtools/tools/javac/T8028504/DontGenerateLVTForGNoneOpTest.java index 150b0fc8c7c..759b78cb929 100644 --- a/test/langtools/tools/javac/T8028504/DontGenerateLVTForGNoneOpTest.java +++ b/test/langtools/tools/javac/T8028504/DontGenerateLVTForGNoneOpTest.java @@ -25,7 +25,6 @@ * @test * @bug 8028504 * @summary javac generates LocalVariableTable even with -g:none - * @enablePreview * @compile -g:none DontGenerateLVTForGNoneOpTest.java * @run main DontGenerateLVTForGNoneOpTest */ diff --git a/test/langtools/tools/javac/T8180141/MissingLNTEntryForBreakContinueTest.java b/test/langtools/tools/javac/T8180141/MissingLNTEntryForBreakContinueTest.java index 1a095ab5301..ad33759899f 100644 --- a/test/langtools/tools/javac/T8180141/MissingLNTEntryForBreakContinueTest.java +++ b/test/langtools/tools/javac/T8180141/MissingLNTEntryForBreakContinueTest.java @@ -25,9 +25,7 @@ * @test * @bug 8180141 * @summary Missing entry in LineNumberTable for break statement that jumps out of try-finally - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.code + * @modules jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.comp * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.main diff --git a/test/langtools/tools/javac/T8180660/MissingLNTEntryForFinalizerTest.java b/test/langtools/tools/javac/T8180660/MissingLNTEntryForFinalizerTest.java index 1cd9ee211e0..1da6fa5e121 100644 --- a/test/langtools/tools/javac/T8180660/MissingLNTEntryForFinalizerTest.java +++ b/test/langtools/tools/javac/T8180660/MissingLNTEntryForFinalizerTest.java @@ -25,9 +25,7 @@ * @test * @bug 8180141 * @summary Missing entry in LineNumberTable for break statement that jumps out of try-finally - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.code + * @modules jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.comp * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.main diff --git a/test/langtools/tools/javac/T8187805/BogusRTTAForUnusedVarTest.java b/test/langtools/tools/javac/T8187805/BogusRTTAForUnusedVarTest.java index aebc8a570d5..bf20746c738 100644 --- a/test/langtools/tools/javac/T8187805/BogusRTTAForUnusedVarTest.java +++ b/test/langtools/tools/javac/T8187805/BogusRTTAForUnusedVarTest.java @@ -24,9 +24,7 @@ /* * @test 8187805 * @summary bogus RuntimeVisibleTypeAnnotations for unused local in a block - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.util + * @modules jdk.compiler/com.sun.tools.javac.util * @run main BogusRTTAForUnusedVarTest */ diff --git a/test/langtools/tools/javac/T8203892/CheckTargetIsNotAddedAsMarkerInterfaceTest.java b/test/langtools/tools/javac/T8203892/CheckTargetIsNotAddedAsMarkerInterfaceTest.java index f123399c8f5..44e6564e49f 100644 --- a/test/langtools/tools/javac/T8203892/CheckTargetIsNotAddedAsMarkerInterfaceTest.java +++ b/test/langtools/tools/javac/T8203892/CheckTargetIsNotAddedAsMarkerInterfaceTest.java @@ -25,9 +25,7 @@ * @test 8203892 * @summary Target interface added as marker interface in calls to altMetafactory * @library /tools/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util * jdk.jdeps/com.sun.tools.javap diff --git a/test/langtools/tools/javac/T8209173/CodeCompletionExceptTest.java b/test/langtools/tools/javac/T8209173/CodeCompletionExceptTest.java index e18761fe5d1..e506340ab0a 100644 --- a/test/langtools/tools/javac/T8209173/CodeCompletionExceptTest.java +++ b/test/langtools/tools/javac/T8209173/CodeCompletionExceptTest.java @@ -26,9 +26,7 @@ * @bug 8209173 * @summary javac fails with completion exception while reporting an error * @library /tools/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util * jdk.jdeps/com.sun.tools.javap diff --git a/test/langtools/tools/javac/T8210435/NoLocalsMustBeReservedForDCEedVarsTest.java b/test/langtools/tools/javac/T8210435/NoLocalsMustBeReservedForDCEedVarsTest.java index 35ccb627b44..225b105664e 100644 --- a/test/langtools/tools/javac/T8210435/NoLocalsMustBeReservedForDCEedVarsTest.java +++ b/test/langtools/tools/javac/T8210435/NoLocalsMustBeReservedForDCEedVarsTest.java @@ -25,7 +25,6 @@ * @test * @summary * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util diff --git a/test/langtools/tools/javac/T8222949/TestConstantDynamic.java b/test/langtools/tools/javac/T8222949/TestConstantDynamic.java index d6f728eda5a..007e7648d40 100644 --- a/test/langtools/tools/javac/T8222949/TestConstantDynamic.java +++ b/test/langtools/tools/javac/T8222949/TestConstantDynamic.java @@ -26,9 +26,7 @@ * @bug 8222949 * @summary add condy support to javac's pool API * @library /tools/javac/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.jvm diff --git a/test/langtools/tools/javac/TryWithResources/TwrSimpleClose.java b/test/langtools/tools/javac/TryWithResources/TwrSimpleClose.java index 4c1e3a48275..1f2230493e4 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrSimpleClose.java +++ b/test/langtools/tools/javac/TryWithResources/TwrSimpleClose.java @@ -26,8 +26,6 @@ * @bug 8194978 * @summary Verify than an appropriate number of close method invocations is generated. * @library /tools/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox TwrSimpleClose * @run main TwrSimpleClose */ diff --git a/test/langtools/tools/javac/annotations/ApplicableAnnotationsOnRecords.java b/test/langtools/tools/javac/annotations/ApplicableAnnotationsOnRecords.java index 0bc65af8aa1..75e8d57fdad 100644 --- a/test/langtools/tools/javac/annotations/ApplicableAnnotationsOnRecords.java +++ b/test/langtools/tools/javac/annotations/ApplicableAnnotationsOnRecords.java @@ -26,9 +26,7 @@ * @summary test for com.sun.tools.javac.comp.Check::validateAnnotation, com.sun.tools.javac.code.SymbolMetadata::removeDeclarationMetadata and ::removeFromCompoundList * @bug 8241312 8246774 * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.util - * java.base/jdk.internal.classfile.impl * @run main ApplicableAnnotationsOnRecords */ import java.lang.classfile.*; diff --git a/test/langtools/tools/javac/annotations/SyntheticParameters.java b/test/langtools/tools/javac/annotations/SyntheticParameters.java index b26232c4989..692499a0b8a 100644 --- a/test/langtools/tools/javac/annotations/SyntheticParameters.java +++ b/test/langtools/tools/javac/annotations/SyntheticParameters.java @@ -26,8 +26,6 @@ * @bug 8065132 * @summary Test generation of annotations on inner class parameters. * @library /lib/annotations/ - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build annotations.classfile.ClassfileInspector SyntheticParameters * @run main SyntheticParameters */ diff --git a/test/langtools/tools/javac/annotations/parameter/ParameterAnnotations.java b/test/langtools/tools/javac/annotations/parameter/ParameterAnnotations.java index 395765fcb80..da042001356 100644 --- a/test/langtools/tools/javac/annotations/parameter/ParameterAnnotations.java +++ b/test/langtools/tools/javac/annotations/parameter/ParameterAnnotations.java @@ -21,11 +21,10 @@ * questions. */ -/** +/* * @test * @bug 8024694 8334870 * @summary Check javac can handle various Runtime(In)VisibleParameterAnnotations attribute combinations - * @enablePreview * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main @@ -641,8 +640,8 @@ private void doTest(Path base, String code, String binaryNameToCheck, } Task.Result result = new JavacTask(tb) + .processors(new TestAP()) .options("-classpath", classes.toString(), - "-processor", TestAP.class.getName(), "-XDrawDiagnostics", "-Xlint:classfile") .outdir(classes) diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsPositionsOnRecords.java b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsPositionsOnRecords.java index 6d2aabaee80..190c6372ebc 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsPositionsOnRecords.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsPositionsOnRecords.java @@ -26,9 +26,7 @@ * @bug 8246774 * @summary Verify location of type annotations on records * @library /tools/lib - * @enablePreview * @modules - * java.base/jdk.internal.classfile.impl * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.code diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/VariablesDeclaredWithVarTest.java b/test/langtools/tools/javac/annotations/typeAnnotations/VariablesDeclaredWithVarTest.java index 7384f4bd5d7..199e56fbf53 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/VariablesDeclaredWithVarTest.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/VariablesDeclaredWithVarTest.java @@ -26,9 +26,7 @@ * @bug 8261205 * @summary check that potentially applicable type annotations are skip if the variable or parameter was declared with var * @library /tools/lib - * @enablePreview * @modules - * java.base/jdk.internal.classfile.impl * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.code diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/AnonymousClassTest.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/AnonymousClassTest.java index eb4b5aa2cf7..7a11e5239d1 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/AnonymousClassTest.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/AnonymousClassTest.java @@ -26,10 +26,8 @@ * @bug 8198945 8207018 8207017 * @summary Invalid RuntimeVisibleTypeAnnotations for annotation on anonymous class type parameter * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * jdk.jdeps/com.sun.tools.javap * @build toolbox.ToolBox toolbox.JavapTask * @run compile -g AnonymousClassTest.java diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java index dfe116580b5..7d3f42584ad 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java @@ -25,8 +25,6 @@ * @test * @bug 8005085 8005877 8004829 8005681 8006734 8006775 * @summary Combinations of Target ElementTypes on (repeated)type annotations. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ import java.lang.classfile.*; diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java index 46f5717103a..dda964c3473 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java @@ -25,8 +25,6 @@ * @test * @bug 8005085 8005877 8004829 8005681 8006734 8006775 8006507 * @summary Combinations of Target ElementTypes on (repeated)type annotations. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ import java.lang.classfile.*; diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest3.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest3.java index d0a4deef80b..16e2ed0bb5c 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest3.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest3.java @@ -25,9 +25,7 @@ * @test * @bug 8005085 8005681 8008769 8010015 * @summary Check (repeating)type annotations on lambda usage. - * @enablePreview * @modules jdk.jdeps/com.sun.tools.classfile - * java.base/jdk.internal.classfile.impl * @run main CombinationsTargetTest3 */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/DeadCode.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/DeadCode.java index 02caa8df615..3a9fdc9270a 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/DeadCode.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/DeadCode.java @@ -32,8 +32,6 @@ * @test * @bug 6917130 8006775 * @summary test that optimized away annotations are not emited to classfile - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ public class DeadCode extends ClassfileTestHelper { diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/InstanceInitializer.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/InstanceInitializer.java index be3ca03c30c..d6a775c2b6c 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/InstanceInitializer.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/InstanceInitializer.java @@ -29,8 +29,6 @@ * @test * @bug 8136419 8200301 * @summary test that type annotations on entities in initializers are emitted to classfile - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -XDdeduplicateLambdas=false InstanceInitializer.java * @run main InstanceInitializer */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java index f447dde8998..cbaebb4916e 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java @@ -31,8 +31,6 @@ /* * @test ClassLiterals * @summary test that new type arguments are emitted to classfile - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ public class NewTypeArguments extends ClassfileTestHelper{ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java index ffab642c1d5..65d5a639f35 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java @@ -34,8 +34,6 @@ * @test NoTargetAnnotations * @summary test that annotations with no Target meta type is emitted * only once as declaration annotation - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ public class NoTargetAnnotations extends ClassfileTestHelper { diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Scopes.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Scopes.java index 35bc576a2ca..4025a61be6a 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Scopes.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Scopes.java @@ -32,8 +32,6 @@ * @test * @bug 6843077 8006775 * @summary Qualified inner type annotation accessible to the class. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ @Scopes.UniqueInner diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/StaticInitializer.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/StaticInitializer.java index 80341544789..b44faa4d6cf 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/StaticInitializer.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/StaticInitializer.java @@ -30,8 +30,6 @@ * @test * @bug 8136419 8200301 * @summary test that type annotations on entities in static initializers are emitted to classfile - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -XDdeduplicateLambdas=false StaticInitializer.java * @run main StaticInitializer */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java index 4b8d317d771..cc2dcf8277f 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java @@ -25,8 +25,6 @@ * @test SyntheticParameters * @summary Test generation of annotations on inner class parameters. * @library /lib/annotations/ - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @run main SyntheticParameters */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008762.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008762.java index 5dae330b193..4dbff9cd68f 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008762.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008762.java @@ -26,8 +26,6 @@ * @bug 8008762 * @summary Type annotation on inner class in anonymous class * shows up as regular annotation - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ import java.lang.annotation.*; import static java.lang.annotation.RetentionPolicy.*; diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008769.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008769.java index fc9ffdfef1d..0aa41def875 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008769.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008769.java @@ -26,8 +26,6 @@ * @summary Repeated type-annotations on type parm of local variable * are not written to classfile. * @bug 8008769 - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ import java.lang.annotation.*; import static java.lang.annotation.RetentionPolicy.*; diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8010015.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8010015.java index 635f4ce9fb2..045c75fa39f 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8010015.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8010015.java @@ -25,8 +25,6 @@ * @test * @summary Wrong classfile attribution in inner class of lambda expression. * @bug 8010015 - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ import java.lang.annotation.*; diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java index fc232d06b64..efb78c02ad3 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java @@ -32,9 +32,6 @@ * annotation place on type of element (a FIELD&TYPE_USE element on a field * results in 2). Elements with no annotations expect 0. * Source template is read in from testanoninner.template - * - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ import java.lang.classfile.*; import java.lang.classfile.attribute.*; diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestNewCastArray.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestNewCastArray.java index 048c1836664..ea4f69ecaca 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestNewCastArray.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestNewCastArray.java @@ -25,8 +25,6 @@ * @test * @bug 8005681 * @summary Repeated annotations on new,array,cast. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ import java.lang.classfile.*; import java.lang.classfile.attribute.*; diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TypeAnnotationPropagationTest.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TypeAnnotationPropagationTest.java index 9f7873bb2c0..46f9ba18e9b 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TypeAnnotationPropagationTest.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TypeAnnotationPropagationTest.java @@ -25,8 +25,6 @@ * @test * @bug 8144185 * @summary javac produces incorrect RuntimeInvisibleTypeAnnotations length attribute - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ import static java.lang.annotation.ElementType.TYPE_USE; diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java index 04907df1203..9a0ed02ae28 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java @@ -33,7 +33,6 @@ * @bug 6843077 8006775 * @summary test that typecasts annotation are emitted if only the cast * expression is optimized away - * @enablePreview */ public class TypeCasts extends ClassfileTestHelper{ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java index 31d9294f120..3295d0a513b 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java @@ -32,7 +32,6 @@ * @test Wildcards * @bug 6843077 8006775 * @summary test that annotations target wildcards get emitted to classfile - * @enablePreview */ public class Wildcards extends ClassfileTestHelper { public static void main(String[] args) throws Exception { diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java index 8607b1cc312..c4581fc1bf3 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java @@ -27,8 +27,6 @@ * @test * @bug 8042451 8164519 * @summary Test population of reference info for class extends clauses - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java ClassExtends.java * @run main Driver ClassExtends */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java index 696d3b32929..2202766e450 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java @@ -27,8 +27,6 @@ * @test * @bug 8042451 * @summary Test population of reference info for class type parameters - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java ClassTypeParam.java * @run main Driver ClassTypeParam */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ConstructorInvocationTypeArgument.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ConstructorInvocationTypeArgument.java index bcffb424827..f89ec2efce4 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ConstructorInvocationTypeArgument.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ConstructorInvocationTypeArgument.java @@ -25,8 +25,6 @@ * @test * @bug 8042451 * @summary Test population of reference info for constructor invocation type argument - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java ConstructorInvocationTypeArgument.java * @run main Driver ConstructorInvocationTypeArgument */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java index beab5ea9fb5..89128a60888 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java @@ -25,8 +25,6 @@ * @test * @bug 8026791 8042451 * @summary Test population of reference info for constructor results - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java Constructors.java * @run main Driver Constructors */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java index b479f7dcfdc..e179764a1e8 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java @@ -28,8 +28,6 @@ * @bug 8028576 8042451 * @summary Test population of reference info for exception parameters * @author Werner Dietl - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java ExceptionParameters.java * @run main Driver ExceptionParameters */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java index 7a77ac2390b..089f32ae775 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java @@ -25,8 +25,6 @@ * @test * @bug 8042451 8208470 * @summary Test population of reference info for field - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java Fields.java * @run main Driver Fields */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java index b52a20353d8..b89517c4376 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java @@ -27,8 +27,6 @@ * @test * @bug 8042451 * @summary Test that the examples from the manual are stored as expected - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java FromSpecification.java * @run main Driver FromSpecification */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Initializers.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Initializers.java index 706edb453b1..70af9591900 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Initializers.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Initializers.java @@ -28,8 +28,6 @@ * @bug 8013852 8042451 * @summary Test population of reference info for instance and class initializers * @author Werner Dietl - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java Initializers.java * @run main Driver Initializers */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java index 690f0ddc186..1d78183e68e 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java @@ -26,8 +26,6 @@ * @bug 8008077 8029721 8042451 8043974 * @summary Test population of reference info for lambda expressions * javac crash for annotated parameter type of lambda in a field - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @ignore 8057687 emit correct byte code an attributes for type annotations * @compile -g Driver.java ReferenceInfoUtil.java Lambda.java * @run main Driver Lambda diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodInvocationTypeArgument.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodInvocationTypeArgument.java index f0df24e3805..38026251a19 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodInvocationTypeArgument.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodInvocationTypeArgument.java @@ -25,8 +25,6 @@ * @test * @bug 8042451 * @summary Test population of reference info for method invocation type arguments - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java MethodInvocationTypeArgument.java * @run main Driver MethodInvocationTypeArgument */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java index 2f5b6d43636..edc9ae18a32 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java @@ -27,8 +27,6 @@ * @test * @bug 8042451 * @summary Test population of reference info for method parameters - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java MethodParameters.java * @run main Driver MethodParameters */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java index faae9c91c04..d379301005f 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java @@ -27,8 +27,6 @@ * @test * @bug 8042451 * @summary Test population of reference info for method receivers - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java MethodReceivers.java * @run main Driver MethodReceivers */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java index ee7248db119..b174ea414c4 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java @@ -27,8 +27,6 @@ * @test * @bug 8042451 * @summary Test population of reference info for method return - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java MethodReturns.java * @run main Driver MethodReturns */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java index 546b8cdeb0a..69de815909e 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java @@ -27,8 +27,6 @@ * @test * @bug 8042451 * @summary Test population of reference info for method exception clauses - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java MethodThrows.java * @run main Driver MethodThrows */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java index fa6203e3fff..05a8c09c1cf 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java @@ -28,8 +28,6 @@ * @test * @bug 8042451 * @summary Test population of reference info for method type parameters - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java MethodTypeParam.java * @run main Driver MethodTypeParam */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java index a3d927a0fb9..a1883ff4864 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java @@ -28,8 +28,6 @@ * @bug 8006732 8006775 8042451 * @summary Test population of reference info for multicatch exception parameters * @author Werner Dietl - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java MultiCatch.java * @run main Driver MultiCatch */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java index f3b54ff35a1..37aedf75f62 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java @@ -27,8 +27,6 @@ * @test * @bug 8042451 8044009 8044010 * @summary Test population of reference info for nested types - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @ignore 8057687 emit correct byte code an attributes for type annotations * @compile -g Driver.java ReferenceInfoUtil.java NestedTypes.java * @run main Driver NestedTypes diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java index cac938a4869..ff90b8bb2da 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java @@ -27,8 +27,6 @@ * @test * @bug 8042451 * @summary Test population of reference info for new object creations - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java NewObjects.java * @run main Driver NewObjects */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java index 70cb3a94bd8..1d78cfed508 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java @@ -26,8 +26,6 @@ /* * @test * @summary Test population of reference info for repeating type annotations - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java RepeatingTypeAnnotations.java * @run main Driver RepeatingTypeAnnotations * @author Werner Dietl diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ResourceVariable.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ResourceVariable.java index e1be3ea1435..bb5944d400c 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ResourceVariable.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ResourceVariable.java @@ -25,8 +25,6 @@ * @test * @bug 8042451 * @summary Test population of reference info for resource variable - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java ResourceVariable.java * @run main Driver ResourceVariable */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java index 9afaffe0bf1..612601538b6 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java @@ -27,8 +27,6 @@ * @test * @bug 8042451 * @summary Test population of reference info for type casts - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java TypeCasts.java * @run main Driver TypeCasts */ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java index 5cbb6a370fa..e82c5f4009a 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java @@ -27,8 +27,6 @@ * @test * @bug 8042451 * @summary Test population of reference info for class literals - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g Driver.java ReferenceInfoUtil.java TypeTests.java * @run main Driver TypeTests */ diff --git a/test/langtools/tools/javac/cast/intersection/DuplicatedCheckcastTest.java b/test/langtools/tools/javac/cast/intersection/DuplicatedCheckcastTest.java index 544314832e8..0bf600044b1 100644 --- a/test/langtools/tools/javac/cast/intersection/DuplicatedCheckcastTest.java +++ b/test/langtools/tools/javac/cast/intersection/DuplicatedCheckcastTest.java @@ -21,16 +21,14 @@ * questions. */ -/** +/* * @test * @bug 8263642 8268885 * @summary javac should not emit duplicate checkcast for first bound of intersection type in cast * duplicate checkcast when destination type is not first type of intersection type * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main DuplicatedCheckcastTest */ diff --git a/test/langtools/tools/javac/classfiles/InnerClasses/SyntheticClasses.java b/test/langtools/tools/javac/classfiles/InnerClasses/SyntheticClasses.java index eca1b840b3a..db06862d3ae 100644 --- a/test/langtools/tools/javac/classfiles/InnerClasses/SyntheticClasses.java +++ b/test/langtools/tools/javac/classfiles/InnerClasses/SyntheticClasses.java @@ -25,8 +25,6 @@ * @bug 8034854 * @summary Verify that the InnerClasses attribute has outer_class_info_index zero if it has * inner_name_index zero (for synthetic classes) - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile SyntheticClasses.java * @run main SyntheticClasses */ diff --git a/test/langtools/tools/javac/classfiles/T8255757/T8255757.java b/test/langtools/tools/javac/classfiles/T8255757/T8255757.java index 231a132e579..b165967bf5e 100644 --- a/test/langtools/tools/javac/classfiles/T8255757/T8255757.java +++ b/test/langtools/tools/javac/classfiles/T8255757/T8255757.java @@ -26,10 +26,8 @@ * @bug 8255757 * @summary Javac shouldn't emit duplicate pool entries on array::clone * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main T8255757 */ diff --git a/test/langtools/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java b/test/langtools/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java index 2911e58820f..f67fa87474e 100644 --- a/test/langtools/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java @@ -26,7 +26,6 @@ * @bug 8042947 * @summary Checking AnnotationDefault attribute. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java b/test/langtools/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java index 924916f5cbd..69a40ddbf45 100644 --- a/test/langtools/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java @@ -26,7 +26,6 @@ * @bug 8042931 8215470 * @summary Checking EnclosingMethod attribute of anonymous/local class. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java index 8312b535f50..3d3d4f69d0a 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java @@ -26,7 +26,6 @@ * @summary Tests a line number table attribute for language constructions in different containers. * @bug 8040131 * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util diff --git a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/MultipleRecordPatterns.java b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/MultipleRecordPatterns.java index 53a60b69cb0..b2b3e1e8a2c 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/MultipleRecordPatterns.java +++ b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/MultipleRecordPatterns.java @@ -26,7 +26,6 @@ * @bug 8307814 * @summary Verify correct LineNumberTable is generated for unrolled record patterns. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util diff --git a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/RuleSwitchBreaks.java b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/RuleSwitchBreaks.java index 58f1386a000..a1bb8a6150c 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/RuleSwitchBreaks.java +++ b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/RuleSwitchBreaks.java @@ -26,7 +26,6 @@ * @bug 8262891 * @summary Verify correct LineNumberTable for rule switches. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util diff --git a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/StringSwitchBreaks.java b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/StringSwitchBreaks.java index e22a847370b..e445818553e 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/StringSwitchBreaks.java +++ b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/StringSwitchBreaks.java @@ -26,7 +26,6 @@ * @bug 8261606 * @summary Tests a line number table attribute for language constructions in different containers. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util diff --git a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/T8050993.java b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/T8050993.java index 934a0ef09e7..5c8af7e3a71 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/T8050993.java +++ b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/T8050993.java @@ -2,8 +2,6 @@ * @test /nodynamiccopyright/ * @bug 8050993 * @summary Verify that the condition in the conditional lexpression gets a LineNumberTable entry - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g T8050993.java * @run main T8050993 */ diff --git a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/T8314275.java b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/T8314275.java index 07a1e7c7575..d17ae238704 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/T8314275.java +++ b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/T8314275.java @@ -25,7 +25,6 @@ * @bug 8314275 * @summary Tests a line number table attribute for switch expression * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util diff --git a/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java b/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java index 1139b8d2fde..2ce77364bea 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java @@ -26,7 +26,6 @@ * @summary local variable table attribute test. * @bug 8040097 * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util diff --git a/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java b/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java index 6681231e4b2..0f4ed838edd 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java @@ -26,7 +26,6 @@ * @summary local variable type table attribute test. * @bug 8040097 * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util diff --git a/test/langtools/tools/javac/classfiles/attributes/Module/ModuleFlagTest.java b/test/langtools/tools/javac/classfiles/attributes/Module/ModuleFlagTest.java index a0e88b7c602..2dcee4d16e1 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Module/ModuleFlagTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Module/ModuleFlagTest.java @@ -26,11 +26,9 @@ * @bug 8080878 * @summary Checking ACC_MODULE flag is generated for module-info. * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask toolbox.ToolBox * @run main ModuleFlagTest */ diff --git a/test/langtools/tools/javac/classfiles/attributes/Module/ModuleTest.java b/test/langtools/tools/javac/classfiles/attributes/Module/ModuleTest.java index c6a329b7d0b..cf09ce7ca39 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Module/ModuleTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Module/ModuleTest.java @@ -25,12 +25,10 @@ * @test * @summary Module attribute tests * @bug 8080878 8161906 8162713 8170250 - * @enablePreview * @modules java.compiler * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util - * java.base/jdk.internal.classfile.impl * @library /tools/lib ../lib /tools/javac/lib * @build toolbox.ToolBox toolbox.JavacTask toolbox.ToolBox * TestBase TestResult ModuleTestBase diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/ConstructorTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/ConstructorTest.java index ae6b5f740c4..20012318ea7 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/ConstructorTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/ConstructorTest.java @@ -26,7 +26,6 @@ * @bug 8049238 * @summary Checks Signature attribute for constructors. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/EnumTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/EnumTest.java index 661b3405735..b7e6d2ca99a 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/EnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/EnumTest.java @@ -26,7 +26,6 @@ * @bug 8049238 * @summary Checks Signature attribute for enum. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/ExceptionTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/ExceptionTest.java index d15efea17df..54706e2822b 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/ExceptionTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/ExceptionTest.java @@ -26,7 +26,6 @@ * @bug 8049238 * @summary Checks Signature attribute for methods which throw exceptions. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/FieldTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/FieldTest.java index e5a7dfa480e..795a4d30bea 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/FieldTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/FieldTest.java @@ -26,7 +26,6 @@ * @bug 8049238 * @summary Checks Signature attribute for fields. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/InnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/InnerClassTest.java index ae3670aca03..740607d56c0 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/InnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/InnerClassTest.java @@ -26,7 +26,6 @@ * @bug 8049238 * @summary Checks Signature attribute for inner classes. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java index 3444cc14ce7..6966ed1852c 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java @@ -26,7 +26,6 @@ * @bug 8049238 * @summary Checks Signature attribute for method parameters. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java index 51e668779b6..2131b5a4f02 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java @@ -26,7 +26,6 @@ * @bug 8049238 * @summary Checks Signature attribute for type bounds. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java index e805baca82a..cce155bbb71 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java @@ -26,7 +26,6 @@ * @bug 8049238 * @summary Checks Signature attribute for array return type of method. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules java.desktop * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java index 63eb7369ff0..15696c89bee 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java @@ -26,7 +26,6 @@ * @summary sourcefile attribute test for anonymous class. * @bug 8040129 * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java index e2442f421d8..d8cd067408f 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java @@ -26,7 +26,6 @@ * @summary sourcefile attribute test for inner class. * @bug 8040129 * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java index a5b44936ede..dc45a92d407 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java @@ -26,7 +26,6 @@ * @summary sourcefile attribute test for local class. * @bug 8040129 * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/MixTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/MixTest.java index 1c7aae4ae0f..d2079bb13f9 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/MixTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/MixTest.java @@ -26,7 +26,6 @@ * @summary sourcefile attribute test for complex structure of nested classes and other types. * @bug 8040129 * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/ModuleInfoTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/ModuleInfoTest.java index 886ee032ed2..d0b65e41cfe 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/ModuleInfoTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/ModuleInfoTest.java @@ -26,7 +26,6 @@ * @summary sourcefile attribute test for module-info. * @bug 8080878 * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java index d4a4972f135..4e4b2faacd2 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java @@ -26,7 +26,6 @@ * @summary sourcefile attribute test for file compiled without debug information. * @bug 8040129 * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java index 33f55545d81..07885640f8a 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java @@ -30,7 +30,6 @@ * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox InMemoryFileManager TestBase SourceFileTestBase - * @enablePreview * @run main SyntheticClassTest */ diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java index d29d2ef9600..ee85b2dc650 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java @@ -26,7 +26,6 @@ * @summary sourcefile attribute test for two type in one file. * @bug 8040129 * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassConstructorsTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassConstructorsTest.java index 1c220441d8d..3072b641b69 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassConstructorsTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassConstructorsTest.java @@ -25,10 +25,8 @@ * @test * @bug 8189335 * @summary Synthetic anonymous class used as access constructor tag conflicting with a top level class. - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult * @build AccessToPrivateInnerClassConstructorsTest SyntheticTestDriver ExpectedClass ExpectedClasses diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java index 3eef2e12ba7..0440ec1a430 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java @@ -26,10 +26,8 @@ * @bug 8044537 * @summary Checking ACC_SYNTHETIC flag is generated for access method * generated to access to private methods and fields. - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult * @build AccessToPrivateInnerClassMembersTest SyntheticTestDriver ExpectedClass ExpectedClasses diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java index 94f4af3a1e2..720af8507a8 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java @@ -26,10 +26,8 @@ * @bug 8044537 * @summary Checking ACC_SYNTHETIC flag is generated for access method * generated to access to private methods and fields. - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase * @build AccessToPrivateSiblingsTest SyntheticTestDriver ExpectedClass ExpectedClasses diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java index 8015177ff14..508bf245c47 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java @@ -25,10 +25,8 @@ * @test * @bug 8044537 * @summary Checking ACC_SYNTHETIC flag is generated for assert statement. - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase * @build AssertFieldTest SyntheticTestDriver ExpectedClass ExpectedClasses diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java index fedcf817ee3..96c7a41fea9 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java @@ -25,10 +25,8 @@ * @test * @bug 8044537 * @summary Checking ACC_SYNTHETIC flag is generated for bridge method generated for generic method. - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase * @build BridgeMethodForGenericMethodTest SyntheticTestDriver ExpectedClass ExpectedClasses diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTargetRelease14Test.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTargetRelease14Test.java index e4dfb5000f5..db123295f7c 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTargetRelease14Test.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTargetRelease14Test.java @@ -32,11 +32,10 @@ * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager * ExpectedClass ExpectedClasses - * @compile --enable-preview --source ${jdk.version} --target ${jdk.version} - * SyntheticTestDriver.java + * @compile SyntheticTestDriver.java * ../lib/TestResult.java ../lib/TestBase.java * @compile --source 14 -target 14 -XDdeduplicateLambdas=false BridgeMethodsForLambdaTargetRelease14Test.java - * @run main/othervm --enable-preview SyntheticTestDriver BridgeMethodsForLambdaTargetRelease14Test + * @run main SyntheticTestDriver BridgeMethodsForLambdaTargetRelease14Test */ import java.util.Comparator; diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java index 10d93dd7631..5d26990d23d 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java @@ -26,10 +26,8 @@ * @bug 8044537 8200301 8238358 * @summary Checking ACC_SYNTHETIC flag is generated for bridge method * generated for lambda expressions and method references. - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase * @build SyntheticTestDriver ExpectedClass ExpectedClasses diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/EnumTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/EnumTest.java index 891f09ae083..d4cfbbe8d19 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/EnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/EnumTest.java @@ -25,10 +25,8 @@ * @test * @bug 8044537 * @summary Checking ACC_SYNTHETIC flag is generated for enum members. - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase * @build EnumTest SyntheticTestDriver ExpectedClass ExpectedClasses diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java index 108a9a16450..18a3c966546 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java @@ -25,10 +25,8 @@ * @test * @bug 8044537 * @summary Checking ACC_SYNTHETIC flag is generated for package-info. - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase * @build SyntheticTestDriver ExpectedClass ExpectedClasses diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java index ed87191d9c0..7c07628afbd 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java @@ -25,10 +25,8 @@ * @test * @bug 8044537 * @summary Checking ACC_SYNTHETIC flag is generated for "this$0" field. - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase * @build ThisFieldTest SyntheticTestDriver ExpectedClass ExpectedClasses diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java index 04bf7820b12..7691bc54ba7 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java @@ -26,9 +26,7 @@ * @bug 8044411 * @summary Tests the RuntimeVisibleAnnotations/RuntimeInvisibleAnnotations attribute. * Checks that the attribute is generated for bridge method. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java index ac8069b2a76..c0ca6d2426d 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java @@ -25,9 +25,7 @@ * @test * @bug 8044411 * @summary Tests the RuntimeVisibleAnnotations/RuntimeInvisibleAnnotations attribute. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java index 2ad55bea369..8fc1aadb276 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java @@ -25,9 +25,7 @@ * @test * @bug 8044411 * @summary Tests the RuntimeVisibleAnnotations/RuntimeInvisibleAnnotations attribute. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java index c4ee74e8ee3..f699124dca9 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java @@ -25,9 +25,7 @@ * @test * @bug 8044411 * @summary Tests the RuntimeVisibleAnnotations/RuntimeInvisibleAnnotations attribute. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java index 5d3bcc519ff..553155fa9f2 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java @@ -25,9 +25,7 @@ * @test * @bug 8044411 * @summary Tests the RuntimeVisibleAnnotations/RuntimeInvisibleAnnotations attribute. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java index 948b8abfcec..6a80acd406e 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java @@ -25,9 +25,7 @@ * @test * @bug 8044411 * @summary Tests the RuntimeVisibleAnnotations/RuntimeInvisibleAnnotations attribute. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java index 2846325dd4a..6e0671c2b23 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java @@ -26,9 +26,7 @@ * @bug 8044411 * @summary Tests the RuntimeParameterVisibleAnnotations/RuntimeParameterInvisibleAnnotations attribute. * Checks that the attribute is generated for bridge method. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java index ef9bd07cd69..c40ac214bd7 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java @@ -25,9 +25,7 @@ * @test * @bug 8044411 8079060 8138612 * @summary Tests the RuntimeParameterVisibleAnnotations/RuntimeParameterInvisibleAnnotations attribute. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java index a62c3a1d989..9443ccc5151 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java @@ -25,9 +25,7 @@ * @test * @bug 8044411 * @summary Tests the RuntimeParameterVisibleAnnotations/RuntimeParameterInvisibleAnnotations attribute. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * @library /tools/lib /tools/javac/lib ../lib * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase diff --git a/test/langtools/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java b/test/langtools/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java index b3e7339b240..d2b8c56207f 100644 --- a/test/langtools/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java @@ -26,11 +26,9 @@ * @bug 8042261 8298405 * @summary Checking that deprecated attribute does not apply to classes of deprecated package. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase * @run main DeprecatedPackageTest */ diff --git a/test/langtools/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java b/test/langtools/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java index 6467f3d8027..9a83cb2a920 100644 --- a/test/langtools/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java @@ -27,7 +27,6 @@ * @summary Checking what attribute is generated by annotation Deprecated * or javadoc deprecated for field, method, class(inner/local), interface. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java index a07a111f024..a7d84a4a599 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner annotations in inner annotation. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java index f02da8d302a..cdf2413eeec 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner annotations in inner class. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java index 06ccbdf0725..1b78cbeccec 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner annotations in inner enum. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java index 7fd6c7bd259..c40b7161d6d 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner annotations in inner interface. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java index 124f46acded..a6210b8455a 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java @@ -26,10 +26,8 @@ * @bug 8042251 * @summary Test that inner classes have in its inner classes attribute enclosing classes and its immediate members. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase * @run main InnerClassesHierarchyTest */ diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java index 45554408974..fb6003752f6 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java @@ -26,7 +26,6 @@ * @bug 8042251 8062373 * @summary Testing InnerClasses_attribute of inner classes in anonymous class. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java index 9b7be560ed4..f69b0d1a885 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner classes in inner annotation. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java index df638c9cd91..bd5d27e7307 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java @@ -26,7 +26,6 @@ * @bug 8034854 8042251 * @summary Testing InnerClasses_attribute of inner classes in inner class. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java index 9ff973177ab..7bca5b5240f 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java @@ -26,7 +26,6 @@ * @bug 8034854 8042251 * @summary Testing InnerClasses_attribute of inner classes in inner enum. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java index 722c1f4951a..3e6d32044cb 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner classes in inner interface. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java index bf5488f60b5..a2409c810d1 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner classes in local class. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules java.base/jdk.internal.classfile.impl * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java index 96f2efc6ea6..d8b78622185 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java @@ -26,10 +26,8 @@ * @bug 8042251 * @summary Test that outer_class_info_index of local and anonymous class is zero. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase * @run main InnerClassesIndexTest */ diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java index f2901d4c9cb..6225c89e591 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java @@ -26,7 +26,6 @@ * @bug 8034854 8042251 * @summary Testing inner classes attributes. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java index 41d9627b278..43aa1462ca6 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner enums in inner annotation. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java index 3136cce327d..3c4775d22a7 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner enums in inner enum. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java index 59d86c3f65a..01beace40ca 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner enums in inner interface. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java index aeee14b8e90..413bee58f00 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner enums in inner class. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java index 57f48bd6d3c..ca25c1028f6 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner interfaces in inner annotation. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java index 522d6077602..c0dac827f81 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java @@ -26,7 +26,6 @@ * @summary Testing InnerClasses_attribute of inner interfaces in inner class. * @author aeremeev * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java index 53136291cfa..5e6051ddd75 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner interfaces in inner enum. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java index 6f3ea9da4ed..abf8e5987d7 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java @@ -26,7 +26,6 @@ * @bug 8042251 * @summary Testing InnerClasses_attribute of inner interfaces in inner interface. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * java.base/jdk.internal.classfile.impl diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java index 35d65208bc5..e6f29a1d078 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java @@ -26,10 +26,8 @@ * @bug 8042251 * @summary Test that there are no inner classes attributes in case of there are no inner classes. * @library /tools/lib /tools/javac/lib ../lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox InMemoryFileManager TestBase * @run main NoInnerClassesTest */ diff --git a/test/langtools/tools/javac/classreader/8171132/BadConstantValue.java b/test/langtools/tools/javac/classreader/8171132/BadConstantValue.java index a44adbf6d9e..1523ac59f37 100644 --- a/test/langtools/tools/javac/classreader/8171132/BadConstantValue.java +++ b/test/langtools/tools/javac/classreader/8171132/BadConstantValue.java @@ -26,9 +26,7 @@ * @test * @bug 8171132 * @summary Improve class reading of invalid or out-of-range ConstantValue attributes - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.jvm * jdk.compiler/com.sun.tools.javac.main diff --git a/test/langtools/tools/javac/classreader/BadMethodParameter.java b/test/langtools/tools/javac/classreader/BadMethodParameter.java index cddd3f24956..56b93183abe 100644 --- a/test/langtools/tools/javac/classreader/BadMethodParameter.java +++ b/test/langtools/tools/javac/classreader/BadMethodParameter.java @@ -31,7 +31,6 @@ * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * @build toolbox.ToolBox toolbox.JavacTask - * @enablePreview * @run main BadMethodParameter */ @@ -99,9 +98,7 @@ public static void f(int x, int y) { Path classDir = getClassDir(); new JavacTask(tb) .classpath(classes, classDir) - .options("--enable-preview", - "-source", String.valueOf(Runtime.version().feature()), - "-verbose", "-parameters", "-processor", P.class.getName()) + .options("-verbose", "-parameters", "-processor", P.class.getName()) .classes(P.class.getName()) .outdir(classes) .run(Task.Expect.SUCCESS); diff --git a/test/langtools/tools/javac/classwriter/IndyCorrectInvocationName.java b/test/langtools/tools/javac/classwriter/IndyCorrectInvocationName.java index 8b5e4e7b695..3a8be1f53ed 100644 --- a/test/langtools/tools/javac/classwriter/IndyCorrectInvocationName.java +++ b/test/langtools/tools/javac/classwriter/IndyCorrectInvocationName.java @@ -27,7 +27,6 @@ * @summary Verify the correct constantpool entries are created for invokedynamic instructions using * the same bootstrap and type, but different name. * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.comp @@ -35,7 +34,6 @@ * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.tree * jdk.compiler/com.sun.tools.javac.util - * java.base/jdk.internal.classfile.impl * jdk.jdeps/com.sun.tools.javap * @build toolbox.JarTask toolbox.JavacTask toolbox.JavapTask toolbox.ToolBox * @run main IndyCorrectInvocationName diff --git a/test/langtools/tools/javac/code/CharImmediateValue.java b/test/langtools/tools/javac/code/CharImmediateValue.java index 44e2744b74e..d96fb60a1b7 100644 --- a/test/langtools/tools/javac/code/CharImmediateValue.java +++ b/test/langtools/tools/javac/code/CharImmediateValue.java @@ -27,7 +27,6 @@ * @summary Verify constant/immediate char values are correctly enhanced to ints when used in unary * operators * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.comp @@ -35,7 +34,6 @@ * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.tree * jdk.compiler/com.sun.tools.javac.util - * java.base/jdk.internal.classfile.impl * jdk.jdeps/com.sun.tools.javap * @build toolbox.JarTask toolbox.JavacTask toolbox.JavapTask toolbox.ToolBox * @compile CharImmediateValue.java diff --git a/test/langtools/tools/javac/constDebug/ConstDebugTest.java b/test/langtools/tools/javac/constDebug/ConstDebugTest.java index 59a6e4daa24..c487ccea269 100644 --- a/test/langtools/tools/javac/constDebug/ConstDebugTest.java +++ b/test/langtools/tools/javac/constDebug/ConstDebugTest.java @@ -25,7 +25,6 @@ * @test * @bug 4645152 4785453 * @summary javac compiler incorrectly inserts when -g is specified - * @enablePreview * @run compile -g ConstDebugTest.java * @run main ConstDebugTest */ diff --git a/test/langtools/tools/javac/defaultMethods/BadClassfile.java b/test/langtools/tools/javac/defaultMethods/BadClassfile.java index 589b65bcf66..ed952ea3799 100644 --- a/test/langtools/tools/javac/defaultMethods/BadClassfile.java +++ b/test/langtools/tools/javac/defaultMethods/BadClassfile.java @@ -26,9 +26,7 @@ * @bug 8025087 * @summary Verify that pre-JDK8 classfiles with default and/or static methods * are refused correctly. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.comp * jdk.compiler/com.sun.tools.javac.jvm diff --git a/test/langtools/tools/javac/defaultMethods/CheckACC_STRICTFlagOnDefaultMethodTest.java b/test/langtools/tools/javac/defaultMethods/CheckACC_STRICTFlagOnDefaultMethodTest.java index fd321f3a269..398a2eca169 100644 --- a/test/langtools/tools/javac/defaultMethods/CheckACC_STRICTFlagOnDefaultMethodTest.java +++ b/test/langtools/tools/javac/defaultMethods/CheckACC_STRICTFlagOnDefaultMethodTest.java @@ -26,7 +26,6 @@ * @bug 8012723 * @summary strictfp interface misses strictfp modifer on default method * @library /tools/lib /test/lib - * @enablePreview * @run main CheckACC_STRICTFlagOnDefaultMethodTest */ diff --git a/test/langtools/tools/javac/defaultMethods/TestDefaultBody.java b/test/langtools/tools/javac/defaultMethods/TestDefaultBody.java index ec4e8b7b558..edf8427bc93 100644 --- a/test/langtools/tools/javac/defaultMethods/TestDefaultBody.java +++ b/test/langtools/tools/javac/defaultMethods/TestDefaultBody.java @@ -25,8 +25,6 @@ * @test * @bug 7192246 * @summary check that code attributed for default methods is correctly generated - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ import java.lang.classfile.*; diff --git a/test/langtools/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java b/test/langtools/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java index 5d334224dc7..cff1b10a7e5 100644 --- a/test/langtools/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java +++ b/test/langtools/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java @@ -25,8 +25,6 @@ * @test * @bug 7192246 * @summary check that javac does not generate bridge methods for defaults - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ import java.lang.classfile.*; diff --git a/test/langtools/tools/javac/defaultMethods/super/TestDirectSuperInterfaceInvoke.java b/test/langtools/tools/javac/defaultMethods/super/TestDirectSuperInterfaceInvoke.java index 8be378eaf7b..9aa52686bc4 100644 --- a/test/langtools/tools/javac/defaultMethods/super/TestDirectSuperInterfaceInvoke.java +++ b/test/langtools/tools/javac/defaultMethods/super/TestDirectSuperInterfaceInvoke.java @@ -25,8 +25,6 @@ * @test * @bug 8027281 * @summary As per JVMS 4.9.2, invokespecial can only refer to direct superinterfaces - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile TestDirectSuperInterfaceInvoke.java * @run main TestDirectSuperInterfaceInvoke */ diff --git a/test/langtools/tools/javac/diags/CheckResourceKeys.java b/test/langtools/tools/javac/diags/CheckResourceKeys.java index 65d4ed24cb3..b5f5b2031de 100644 --- a/test/langtools/tools/javac/diags/CheckResourceKeys.java +++ b/test/langtools/tools/javac/diags/CheckResourceKeys.java @@ -25,10 +25,8 @@ * @test * @bug 6964768 6964461 6964469 6964487 6964460 6964481 6980021 * @summary need test program to validate javac resource bundles - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.resources:open - * java.base/jdk.internal.classfile.impl */ import java.io.*; diff --git a/test/langtools/tools/javac/diags/Example.java b/test/langtools/tools/javac/diags/Example.java index 1c76e429fd6..8940032367d 100644 --- a/test/langtools/tools/javac/diags/Example.java +++ b/test/langtools/tools/javac/diags/Example.java @@ -293,17 +293,6 @@ private void run(PrintWriter out, Set keys, boolean raw, boolean verbose if (procFiles.size() > 0) { List pOpts = new ArrayList<>(Arrays.asList("-d", classesDir.getPath())); - // hack to automatically add exports; a better solution would be to grep the - // source for import statements or a magic comment - for (File pf: procFiles) { - if (pf.getName().equals("CreateBadClassFile.java")) { - pOpts.add("--enable-preview"); - pOpts.add("--source"); - pOpts.add(String.valueOf(Runtime.version().feature())); - pOpts.add("--add-exports=java.base/jdk.internal.classfile.impl=ALL-UNNAMED"); - } - } - new Jsr199Compiler(verbose).run(null, null, false, pOpts, procFiles); opts.add("-classpath"); // avoid using -processorpath for now opts.add(classesDir.getPath()); diff --git a/test/langtools/tools/javac/diags/examples/BadConstantValueType/BadConstantValueType.java b/test/langtools/tools/javac/diags/examples/BadConstantValueType/BadConstantValueType.java index c8dac3a388d..1a9faf67547 100644 --- a/test/langtools/tools/javac/diags/examples/BadConstantValueType/BadConstantValueType.java +++ b/test/langtools/tools/javac/diags/examples/BadConstantValueType/BadConstantValueType.java @@ -25,7 +25,6 @@ // key: compiler.misc.bad.class.file.header // key: compiler.err.cant.access // options: -processor CreateBadClassFile -// run: exec --enable-preview /* The annotation processor will create an invalid classfile with a static * final field of type java.lang.Object having ConstantValue attribute with diff --git a/test/langtools/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java b/test/langtools/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java index c61e123c647..bae237b09d2 100644 --- a/test/langtools/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java +++ b/test/langtools/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java @@ -25,7 +25,6 @@ // key: compiler.misc.bad.class.file.header // key: compiler.err.cant.access // options: -processor CreateBadClassFile -// run: exec --enable-preview /* The annotation processor will create an invalid classfile with version 51.0 * and a non-abstract method in an interface. Loading the classfile will produce diff --git a/test/langtools/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java b/test/langtools/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java index 264b8861107..ba739de15ec 100644 --- a/test/langtools/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java +++ b/test/langtools/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java @@ -25,7 +25,6 @@ // key: compiler.misc.bad.class.file.header // key: compiler.err.cant.access // options: -processor CreateBadClassFile -// run: exec --enable-preview /* The annotation processor will create an invalid classfile with version 51.0 * and a static method in an interface. Loading the classfile will produce diff --git a/test/langtools/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java b/test/langtools/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java index e4879302058..57f4fcde3e7 100644 --- a/test/langtools/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java +++ b/test/langtools/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java @@ -26,8 +26,6 @@ * @bug 8027789 * @summary check that the direct superclass is used as the site when calling * a superclass' method - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile Base.java NonDirectSuper.java * @run main test.NonDirectSuper */ diff --git a/test/langtools/tools/javac/file/SymLinkArchiveTest.java b/test/langtools/tools/javac/file/SymLinkArchiveTest.java index eba933af49e..9cb544244f2 100644 --- a/test/langtools/tools/javac/file/SymLinkArchiveTest.java +++ b/test/langtools/tools/javac/file/SymLinkArchiveTest.java @@ -26,10 +26,8 @@ * @bug 8181897 * @summary * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.JavacTask toolbox.TestRunner toolbox.ToolBox * @run main SymLinkArchiveTest */ diff --git a/test/langtools/tools/javac/file/SymLinkShortNameTest.java b/test/langtools/tools/javac/file/SymLinkShortNameTest.java index 28f25f8b5bf..cb2d4ba058e 100644 --- a/test/langtools/tools/javac/file/SymLinkShortNameTest.java +++ b/test/langtools/tools/javac/file/SymLinkShortNameTest.java @@ -26,10 +26,8 @@ * @bug 8193277 * @summary SimpleFileObject inconsistency between getName and getShortName * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.JavacTask toolbox.TestRunner toolbox.ToolBox * @run main SymLinkShortNameTest */ diff --git a/test/langtools/tools/javac/file/SymLinkTest.java b/test/langtools/tools/javac/file/SymLinkTest.java index 45405aac2ee..ea5295505e1 100644 --- a/test/langtools/tools/javac/file/SymLinkTest.java +++ b/test/langtools/tools/javac/file/SymLinkTest.java @@ -28,10 +28,8 @@ * class.public.should.be.in.file diagnostic and SourceFile * attribute content * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.JavacTask toolbox.TestRunner toolbox.ToolBox * @run main SymLinkTest */ diff --git a/test/langtools/tools/javac/flow/LVTHarness.java b/test/langtools/tools/javac/flow/LVTHarness.java index cd4374d93e2..3686323567b 100644 --- a/test/langtools/tools/javac/flow/LVTHarness.java +++ b/test/langtools/tools/javac/flow/LVTHarness.java @@ -28,8 +28,6 @@ * javac crash while creating LVT entry for a local variable defined in * an inner block * @library /tools/javac/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @build JavacTestingAbstractProcessor LVTHarness * @run main LVTHarness */ diff --git a/test/langtools/tools/javac/generics/bridges/BridgeHarness.java b/test/langtools/tools/javac/generics/bridges/BridgeHarness.java index acf1a3cdef1..25414c8127c 100644 --- a/test/langtools/tools/javac/generics/bridges/BridgeHarness.java +++ b/test/langtools/tools/javac/generics/bridges/BridgeHarness.java @@ -26,9 +26,7 @@ * @bug 8013789 * @summary Compiler should emit bridges in interfaces * @library /tools/javac/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.code + * @modules jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.util * @build JavacTestingAbstractProcessor BridgeHarness * @run main BridgeHarness diff --git a/test/langtools/tools/javac/importscope/T8193717.java b/test/langtools/tools/javac/importscope/T8193717.java index bb2f0e87462..6ca58eb8a89 100644 --- a/test/langtools/tools/javac/importscope/T8193717.java +++ b/test/langtools/tools/javac/importscope/T8193717.java @@ -26,9 +26,7 @@ * @bug 8193717 * @summary Check that code with a lot named imports can compile. * @library /tools/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.jdeps/com.sun.tools.javap * @build toolbox.ToolBox toolbox.JavapTask diff --git a/test/langtools/tools/javac/jvm/ClassRefDupInConstantPoolTest.java b/test/langtools/tools/javac/jvm/ClassRefDupInConstantPoolTest.java index df700552ae9..3ea1f5b72bb 100644 --- a/test/langtools/tools/javac/jvm/ClassRefDupInConstantPoolTest.java +++ b/test/langtools/tools/javac/jvm/ClassRefDupInConstantPoolTest.java @@ -25,7 +25,6 @@ * @test * @bug 8015927 * @summary Class reference duplicates in constant pool - * @enablePreview * @clean ClassRefDupInConstantPoolTest$Duplicates * @run main ClassRefDupInConstantPoolTest */ diff --git a/test/langtools/tools/javac/lambda/ByteCodeTest.java b/test/langtools/tools/javac/lambda/ByteCodeTest.java index df5c8df1ff9..f273305925c 100644 --- a/test/langtools/tools/javac/lambda/ByteCodeTest.java +++ b/test/langtools/tools/javac/lambda/ByteCodeTest.java @@ -26,8 +26,6 @@ * @bug 8011738 * @author sogoel * @summary Code translation test for Lambda expressions, method references - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @run main ByteCodeTest */ diff --git a/test/langtools/tools/javac/lambda/LambdaTestStrictFPFlag.java b/test/langtools/tools/javac/lambda/LambdaTestStrictFPFlag.java index 47bc3f78f79..d4fc3eae0be 100644 --- a/test/langtools/tools/javac/lambda/LambdaTestStrictFPFlag.java +++ b/test/langtools/tools/javac/lambda/LambdaTestStrictFPFlag.java @@ -26,7 +26,6 @@ * @bug 8046060 * @summary Different results of floating point multiplication for lambda code block * @library /tools/lib /test/lib - * @enablePreview * @run main LambdaTestStrictFPFlag */ diff --git a/test/langtools/tools/javac/lambda/LocalVariableTable.java b/test/langtools/tools/javac/lambda/LocalVariableTable.java index e78fed1288a..cb243957287 100644 --- a/test/langtools/tools/javac/lambda/LocalVariableTable.java +++ b/test/langtools/tools/javac/lambda/LocalVariableTable.java @@ -25,8 +25,6 @@ * @test * @bug 8025998 8026749 8054220 8058227 * @summary Missing LV table in lambda bodies - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g LocalVariableTable.java * @run main LocalVariableTable */ diff --git a/test/langtools/tools/javac/lambda/TestBootstrapMethodsCount.java b/test/langtools/tools/javac/lambda/TestBootstrapMethodsCount.java index 1220bf4dfa4..46a381c97c2 100644 --- a/test/langtools/tools/javac/lambda/TestBootstrapMethodsCount.java +++ b/test/langtools/tools/javac/lambda/TestBootstrapMethodsCount.java @@ -26,9 +26,7 @@ * @bug 8129547 * @summary Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs * @library /tools/javac/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.jvm * jdk.compiler/com.sun.tools.javac.tree diff --git a/test/langtools/tools/javac/lambda/TestInvokeDynamic.java b/test/langtools/tools/javac/lambda/TestInvokeDynamic.java index 05c304cdd31..9ad73564e23 100644 --- a/test/langtools/tools/javac/lambda/TestInvokeDynamic.java +++ b/test/langtools/tools/javac/lambda/TestInvokeDynamic.java @@ -28,9 +28,7 @@ * Add back-end support for invokedynamic * temporarily workaround combo tests are causing time out in several platforms * @library /tools/javac/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.jvm diff --git a/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecode.java b/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecode.java index c19c848ee68..f7741921b70 100644 --- a/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecode.java +++ b/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecode.java @@ -27,9 +27,7 @@ * @summary Lambda back-end should generate invokevirtual for method handles referring to * private instance methods as lambda proxy is a nestmate of the target clsas * @library /tools/javac/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.util * @build combo.ComboTestHelper diff --git a/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecodeTargetRelease14.java b/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecodeTargetRelease14.java index 326de3168b3..6970832c45b 100644 --- a/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecodeTargetRelease14.java +++ b/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecodeTargetRelease14.java @@ -27,9 +27,7 @@ * @summary Lambda back-end should generate invokespecial for method handles referring to * private instance methods when compiling with --release 14 * @library /tools/javac/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.util * @build combo.ComboTestHelper diff --git a/test/langtools/tools/javac/lambda/deduplication/DeduplicationTest.java b/test/langtools/tools/javac/lambda/deduplication/DeduplicationTest.java index b9261632f61..10cbde8a2a4 100644 --- a/test/langtools/tools/javac/lambda/deduplication/DeduplicationTest.java +++ b/test/langtools/tools/javac/lambda/deduplication/DeduplicationTest.java @@ -24,9 +24,7 @@ /** * @test 8200301 8201194 * @summary deduplicate lambda methods with the same body, target type, and captured state - * @enablePreview * @modules - * java.base/jdk.internal.classfile.impl * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.code jdk.compiler/com.sun.tools.javac.comp * jdk.compiler/com.sun.tools.javac.file jdk.compiler/com.sun.tools.javac.main @@ -66,7 +64,6 @@ import com.sun.tools.javac.tree.TreeScanner; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.JCDiagnostic; -import jdk.internal.classfile.impl.BootstrapMethodEntryImpl; import java.io.InputStream; import java.nio.file.Path; @@ -156,7 +153,7 @@ public static void main(String[] args) throws Exception { } BootstrapMethodsAttribute bsm = cm.findAttribute(Attributes.bootstrapMethods()).orElseThrow(); for (BootstrapMethodEntry b : bsm.bootstrapMethods()) { - if (((BootstrapMethodEntryImpl) b).bootstrapMethod().asSymbol().methodName().equals("metafactory")) { + if (b.bootstrapMethod().asSymbol().methodName().equals("metafactory")) { bootstrapMethodNames.add( ((MethodHandleEntry) b.arguments().get(1)) .reference() diff --git a/test/langtools/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java b/test/langtools/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java index 8052c4b67bc..7b418f6184d 100644 --- a/test/langtools/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java +++ b/test/langtools/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java @@ -26,9 +26,7 @@ * @bug 8067422 * @summary Check that the lambda names are not unnecessarily unstable * @library /tools/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.jdeps/com.sun.tools.javap * @build toolbox.ToolBox toolbox.JavacTask diff --git a/test/langtools/tools/javac/launcher/GetResourceTest.java b/test/langtools/tools/javac/launcher/GetResourceTest.java index 4b46cb034ee..8cb9ce9fe72 100644 --- a/test/langtools/tools/javac/launcher/GetResourceTest.java +++ b/test/langtools/tools/javac/launcher/GetResourceTest.java @@ -25,7 +25,6 @@ * @test * @bug 8210009 8321739 * @summary Source Launcher classloader should support getResource and getResourceAsStream - * @enablePreview * @modules jdk.compiler * @library /tools/lib * @build toolbox.JavaTask toolbox.ToolBox @@ -54,7 +53,6 @@ void run() throws Exception { ToolBox tb = new ToolBox(); Path file = Paths.get(tb.testSrc).resolve("src/p/q").resolve("CLTest.java"); new JavaTask(tb) - .vmOptions("--enable-preview", "--source", String.valueOf(Runtime.version().feature())) .className(file.toString()) // implies source file mode .run(Task.Expect.SUCCESS) .writeAll(); diff --git a/test/langtools/tools/javac/launcher/SourceLauncherTest.java b/test/langtools/tools/javac/launcher/SourceLauncherTest.java index 090c4e298fd..3676ced9535 100644 --- a/test/langtools/tools/javac/launcher/SourceLauncherTest.java +++ b/test/langtools/tools/javac/launcher/SourceLauncherTest.java @@ -26,11 +26,9 @@ * @bug 8192920 8204588 8246774 8248843 8268869 8235876 8328339 8335896 * @summary Test source launcher * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.launcher * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * java.base/jdk.internal.module * @build toolbox.JavaTask toolbox.JavacTask toolbox.TestRunner toolbox.ToolBox * @run main SourceLauncherTest @@ -566,7 +564,7 @@ public void testNoMain(Path base) throws IOException { "error: can't find main(String[]) method in class: NoMain"); } - //@Test temporary disabled as enabled preview allows no-param main + @Test public void testMainBadParams(Path base) throws IOException { tb.writeJavaFiles(base, "class BadParams { public static void main() { } }"); @@ -574,7 +572,7 @@ public void testMainBadParams(Path base) throws IOException { "error: can't find main(String[]) method in class: BadParams"); } - //@Test temporary disabled as enabled preview allows non-public main + @Test public void testMainNotPublic(Path base) throws IOException { tb.writeJavaFiles(base, "class NotPublic { static void main(String... args) { } }"); @@ -582,7 +580,7 @@ public void testMainNotPublic(Path base) throws IOException { "error: can't find main(String[]) method in class: NotPublic"); } - //@Test temporary disabled as enabled preview allows non-static main + @Test public void testMainNotStatic(Path base) throws IOException { tb.writeJavaFiles(base, "class NotStatic { public void main(String... args) { } }"); diff --git a/test/langtools/tools/javac/launcher/src/p/q/CLTest.java b/test/langtools/tools/javac/launcher/src/p/q/CLTest.java index 9f7e5577847..4ec90245659 100644 --- a/test/langtools/tools/javac/launcher/src/p/q/CLTest.java +++ b/test/langtools/tools/javac/launcher/src/p/q/CLTest.java @@ -30,9 +30,7 @@ * The class uses the ClassFile library to validate the contents of * the URLs and streams returned by the methods being tested. * - * $ java \ - * --enable-preview - * /path/to/CLTest.java + * $ java /path/to/CLTest.java */ package p.q; diff --git a/test/langtools/tools/javac/linenumbers/ConditionalLineNumberTest.java b/test/langtools/tools/javac/linenumbers/ConditionalLineNumberTest.java index c44def84987..5e1cce76a28 100644 --- a/test/langtools/tools/javac/linenumbers/ConditionalLineNumberTest.java +++ b/test/langtools/tools/javac/linenumbers/ConditionalLineNumberTest.java @@ -25,7 +25,6 @@ * @test * @bug 8034091 * @summary Add LineNumberTable attributes for conditional operator (?:) split across several lines. - * @enablePreview */ import java.lang.classfile.*; diff --git a/test/langtools/tools/javac/linenumbers/FinallyLineNumberTest.java b/test/langtools/tools/javac/linenumbers/FinallyLineNumberTest.java index d150c6bb4b7..d1fbadb6f2f 100644 --- a/test/langtools/tools/javac/linenumbers/FinallyLineNumberTest.java +++ b/test/langtools/tools/javac/linenumbers/FinallyLineNumberTest.java @@ -25,7 +25,6 @@ * @test * @bug 8134759 * @summary Add LineNumberTable attribute for return bytecodes split around finally code - * @enablePreview */ import java.lang.classfile.*; diff --git a/test/langtools/tools/javac/linenumbers/NestedLineNumberTest.java b/test/langtools/tools/javac/linenumbers/NestedLineNumberTest.java index 108a31c23db..8827839eb23 100644 --- a/test/langtools/tools/javac/linenumbers/NestedLineNumberTest.java +++ b/test/langtools/tools/javac/linenumbers/NestedLineNumberTest.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 8061778 * @summary Wrong LineNumberTable for default constructors - * @enablePreview */ import java.util.List; @@ -21,8 +20,8 @@ public static void main(String[] args) throws Exception { } int line = lines.get(0).lineNumber(); - if (line != 50) { - error(String.format("LineNumberTable contains wrong line number - expected %d, found %d", 50, line)); + if (line != 49) { + error(String.format("LineNumberTable contains wrong line number - expected %d, found %d", 49, line)); } } diff --git a/test/langtools/tools/javac/linenumbers/NullCheckLineNumberTest.java b/test/langtools/tools/javac/linenumbers/NullCheckLineNumberTest.java index d74a0e5667b..48a999c90a2 100644 --- a/test/langtools/tools/javac/linenumbers/NullCheckLineNumberTest.java +++ b/test/langtools/tools/javac/linenumbers/NullCheckLineNumberTest.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 8172880 * @summary Wrong LineNumberTable for synthetic null checks - * @enablePreview */ import java.lang.classfile.*; @@ -36,13 +35,13 @@ public Test() { public static void main(String[] args) throws Exception { List actualEntries = findEntries(); List expectedEntries = List.of( - new SimpleEntry<>(25, 0), - new SimpleEntry<>(26, 4), - new SimpleEntry<>(28, 9), - new SimpleEntry<>(29, 16), - new SimpleEntry<>(30, 32), - new SimpleEntry<>(31, 46), - new SimpleEntry<>(32, 52) + new SimpleEntry<>(24, 0), + new SimpleEntry<>(25, 4), + new SimpleEntry<>(27, 9), + new SimpleEntry<>(28, 16), + new SimpleEntry<>(29, 32), + new SimpleEntry<>(30, 46), + new SimpleEntry<>(31, 52) ); if (!Objects.equals(actualEntries, expectedEntries)) { error(String.format("Unexpected LineNumberTable: %s", actualEntries.toString())); @@ -53,8 +52,8 @@ public static void main(String[] args) throws Exception { } catch (NullPointerException npe) { if (Arrays.stream(npe.getStackTrace()) .noneMatch(se -> se.getFileName().contains("NullCheckLineNumberTest") && - se.getLineNumber() == 30)) { - throw new AssertionError("Should go through line 30!"); + se.getLineNumber() == 29)) { + throw new AssertionError("Should go through line 29!"); } } } diff --git a/test/langtools/tools/javac/meth/TestCP.java b/test/langtools/tools/javac/meth/TestCP.java index bc574134b89..b01ac799b55 100644 --- a/test/langtools/tools/javac/meth/TestCP.java +++ b/test/langtools/tools/javac/meth/TestCP.java @@ -25,8 +25,6 @@ * @test * @bug 6991980 * @summary polymorphic signature calls don't share the same CP entries - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @run main TestCP */ diff --git a/test/langtools/tools/javac/modules/AnnotationsOnModules.java b/test/langtools/tools/javac/modules/AnnotationsOnModules.java index 909b5294d00..65019854360 100644 --- a/test/langtools/tools/javac/modules/AnnotationsOnModules.java +++ b/test/langtools/tools/javac/modules/AnnotationsOnModules.java @@ -26,10 +26,8 @@ * @bug 8159602 8170549 8171255 8171322 8254023 8341966 * @summary Test annotations on module declaration. * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase * @run main AnnotationsOnModules */ diff --git a/test/langtools/tools/javac/modules/IncubatingTest.java b/test/langtools/tools/javac/modules/IncubatingTest.java index ce9d372a2f6..68f615abc04 100644 --- a/test/langtools/tools/javac/modules/IncubatingTest.java +++ b/test/langtools/tools/javac/modules/IncubatingTest.java @@ -26,10 +26,8 @@ * @bug 8171177 8187591 * @summary Verify that ModuleResolution attribute flags are honored. * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * java.base/jdk.internal.module * jdk.jdeps/com.sun.tools.javap * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask toolbox.JavapTask ModuleTestBase diff --git a/test/langtools/tools/javac/modules/JavaBaseTest.java b/test/langtools/tools/javac/modules/JavaBaseTest.java index 484225fcd0c..935ddfa1d43 100644 --- a/test/langtools/tools/javac/modules/JavaBaseTest.java +++ b/test/langtools/tools/javac/modules/JavaBaseTest.java @@ -26,13 +26,11 @@ * @bug 8193125 8196623 8335989 * @summary test modifiers with java.base * @library /tools/lib - * @enablePreview * @modules * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.jvm * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.platform - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main JavaBaseTest */ diff --git a/test/langtools/tools/javac/modules/ModuleVersion.java b/test/langtools/tools/javac/modules/ModuleVersion.java index cbf9b82c54c..c5368b394a1 100644 --- a/test/langtools/tools/javac/modules/ModuleVersion.java +++ b/test/langtools/tools/javac/modules/ModuleVersion.java @@ -25,10 +25,8 @@ * @test * @summary simple tests of module uses * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask toolbox.ModuleBuilder ModuleTestBase * @run main ModuleVersion */ diff --git a/test/langtools/tools/javac/modules/OpenModulesTest.java b/test/langtools/tools/javac/modules/OpenModulesTest.java index f2bf1d00cc7..dc4c78912aa 100644 --- a/test/langtools/tools/javac/modules/OpenModulesTest.java +++ b/test/langtools/tools/javac/modules/OpenModulesTest.java @@ -25,10 +25,8 @@ * @test * @summary tests for multi-module mode compilation * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * jdk.jdeps/com.sun.tools.javap * @build toolbox.ToolBox toolbox.JavacTask toolbox.ModuleBuilder ModuleTestBase * @run main OpenModulesTest diff --git a/test/langtools/tools/javac/multicatch/7005371/T7005371.java b/test/langtools/tools/javac/multicatch/7005371/T7005371.java index c99371642a6..a8f71a1d078 100644 --- a/test/langtools/tools/javac/multicatch/7005371/T7005371.java +++ b/test/langtools/tools/javac/multicatch/7005371/T7005371.java @@ -25,8 +25,6 @@ * @test * @bug 7005371 * @summary Multicatch: assertion error while generating LocalVariableTypeTable attribute - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g SubTest.java * @run main T7005371 */ diff --git a/test/langtools/tools/javac/multicatch/Pos05.java b/test/langtools/tools/javac/multicatch/Pos05.java index 16ee54f2ccd..b3e6882752f 100644 --- a/test/langtools/tools/javac/multicatch/Pos05.java +++ b/test/langtools/tools/javac/multicatch/Pos05.java @@ -25,8 +25,6 @@ * @test * @bug 6943289 * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch') - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @run main Pos05 */ diff --git a/test/langtools/tools/javac/patterns/Annotations.java b/test/langtools/tools/javac/patterns/Annotations.java index a8106a39827..849e104d2ba 100644 --- a/test/langtools/tools/javac/patterns/Annotations.java +++ b/test/langtools/tools/javac/patterns/Annotations.java @@ -26,13 +26,11 @@ * @bug 8256266 8281238 * @summary Verify annotations work correctly on binding variables * @library /tools/javac/lib - * @enablePreview * @modules java.compiler * jdk.compiler - * java.base/jdk.internal.classfile.impl * @build JavacTestingAbstractProcessor * @compile Annotations.java - * @compile -J--enable-preview -processor Annotations -proc:only Annotations.java + * @compile -processor Annotations -proc:only Annotations.java * @run main Annotations */ diff --git a/test/langtools/tools/javac/patterns/LocalVariableTable.java b/test/langtools/tools/javac/patterns/LocalVariableTable.java index 37051daf142..1b80743bb26 100644 --- a/test/langtools/tools/javac/patterns/LocalVariableTable.java +++ b/test/langtools/tools/javac/patterns/LocalVariableTable.java @@ -25,8 +25,6 @@ * @test * @bug 8231827 * @summary Ensure the LV table entries are generated for bindings - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile -g LocalVariableTable.java * @run main LocalVariableTable */ diff --git a/test/langtools/tools/javac/patterns/MatchExceptionTest.java b/test/langtools/tools/javac/patterns/MatchExceptionTest.java index b54d0492bdf..1f761faaec1 100644 --- a/test/langtools/tools/javac/patterns/MatchExceptionTest.java +++ b/test/langtools/tools/javac/patterns/MatchExceptionTest.java @@ -26,10 +26,8 @@ * @bug 8297118 * @summary Verify javac uses MatchException or IncompatibleClassChangeError for exhaustive switches * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main MatchExceptionTest */ diff --git a/test/langtools/tools/javac/patterns/NestedPatternVariablesBytecode.java b/test/langtools/tools/javac/patterns/NestedPatternVariablesBytecode.java index 36068729146..ddec9fd2e56 100644 --- a/test/langtools/tools/javac/patterns/NestedPatternVariablesBytecode.java +++ b/test/langtools/tools/javac/patterns/NestedPatternVariablesBytecode.java @@ -26,10 +26,8 @@ * @bug 8268748 * @summary Javac generates error opcodes when using nest pattern variables * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main NestedPatternVariablesBytecode */ diff --git a/test/langtools/tools/javac/patterns/NoUnnecessaryCast.java b/test/langtools/tools/javac/patterns/NoUnnecessaryCast.java index 55444e1d748..84d4752671e 100644 --- a/test/langtools/tools/javac/patterns/NoUnnecessaryCast.java +++ b/test/langtools/tools/javac/patterns/NoUnnecessaryCast.java @@ -26,8 +26,6 @@ * @bug 8237528 * @summary Verify there are no unnecessary checkcasts and conditions generated * for the pattern matching in instanceof. - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl * @compile NoUnnecessaryCast.java * @run main NoUnnecessaryCast */ diff --git a/test/langtools/tools/javac/platform/ModuleVersionTest.java b/test/langtools/tools/javac/platform/ModuleVersionTest.java index 0e8f8b8c05f..457674cf45c 100644 --- a/test/langtools/tools/javac/platform/ModuleVersionTest.java +++ b/test/langtools/tools/javac/platform/ModuleVersionTest.java @@ -26,7 +26,6 @@ * @bug 8318913 * @summary Verify correct module versions are recorded when --release is used. * @library /tools/lib - * @enablePreview * @modules * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main diff --git a/test/langtools/tools/javac/platform/VerifyCTSymClassFiles.java b/test/langtools/tools/javac/platform/VerifyCTSymClassFiles.java index c97b15a2b15..3c563904b16 100644 --- a/test/langtools/tools/javac/platform/VerifyCTSymClassFiles.java +++ b/test/langtools/tools/javac/platform/VerifyCTSymClassFiles.java @@ -25,7 +25,6 @@ * @test * @bug 8331027 * @summary Verify classfile inside ct.sym - * @enablePreview * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main diff --git a/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsTest.java b/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsTest.java index 7f7400a65b4..97def1b1480 100644 --- a/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsTest.java +++ b/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsTest.java @@ -25,7 +25,6 @@ * @test * @bug 8072480 8277106 8331027 * @summary Unit test for CreateSymbols - * @enablePreview * @modules java.compiler * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.jvm @@ -102,9 +101,6 @@ void doRun() throws Exception { null, List.of("-d", compileDir.toAbsolutePath().toString(), - "--enable-preview", - "--source", - "" + System.getProperty("java.specification.version"), "-g", "--add-modules", "jdk.jdeps", "--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", diff --git a/test/langtools/tools/javac/preview/PreviewAutoSuppress.java b/test/langtools/tools/javac/preview/PreviewAutoSuppress.java index d77bd3b22da..20e562fe2d9 100644 --- a/test/langtools/tools/javac/preview/PreviewAutoSuppress.java +++ b/test/langtools/tools/javac/preview/PreviewAutoSuppress.java @@ -25,11 +25,9 @@ * @test * @bug 8250768 * @library /tools/lib - * @enablePreview * @modules * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main PreviewAutoSuppress */ diff --git a/test/langtools/tools/javac/preview/PreviewErrors.java b/test/langtools/tools/javac/preview/PreviewErrors.java index 8c76423c9d2..3ec1e99b2ed 100644 --- a/test/langtools/tools/javac/preview/PreviewErrors.java +++ b/test/langtools/tools/javac/preview/PreviewErrors.java @@ -26,14 +26,12 @@ * @bug 8226585 8250768 * @summary Verify behavior w.r.t. preview feature API errors and warnings * @library /tools/lib /tools/javac/lib - * @enablePreview * @modules * java.base/jdk.internal.javac * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @build combo.ComboTestHelper * @run main PreviewErrors diff --git a/test/langtools/tools/javac/preview/PreviewTest.java b/test/langtools/tools/javac/preview/PreviewTest.java index ad67ef8ac87..36f1e70acd0 100644 --- a/test/langtools/tools/javac/preview/PreviewTest.java +++ b/test/langtools/tools/javac/preview/PreviewTest.java @@ -25,11 +25,9 @@ * @test * @bug 8282823 8343540 * @library /tools/lib - * @enablePreview * @modules * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main PreviewTest */ diff --git a/test/langtools/tools/javac/processing/model/element/TestFileObjectOf.java b/test/langtools/tools/javac/processing/model/element/TestFileObjectOf.java index 3fef2fe434c..15d04e39d01 100644 --- a/test/langtools/tools/javac/processing/model/element/TestFileObjectOf.java +++ b/test/langtools/tools/javac/processing/model/element/TestFileObjectOf.java @@ -26,10 +26,8 @@ * @bug 8224922 * @summary Verify the behavior of the Elements.getFileObjectOf * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask toolbox.TestRunner * @build TestFileObjectOf * @run main TestFileObjectOf diff --git a/test/langtools/tools/javac/processing/model/element/TestOrigin.java b/test/langtools/tools/javac/processing/model/element/TestOrigin.java index dee13cbbeb2..b12f8f2dedc 100644 --- a/test/langtools/tools/javac/processing/model/element/TestOrigin.java +++ b/test/langtools/tools/javac/processing/model/element/TestOrigin.java @@ -26,10 +26,8 @@ * @bug 8171355 * @summary Test behavior of javax.lang.model.util.Elements.getOrigin. * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask toolbox.TestRunner * @build TestOrigin * @run main TestOrigin diff --git a/test/langtools/tools/javac/records/RecordCompilationTests.java b/test/langtools/tools/javac/records/RecordCompilationTests.java index a01712fedb3..1de0ec48f0d 100644 --- a/test/langtools/tools/javac/records/RecordCompilationTests.java +++ b/test/langtools/tools/javac/records/RecordCompilationTests.java @@ -29,12 +29,10 @@ * 8332600 * @summary Negative compilation tests, and positive compilation (smoke) tests for records * @library /lib/combo /tools/lib /tools/javac/lib - * @enablePreview * @modules * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.util - * java.base/jdk.internal.classfile.impl * @build JavacTestingAbstractProcessor * @run junit/othervm -DuseAP=false RecordCompilationTests * @run junit/othervm -DuseAP=true RecordCompilationTests diff --git a/test/langtools/tools/javac/records/RecordsBinaryCompatibilityTests.java b/test/langtools/tools/javac/records/RecordsBinaryCompatibilityTests.java index fd1304dfb9e..10ed2809bd0 100644 --- a/test/langtools/tools/javac/records/RecordsBinaryCompatibilityTests.java +++ b/test/langtools/tools/javac/records/RecordsBinaryCompatibilityTests.java @@ -25,12 +25,10 @@ * @test * @summary test binary compatibility rules for record classes * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util * jdk.compiler/com.sun.tools.javac.code - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main RecordsBinaryCompatibilityTests */ diff --git a/test/langtools/tools/javac/records/recordComponent/RecordComponentTypeTest.java b/test/langtools/tools/javac/records/recordComponent/RecordComponentTypeTest.java index 015dc805eea..f7550cb5339 100644 --- a/test/langtools/tools/javac/records/recordComponent/RecordComponentTypeTest.java +++ b/test/langtools/tools/javac/records/recordComponent/RecordComponentTypeTest.java @@ -26,10 +26,8 @@ * @bug 8273408 * @summary The compiler shouldn't crash when record component uses the class generated by the annotation processor. * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @compile GenerateTypeProcessor.java * @run main RecordComponentTypeTest */ diff --git a/test/langtools/tools/javac/recovery/AnnotationRecovery.java b/test/langtools/tools/javac/recovery/AnnotationRecovery.java index d9b9854f021..1ef98901ddc 100644 --- a/test/langtools/tools/javac/recovery/AnnotationRecovery.java +++ b/test/langtools/tools/javac/recovery/AnnotationRecovery.java @@ -26,10 +26,8 @@ * @bug 8270139 * @summary Verify error recovery w.r.t. annotations * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main AnnotationRecovery */ diff --git a/test/langtools/tools/javac/recovery/AttrRecovery.java b/test/langtools/tools/javac/recovery/AttrRecovery.java index 19325420af7..db679915e08 100644 --- a/test/langtools/tools/javac/recovery/AttrRecovery.java +++ b/test/langtools/tools/javac/recovery/AttrRecovery.java @@ -26,10 +26,8 @@ * @bug 8301580 8322159 8333107 8332230 8338678 * @summary Verify error recovery w.r.t. Attr * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main AttrRecovery */ diff --git a/test/langtools/tools/javac/recovery/FlowRecovery.java b/test/langtools/tools/javac/recovery/FlowRecovery.java index 930f230222b..2597e7fe51e 100644 --- a/test/langtools/tools/javac/recovery/FlowRecovery.java +++ b/test/langtools/tools/javac/recovery/FlowRecovery.java @@ -26,10 +26,8 @@ * @bug 8331212 * @summary Verify error recovery w.r.t. Flow * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main FlowRecovery */ diff --git a/test/langtools/tools/javac/recovery/LambdaRecovery.java b/test/langtools/tools/javac/recovery/LambdaRecovery.java index d64ae573ace..cbf8c540c79 100644 --- a/test/langtools/tools/javac/recovery/LambdaRecovery.java +++ b/test/langtools/tools/javac/recovery/LambdaRecovery.java @@ -26,10 +26,8 @@ * @bug 8297974 * @summary Verify error recovery w.r.t. lambdas * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main LambdaRecovery */ diff --git a/test/langtools/tools/javac/recovery/MethodModifiers.java b/test/langtools/tools/javac/recovery/MethodModifiers.java index 893c65f8cb0..a8220114700 100644 --- a/test/langtools/tools/javac/recovery/MethodModifiers.java +++ b/test/langtools/tools/javac/recovery/MethodModifiers.java @@ -26,10 +26,8 @@ * @bug 8292755 * @summary Verify error recovery related to method modifiers. * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main MethodModifiers */ diff --git a/test/langtools/tools/javac/resolve/NoObjectToString.java b/test/langtools/tools/javac/resolve/NoObjectToString.java index 56f574bbbbe..dd743bd7784 100644 --- a/test/langtools/tools/javac/resolve/NoObjectToString.java +++ b/test/langtools/tools/javac/resolve/NoObjectToString.java @@ -25,7 +25,6 @@ * @test * @bug 8272564 * @summary Correct resolution of toString() (and other similar calls) on interfaces - * @enablePreview * @compile NoObjectToString.java * @run main NoObjectToString */ diff --git a/test/langtools/tools/javac/sealed/BinaryCompatibilityTests.java b/test/langtools/tools/javac/sealed/BinaryCompatibilityTests.java index 2d3ce1821d2..e505f2a291a 100644 --- a/test/langtools/tools/javac/sealed/BinaryCompatibilityTests.java +++ b/test/langtools/tools/javac/sealed/BinaryCompatibilityTests.java @@ -25,12 +25,10 @@ * @test * @summary test binary compatibility rules for sealed classes * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util * jdk.compiler/com.sun.tools.javac.code - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main BinaryCompatibilityTests */ diff --git a/test/langtools/tools/javac/sealed/CheckSubtypesOfSealedTest.java b/test/langtools/tools/javac/sealed/CheckSubtypesOfSealedTest.java index 0f9634423ec..f0f27470aef 100644 --- a/test/langtools/tools/javac/sealed/CheckSubtypesOfSealedTest.java +++ b/test/langtools/tools/javac/sealed/CheckSubtypesOfSealedTest.java @@ -25,9 +25,7 @@ * @test * @summary check subtypes of sealed classes * @library /tools/lib /tools/javac/lib /tools/javac/classfiles/attributes/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.code + * @modules jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util diff --git a/test/langtools/tools/javac/sealed/SealedDiffConfigurationsTest.java b/test/langtools/tools/javac/sealed/SealedDiffConfigurationsTest.java index 6cec46ef2d1..f2c40422edd 100644 --- a/test/langtools/tools/javac/sealed/SealedDiffConfigurationsTest.java +++ b/test/langtools/tools/javac/sealed/SealedDiffConfigurationsTest.java @@ -25,12 +25,10 @@ * @test 8247352 8293348 * @summary test different configurations of sealed classes, same compilation unit, diff pkg or mdl, etc * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util * jdk.compiler/com.sun.tools.javac.code - * java.base/jdk.internal.classfile.impl * @build toolbox.ToolBox toolbox.JavacTask * @run main SealedDiffConfigurationsTest */ diff --git a/test/langtools/tools/javac/sym/ElementStructureTest.java b/test/langtools/tools/javac/sym/ElementStructureTest.java index 8e46863279a..7a5db50c06a 100644 --- a/test/langtools/tools/javac/sym/ElementStructureTest.java +++ b/test/langtools/tools/javac/sym/ElementStructureTest.java @@ -21,18 +21,16 @@ * questions. */ -/** +/* * @test * @bug 8072480 8203814 * @summary Check the platform classpath contains the correct elements. * @library /tools/lib - * @enablePreview * @modules jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.platform * jdk.compiler/com.sun.tools.javac.util - * java.base/jdk.internal.classfile.impl * jdk.jdeps/com.sun.tools.javap * @build toolbox.ToolBox ElementStructureTest * @run main ElementStructureTest diff --git a/test/langtools/tools/javac/varargs/6199075/T6199075.java b/test/langtools/tools/javac/varargs/6199075/T6199075.java index 6e77280eea5..3b90295cb5e 100644 --- a/test/langtools/tools/javac/varargs/6199075/T6199075.java +++ b/test/langtools/tools/javac/varargs/6199075/T6199075.java @@ -28,9 +28,7 @@ * @summary Unambiguous varargs method calls flagged as ambiguous * @author mcimadamore * - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.util */ diff --git a/test/langtools/tools/javac/varargs/7042566/T7042566.java b/test/langtools/tools/javac/varargs/7042566/T7042566.java index 41c8e9609ca..b2b37c9d573 100644 --- a/test/langtools/tools/javac/varargs/7042566/T7042566.java +++ b/test/langtools/tools/javac/varargs/7042566/T7042566.java @@ -27,9 +27,7 @@ * @summary Unambiguous varargs method calls flagged as ambiguous * temporarily workaround combo tests are causing time out in several platforms * @library /tools/javac/lib - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl - * jdk.compiler/com.sun.tools.javac.api + * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.util * @build combo.ComboTestHelper diff --git a/test/langtools/tools/javap/T6716452.java b/test/langtools/tools/javap/T6716452.java index 20c382918c3..c2f219a4597 100644 --- a/test/langtools/tools/javap/T6716452.java +++ b/test/langtools/tools/javap/T6716452.java @@ -24,7 +24,6 @@ /* * @test 6716452 * @summary need a method to get an index of an attribute - * @enablePreview */ import java.io.*; diff --git a/test/langtools/tools/javap/TestClassNameWarning.java b/test/langtools/tools/javap/TestClassNameWarning.java index 3412f8d290f..bed3c4a2cc3 100644 --- a/test/langtools/tools/javap/TestClassNameWarning.java +++ b/test/langtools/tools/javap/TestClassNameWarning.java @@ -26,7 +26,6 @@ * @bug 8170708 * @summary javap -m cannot read a module-info.class * @library /tools/lib - * @enablePreview * @modules * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main diff --git a/test/langtools/tools/javap/UndefinedAccessFlagTest.java b/test/langtools/tools/javap/UndefinedAccessFlagTest.java index 822c9e20f35..ab63dbddce8 100644 --- a/test/langtools/tools/javap/UndefinedAccessFlagTest.java +++ b/test/langtools/tools/javap/UndefinedAccessFlagTest.java @@ -26,7 +26,6 @@ * @summary javap should not fail if reserved access flag bits are set to 1 * @library /tools/lib * @modules jdk.jdeps/com.sun.tools.javap - * @enablePreview * @run junit UndefinedAccessFlagTest */ diff --git a/test/langtools/tools/javap/VerificationTest.java b/test/langtools/tools/javap/VerificationTest.java index 7caec462f16..9d9f593bc0d 100644 --- a/test/langtools/tools/javap/VerificationTest.java +++ b/test/langtools/tools/javap/VerificationTest.java @@ -24,7 +24,6 @@ /* * @test * @bug 8182774 - * @enablePreview * @summary test on class with a verification error * @modules jdk.jdeps/com.sun.tools.javap */ diff --git a/test/langtools/tools/javap/classfile/6888367/T6888367.java b/test/langtools/tools/javap/classfile/6888367/T6888367.java index 3e3e3adcd7a..2491398a70e 100644 --- a/test/langtools/tools/javap/classfile/6888367/T6888367.java +++ b/test/langtools/tools/javap/classfile/6888367/T6888367.java @@ -35,8 +35,6 @@ * @test * @bug 6888367 * @summary classfile library parses signature attributes incorrectly - * @enablePreview - * @modules java.base/jdk.internal.classfile.impl */ /* diff --git a/test/langtools/tools/javap/classfile/T6887895.java b/test/langtools/tools/javap/classfile/T6887895.java index fdc72395cad..b6c23a2d40e 100644 --- a/test/langtools/tools/javap/classfile/T6887895.java +++ b/test/langtools/tools/javap/classfile/T6887895.java @@ -25,7 +25,6 @@ * @test * @bug 6887895 * @summary test getting constantpool elements' basename through asInternalName() API - * @enablePreview */ import java.io.*; diff --git a/test/langtools/tools/javap/classfile/deps/T6907575.java b/test/langtools/tools/javap/classfile/deps/T6907575.java index 49019d4f870..9bcd16111d2 100644 --- a/test/langtools/tools/javap/classfile/deps/T6907575.java +++ b/test/langtools/tools/javap/classfile/deps/T6907575.java @@ -27,7 +27,6 @@ * @modules jdk.jdeps/com.sun.tools.jdeps * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.util - * @enablePreview * @build GetDeps p.C1 * @run main T6907575 */ diff --git a/test/langtools/tools/javap/typeAnnotations/JSR175Annotations.java b/test/langtools/tools/javap/typeAnnotations/JSR175Annotations.java index 1f5b2f43958..540d78acba8 100644 --- a/test/langtools/tools/javap/typeAnnotations/JSR175Annotations.java +++ b/test/langtools/tools/javap/typeAnnotations/JSR175Annotations.java @@ -30,7 +30,6 @@ * @test JSR175Annotations * @bug 6843077 * @summary test that only type annotations are recorded as such in classfile - * @enablePreview */ public class JSR175Annotations { diff --git a/test/langtools/tools/javap/typeAnnotations/NewArray.java b/test/langtools/tools/javap/typeAnnotations/NewArray.java index cf08baf2955..05760d6a925 100644 --- a/test/langtools/tools/javap/typeAnnotations/NewArray.java +++ b/test/langtools/tools/javap/typeAnnotations/NewArray.java @@ -29,7 +29,6 @@ * @test NewArray * @bug 6843077 * @summary Test type annotations on local array are in method's code attribute. - * @enablePreview */ public class NewArray { diff --git a/test/langtools/tools/javap/typeAnnotations/Presence.java b/test/langtools/tools/javap/typeAnnotations/Presence.java index 2fb488e705e..5e1b2a05dca 100644 --- a/test/langtools/tools/javap/typeAnnotations/Presence.java +++ b/test/langtools/tools/javap/typeAnnotations/Presence.java @@ -30,7 +30,6 @@ * @test Presence * @bug 6843077 * @summary test that all type annotations are present in the classfile - * @enablePreview */ public class Presence { diff --git a/test/langtools/tools/javap/typeAnnotations/PresenceInner.java b/test/langtools/tools/javap/typeAnnotations/PresenceInner.java index ccb79534616..d0cedc42db6 100644 --- a/test/langtools/tools/javap/typeAnnotations/PresenceInner.java +++ b/test/langtools/tools/javap/typeAnnotations/PresenceInner.java @@ -29,7 +29,6 @@ * @test PresenceInner * @bug 6843077 * @summary test that annotations in inner types count only once - * @enablePreview */ public class PresenceInner { diff --git a/test/langtools/tools/javap/typeAnnotations/TypeCasts.java b/test/langtools/tools/javap/typeAnnotations/TypeCasts.java index c8ee0fde965..8889d7e6db5 100644 --- a/test/langtools/tools/javap/typeAnnotations/TypeCasts.java +++ b/test/langtools/tools/javap/typeAnnotations/TypeCasts.java @@ -30,7 +30,6 @@ * @bug 6843077 * @summary test that typecasts annotation are emitted if only the cast * expression is optimized away - * @enablePreview */ public class TypeCasts { diff --git a/test/langtools/tools/javap/typeAnnotations/Visibility.java b/test/langtools/tools/javap/typeAnnotations/Visibility.java index ebffbf9176d..48bfbed343e 100644 --- a/test/langtools/tools/javap/typeAnnotations/Visibility.java +++ b/test/langtools/tools/javap/typeAnnotations/Visibility.java @@ -30,7 +30,6 @@ * @test Visibility * @bug 6843077 * @summary test that type annotations are recorded in the classfile - * @enablePreview */ public class Visibility { diff --git a/test/langtools/tools/javap/typeAnnotations/Wildcards.java b/test/langtools/tools/javap/typeAnnotations/Wildcards.java index 6bbabebdd37..a4e9b0609e8 100644 --- a/test/langtools/tools/javap/typeAnnotations/Wildcards.java +++ b/test/langtools/tools/javap/typeAnnotations/Wildcards.java @@ -29,7 +29,6 @@ * @test Wildcards * @bug 6843077 * @summary test that annotations target wildcards get emitted to classfile - * @enablePreview */ public class Wildcards { public static void main(String[] args) throws Exception { diff --git a/test/micro/org/openjdk/bench/java/lang/classfile/TypeKindBench.java b/test/micro/org/openjdk/bench/java/lang/classfile/TypeKindBench.java index 43d94f0385a..bf66fb5220b 100644 --- a/test/micro/org/openjdk/bench/java/lang/classfile/TypeKindBench.java +++ b/test/micro/org/openjdk/bench/java/lang/classfile/TypeKindBench.java @@ -50,7 +50,7 @@ @OutputTimeUnit(TimeUnit.NANOSECONDS) @Warmup(iterations = 3, time = 2) @Measurement(iterations = 6, time = 1) -@Fork(jvmArgs = "--enable-preview", value = 1) +@Fork(value = 1) @State(Scope.Thread) public class TypeKindBench { diff --git a/test/micro/org/openjdk/bench/java/lang/classfile/Utf8EntryWriteTo.java b/test/micro/org/openjdk/bench/java/lang/classfile/Utf8EntryWriteTo.java index db27d318699..101b7e46567 100644 --- a/test/micro/org/openjdk/bench/java/lang/classfile/Utf8EntryWriteTo.java +++ b/test/micro/org/openjdk/bench/java/lang/classfile/Utf8EntryWriteTo.java @@ -56,7 +56,7 @@ @OutputTimeUnit(TimeUnit.NANOSECONDS) @Warmup(iterations = 1, time = 2) @Measurement(iterations = 3, time = 1) -@Fork(jvmArgs = "--enable-preview", value = 3) +@Fork(value = 3) @State(Scope.Thread) public class Utf8EntryWriteTo { static final ClassDesc STRING_BUILDER = ClassDesc.ofDescriptor("Ljava/lang/StringBuilder;"); diff --git a/test/micro/org/openjdk/bench/java/lang/invoke/LazyStaticColdStart.java b/test/micro/org/openjdk/bench/java/lang/invoke/LazyStaticColdStart.java index 49a77d9539e..a28e8c82876 100644 --- a/test/micro/org/openjdk/bench/java/lang/invoke/LazyStaticColdStart.java +++ b/test/micro/org/openjdk/bench/java/lang/invoke/LazyStaticColdStart.java @@ -52,9 +52,7 @@ @BenchmarkMode(Mode.SingleShotTime) @OutputTimeUnit(TimeUnit.MICROSECONDS) @State(Scope.Thread) -@Fork(value = 10, warmups = 5, jvmArgs = { - "--enable-preview" -}) +@Fork(value = 10, warmups = 5) public class LazyStaticColdStart { private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); diff --git a/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java b/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java index 685f73e64ce..51ee5743f9b 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 @@ @Fork(value = 1, jvmArgs = { "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED", - "--enable-preview", "--add-exports", "java.base/jdk.internal.classfile.components=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile.impl=ALL-UNNAMED"}) @State(Scope.Benchmark) diff --git a/test/micro/org/openjdk/bench/jdk/classfile/ClassfileBenchmark.java b/test/micro/org/openjdk/bench/jdk/classfile/ClassfileBenchmark.java index ecd671feaac..073d87ffdf4 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/ClassfileBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/ClassfileBenchmark.java @@ -50,9 +50,7 @@ */ @Warmup(iterations = 3) @Measurement(iterations = 5) -@Fork(value = 1, jvmArgs = { - "--enable-preview"}) - +@Fork(value = 1) @State(Scope.Benchmark) public class ClassfileBenchmark { private byte[] benchBytes; diff --git a/test/micro/org/openjdk/bench/jdk/classfile/CodeAttributeTools.java b/test/micro/org/openjdk/bench/jdk/classfile/CodeAttributeTools.java index 877a36e3864..f16535ba3ae 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/CodeAttributeTools.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/CodeAttributeTools.java @@ -56,7 +56,6 @@ @BenchmarkMode(Mode.Throughput) @State(Scope.Benchmark) @Fork(value = 1, jvmArgs = { - "--enable-preview", "--add-exports", "java.base/jdk.internal.classfile.impl=ALL-UNNAMED"}) @Warmup(iterations = 2) @Measurement(iterations = 8) diff --git a/test/micro/org/openjdk/bench/jdk/classfile/ConstantPoolBuildingClassEntry.java b/test/micro/org/openjdk/bench/jdk/classfile/ConstantPoolBuildingClassEntry.java index afb586dabe7..bc9d334ad35 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/ConstantPoolBuildingClassEntry.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/ConstantPoolBuildingClassEntry.java @@ -43,7 +43,7 @@ @Measurement(iterations = 5) @OutputTimeUnit(TimeUnit.MILLISECONDS) @BenchmarkMode(Mode.Throughput) -@Fork(value = 1, jvmArgs = {"--enable-preview"}) +@Fork(value = 1) @State(Scope.Benchmark) public class ConstantPoolBuildingClassEntry { // JDK-8338546 diff --git a/test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java b/test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java index f6542983e13..9b4dae2da5b 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java @@ -37,8 +37,7 @@ @BenchmarkMode(Mode.Throughput) @State(Scope.Benchmark) -@Fork(value = 1, jvmArgs = { - "--enable-preview"}) +@Fork(value = 1) @Warmup(iterations = 2) @Measurement(iterations = 4) public class RebuildMethodBodies { diff --git a/test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java b/test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java index f8f29036545..e96e322c59d 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java @@ -37,8 +37,7 @@ @BenchmarkMode(Mode.Throughput) @State(Scope.Benchmark) @Fork(value = 1, jvmArgs = { - "--add-exports", "java.base/jdk.internal.classfile.components=ALL-UNNAMED", - "--enable-preview"}) + "--add-exports", "java.base/jdk.internal.classfile.components=ALL-UNNAMED"}) @Warmup(iterations = 3) @Measurement(iterations = 4) public class RepeatedModelTraversal { diff --git a/test/micro/org/openjdk/bench/jdk/classfile/Write.java b/test/micro/org/openjdk/bench/jdk/classfile/Write.java index 19dfabbdce8..ffd5b8f1c5e 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/Write.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/Write.java @@ -59,7 +59,6 @@ @Fork(value = 1, jvmArgs = { "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED", - "--enable-preview", "--add-exports", "java.base/jdk.internal.classfile.impl=ALL-UNNAMED"}) public class Write { static final int REPEATS = 40; From 253030a6d4e1d5d49622184cbff6ed809ab58206 Mon Sep 17 00:00:00 2001 From: Per Minborg Date: Tue, 10 Dec 2024 14:22:42 +0000 Subject: [PATCH 23/27] 8345465: Fix performance regression on x64 after JDK-8345120 Reviewed-by: jvernee Backport-of: 06c44dd568d91e1bd68f60fd3e57abcbe97e5dca --- .../jdk/internal/foreign/StringSupport.java | 29 +++++++++++-------- .../java/lang/foreign/InternalStrLen.java | 24 +++++++-------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/java.base/share/classes/jdk/internal/foreign/StringSupport.java b/src/java.base/share/classes/jdk/internal/foreign/StringSupport.java index 8f182f3b338..6dc104ff323 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/StringSupport.java +++ b/src/java.base/share/classes/jdk/internal/foreign/StringSupport.java @@ -130,8 +130,8 @@ public static int strlenByte(final AbstractMemorySegmentImpl segment, final long toOffset) { final long length = toOffset - fromOffset; segment.checkBounds(fromOffset, length); - if (length == 0) { - // The state has to be checked explicitly for zero-length segments + if (length < Byte.BYTES) { + // There can be no null terminator present segment.scope.checkValidState(); throw nullNotFound(segment, fromOffset, toOffset); } @@ -164,7 +164,8 @@ public static int strlenShort(final AbstractMemorySegmentImpl segment, final long toOffset) { final long length = toOffset - fromOffset; segment.checkBounds(fromOffset, length); - if (length == 0) { + if (length < Short.BYTES) { + // There can be no null terminator present segment.scope.checkValidState(); throw nullNotFound(segment, fromOffset, toOffset); } @@ -199,19 +200,23 @@ public static int strlenInt(final AbstractMemorySegmentImpl segment, final long toOffset) { final long length = toOffset - fromOffset; segment.checkBounds(fromOffset, length); - if (length == 0) { + if (length < Integer.BYTES) { + // There can be no null terminator present segment.scope.checkValidState(); throw nullNotFound(segment, fromOffset, toOffset); } - final long longBytes = length & LONG_MASK; - final long longLimit = fromOffset + longBytes; long offset = fromOffset; - for (; offset < longLimit; offset += Long.BYTES) { - long val = SCOPED_MEMORY_ACCESS.getLongUnaligned(segment.sessionImpl(), segment.unsafeGetBase(), segment.unsafeGetOffset() + offset, !Architecture.isLittleEndian()); - if (mightContainZeroInt(val)) { - for (int j = 0; j < Long.BYTES; j += Integer.BYTES) { - if (SCOPED_MEMORY_ACCESS.getIntUnaligned(segment.sessionImpl(), segment.unsafeGetBase(), segment.unsafeGetOffset() + offset + j, !Architecture.isLittleEndian()) == 0) { - return requireWithinStringSize(offset + j - fromOffset, segment, fromOffset, toOffset); + // For quad byte strings, it does not pay off to use long scanning on x64 + if (!Architecture.isX64()) { + final long longBytes = length & LONG_MASK; + final long longLimit = fromOffset + longBytes; + for (; offset < longLimit; offset += Long.BYTES) { + long val = SCOPED_MEMORY_ACCESS.getLongUnaligned(segment.sessionImpl(), segment.unsafeGetBase(), segment.unsafeGetOffset() + offset, !Architecture.isLittleEndian()); + if (mightContainZeroInt(val)) { + for (int j = 0; j < Long.BYTES; j += Integer.BYTES) { + if (SCOPED_MEMORY_ACCESS.getIntUnaligned(segment.sessionImpl(), segment.unsafeGetBase(), segment.unsafeGetOffset() + offset + j, !Architecture.isLittleEndian()) == 0) { + return requireWithinStringSize(offset + j - fromOffset, segment, fromOffset, toOffset); + } } } } diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/InternalStrLen.java b/test/micro/org/openjdk/bench/java/lang/foreign/InternalStrLen.java index b7867efd771..4b2a5222159 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/InternalStrLen.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/InternalStrLen.java @@ -55,10 +55,10 @@ "--enable-native-access=ALL-UNNAMED"}) public class InternalStrLen { - private AbstractMemorySegmentImpl singleByteSegment; - private AbstractMemorySegmentImpl singleByteSegmentMisaligned; - private AbstractMemorySegmentImpl doubleByteSegment; - private AbstractMemorySegmentImpl quadByteSegment; + private MemorySegment singleByteSegment; + private MemorySegment singleByteSegmentMisaligned; + private MemorySegment doubleByteSegment; + private MemorySegment quadByteSegment; @Param({"1", "4", "16", "251", "1024"}) int size; @@ -66,9 +66,9 @@ public class InternalStrLen { @Setup public void setup() { var arena = Arena.ofAuto(); - singleByteSegment = (AbstractMemorySegmentImpl) arena.allocate((size + 1L) * Byte.BYTES); - doubleByteSegment = (AbstractMemorySegmentImpl) arena.allocate((size + 1L) * Short.BYTES); - quadByteSegment = (AbstractMemorySegmentImpl) arena.allocate((size + 1L) * Integer.BYTES); + singleByteSegment = arena.allocate((size + 1L) * Byte.BYTES); + doubleByteSegment = arena.allocate((size + 1L) * Short.BYTES); + quadByteSegment = arena.allocate((size + 1L) * Integer.BYTES); Stream.of(singleByteSegment, doubleByteSegment, quadByteSegment) .forEach(s -> IntStream.range(0, (int) s.byteSize() - 1) .forEach(i -> s.set( @@ -79,7 +79,7 @@ public void setup() { singleByteSegment.set(ValueLayout.JAVA_BYTE, singleByteSegment.byteSize() - Byte.BYTES, (byte) 0); doubleByteSegment.set(ValueLayout.JAVA_SHORT, doubleByteSegment.byteSize() - Short.BYTES, (short) 0); quadByteSegment.set(ValueLayout.JAVA_INT, quadByteSegment.byteSize() - Integer.BYTES, 0); - singleByteSegmentMisaligned = (AbstractMemorySegmentImpl) arena.allocate(singleByteSegment.byteSize() + 1). + singleByteSegmentMisaligned = arena.allocate(singleByteSegment.byteSize() + 1). asSlice(1); MemorySegment.copy(singleByteSegment, 0, singleByteSegmentMisaligned, 0, singleByteSegment.byteSize()); } @@ -106,22 +106,22 @@ public int elementQuad() { @Benchmark public int chunkedSingle() { - return StringSupport.strlenByte(singleByteSegment, 0, singleByteSegment.byteSize()); + return StringSupport.strlenByte((AbstractMemorySegmentImpl) singleByteSegment, 0, singleByteSegment.byteSize()); } @Benchmark public int chunkedSingleMisaligned() { - return StringSupport.strlenByte(singleByteSegmentMisaligned, 0, singleByteSegment.byteSize()); + return StringSupport.strlenByte((AbstractMemorySegmentImpl) singleByteSegmentMisaligned, 0, singleByteSegment.byteSize()); } @Benchmark public int chunkedDouble() { - return StringSupport.strlenShort(doubleByteSegment, 0, doubleByteSegment.byteSize()); + return StringSupport.strlenShort((AbstractMemorySegmentImpl) doubleByteSegment, 0, doubleByteSegment.byteSize()); } @Benchmark public int changedElementQuad() { - return StringSupport.strlenInt(quadByteSegment, 0, quadByteSegment.byteSize()); + return StringSupport.strlenInt((AbstractMemorySegmentImpl) quadByteSegment, 0, quadByteSegment.byteSize()); } // These are the legacy methods From ba02e0bd1b9f7104522c623eed1cf14f4366434c Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Tue, 10 Dec 2024 16:58:13 +0000 Subject: [PATCH 24/27] 8345794: Backout doc change introduced by JDK-8235786 Reviewed-by: dfuchs Backport-of: eff20a38c75a59372856e3ac54559661db92442d --- .../com/sun/net/httpserver/HttpExchange.java | 19 +-- .../net/httpserver/ExchangeAttributeTest.java | 130 +++--------------- 2 files changed, 23 insertions(+), 126 deletions(-) diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java index ebcbaa3a773..ea2845f56f5 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2021, 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 @@ -233,29 +233,22 @@ protected HttpExchange() { public abstract String getProtocol(); /** - * Returns the attribute's value from this exchange's - * {@linkplain HttpContext#getAttributes() context attributes}. - * - * @apiNote {@link Filter} modules may store arbitrary objects as attributes through - * {@code HttpExchange} instances as an out-of-band communication mechanism. Other filters + * {@link Filter} modules may store arbitrary objects with {@code HttpExchange} + * instances as an out-of-band communication mechanism. Other filters * or the exchange handler may then access these objects. * *

Each {@code Filter} class will document the attributes which they make * available. * * @param name the name of the attribute to retrieve - * @return the attribute's value or {@code null} if either the attribute isn't set - * or the attribute value is {@code null} + * @return the attribute object, or {@code null} if it does not exist * @throws NullPointerException if name is {@code null} */ public abstract Object getAttribute(String name); /** - * Sets an attribute with the given {@code name} and {@code value} in this exchange's - * {@linkplain HttpContext#getAttributes() context attributes}. - * - * @apiNote {@link Filter} modules may store arbitrary objects as attributes through - * {@code HttpExchange} instances as an out-of-band communication mechanism. Other filters + * {@link Filter} modules may store arbitrary objects with {@code HttpExchange} + * instances as an out-of-band communication mechanism. Other filters * or the exchange handler may then access these objects. * *

Each {@code Filter} class will document the attributes which they make diff --git a/test/jdk/com/sun/net/httpserver/ExchangeAttributeTest.java b/test/jdk/com/sun/net/httpserver/ExchangeAttributeTest.java index 84c7837e0b3..2ce3dfd016d 100644 --- a/test/jdk/com/sun/net/httpserver/ExchangeAttributeTest.java +++ b/test/jdk/com/sun/net/httpserver/ExchangeAttributeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 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 @@ -23,19 +23,16 @@ /* * @test - * @bug 8288109 8235786 + * @bug 8288109 * @summary Tests for HttpExchange set/getAttribute * @library /test/lib * @run junit/othervm ExchangeAttributeTest */ -import com.sun.net.httpserver.Filter; -import com.sun.net.httpserver.HttpContext; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; import jdk.test.lib.net.URIBuilder; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -56,87 +53,44 @@ public class ExchangeAttributeTest { - private static final InetAddress LOOPBACK_ADDR = InetAddress.getLoopbackAddress(); - private static final boolean ENABLE_LOGGING = true; - private static final Logger logger = Logger.getLogger("com.sun.net.httpserver"); - - private static HttpServer server; + static final InetAddress LOOPBACK_ADDR = InetAddress.getLoopbackAddress(); + static final boolean ENABLE_LOGGING = true; + static final Logger logger = Logger.getLogger("com.sun.net.httpserver"); @BeforeAll - public static void setup() throws Exception { + public static void setup() { if (ENABLE_LOGGING) { ConsoleHandler ch = new ConsoleHandler(); logger.setLevel(Level.ALL); ch.setLevel(Level.ALL); logger.addHandler(ch); } - server = HttpServer.create(new InetSocketAddress(LOOPBACK_ADDR, 0), 10); - server.createContext("/normal", new AttribHandler()); - final HttpContext filteredCtx = server.createContext("/filtered", new AttribHandler()); - filteredCtx.getFilters().add(new AttributeAddingFilter()); - server.start(); - System.out.println("Server started at " + server.getAddress()); - } - - @AfterAll - public static void afterAll() { - if (server != null) { - System.out.println("Stopping server " + server.getAddress()); - server.stop(0); - } } - /* - * Verifies that HttpExchange.setAttribute() allows for null value. - */ @Test - public void testNullAttributeValue() throws Exception { - try (var client = HttpClient.newBuilder().proxy(NO_PROXY).build()) { - var request = HttpRequest.newBuilder(uri(server, "/normal", null)).build(); + public void testExchangeAttributes() throws Exception { + var handler = new AttribHandler(); + var server = HttpServer.create(new InetSocketAddress(LOOPBACK_ADDR,0), 10); + server.createContext("/", handler); + server.start(); + try { + var client = HttpClient.newBuilder().proxy(NO_PROXY).build(); + var request = HttpRequest.newBuilder(uri(server, "")).build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); assertEquals(200, response.statusCode()); - } - } - - /* - * Verifies that an attribute set on one exchange is accessible to another exchange that - * belongs to the same HttpContext. - */ - @Test - public void testSharedAttribute() throws Exception { - try (var client = HttpClient.newBuilder().proxy(NO_PROXY).build()) { - final var firstReq = HttpRequest.newBuilder(uri(server, "/filtered", "firstreq")) - .build(); - System.out.println("issuing request " + firstReq); - final var firstResp = client.send(firstReq, HttpResponse.BodyHandlers.ofString()); - assertEquals(200, firstResp.statusCode()); - - // issue the second request - final var secondReq = HttpRequest.newBuilder(uri(server, "/filtered", "secondreq")) - .build(); - System.out.println("issuing request " + secondReq); - final var secondResp = client.send(secondReq, HttpResponse.BodyHandlers.ofString()); - assertEquals(200, secondResp.statusCode()); - - // verify that the filter was invoked for both the requests. the filter internally - // does the setAttribute() and getAttribute() and asserts that the attribute value - // set by the first exchange was available through the second exchange. - assertTrue(AttributeAddingFilter.filteredFirstReq, "Filter wasn't invoked for " - + firstReq.uri()); - assertTrue(AttributeAddingFilter.filteredSecondReq, "Filter wasn't invoked for " - + secondReq.uri()); + } finally { + server.stop(0); } } // --- infra --- - static URI uri(HttpServer server, String path, String query) throws URISyntaxException { + static URI uri(HttpServer server, String path) throws URISyntaxException { return URIBuilder.newBuilder() .scheme("http") .loopback() .port(server.getAddress().getPort()) .path(path) - .query(query) .build(); } @@ -158,54 +112,4 @@ public void handle(HttpExchange exchange) throws IOException { } } } - - private static final class AttributeAddingFilter extends Filter { - - private static final String ATTR_NAME ="foo-bar"; - private static final String ATTR_VAL ="hello-world"; - private static volatile boolean filteredFirstReq; - private static volatile boolean filteredSecondReq; - - @Override - public void doFilter(final HttpExchange exchange, final Chain chain) throws IOException { - if (exchange.getRequestURI().getQuery().contains("firstreq")) { - filteredFirstReq = true; - // add a request attribute through the exchange, for this first request - // and at the same time verify that the attribute doesn't already exist - final Object attrVal = exchange.getAttribute(ATTR_NAME); - if (attrVal != null) { - throw new IOException("attribute " + ATTR_NAME + " with value: " + attrVal - + " unexpectedly present in exchange: " + exchange.getRequestURI()); - } - // set the value - exchange.setAttribute(ATTR_NAME, ATTR_VAL); - System.out.println(exchange.getRequestURI() + " set attribute " - + ATTR_NAME + "=" + ATTR_VAL); - } else if (exchange.getRequestURI().getQuery().contains("secondreq")) { - filteredSecondReq = true; - // verify the attribute is already set and the value is the expected one. - final Object attrVal = exchange.getAttribute(ATTR_NAME); - if (attrVal == null) { - throw new IOException("attribute " + ATTR_NAME + " is missing in exchange: " - + exchange.getRequestURI()); - } - if (!ATTR_VAL.equals(attrVal)) { - throw new IOException("unexpected value: " + attrVal + " for attribute " - + ATTR_NAME + " in exchange: " + exchange.getRequestURI()); - } - System.out.println(exchange.getRequestURI() + " found attribute " - + ATTR_NAME + "=" + attrVal); - } else { - // unexpected request - throw new IOException("unexpected request " + exchange.getRequestURI()); - } - // let the request proceed - chain.doFilter(exchange); - } - - @Override - public String description() { - return "AttributeAddingFilter"; - } - } } From 4ecb28ccdce9f323752ac5b8385f68a40bfb4183 Mon Sep 17 00:00:00 2001 From: Kevin Driver Date: Tue, 10 Dec 2024 21:14:37 +0000 Subject: [PATCH 25/27] 8344924: Default CA certificates loaded despite request to use custom keystore Reviewed-by: mullan Backport-of: 4c39e9faa0cb8e4fd00d8b9dc0ac5ad64d6b287d --- .../classes/sun/security/ssl/X509TrustManagerImpl.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java b/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java index ee19ff62a38..58794e5dce8 100644 --- a/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java @@ -25,7 +25,6 @@ package sun.security.ssl; -import java.lang.invoke.MethodHandles; import java.net.Socket; import java.security.*; import java.security.cert.*; @@ -52,15 +51,6 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager implements X509TrustManager { - static { - // eagerly initialize to avoid pinning virtual thread during TLS handshake - try { - MethodHandles.lookup().ensureInitialized(AnchorCertificates.class); - } catch (IllegalAccessException e) { - throw new ExceptionInInitializerError(e); - } - } - private final String validatorType; /** From 03bdee0f751b9a4a36c1830374474064a019336b Mon Sep 17 00:00:00 2001 From: Chen Liang Date: Wed, 11 Dec 2024 16:06:40 +0000 Subject: [PATCH 26/27] 8342469: Improve API documentation for java.lang.classfile.instruction Reviewed-by: asotona Backport-of: 0f035545e5c0cd02d11ab8edd5786c1f1f6043a7 --- .../java/lang/classfile/ClassFile.java | 26 +- .../java/lang/classfile/CodeBuilder.java | 2 +- .../java/lang/classfile/Instruction.java | 13 +- .../classes/java/lang/classfile/Label.java | 59 +- .../classes/java/lang/classfile/Opcode.java | 1696 ++++++++++++++--- .../classes/java/lang/classfile/TypeKind.java | 35 +- .../instruction/ArrayLoadInstruction.java | 22 +- .../instruction/ArrayStoreInstruction.java | 22 +- .../instruction/BranchInstruction.java | 33 +- .../classfile/instruction/CharacterRange.java | 31 +- .../instruction/ConstantInstruction.java | 102 +- .../instruction/ConvertInstruction.java | 32 +- .../instruction/DiscontinuedInstruction.java | 98 +- .../classfile/instruction/ExceptionCatch.java | 36 +- .../instruction/FieldInstruction.java | 26 +- .../instruction/IncrementInstruction.java | 26 +- .../instruction/InvokeDynamicInstruction.java | 22 +- .../instruction/InvokeInstruction.java | 52 +- .../classfile/instruction/LabelTarget.java | 26 +- .../classfile/instruction/LineNumber.java | 31 +- .../instruction/LoadInstruction.java | 41 +- .../classfile/instruction/LocalVariable.java | 46 +- .../instruction/LocalVariableType.java | 52 +- .../instruction/LookupSwitchInstruction.java | 23 +- .../instruction/MonitorInstruction.java | 15 +- .../instruction/NewMultiArrayInstruction.java | 19 +- .../instruction/NewObjectInstruction.java | 14 +- .../NewPrimitiveArrayInstruction.java | 23 +- .../NewReferenceArrayInstruction.java | 13 +- .../classfile/instruction/NopInstruction.java | 8 +- .../instruction/OperatorInstruction.java | 12 +- .../instruction/ReturnInstruction.java | 18 +- .../instruction/StackInstruction.java | 9 +- .../instruction/StoreInstruction.java | 44 +- .../classfile/instruction/SwitchCase.java | 17 +- .../instruction/TableSwitchInstruction.java | 31 +- .../instruction/ThrowInstruction.java | 8 +- .../instruction/TypeCheckInstruction.java | 27 +- .../classfile/instruction/package-info.java | 38 +- 39 files changed, 2407 insertions(+), 441 deletions(-) diff --git a/src/java.base/share/classes/java/lang/classfile/ClassFile.java b/src/java.base/share/classes/java/lang/classfile/ClassFile.java index db293f41588..6593dfcf2ae 100644 --- a/src/java.base/share/classes/java/lang/classfile/ClassFile.java +++ b/src/java.base/share/classes/java/lang/classfile/ClassFile.java @@ -32,6 +32,8 @@ import java.lang.classfile.constantpool.ClassEntry; import java.lang.classfile.constantpool.ConstantPoolBuilder; import java.lang.classfile.constantpool.Utf8Entry; +import java.lang.classfile.instruction.BranchInstruction; +import java.lang.classfile.instruction.DiscontinuedInstruction; import java.lang.classfile.instruction.ExceptionCatch; import java.lang.constant.ClassDesc; import java.lang.reflect.AccessFlag; @@ -230,17 +232,35 @@ enum LineNumbersOption implements Option { /** * Option describing whether to automatically rewrite short jumps to * long when necessary. - * Default is {@code FIX_SHORT_JUMPS} to automatically rewrite jump + * Default is {@link #FIX_SHORT_JUMPS} to automatically rewrite jump * instructions. + *

+ * Due to physical restrictions, some types of instructions cannot encode + * certain jump targets with bci offsets less than -32768 or greater than + * 32767, as they use a {@code s2} to encode such an offset. (The maximum + * length of the {@code code} array is 65535.) These types of instructions + * are called "short jumps". * + * @see BranchInstruction + * @see DiscontinuedInstruction.JsrInstruction * @since 24 */ enum ShortJumpsOption implements Option { - /** Automatically convert short jumps to long when necessary */ + /** + * Automatically convert short jumps to long when necessary. + *

+ * For an invalid instruction model, a {@link CodeBuilder} may generate + * another or a few other instructions to accomplish the same effect. + */ FIX_SHORT_JUMPS, - /** Fail if short jump overflows */ + /** + * Fail with an {@link IllegalArgumentException} if short jump overflows. + *

+ * This is useful to ensure the physical accuracy of a generated {@code + * class} file. + */ FAIL_ON_SHORT_JUMPS } diff --git a/src/java.base/share/classes/java/lang/classfile/CodeBuilder.java b/src/java.base/share/classes/java/lang/classfile/CodeBuilder.java index 1a074c1554a..3cbcb893cb1 100644 --- a/src/java.base/share/classes/java/lang/classfile/CodeBuilder.java +++ b/src/java.base/share/classes/java/lang/classfile/CodeBuilder.java @@ -51,7 +51,7 @@ * #with(ClassFileElement)} or concretely by calling the various {@code withXxx} * methods. * - *

Instruction Factories

+ *

Instruction Factories

* {@code CodeBuilder} provides convenience methods to create instructions (See * JVMS {@jvms 6.5} Instructions) by their mnemonic, taking necessary operands. *
    diff --git a/src/java.base/share/classes/java/lang/classfile/Instruction.java b/src/java.base/share/classes/java/lang/classfile/Instruction.java index 2fe0ec5a588..199aa6447a1 100644 --- a/src/java.base/share/classes/java/lang/classfile/Instruction.java +++ b/src/java.base/share/classes/java/lang/classfile/Instruction.java @@ -25,13 +25,20 @@ package java.lang.classfile; +import java.lang.classfile.attribute.CodeAttribute; import java.lang.classfile.instruction.*; import jdk.internal.classfile.impl.AbstractInstruction; /** - * Models an executable instruction in a method body. + * Models an executable instruction in the {@code code} array of the {@link + * CodeAttribute Code} attribute of a method. + *

    + * The {@link #opcode() opcode} identifies the operation of an instruction. + * Each {@linkplain Opcode#kind() kind} of opcode has its own modeling interface + * for instructions. * + * @sealedGraph * @since 24 */ public sealed interface Instruction extends CodeElement @@ -46,12 +53,14 @@ public sealed interface Instruction extends CodeElement ThrowInstruction, TypeCheckInstruction, AbstractInstruction { /** - * {@return the opcode of this instruction} + * {@return the operation of this instruction} */ Opcode opcode(); /** * {@return the size in bytes of this instruction} + * This value is equal to {@link Opcode#sizeIfFixed() + * opcode().sizeIfFixed()} if it is not {@code -1}. */ int sizeInBytes(); } diff --git a/src/java.base/share/classes/java/lang/classfile/Label.java b/src/java.base/share/classes/java/lang/classfile/Label.java index e958e116084..653c410728c 100644 --- a/src/java.base/share/classes/java/lang/classfile/Label.java +++ b/src/java.base/share/classes/java/lang/classfile/Label.java @@ -24,21 +24,60 @@ */ package java.lang.classfile; +import java.lang.classfile.attribute.CodeAttribute; +import java.lang.classfile.instruction.LabelTarget; +import java.util.ListIterator; + import jdk.internal.classfile.impl.LabelImpl; /** * A marker for a position within the instructions of a method body. The - * association between a label's identity and the position it represents is - * managed by the entity managing the method body (a {@link CodeModel} or {@link - * CodeBuilder}), not the label itself; this allows the same label to have a - * meaning both in an existing method (as managed by a {@linkplain CodeModel}) - * and in the transformation of that method (as managed by a {@linkplain - * CodeBuilder}), while corresponding to different positions in each. When - * traversing the elements of a {@linkplain CodeModel}, {@linkplain Label} - * markers will be delivered at the position to which they correspond. A label - * can be bound to the current position within a {@linkplain CodeBuilder} via - * {@link CodeBuilder#labelBinding(Label)} or {@link CodeBuilder#with(ClassFileElement)}. + * position is a cursor position in the list of instructions, similar to that + * of a {@link ListIterator}. + * + *

    Reading Labels

    + * Labels read from {@code class} files represent positions in the {@code code} + * array of a {@link CodeAttribute Code} attribute. It is associated with a + * {@index bci} (bytecode index), also known as {@index pc} + * (program counter), the index into the {@code code} array; the actual cursor + * position is immediately before the given index, so a label at the beginning + * of the instructions has bci {@code 0}, and a label at the end of the + * instructions has bci {@link CodeAttribute#codeLength codeLength() + 1}. The + * bci can be inspected through {@link CodeAttribute#labelToBci + * CodeAttribute::labelToBci}. + *

    + * In generic {@link CodeModel}s, a label may not have a bci value; the position + * of a label can be found by searching for the corresponding {@link LabelTarget} + * within that model. + * + *

    Writing Labels

    + * Many models in {@link java.lang.classfile} refer to labels. To write a + * label, a label must be obtained, it must be bound to a {@link CodeBuilder}. + *

    + * To obtain a label: + *

      + *
    • Use a label read from other models. + *
    • Use pre-defined labels from a {@link CodeBuilder}, such as {@link + * CodeBuilder#startLabel() CodeBuilder::startLabel}, {@link CodeBuilder#endLabel + * CodeBuilder::endLabel}, or {@link CodeBuilder.BlockCodeBuilder#breakLabel + * BlockCodeBuilder::breakLabel}. They are already bound. + *
    • Create labels with {@link CodeBuilder#newLabel CodeBuilder::newLabel} or + * {@link CodeBuilder#newBoundLabel CodeBuilder::newBoundLabel}. + *
    + *

    + * A label must be bound exactly once in the {@code CodeBuilder} where it is + * used; otherwise, writing fails. To bind an unbound label: + *

      + *
    • Send a read {@link LabelTarget} to a {@code CodeBuilder}. + *
    • Use {@link CodeBuilder#labelBinding CodeBuilder::labelBinding}. + *
    + * Note that a label read from another model is not automatically bound in a + * {@code CodeBuilder}; they are separate entities and the label is bound to + * different positions in them. * + * @see CodeAttribute#labelToBci CodeAttribute::labelToBci + * @see CodeBuilder#newLabel CodeBuilder::newLabel + * @see CodeBuilder#labelBinding CodeBuilder::labelBinding * @since 24 */ public sealed interface Label diff --git a/src/java.base/share/classes/java/lang/classfile/Opcode.java b/src/java.base/share/classes/java/lang/classfile/Opcode.java index 4d333400001..a3b0a370763 100644 --- a/src/java.base/share/classes/java/lang/classfile/Opcode.java +++ b/src/java.base/share/classes/java/lang/classfile/Opcode.java @@ -24,684 +24,1849 @@ */ package java.lang.classfile; +import java.lang.classfile.instruction.*; + import jdk.internal.classfile.impl.RawBytecodeHelper; /** * Describes the opcodes of the JVM instruction set, as described in JVMS {@jvms 6.5}. - * As well as a number of pseudo-instructions that may be encountered when - * traversing the instructions of a method. + * This includes a few pseudo-opcodes modified by {@link #isWide() wide}. + *

    + * An opcode describes the operation of an instruction. + * + * @apiNote + * The enum constants are named after the opcodes' mnemonics in uppercase. + * Wide pseudo-opcodes are named with the original opcodes' mnemonic plus + * a {@code _W} suffix. However, {@link #LDC_W ldc_w}, {@link #LDC2_W ldc2_w}, + * {@link #GOTO_W goto_w}, and {@link #JSR_W jsr_w} are legitimate opcodes + * instead of wide pseudo-opcodes. * * @see Instruction - * @see PseudoInstruction * * @since 24 */ public enum Opcode { - /** Do nothing */ + /** + * Do nothing. + * + * @jvms 6.5.nop nop + * @see Kind#NOP + */ NOP(RawBytecodeHelper.NOP, 1, Kind.NOP), - /** Push null */ + /** + * Push {@code null}. + * + * @jvms 6.5.aconst_null aconst_null + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ ACONST_NULL(RawBytecodeHelper.ACONST_NULL, 1, Kind.CONSTANT), - /** Push int constant -1 */ + /** + * Push {@link TypeKind#INT int} constant {@code -1}. + * + * @jvms 6.5.iconst_i iconst_<i> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ ICONST_M1(RawBytecodeHelper.ICONST_M1, 1, Kind.CONSTANT), - /** Push int constant 0 */ + /** + * Push {@link TypeKind#INT int} constant {@code 0}. + * + * @jvms 6.5.iconst_i iconst_<i> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ ICONST_0(RawBytecodeHelper.ICONST_0, 1, Kind.CONSTANT), - /** Push int constant 1 */ + /** + * Push {@link TypeKind#INT int} constant {@code 1}. + * + * @jvms 6.5.iconst_i iconst_<i> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ ICONST_1(RawBytecodeHelper.ICONST_1, 1, Kind.CONSTANT), - /** Push int constant 2 */ + /** + * Push {@link TypeKind#INT int} constant {@code 2}. + * + * @jvms 6.5.iconst_i iconst_<i> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ ICONST_2(RawBytecodeHelper.ICONST_2, 1, Kind.CONSTANT), - /** Push int constant 3 */ + /** + * Push {@link TypeKind#INT int} constant {@code 3}. + * + * @jvms 6.5.iconst_i iconst_<i> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ ICONST_3(RawBytecodeHelper.ICONST_3, 1, Kind.CONSTANT), - /** Push int constant 4 */ + /** + * Push {@link TypeKind#INT int} constant {@code 4}. + * + * @jvms 6.5.iconst_i iconst_<i> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ ICONST_4(RawBytecodeHelper.ICONST_4, 1, Kind.CONSTANT), - /** Push int constant 5 */ + /** + * Push {@link TypeKind#INT int} constant {@code 5}. + * + * @jvms 6.5.iconst_i iconst_<i> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ ICONST_5(RawBytecodeHelper.ICONST_5, 1, Kind.CONSTANT), - /** Push long constant 0 */ + /** + * Push {@link TypeKind#LONG long} constant {@code 0L}. + * + * @jvms 6.5.lconst_l lconst_<l> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ LCONST_0(RawBytecodeHelper.LCONST_0, 1, Kind.CONSTANT), - /** Push long constant 1 */ + /** + * Push {@link TypeKind#LONG long} constant {@code 1L}. + * + * @jvms 6.5.lconst_l lconst_<l> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ LCONST_1(RawBytecodeHelper.LCONST_1, 1, Kind.CONSTANT), - /** Push float constant 0 */ + /** + * Push {@link TypeKind#FLOAT float} constant {@code 0.0F}. + * + * @jvms 6.5.fconst_f fconst_<f> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ FCONST_0(RawBytecodeHelper.FCONST_0, 1, Kind.CONSTANT), - /** Push float constant 1 */ + /** + * Push {@link TypeKind#FLOAT float} constant {@code 1.0F}. + * + * @jvms 6.5.fconst_f fconst_<f> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ FCONST_1(RawBytecodeHelper.FCONST_1, 1, Kind.CONSTANT), - /** Push float constant 2 */ + /** + * Push {@link TypeKind#FLOAT float} constant {@code 2.0F}. + * + * @jvms 6.5.fconst_f fconst_<f> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ FCONST_2(RawBytecodeHelper.FCONST_2, 1, Kind.CONSTANT), - /** Push double constant 0 */ + /** + * Push {@link TypeKind#DOUBLE double} constant {@code 0.0D}. + * + * @jvms 6.5.dconst_d dconst_<d> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ DCONST_0(RawBytecodeHelper.DCONST_0, 1, Kind.CONSTANT), - /** Push double constant 1 */ + /** + * Push {@link TypeKind#DOUBLE double} constant {@code 1.0D}. + * + * @jvms 6.5.dconst_d dconst_<d> + * @see ConstantInstruction.IntrinsicConstantInstruction + * @see Kind#CONSTANT + */ DCONST_1(RawBytecodeHelper.DCONST_1, 1, Kind.CONSTANT), - /** Push byte */ + /** + * Push {@link TypeKind#INT int} value from sign-extension of immediate + * {@link TypeKind#BYTE byte} value. + * + * @jvms 6.5.bipush bipush + * @see ConstantInstruction.ArgumentConstantInstruction + * @see Kind#CONSTANT + */ BIPUSH(RawBytecodeHelper.BIPUSH, 2, Kind.CONSTANT), - /** Push short */ + /** + * Push {@link TypeKind#INT int} value from sign-extension of immediate + * {@link TypeKind#SHORT short} value. + * + * @jvms 6.5.sipush sipush + * @see ConstantInstruction.ArgumentConstantInstruction + * @see Kind#CONSTANT + */ SIPUSH(RawBytecodeHelper.SIPUSH, 3, Kind.CONSTANT), - /** Push item from run-time constant pool */ + /** + * Push item from run-time constant pool. + * + * @jvms 6.5.ldc ldc + * @see ConstantInstruction.LoadConstantInstruction + * @see Kind#CONSTANT + */ LDC(RawBytecodeHelper.LDC, 2, Kind.CONSTANT), - /** Push item from run-time constant pool (wide index) */ + /** + * Push item from run-time constant pool (wide index). + * + * @jvms 6.5.ldc_w ldc_w + * @see ConstantInstruction.LoadConstantInstruction + * @see Kind#CONSTANT + */ LDC_W(RawBytecodeHelper.LDC_W, 3, Kind.CONSTANT), - /** Push long or double from run-time constant pool (wide index) */ + /** + * Push {@link TypeKind#LONG long} or {@link TypeKind#DOUBLE double} + * from run-time constant pool (wide index). + * + * @jvms 6.5.ldc2_w ldc2_w + * @see ConstantInstruction.LoadConstantInstruction + * @see Kind#CONSTANT + */ LDC2_W(RawBytecodeHelper.LDC2_W, 3, Kind.CONSTANT), - /** Load int from local variable */ + /** + * Load {@link TypeKind#INT int} from local variable. + * + * @jvms 6.5.iload iload + * @see Kind#LOAD + */ ILOAD(RawBytecodeHelper.ILOAD, 2, Kind.LOAD), - /** Load long from local variable */ + /** + * Load {@link TypeKind#LONG long} from local variable. + * + * @jvms 6.5.lload lload + * @see Kind#LOAD + */ LLOAD(RawBytecodeHelper.LLOAD, 2, Kind.LOAD), - /** Load float from local variable */ + /** + * Load {@link TypeKind#FLOAT float} from local variable. + * + * @jvms 6.5.fload fload + * @see Kind#LOAD + */ FLOAD(RawBytecodeHelper.FLOAD, 2, Kind.LOAD), - /** Load double from local variable */ + /** + * Load {@link TypeKind#DOUBLE double} from local variable. + * + * @jvms 6.5.dload dload + * @see Kind#LOAD + */ DLOAD(RawBytecodeHelper.DLOAD, 2, Kind.LOAD), - /** Load reference from local variable */ + /** + * Load {@link TypeKind#REFERENCE reference} from local variable. + * + * @jvms 6.5.aload aload + * @see Kind#LOAD + */ ALOAD(RawBytecodeHelper.ALOAD, 2, Kind.LOAD), - /** Load int from local variable 0 */ + /** + * Load {@link TypeKind#INT int} from local variable slot {@code 0}. + * + * @jvms 6.5.iload_n iload_<n> + * @see Kind#LOAD + */ ILOAD_0(RawBytecodeHelper.ILOAD_0, 1, Kind.LOAD), - /** Load int from local variable 1 */ + /** + * Load {@link TypeKind#INT int} from local variable slot {@code 1}. + * + * @jvms 6.5.iload_n iload_<n> + * @see Kind#LOAD + */ ILOAD_1(RawBytecodeHelper.ILOAD_1, 1, Kind.LOAD), - /** Load int from local variable 2 */ + /** + * Load {@link TypeKind#INT int} from local variable slot {@code 2}. + * + * @jvms 6.5.iload_n iload_<n> + * @see Kind#LOAD + */ ILOAD_2(RawBytecodeHelper.ILOAD_2, 1, Kind.LOAD), - /** Load int from local variable3 */ + /** + * Load {@link TypeKind#INT int} from local variable slot {@code 3}. + * + * @jvms 6.5.iload_n iload_<n> + * @see Kind#LOAD + */ ILOAD_3(RawBytecodeHelper.ILOAD_3, 1, Kind.LOAD), - /** Load long from local variable 0 */ + /** + * Load {@link TypeKind#LONG long} from local variable slot {@code 0}. + * + * @jvms 6.5.lload_n lload_<n> + * @see Kind#LOAD + */ LLOAD_0(RawBytecodeHelper.LLOAD_0, 1, Kind.LOAD), - /** Load long from local variable 1 */ + /** + * Load {@link TypeKind#LONG long} from local variable slot {@code 1}. + * + * @jvms 6.5.lload_n lload_<n> + * @see Kind#LOAD + */ LLOAD_1(RawBytecodeHelper.LLOAD_1, 1, Kind.LOAD), - /** Load long from local variable 2 */ + /** + * Load {@link TypeKind#LONG long} from local variable slot {@code 2}. + * + * @jvms 6.5.lload_n lload_<n> + * @see Kind#LOAD + */ LLOAD_2(RawBytecodeHelper.LLOAD_2, 1, Kind.LOAD), - /** Load long from local variable 3 */ + /** + * Load {@link TypeKind#LONG long} from local variable slot {@code 3}. + * + * @jvms 6.5.lload_n lload_<n> + * @see Kind#LOAD + */ LLOAD_3(RawBytecodeHelper.LLOAD_3, 1, Kind.LOAD), - /** Load float from local variable 0 */ + /** + * Load {@link TypeKind#FLOAT float} from local variable slot {@code 0}. + * + * @jvms 6.5.fload_n fload_<n> + * @see Kind#LOAD + */ FLOAD_0(RawBytecodeHelper.FLOAD_0, 1, Kind.LOAD), - /** Load float from local variable 1 */ + /** + * Load {@link TypeKind#FLOAT float} from local variable slot {@code 1}. + * + * @jvms 6.5.fload_n fload_<n> + * @see Kind#LOAD + */ FLOAD_1(RawBytecodeHelper.FLOAD_1, 1, Kind.LOAD), - /** Load float from local variable 2 */ + /** + * Load {@link TypeKind#FLOAT float} from local variable slot {@code 2}. + * + * @jvms 6.5.fload_n fload_<n> + * @see Kind#LOAD + */ FLOAD_2(RawBytecodeHelper.FLOAD_2, 1, Kind.LOAD), - /** Load float from local variable 3 */ + /** + * Load {@link TypeKind#FLOAT float} from local variable slot {@code 3}. + * + * @jvms 6.5.fload_n fload_<n> + * @see Kind#LOAD + */ FLOAD_3(RawBytecodeHelper.FLOAD_3, 1, Kind.LOAD), - /** Load double from local variable 0 */ + /** + * Load {@link TypeKind#DOUBLE double} from local variable slot {@code 0}. + * + * @jvms 6.5.dload_n dload_<n> + * @see Kind#LOAD + */ DLOAD_0(RawBytecodeHelper.DLOAD_0, 1, Kind.LOAD), - /** Load double from local variable 1 */ + /** + * Load {@link TypeKind#DOUBLE double} from local variable slot {@code 1}. + * + * @jvms 6.5.dload_n dload_<n> + * @see Kind#LOAD + */ DLOAD_1(RawBytecodeHelper.DLOAD_1, 1, Kind.LOAD), - /** Load double from local variable 2 */ + /** + * Load {@link TypeKind#DOUBLE double} from local variable slot {@code 2}. + * + * @jvms 6.5.dload_n dload_<n> + * @see Kind#LOAD + */ DLOAD_2(RawBytecodeHelper.DLOAD_2, 1, Kind.LOAD), - /** Load double from local variable 3 */ + /** + * Load {@link TypeKind#DOUBLE double} from local variable slot {@code 3}. + * + * @jvms 6.5.dload_n dload_<n> + * @see Kind#LOAD + */ DLOAD_3(RawBytecodeHelper.DLOAD_3, 1, Kind.LOAD), - /** Load reference from local variable 0 */ + /** + * Load {@link TypeKind#REFERENCE reference} from local variable slot {@code 0}. + * + * @jvms 6.5.aload_n aload_<n> + * @see Kind#LOAD + */ ALOAD_0(RawBytecodeHelper.ALOAD_0, 1, Kind.LOAD), - /** Load reference from local variable 1 */ + /** + * Load {@link TypeKind#REFERENCE reference} from local variable slot {@code 1}. + * + * @jvms 6.5.aload_n aload_<n> + * @see Kind#LOAD + */ ALOAD_1(RawBytecodeHelper.ALOAD_1, 1, Kind.LOAD), - /** Load reference from local variable 2 */ + /** + * Load {@link TypeKind#REFERENCE reference} from local variable slot {@code 2}. + * + * @jvms 6.5.aload_n aload_<n> + * @see Kind#LOAD + */ ALOAD_2(RawBytecodeHelper.ALOAD_2, 1, Kind.LOAD), - /** Load reference from local variable 3 */ + /** + * Load {@link TypeKind#REFERENCE reference} from local variable slot {@code 3}. + * + * @jvms 6.5.aload_n aload_<n> + * @see Kind#LOAD + */ ALOAD_3(RawBytecodeHelper.ALOAD_3, 1, Kind.LOAD), - /** Load int from array */ + /** + * Load {@link TypeKind#INT int} from array. + * + * @jvms 6.5.iaload iaload + * @see Kind#ARRAY_LOAD + */ IALOAD(RawBytecodeHelper.IALOAD, 1, Kind.ARRAY_LOAD), - /** Load long from array */ + /** + * Load {@link TypeKind#LONG long} from array. + * + * @jvms 6.5.laload laload + * @see Kind#ARRAY_LOAD + */ LALOAD(RawBytecodeHelper.LALOAD, 1, Kind.ARRAY_LOAD), - /** Load float from array */ + /** + * Load {@link TypeKind#FLOAT float} from array. + * + * @jvms 6.5.faload faload + * @see Kind#ARRAY_LOAD + */ FALOAD(RawBytecodeHelper.FALOAD, 1, Kind.ARRAY_LOAD), - /** Load double from array */ + /** + * Load {@link TypeKind#DOUBLE double} from array. + * + * @jvms 6.5.daload daload + * @see Kind#ARRAY_LOAD + */ DALOAD(RawBytecodeHelper.DALOAD, 1, Kind.ARRAY_LOAD), - /** Load reference from array */ + /** + * Load {@link TypeKind#REFERENCE reference} from array. + * + * @jvms 6.5.aaload aaload + * @see Kind#ARRAY_LOAD + */ AALOAD(RawBytecodeHelper.AALOAD, 1, Kind.ARRAY_LOAD), - /** Load byte from array */ + /** + * Load {@link TypeKind#BYTE byte} or {@link TypeKind#BOOLEAN boolean} from array. + * + * @jvms 6.5.baload baload + * @see Kind#ARRAY_LOAD + */ BALOAD(RawBytecodeHelper.BALOAD, 1, Kind.ARRAY_LOAD), - /** Load char from array */ + /** + * Load {@link TypeKind#CHAR char} from array. + * + * @jvms 6.5.caload caload + * @see Kind#ARRAY_LOAD + */ CALOAD(RawBytecodeHelper.CALOAD, 1, Kind.ARRAY_LOAD), - /** Load short from array */ + /** + * Load {@link TypeKind#SHORT short} from array. + * + * @jvms 6.5.saload saload + * @see Kind#ARRAY_LOAD + */ SALOAD(RawBytecodeHelper.SALOAD, 1, Kind.ARRAY_LOAD), - /** Store int into local variable */ + /** + * Store {@link TypeKind#INT int} into local variable. + * + * @jvms 6.5.istore istore + * @see Kind#STORE + */ ISTORE(RawBytecodeHelper.ISTORE, 2, Kind.STORE), - /** Store long into local variable */ + /** + * Store {@link TypeKind#LONG long} into local variable. + * + * @jvms 6.5.lstore lstore + * @see Kind#STORE + */ LSTORE(RawBytecodeHelper.LSTORE, 2, Kind.STORE), - /** Store float into local variable */ + /** + * Store {@link TypeKind#FLOAT float} into local variable. + * + * @jvms 6.5.fstore fstore + * @see Kind#STORE + */ FSTORE(RawBytecodeHelper.FSTORE, 2, Kind.STORE), - /** Store double into local variable */ + /** + * Store {@link TypeKind#DOUBLE double} into local variable. + * + * @jvms 6.5.dstore dstore + * @see Kind#STORE + */ DSTORE(RawBytecodeHelper.DSTORE, 2, Kind.STORE), - /** Store reference into local variable */ + /** + * Store {@link TypeKind#REFERENCE reference} into local variable. + * Can also store the {@link TypeKind##returnAddress returnAddress} type. + * + * @jvms 6.5.astore astore + * @see Kind#STORE + */ ASTORE(RawBytecodeHelper.ASTORE, 2, Kind.STORE), - /** Store int into local variable 0 */ + /** + * Store {@link TypeKind#INT int} into local variable slot {@code 0}. + * + * @jvms 6.5.istore_n istore_<n> + * @see Kind#STORE + */ ISTORE_0(RawBytecodeHelper.ISTORE_0, 1, Kind.STORE), - /** Store int into local variable 1 */ + /** + * Store {@link TypeKind#INT int} into local variable slot {@code 1}. + * + * @jvms 6.5.istore_n istore_<n> + * @see Kind#STORE + */ ISTORE_1(RawBytecodeHelper.ISTORE_1, 1, Kind.STORE), - /** Store int into local variable 2 */ + /** + * Store {@link TypeKind#INT int} into local variable slot {@code 2}. + * + * @jvms 6.5.istore_n istore_<n> + * @see Kind#STORE + */ ISTORE_2(RawBytecodeHelper.ISTORE_2, 1, Kind.STORE), - /** Store int into local variable 3 */ + /** + * Store {@link TypeKind#INT int} into local variable slot {@code 3}. + * + * @jvms 6.5.istore_n istore_<n> + * @see Kind#STORE + */ ISTORE_3(RawBytecodeHelper.ISTORE_3, 1, Kind.STORE), - /** Store long into local variable 0 */ + /** + * Store {@link TypeKind#LONG long} into local variable slot {@code 0}. + * + * @jvms 6.5.lstore_n lstore_<n> + * @see Kind#STORE + */ LSTORE_0(RawBytecodeHelper.LSTORE_0, 1, Kind.STORE), - /** Store long into local variable 1 */ + /** + * Store {@link TypeKind#LONG long} into local variable slot {@code 1}. + * + * @jvms 6.5.lstore_n lstore_<n> + * @see Kind#STORE + */ LSTORE_1(RawBytecodeHelper.LSTORE_1, 1, Kind.STORE), - /** Store long into local variable 2 */ + /** + * Store {@link TypeKind#LONG long} into local variable slot {@code 2}. + * + * @jvms 6.5.lstore_n lstore_<n> + * @see Kind#STORE + */ LSTORE_2(RawBytecodeHelper.LSTORE_2, 1, Kind.STORE), - /** Store long into local variable 3 */ + /** + * Store {@link TypeKind#LONG long} into local variable slot {@code 3}. + * + * @jvms 6.5.lstore_n lstore_<n> + * @see Kind#STORE + */ LSTORE_3(RawBytecodeHelper.LSTORE_3, 1, Kind.STORE), - /** Store float into local variable 0 */ + /** + * Store {@link TypeKind#FLOAT float} into local variable slot {@code 0}. + * + * @jvms 6.5.fstore_n fstore_<n> + * @see Kind#STORE + */ FSTORE_0(RawBytecodeHelper.FSTORE_0, 1, Kind.STORE), - /** Store float into local variable 1 */ + /** + * Store {@link TypeKind#FLOAT float} into local variable slot {@code 1}. + * + * @jvms 6.5.fstore_n fstore_<n> + * @see Kind#STORE + */ FSTORE_1(RawBytecodeHelper.FSTORE_1, 1, Kind.STORE), - /** Store float into local variable 2 */ + /** + * Store {@link TypeKind#FLOAT float} into local variable slot {@code 2}. + * + * @jvms 6.5.fstore_n fstore_<n> + * @see Kind#STORE + */ FSTORE_2(RawBytecodeHelper.FSTORE_2, 1, Kind.STORE), - /** Store float into local variable 3 */ + /** + * Store {@link TypeKind#FLOAT float} into local variable slot {@code 3}. + * + * @jvms 6.5.fstore_n fstore_<n> + * @see Kind#STORE + */ FSTORE_3(RawBytecodeHelper.FSTORE_3, 1, Kind.STORE), - /** Store double into local variable 0 */ + /** + * Store {@link TypeKind#DOUBLE double} into local variable slot {@code 0}. + * + * @jvms 6.5.dstore_n dstore_<n> + * @see Kind#STORE + */ DSTORE_0(RawBytecodeHelper.DSTORE_0, 1, Kind.STORE), - /** Store double into local variable 1 */ + /** + * Store {@link TypeKind#DOUBLE double} into local variable slot {@code 1}. + * + * @jvms 6.5.dstore_n dstore_<n> + * @see Kind#STORE + */ DSTORE_1(RawBytecodeHelper.DSTORE_1, 1, Kind.STORE), - /** Store double into local variable 2 */ + /** + * Store {@link TypeKind#DOUBLE double} into local variable slot {@code 2}. + * + * @jvms 6.5.dstore_n dstore_<n> + * @see Kind#STORE + */ DSTORE_2(RawBytecodeHelper.DSTORE_2, 1, Kind.STORE), - /** Store double into local variable 3 */ + /** + * Store {@link TypeKind#DOUBLE double} into local variable slot {@code 3}. + * + * @jvms 6.5.dstore_n dstore_<n> + * @see Kind#STORE + */ DSTORE_3(RawBytecodeHelper.DSTORE_3, 1, Kind.STORE), - /** Store reference into local variable 0 */ + /** + * Store {@link TypeKind#REFERENCE reference} into local variable slot {@code 0}. + * Can also store the {@link TypeKind##returnAddress returnAddress} type. + * + * @jvms 6.5.astore_n astore_<n> + * @see Kind#STORE + */ ASTORE_0(RawBytecodeHelper.ASTORE_0, 1, Kind.STORE), - /** Store reference into local variable 1 */ + /** + * Store {@link TypeKind#REFERENCE reference} into local variable slot {@code 1}. + * Can also store the {@link TypeKind##returnAddress returnAddress} type. + * + * @jvms 6.5.astore_n astore_<n> + * @see Kind#STORE + */ ASTORE_1(RawBytecodeHelper.ASTORE_1, 1, Kind.STORE), - /** Store reference into local variable 2 */ + /** + * Store {@link TypeKind#REFERENCE reference} into local variable slot {@code 2}. + * Can also store the {@link TypeKind##returnAddress returnAddress} type. + * + * @jvms 6.5.astore_n astore_<n> + * @see Kind#STORE + */ ASTORE_2(RawBytecodeHelper.ASTORE_2, 1, Kind.STORE), - /** Store reference into local variable 3 */ + /** + * Store {@link TypeKind#REFERENCE reference} into local variable slot {@code 3}. + * Can also store the {@link TypeKind##returnAddress returnAddress} type. + * + * @jvms 6.5.astore_n astore_<n> + * @see Kind#STORE + */ ASTORE_3(RawBytecodeHelper.ASTORE_3, 1, Kind.STORE), - /** Store into int array */ + /** + * Store into {@link TypeKind#INT int} array. + * + * @jvms 6.5.iastore iastore + * @see Kind#ARRAY_STORE + */ IASTORE(RawBytecodeHelper.IASTORE, 1, Kind.ARRAY_STORE), - /** Store into long array */ + /** + * Store into {@link TypeKind#LONG long} array. + * + * @jvms 6.5.lastore lastore + * @see Kind#ARRAY_STORE + */ LASTORE(RawBytecodeHelper.LASTORE, 1, Kind.ARRAY_STORE), - /** Store into float array */ + /** + * Store into {@link TypeKind#FLOAT float} array. + * + * @jvms 6.5.fastore fastore + * @see Kind#ARRAY_STORE + */ FASTORE(RawBytecodeHelper.FASTORE, 1, Kind.ARRAY_STORE), - /** Store into double array */ + /** + * Store into {@link TypeKind#DOUBLE double} array. + * + * @jvms 6.5.dastore dastore + * @see Kind#ARRAY_STORE + */ DASTORE(RawBytecodeHelper.DASTORE, 1, Kind.ARRAY_STORE), - /** Store into reference array */ + /** + * Store into {@link TypeKind#REFERENCE reference} array. + * + * @jvms 6.5.aastore aastore + * @see Kind#ARRAY_STORE + */ AASTORE(RawBytecodeHelper.AASTORE, 1, Kind.ARRAY_STORE), - /** Store into byte array */ + /** + * Store into {@link TypeKind#BYTE byte} or {@link TypeKind#BOOLEAN boolean} array. + * + * @jvms 6.5.bastore bastore + * @see Kind#ARRAY_STORE + */ BASTORE(RawBytecodeHelper.BASTORE, 1, Kind.ARRAY_STORE), - /** Store into char array */ + /** + * Store into {@link TypeKind#CHAR char} array. + * + * @jvms 6.5.castore castore + * @see Kind#ARRAY_STORE + */ CASTORE(RawBytecodeHelper.CASTORE, 1, Kind.ARRAY_STORE), - /** Store into short array */ + /** + * Store into {@link TypeKind#SHORT short} array. + * + * @jvms 6.5.sastore sastore + * @see Kind#ARRAY_STORE + */ SASTORE(RawBytecodeHelper.SASTORE, 1, Kind.ARRAY_STORE), - /** Pop the top operand stack value */ + /** + * Pop the top operand stack value. + * + * @jvms 6.5.pop pop + * @see Kind#STACK + */ POP(RawBytecodeHelper.POP, 1, Kind.STACK), - /** Pop the top one or two operand stack values */ + /** + * Pop the top one or two operand stack values. + * + * @jvms 6.5.pop2 pop2 + * @see Kind#STACK + */ POP2(RawBytecodeHelper.POP2, 1, Kind.STACK), - /** Duplicate the top operand stack value */ + /** + * Duplicate the top operand stack value. + * + * @jvms 6.5.dup dup + * @see Kind#STACK + */ DUP(RawBytecodeHelper.DUP, 1, Kind.STACK), - /** Duplicate the top operand stack value and insert two values down */ + /** + * Duplicate the top operand stack value and insert two values down. + * + * @jvms 6.5.dup_x1 dup_x1 + * @see Kind#STACK + */ DUP_X1(RawBytecodeHelper.DUP_X1, 1, Kind.STACK), - /** Duplicate the top operand stack value and insert two or three values down */ + /** + * Duplicate the top operand stack value and insert two or three values down. + * + * @jvms 6.5.dup_x2 dup_x2 + * @see Kind#STACK + */ DUP_X2(RawBytecodeHelper.DUP_X2, 1, Kind.STACK), - /** Duplicate the top one or two operand stack values */ + /** + * Duplicate the top one or two operand stack values. + * + * @jvms 6.5.dup2 dup2 + * @see Kind#STACK + */ DUP2(RawBytecodeHelper.DUP2, 1, Kind.STACK), - /** Duplicate the top one or two operand stack values and insert two or three values down */ + /** + * Duplicate the top one or two operand stack values and insert two or three + * values down. + * + * @jvms 6.5.dup2_x1 dup2_x1 + * @see Kind#STACK + */ DUP2_X1(RawBytecodeHelper.DUP2_X1, 1, Kind.STACK), - /** Duplicate the top one or two operand stack values and insert two, three, or four values down */ + /** + * Duplicate the top one or two operand stack values and insert two, three, + * or four values down. + * + * @jvms 6.5.dup2_x2 dup2_x2 + * @see Kind#STACK + */ DUP2_X2(RawBytecodeHelper.DUP2_X2, 1, Kind.STACK), - /** Swap the top two operand stack values */ + /** + * Swap the top two operand stack values. + * + * @jvms 6.5.swap swap + * @see Kind#STACK + */ SWAP(RawBytecodeHelper.SWAP, 1, Kind.STACK), - /** Add int */ + /** + * Add {@link TypeKind#INT int}. + * + * @jvms 6.5.iadd iadd + * @see Kind#OPERATOR + */ IADD(RawBytecodeHelper.IADD, 1, Kind.OPERATOR), - /** Add long */ + /** + * Add {@link TypeKind#LONG long}. + * + * @jvms 6.5.ladd ladd + * @see Kind#OPERATOR + */ LADD(RawBytecodeHelper.LADD, 1, Kind.OPERATOR), - /** Add float */ + /** + * Add {@link TypeKind#FLOAT float}. + * + * @jvms 6.5.fadd fadd + * @see Kind#OPERATOR + */ FADD(RawBytecodeHelper.FADD, 1, Kind.OPERATOR), - /** Add double */ + /** + * Add {@link TypeKind#DOUBLE double}. + * + * @jvms 6.5.dadd dadd + * @see Kind#OPERATOR + */ DADD(RawBytecodeHelper.DADD, 1, Kind.OPERATOR), - /** Subtract int */ + /** + * Subtract {@link TypeKind#INT int}. + * + * @jvms 6.5.isub isub + * @see Kind#OPERATOR + */ ISUB(RawBytecodeHelper.ISUB, 1, Kind.OPERATOR), - /** Subtract long */ + /** + * Subtract {@link TypeKind#LONG long}. + * + * @jvms 6.5.lsub lsub + * @see Kind#OPERATOR + */ LSUB(RawBytecodeHelper.LSUB, 1, Kind.OPERATOR), - /** Subtract float */ + /** + * Subtract {@link TypeKind#FLOAT float}. + * + * @jvms 6.5.fsub fsub + * @see Kind#OPERATOR + */ FSUB(RawBytecodeHelper.FSUB, 1, Kind.OPERATOR), - /** Subtract double */ + /** + * Subtract {@link TypeKind#DOUBLE double}. + * + * @jvms 6.5.dsub dsub + * @see Kind#OPERATOR + */ DSUB(RawBytecodeHelper.DSUB, 1, Kind.OPERATOR), - /** Multiply int */ + /** + * Multiply {@link TypeKind#INT int}. + * + * @jvms 6.5.imul imul + * @see Kind#OPERATOR + */ IMUL(RawBytecodeHelper.IMUL, 1, Kind.OPERATOR), - /** Multiply long */ + /** + * Multiply {@link TypeKind#LONG long}. + * + * @jvms 6.5.lmul lmul + * @see Kind#OPERATOR + */ LMUL(RawBytecodeHelper.LMUL, 1, Kind.OPERATOR), - /** Multiply float */ + /** + * Multiply {@link TypeKind#FLOAT float}. + * + * @jvms 6.5.fmul fmul + * @see Kind#OPERATOR + */ FMUL(RawBytecodeHelper.FMUL, 1, Kind.OPERATOR), - /** Multiply double */ + /** + * Multiply {@link TypeKind#DOUBLE double}. + * + * @jvms 6.5.dmul dmul + * @see Kind#OPERATOR + */ DMUL(RawBytecodeHelper.DMUL, 1, Kind.OPERATOR), - /** Divide int */ + /** + * Divide {@link TypeKind#INT int}. + * + * @jvms 6.5.idiv idiv + * @see Kind#OPERATOR + */ IDIV(RawBytecodeHelper.IDIV, 1, Kind.OPERATOR), - /** Divide long */ + /** + * Divide {@link TypeKind#LONG long}. + * + * @jvms 6.5.ldiv ldiv + * @see Kind#OPERATOR + */ LDIV(RawBytecodeHelper.LDIV, 1, Kind.OPERATOR), - /** Divide float */ + /** + * Divide {@link TypeKind#FLOAT float}. + * + * @jvms 6.5.fdiv fdiv + * @see Kind#OPERATOR + */ FDIV(RawBytecodeHelper.FDIV, 1, Kind.OPERATOR), - /** Divide double */ + /** + * Divide {@link TypeKind#DOUBLE double}. + * + * @jvms 6.5.ddiv ddiv + * @see Kind#OPERATOR + */ DDIV(RawBytecodeHelper.DDIV, 1, Kind.OPERATOR), - /** Remainder int */ + /** + * Remainder {@link TypeKind#INT int}. + * + * @jvms 6.5.irem irem + * @see Kind#OPERATOR + */ IREM(RawBytecodeHelper.IREM, 1, Kind.OPERATOR), - /** Remainder long */ + /** + * Remainder {@link TypeKind#LONG long}. + * + * @jvms 6.5.lrem lrem + * @see Kind#OPERATOR + */ LREM(RawBytecodeHelper.LREM, 1, Kind.OPERATOR), - /** Remainder float */ + /** + * Remainder {@link TypeKind#FLOAT float}. + * + * @jvms 6.5.frem frem + * @see Kind#OPERATOR + */ FREM(RawBytecodeHelper.FREM, 1, Kind.OPERATOR), - /** Remainder double */ + /** + * Remainder {@link TypeKind#DOUBLE double}. + * + * @jvms 6.5.drem drem + * @see Kind#OPERATOR + */ DREM(RawBytecodeHelper.DREM, 1, Kind.OPERATOR), - /** Negate int */ + /** + * Negate {@link TypeKind#INT int}. + * + * @jvms 6.5.ineg ineg + * @see Kind#OPERATOR + */ INEG(RawBytecodeHelper.INEG, 1, Kind.OPERATOR), - /** Negate long */ + /** + * Negate {@link TypeKind#LONG long}. + * + * @jvms 6.5.lneg lneg + * @see Kind#OPERATOR + */ LNEG(RawBytecodeHelper.LNEG, 1, Kind.OPERATOR), - /** Negate float */ + /** + * Negate {@link TypeKind#FLOAT float}. + * + * @jvms 6.5.fneg fneg + * @see Kind#OPERATOR + */ FNEG(RawBytecodeHelper.FNEG, 1, Kind.OPERATOR), - /** Negate double */ + /** + * Negate {@link TypeKind#DOUBLE double}. + * + * @jvms 6.5.dneg dneg + * @see Kind#OPERATOR + */ DNEG(RawBytecodeHelper.DNEG, 1, Kind.OPERATOR), - /** Shift left int */ + /** + * Shift left {@link TypeKind#INT int}. + * + * @jvms 6.5.ishl ishl + * @see Kind#OPERATOR + */ ISHL(RawBytecodeHelper.ISHL, 1, Kind.OPERATOR), - /** Shift left long */ + /** + * Shift left {@link TypeKind#LONG long}. + * + * @jvms 6.5.lshl lshl + * @see Kind#OPERATOR + */ LSHL(RawBytecodeHelper.LSHL, 1, Kind.OPERATOR), - /** Shift right int */ + /** + * Arithmetic shift right {@link TypeKind#INT int}. + * + * @jvms 6.5.ishr ishr + * @see Kind#OPERATOR + */ ISHR(RawBytecodeHelper.ISHR, 1, Kind.OPERATOR), - /** Shift right long */ + /** + * Arithmetic shift right {@link TypeKind#LONG long}. + * + * @jvms 6.5.lshr lshr + * @see Kind#OPERATOR + */ LSHR(RawBytecodeHelper.LSHR, 1, Kind.OPERATOR), - /** Logical shift right int */ + /** + * Logical shift right {@link TypeKind#INT int}. + * + * @jvms 6.5.iushr iushr + * @see Kind#OPERATOR + */ IUSHR(RawBytecodeHelper.IUSHR, 1, Kind.OPERATOR), - /** Logical shift right long */ + /** + * Logical shift right {@link TypeKind#LONG long}. + * + * @jvms 6.5.lushr lushr + * @see Kind#OPERATOR + */ LUSHR(RawBytecodeHelper.LUSHR, 1, Kind.OPERATOR), - /** Boolean AND int */ + /** + * Bitwise AND {@link TypeKind#INT int}. + * + * @apiNote + * This may be used to implement {@link TypeKind#BOOLEAN boolean} AND. + * + * @jvms 6.5.iand iand + * @see Kind#OPERATOR + */ IAND(RawBytecodeHelper.IAND, 1, Kind.OPERATOR), - /** Boolean AND long */ + /** + * Bitwise AND {@link TypeKind#LONG long}. + * + * @jvms 6.5.land land + * @see Kind#OPERATOR + */ LAND(RawBytecodeHelper.LAND, 1, Kind.OPERATOR), - /** Boolean OR int */ + /** + * Bitwise OR {@link TypeKind#INT int}. + * + * @apiNote + * This may be used to implement {@link TypeKind#BOOLEAN boolean} OR. + * + * @jvms 6.5.ior ior + * @see Kind#OPERATOR + */ IOR(RawBytecodeHelper.IOR, 1, Kind.OPERATOR), - /** Boolean OR long */ + /** + * Bitwise OR {@link TypeKind#LONG long}. + * + * @jvms 6.5.lor lor + * @see Kind#OPERATOR + */ LOR(RawBytecodeHelper.LOR, 1, Kind.OPERATOR), - /** Boolean XOR int */ + /** + * Bitwise XOR {@link TypeKind#INT int}. + * + * @apiNote + * This may be used to implement {@link TypeKind#BOOLEAN boolean} XOR. + * + * @jvms 6.5.ixor ixor + * @see Kind#OPERATOR + */ IXOR(RawBytecodeHelper.IXOR, 1, Kind.OPERATOR), - /** Boolean XOR long */ + /** + * Bitwise XOR {@link TypeKind#LONG long}. + * + * @jvms 6.5.lxor lxor + * @see Kind#OPERATOR + */ LXOR(RawBytecodeHelper.LXOR, 1, Kind.OPERATOR), - /** Increment local variable by constant */ + /** + * Increment local variable by constant. + * + * @jvms 6.5.iinc iinc + * @see Kind#INCREMENT + */ IINC(RawBytecodeHelper.IINC, 3, Kind.INCREMENT), - /** Convert int to long */ + /** + * Convert {@link TypeKind#INT int} to {@link TypeKind#LONG long}. + * + * @jls 5.1.2 Widening Primitive Conversion + * @jvms 6.5.i2l i2l + * @see Kind#CONVERT + */ I2L(RawBytecodeHelper.I2L, 1, Kind.CONVERT), - /** Convert int to float */ + /** + * Convert {@link TypeKind#INT int} to {@link TypeKind#FLOAT float}. + * + * @jls 5.1.2 Widening Primitive Conversion + * @jvms 6.5.i2f i2f + * @see Kind#CONVERT + */ I2F(RawBytecodeHelper.I2F, 1, Kind.CONVERT), - /** Convert int to double */ + /** + * Convert {@link TypeKind#INT int} to {@link TypeKind#DOUBLE double}. + * + * @jls 5.1.2 Widening Primitive Conversion + * @jvms 6.5.i2d i2d + * @see Kind#CONVERT + */ I2D(RawBytecodeHelper.I2D, 1, Kind.CONVERT), - /** Convert long to int */ + /** + * Convert {@link TypeKind#LONG long} to {@link TypeKind#INT int}. + * + * @jls 5.1.3 Narrowing Primitive Conversion + * @jvms 6.5.l2i l2i + * @see Kind#CONVERT + */ L2I(RawBytecodeHelper.L2I, 1, Kind.CONVERT), - /** Convert long to float */ + /** Convert {@link TypeKind#LONG long} to {@link TypeKind#FLOAT float}. + * + * @jls 5.1.2 Widening Primitive Conversion + * @jvms 6.5.l2f l2f + * @see Kind#CONVERT + */ L2F(RawBytecodeHelper.L2F, 1, Kind.CONVERT), - /** Convert long to double */ + /** Convert {@link TypeKind#LONG long} to {@link TypeKind#DOUBLE double}. + * + * @jls 5.1.2 Widening Primitive Conversion + * @jvms 6.5.l2d l2d + * @see Kind#CONVERT + */ L2D(RawBytecodeHelper.L2D, 1, Kind.CONVERT), - /** Convert float to int */ + /** + * Convert {@link TypeKind#FLOAT float} to {@link TypeKind#INT int}. + * + * @jls 5.1.3 Narrowing Primitive Conversion + * @jvms 6.5.f2i f2i + * @see Kind#CONVERT + */ F2I(RawBytecodeHelper.F2I, 1, Kind.CONVERT), - /** Convert float to long */ + /** + * Convert {@link TypeKind#FLOAT float} to {@link TypeKind#LONG long}. + * + * @jls 5.1.3 Narrowing Primitive Conversion + * @jvms 6.5.f2l f2l + * @see Kind#CONVERT + */ F2L(RawBytecodeHelper.F2L, 1, Kind.CONVERT), - /** Convert float to double */ + /** + * Convert {@link TypeKind#FLOAT float} to {@link TypeKind#DOUBLE double}. + * + * @jls 5.1.2 Widening Primitive Conversion + * @jvms 6.5.f2d f2d + * @see Kind#CONVERT + */ F2D(RawBytecodeHelper.F2D, 1, Kind.CONVERT), - /** Convert double to int */ + /** + * Convert {@link TypeKind#DOUBLE double} to {@link TypeKind#INT int}. + * + * @jls 5.1.3 Narrowing Primitive Conversion + * @jvms 6.5.d2i d2i + * @see Kind#CONVERT + */ D2I(RawBytecodeHelper.D2I, 1, Kind.CONVERT), - /** Convert double to long */ + /** + * Convert {@link TypeKind#DOUBLE double} to {@link TypeKind#LONG long}. + * + * @jvms 6.5.d2l d2l + * @see Kind#CONVERT + */ D2L(RawBytecodeHelper.D2L, 1, Kind.CONVERT), - /** Convert double to float */ + /** + * Convert {@link TypeKind#DOUBLE double} to {@link TypeKind#FLOAT float}. + * + * @jls 5.1.3 Narrowing Primitive Conversion + * @jvms 6.5.d2f d2f + * @see Kind#CONVERT + */ D2F(RawBytecodeHelper.D2F, 1, Kind.CONVERT), - /** Convert int to byte */ + /** + * Convert {@link TypeKind#INT int} to {@link TypeKind#BYTE byte}. + * This is as if storing the {@linkplain TypeKind##computational-type + * computational} {@code int} into a {@code byte} and loading it back. + * + * @jls 5.1.3 Narrowing Primitive Conversion + * @jvms 6.5.i2b i2b + * @see Kind#CONVERT + */ I2B(RawBytecodeHelper.I2B, 1, Kind.CONVERT), - /** Convert int to char */ + /** + * Convert {@link TypeKind#INT int} to {@link TypeKind#CHAR char}. + * This is as if storing the {@linkplain TypeKind##computational-type + * computational} {@code int} into a {@code char} and loading it back. + * + * @jls 5.1.3 Narrowing Primitive Conversion + * @jvms 6.5.i2c i2c + * @see Kind#CONVERT + */ I2C(RawBytecodeHelper.I2C, 1, Kind.CONVERT), - /** Convert int to short */ + /** + * Convert {@link TypeKind#INT int} to {@link TypeKind#SHORT short}. + * This is as if storing the {@linkplain TypeKind##computational-type + * computational} {@code int} into a {@code short} and loading it back. + * + * @jls 5.1.3 Narrowing Primitive Conversion + * @jvms 6.5.i2s i2s + * @see Kind#CONVERT + */ I2S(RawBytecodeHelper.I2S, 1, Kind.CONVERT), - /** Compare long */ + /** + * Compare {@link TypeKind#LONG long}. + * + * @see Long#compare(long, long) + * @jvms 6.5.lcmp lcmp + * @see Kind#OPERATOR + */ LCMP(RawBytecodeHelper.LCMP, 1, Kind.OPERATOR), - /** Compare float */ + /** + * Compare {@link TypeKind#FLOAT float}. + * Produces {@code -1} if any operand is {@link Float#isNaN(float) NaN}. + * + * @see Double##equivalenceRelation Floating-point Equality, Equivalence, and Comparison + * @jvms 6.5.fcmp_op fcmp<op> + * @see Kind#OPERATOR + */ FCMPL(RawBytecodeHelper.FCMPL, 1, Kind.OPERATOR), - /** Compare float */ + /** + * Compare {@link TypeKind#FLOAT float}. + * Produces {@code 1} if any operand is {@link Float#isNaN(float) NaN}. + * + * @see Double##equivalenceRelation Floating-point Equality, Equivalence, and Comparison + * @jvms 6.5.fcmp_op fcmp<op> + * @see Kind#OPERATOR + */ FCMPG(RawBytecodeHelper.FCMPG, 1, Kind.OPERATOR), - /** Compare double */ + /** + * Compare {@link TypeKind#DOUBLE double}. + * Produces {@code -1} if any operand is {@link Double#isNaN(double) NaN}. + * + * @see Double##equivalenceRelation Floating-point Equality, Equivalence, and Comparison + * @jvms 6.5.dcmp_op dcmp<op> + * @see Kind#OPERATOR + */ DCMPL(RawBytecodeHelper.DCMPL, 1, Kind.OPERATOR), - /** Compare double */ + /** + * Compare {@link TypeKind#DOUBLE double}. + * Produces {@code 1} if any operand is {@link Double#isNaN(double) NaN}. + * + * @see Double##equivalenceRelation Floating-point Equality, Equivalence, and Comparison + * @jvms 6.5.dcmp_op dcmp<op> + * @see Kind#OPERATOR + */ DCMPG(RawBytecodeHelper.DCMPG, 1, Kind.OPERATOR), - /** Branch if int comparison with zero succeeds */ + /** + * Branch if {@link TypeKind#INT int} comparison {@code == 0} succeeds. + * + * @jvms 6.5.if_cond if_<cond> + * @see Kind#BRANCH + */ IFEQ(RawBytecodeHelper.IFEQ, 3, Kind.BRANCH), - /** Branch if int comparison with zero succeeds */ + /** + * Branch if {@link TypeKind#INT int} comparison {@code != 0} succeeds. + * + * @jvms 6.5.if_cond if_<cond> + * @see Kind#BRANCH + */ IFNE(RawBytecodeHelper.IFNE, 3, Kind.BRANCH), - /** Branch if int comparison with zero succeeds */ + /** + * Branch if {@link TypeKind#INT int} comparison {@code < 0} succeeds. + * + * @jvms 6.5.if_cond if_<cond> + * @see Kind#BRANCH + */ IFLT(RawBytecodeHelper.IFLT, 3, Kind.BRANCH), - /** Branch if int comparison with zero succeeds */ + /** + * Branch if {@link TypeKind#INT int} comparison {@code >= 0} succeeds. + * + * @jvms 6.5.if_cond if_<cond> + * @see Kind#BRANCH + */ IFGE(RawBytecodeHelper.IFGE, 3, Kind.BRANCH), - /** Branch if int comparison with zero succeeds */ + /** + * Branch if {@link TypeKind#INT int} comparison {@code > 0} succeeds. + * + * @jvms 6.5.if_cond if_<cond> + * @see Kind#BRANCH + */ IFGT(RawBytecodeHelper.IFGT, 3, Kind.BRANCH), - /** Branch if int comparison with zero succeeds */ + /** + * Branch if {@link TypeKind#INT int} comparison {@code <= 0} succeeds. + * + * @jvms 6.5.if_cond if_<cond> + * @see Kind#BRANCH + */ IFLE(RawBytecodeHelper.IFLE, 3, Kind.BRANCH), - /** Branch if int comparison succeeds */ + /** + * Branch if {@link TypeKind#INT int} comparison {@code operand1 == operand2} succeeds. + * + * @jvms 6.5.if_icmp_cond if_icmp<cond> + * @see Kind#BRANCH + */ IF_ICMPEQ(RawBytecodeHelper.IF_ICMPEQ, 3, Kind.BRANCH), - /** Branch if int comparison succeeds */ + /** + * Branch if {@link TypeKind#INT int} comparison {@code operand1 != operand2} succeeds. + * + * @jvms 6.5.if_icmp_cond if_icmp<cond> + * @see Kind#BRANCH + */ IF_ICMPNE(RawBytecodeHelper.IF_ICMPNE, 3, Kind.BRANCH), - /** Branch if int comparison succeeds */ + /** + * Branch if {@link TypeKind#INT int} comparison {@code operand1 < operand2} succeeds. + * + * @jvms 6.5.if_icmp_cond if_icmp<cond> + * @see Kind#BRANCH + */ IF_ICMPLT(RawBytecodeHelper.IF_ICMPLT, 3, Kind.BRANCH), - /** Branch if int comparison succeeds */ + /** + * Branch if {@link TypeKind#INT int} comparison {@code operand1 >= operand2} succeeds. + * + * @jvms 6.5.if_icmp_cond if_icmp<cond> + * @see Kind#BRANCH + */ IF_ICMPGE(RawBytecodeHelper.IF_ICMPGE, 3, Kind.BRANCH), - /** Branch if int comparison succeeds */ + /** + * Branch if {@link TypeKind#INT int} comparison {@code operand1 > operand2} succeeds. + * + * @jvms 6.5.if_icmp_cond if_icmp<cond> + * @see Kind#BRANCH + */ IF_ICMPGT(RawBytecodeHelper.IF_ICMPGT, 3, Kind.BRANCH), - /** Branch if int comparison succeeds */ + /** + * Branch if {@link TypeKind#INT int} comparison {@code operand1 <= operand2} succeeds. + * + * @jvms 6.5.if_icmp_cond if_icmp<cond> + * @see Kind#BRANCH + */ IF_ICMPLE(RawBytecodeHelper.IF_ICMPLE, 3, Kind.BRANCH), - /** Branch if reference comparison succeeds */ + /** + * Branch if {@link TypeKind#REFERENCE reference} comparison + * {@code operand1 == operand2} succeeds. + * + * @jvms 6.5.if_acmp_cond if_acmp<cond> + * @see Kind#BRANCH + */ IF_ACMPEQ(RawBytecodeHelper.IF_ACMPEQ, 3, Kind.BRANCH), - /** Branch if reference comparison succeeds */ + /** + * Branch if {@link TypeKind#REFERENCE reference} comparison + * {@code operand1 != operand2} succeeds. + * + * @jvms 6.5.if_acmp_cond if_acmp<cond> + * @see Kind#BRANCH + */ IF_ACMPNE(RawBytecodeHelper.IF_ACMPNE, 3, Kind.BRANCH), - /** Branch always */ + /** + * Branch always. + * + * @jvms 6.5.goto goto + * @see Kind#BRANCH + */ GOTO(RawBytecodeHelper.GOTO, 3, Kind.BRANCH), /** - * Jump subroutine is discontinued opcode - * @see java.lang.classfile.instruction.DiscontinuedInstruction + * (Discontinued) Jump subroutine; last used in major version {@value + * ClassFile#JAVA_6_VERSION}. + * + * @jvms 4.9.1 Static Constraints + * @jvms 6.5.jsr jsr + * @see Kind#DISCONTINUED_JSR */ JSR(RawBytecodeHelper.JSR, 3, Kind.DISCONTINUED_JSR), /** - * Return from subroutine is discontinued opcode - * @see java.lang.classfile.instruction.DiscontinuedInstruction + * (Discontinued) Return from subroutine; last used in major version + * {@value ClassFile#JAVA_6_VERSION}. + * + * @jvms 4.9.1 Static Constraints + * @jvms 6.5.ret ret + * @see Kind#DISCONTINUED_RET */ RET(RawBytecodeHelper.RET, 2, Kind.DISCONTINUED_RET), - /** Access jump table by index and jump */ + /** + * Access jump table by index and jump. + * + * @jvms 6.5.tableswitch tableswitch + * @see Kind#TABLE_SWITCH + */ TABLESWITCH(RawBytecodeHelper.TABLESWITCH, -1, Kind.TABLE_SWITCH), - /** Access jump table by key match and jump */ + /** + * Access jump table by key match and jump. + * + * @jvms 6.5.lookupswitch lookupswitch + * @see Kind#LOOKUP_SWITCH + */ LOOKUPSWITCH(RawBytecodeHelper.LOOKUPSWITCH, -1, Kind.LOOKUP_SWITCH), - /** Return int from method */ + /** + * Return {@link TypeKind#INT int} from method. + * + * @jvms 6.5.ireturn ireturn + * @see Kind#RETURN + */ IRETURN(RawBytecodeHelper.IRETURN, 1, Kind.RETURN), - /** Return long from method */ + /** + * Return {@link TypeKind#LONG long} from method. + * + * @jvms 6.5.lreturn lreturn + * @see Kind#RETURN + */ LRETURN(RawBytecodeHelper.LRETURN, 1, Kind.RETURN), - /** Return float from method */ + /** + * Return {@link TypeKind#FLOAT float} from method. + * + * @jvms 6.5.freturn freturn + * @see Kind#RETURN + */ FRETURN(RawBytecodeHelper.FRETURN, 1, Kind.RETURN), - /** Return double from method */ + /** + * Return {@link TypeKind#DOUBLE double} from method. + * + * @jvms 6.5.dreturn dreturn + * @see Kind#RETURN + */ DRETURN(RawBytecodeHelper.DRETURN, 1, Kind.RETURN), - /** Return reference from method */ + /** + * Return {@link TypeKind#REFERENCE reference} from method. + * + * @jvms 6.5.areturn areturn + * @see Kind#RETURN + */ ARETURN(RawBytecodeHelper.ARETURN, 1, Kind.RETURN), - /** Return void from method */ + /** + * Return {@link TypeKind#VOID void} from method. + * + * @jvms 6.5.return return + * @see Kind#RETURN + */ RETURN(RawBytecodeHelper.RETURN, 1, Kind.RETURN), - /** Get static field from class */ + /** + * Get {@code static} field from class. + * + * @jvms 6.5.getstatic getstatic + * @see Kind#FIELD_ACCESS + */ GETSTATIC(RawBytecodeHelper.GETSTATIC, 3, Kind.FIELD_ACCESS), - /** Set static field in class */ + /** + * Set {@code static} field in class. + * + * @jvms 6.5.putstatic putstatic + * @see Kind#FIELD_ACCESS + */ PUTSTATIC(RawBytecodeHelper.PUTSTATIC, 3, Kind.FIELD_ACCESS), - /** Fetch field from object */ + /** + * Fetch field from object. + * + * @jvms 6.5.getfield getfield + * @see Kind#FIELD_ACCESS + */ GETFIELD(RawBytecodeHelper.GETFIELD, 3, Kind.FIELD_ACCESS), - /** Set field in object */ + /** + * Set field in object. + * + * @jvms 6.5.putfield putfield + * @see Kind#FIELD_ACCESS + */ PUTFIELD(RawBytecodeHelper.PUTFIELD, 3, Kind.FIELD_ACCESS), - /** Invoke instance method; dispatch based on class */ + /** + * Invoke instance method; dispatch based on class. + * + * @jvms 6.5.invokevirtual invokevirtual + * @see Kind#INVOKE + */ INVOKEVIRTUAL(RawBytecodeHelper.INVOKEVIRTUAL, 3, Kind.INVOKE), /** * Invoke instance method; direct invocation of instance initialization - * methods and methods of the current class and its supertypes + * methods and methods of the current class and its supertypes. + * + * @jvms 6.5.invokevirtual invokevirtual + * @see Kind#INVOKE */ INVOKESPECIAL(RawBytecodeHelper.INVOKESPECIAL, 3, Kind.INVOKE), - /** Invoke a class (static) method */ + /** + * Invoke a class ({@code static}) method. + * + * @jvms 6.5.invokestatic invokestatic + * @see Kind#INVOKE + */ INVOKESTATIC(RawBytecodeHelper.INVOKESTATIC, 3, Kind.INVOKE), - /** Invoke interface method */ + /** + * Invoke interface method. + * + * @jvms 6.5.invokeinterface invokeinterface + * @see Kind#INVOKE + */ INVOKEINTERFACE(RawBytecodeHelper.INVOKEINTERFACE, 5, Kind.INVOKE), - /** Invoke a dynamically-computed call site */ + /** + * Invoke a dynamically-computed call site. + * + * @jvms 6.5.invokedynamic invokedynamic + * @see Kind#INVOKE_DYNAMIC + */ INVOKEDYNAMIC(RawBytecodeHelper.INVOKEDYNAMIC, 5, Kind.INVOKE_DYNAMIC), - /** Create new object */ + /** + * Create new object. + * + * @jvms 6.5.new new + * @see Kind#NEW_OBJECT + */ NEW(RawBytecodeHelper.NEW, 3, Kind.NEW_OBJECT), - /** Create new array */ + /** + * Create new array. + * + * @jvms 6.5.newarray newarray + * @see Kind#NEW_PRIMITIVE_ARRAY + */ NEWARRAY(RawBytecodeHelper.NEWARRAY, 2, Kind.NEW_PRIMITIVE_ARRAY), - /** Create new array of reference */ + /** + * Create new array of {@link TypeKind#REFERENCE reference}. + * + * @jvms 6.5.anewarray anewarray + * @see Kind#NEW_REF_ARRAY + */ ANEWARRAY(RawBytecodeHelper.ANEWARRAY, 3, Kind.NEW_REF_ARRAY), - /** Get length of array */ + /** + * Get length of array. + * + * @jvms 6.5.arraylength arraylength + * @see Kind#OPERATOR + */ ARRAYLENGTH(RawBytecodeHelper.ARRAYLENGTH, 1, Kind.OPERATOR), - /** Throw exception or error */ + /** + * Throw exception or error. + * + * @jvms 6.5.athrow athrow + * @see Kind#THROW_EXCEPTION + */ ATHROW(RawBytecodeHelper.ATHROW, 1, Kind.THROW_EXCEPTION), - /** Check whether object is of given type */ + /** + * Check whether object is of given type. + * + * @see Class#cast(Object) + * @jvms 6.5.checkcast checkcast + * @see Kind#TYPE_CHECK + */ CHECKCAST(RawBytecodeHelper.CHECKCAST, 3, Kind.TYPE_CHECK), - /** Determine if object is of given type */ + /** + * Determine if object is of given type. + * + * @see Class#isInstance(Object) + * @jvms 6.5.instanceof instanceof + * @see Kind#TYPE_CHECK + */ INSTANCEOF(RawBytecodeHelper.INSTANCEOF, 3, Kind.TYPE_CHECK), - /** Enter monitor for object */ + /** + * Enter monitor for object. + * + * @jvms 6.5.monitorenter monitorenter + * @see Kind#MONITOR + */ MONITORENTER(RawBytecodeHelper.MONITORENTER, 1, Kind.MONITOR), - /** Exit monitor for object */ + /** + * Exit monitor for object. + * + * @jvms 6.5.monitorexit monitorexit + * @see Kind#MONITOR + */ MONITOREXIT(RawBytecodeHelper.MONITOREXIT, 1, Kind.MONITOR), - /** Create new multidimensional array */ + /** + * Create new multidimensional array. + * + * @jvms 6.5.multianewarray multianewarray + * @see Kind#NEW_MULTI_ARRAY + */ MULTIANEWARRAY(RawBytecodeHelper.MULTIANEWARRAY, 4, Kind.NEW_MULTI_ARRAY), - /** Branch if reference is null */ + /** + * Branch if {@link TypeKind#REFERENCE reference} is {@code null}. + * + * @jvms 6.5.ifnull ifnull + * @see Kind#BRANCH + */ IFNULL(RawBytecodeHelper.IFNULL, 3, Kind.BRANCH), - /** Branch if reference not null */ + /** + * Branch if {@link TypeKind#REFERENCE reference} is not {@code null}. + * + * @jvms 6.5.ifnonnull ifnonnull + * @see Kind#BRANCH + */ IFNONNULL(RawBytecodeHelper.IFNONNULL, 3, Kind.BRANCH), - /** Branch always (wide index) */ + /** + * Branch always (wide index). + * + * @jvms 6.5.goto_w goto_w + * @see Kind#BRANCH + */ GOTO_W(RawBytecodeHelper.GOTO_W, 5, Kind.BRANCH), /** - * Jump subroutine (wide index) is discontinued opcode - * @see java.lang.classfile.instruction.DiscontinuedInstruction + * (Discontinued) Jump subroutine (wide index); last used in major + * version {@value ClassFile#JAVA_6_VERSION}. + * + * @jvms 4.9.1 Static Constraints + * @jvms 6.5.jsr_w jsr_w + * @see Kind#DISCONTINUED_JSR */ JSR_W(RawBytecodeHelper.JSR_W, 5, Kind.DISCONTINUED_JSR), - /** Load int from local variable (wide index) */ + /** + * Load {@link TypeKind#INT int} from local variable (wide index). + * This is a {@linkplain #isWide() wide}-modified pseudo-opcode. + * + * @jvms 6.5.wide wide + * @jvms 6.5.iload iload + * @see Kind#LOAD + */ ILOAD_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.ILOAD, 4, Kind.LOAD), - /** Load long from local variable (wide index) */ + /** + * Load {@link TypeKind#LONG long} from local variable (wide index). + * This is a {@linkplain #isWide() wide}-modified pseudo-opcode. + * + * @jvms 6.5.wide wide + * @jvms 6.5.lload lload + * @see Kind#LOAD + */ LLOAD_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.LLOAD, 4, Kind.LOAD), - /** Load float from local variable (wide index) */ + /** + * Load {@link TypeKind#FLOAT float} from local variable (wide index). + * This is a {@linkplain #isWide() wide}-modified pseudo-opcode. + * + * @jvms 6.5.wide wide + * @jvms 6.5.fload fload + * @see Kind#LOAD + */ FLOAD_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.FLOAD, 4, Kind.LOAD), - /** Load double from local variable (wide index) */ + /** + * Load {@link TypeKind#DOUBLE double} from local variable (wide index). + * This is a {@linkplain #isWide() wide}-modified pseudo-opcode. + * + * @jvms 6.5.wide wide + * @jvms 6.5.dload dload + * @see Kind#LOAD + */ DLOAD_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.DLOAD, 4, Kind.LOAD), - /** Load reference from local variable (wide index) */ + /** + * Load {@link TypeKind#REFERENCE reference} from local variable (wide index). + * This is a {@linkplain #isWide() wide}-modified pseudo-opcode. + * + * @jvms 6.5.wide wide + * @jvms 6.5.aload aload + * @see Kind#LOAD + */ ALOAD_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.ALOAD, 4, Kind.LOAD), - /** Store int into local variable (wide index) */ + /** + * Store {@link TypeKind#INT int} into local variable (wide index). + * This is a {@linkplain #isWide() wide}-modified pseudo-opcode. + * + * @jvms 6.5.wide wide + * @jvms 6.5.istore istore + * @see Kind#STORE + */ ISTORE_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.ISTORE, 4, Kind.STORE), - /** Store long into local variable (wide index) */ + /** + * Store {@link TypeKind#LONG long} into local variable (wide index). + * This is a {@linkplain #isWide() wide}-modified pseudo-opcode. + * + * @jvms 6.5.wide wide + * @jvms 6.5.lstore lstore + * @see Kind#STORE + */ LSTORE_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.LSTORE, 4, Kind.STORE), - /** Store float into local variable (wide index) */ + /** + * Store {@link TypeKind#FLOAT float} into local variable (wide index). + * This is a {@linkplain #isWide() wide}-modified pseudo-opcode. + * + * @jvms 6.5.wide wide + * @jvms 6.5.fstore fstore + * @see Kind#STORE + */ FSTORE_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.FSTORE, 4, Kind.STORE), - /** Store double into local variable (wide index) */ + /** + * Store {@link TypeKind#DOUBLE double} into local variable (wide index). + * This is a {@linkplain #isWide() wide}-modified pseudo-opcode. + * + * @jvms 6.5.wide wide + * @jvms 6.5.dstore dstore + * @see Kind#STORE + */ DSTORE_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.DSTORE, 4, Kind.STORE), - /** Store reference into local variable (wide index) */ + /** + * Store {@link TypeKind#REFERENCE reference} into local variable (wide index). + * This is a {@linkplain #isWide() wide}-modified pseudo-opcode. + * Can also store the {@link TypeKind##returnAddress returnAddress} type. + * + * @jvms 6.5.wide wide + * @jvms 6.5.astore astore + * @see Kind#STORE + */ ASTORE_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.ASTORE, 4, Kind.STORE), /** - * Return from subroutine (wide index) is discontinued opcode - * @see java.lang.classfile.instruction.DiscontinuedInstruction + * (Discontinued) Return from subroutine (wide index); last used in major + * version {@value ClassFile#JAVA_6_VERSION}. + * This is a {@linkplain #isWide() wide}-modified pseudo-opcode. + * + * @jvms 4.9.1 Static Constraints + * @jvms 6.5.wide wide + * @jvms 6.5.ret ret + * @see Kind#DISCONTINUED_RET */ RET_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.RET, 4, Kind.DISCONTINUED_RET), - /** Increment local variable by constant (wide index) */ + /** + * Increment local variable by constant (wide index). + * This is a {@linkplain #isWide() wide}-modified pseudo-opcode. + * + * @jvms 6.5.wide wide + * @jvms 6.5.iinc iinc + * @see Kind#INCREMENT + */ IINC_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.IINC, 6, Kind.INCREMENT); /** - * Kinds of opcodes. + * Kinds of opcodes. Each kind of opcode has its own modeling interface + * for its instructions. * * @since 24 */ - public static enum Kind { + public enum Kind { /** - * Load from local variable + * Load from local variable. * + * @see LoadInstruction * @see Opcode#ILOAD * @see Opcode#LLOAD * @see Opcode#FLOAD @@ -736,8 +1901,9 @@ public static enum Kind { LOAD, /** - * Store into local variable + * Store into local variable. * + * @see StoreInstruction * @see Opcode#ISTORE * @see Opcode#LSTORE * @see Opcode#FSTORE @@ -772,16 +1938,18 @@ public static enum Kind { STORE, /** - * Increment local variable + * Increment local variable. * + * @see IncrementInstruction * @see Opcode#IINC * @see Opcode#IINC_W */ INCREMENT, /** - * Branch + * Branch. * + * @see BranchInstruction * @see Opcode#IFEQ * @see Opcode#IFNE * @see Opcode#IFLT @@ -804,22 +1972,25 @@ public static enum Kind { BRANCH, /** - * Access jump table by key match and jump + * Access jump table by key match and jump. * + * @see LookupSwitchInstruction * @see Opcode#LOOKUPSWITCH */ LOOKUP_SWITCH, /** - * Access jump table by index and jump + * Access jump table by index and jump. * + * @see TableSwitchInstruction * @see Opcode#TABLESWITCH */ TABLE_SWITCH, /** - * Return from method + * Return from method. * + * @see ReturnInstruction * @see Opcode#IRETURN * @see Opcode#LRETURN * @see Opcode#FRETURN @@ -830,15 +2001,17 @@ public static enum Kind { RETURN, /** - * Throw exception or error + * Throw exception or error. * + * @see ThrowInstruction * @see Opcode#ATHROW */ THROW_EXCEPTION, /** - * Access field + * Access field. * + * @see FieldInstruction * @see Opcode#GETSTATIC * @see Opcode#PUTSTATIC * @see Opcode#GETFIELD @@ -847,8 +2020,9 @@ public static enum Kind { FIELD_ACCESS, /** - * Invoke method or constructor + * Invoke method or constructor. * + * @see InvokeInstruction * @see Opcode#INVOKEVIRTUAL * @see Opcode#INVOKESPECIAL * @see Opcode#INVOKESTATIC @@ -857,51 +2031,58 @@ public static enum Kind { INVOKE, /** - * Invoke a dynamically-computed call site + * Invoke a dynamically-computed call site. * + * @see InvokeDynamicInstruction * @see Opcode#INVOKEDYNAMIC */ INVOKE_DYNAMIC, /** - * Create new object + * Create new object. * + * @see NewObjectInstruction * @see Opcode#NEW */ NEW_OBJECT, /** - * Create new array + * Create new array. * + * @see NewPrimitiveArrayInstruction * @see Opcode#NEWARRAY */ NEW_PRIMITIVE_ARRAY, /** - * Create new reference array + * Create new {@link TypeKind#REFERENCE reference} array. * + * @see NewReferenceArrayInstruction * @see Opcode#ANEWARRAY */ NEW_REF_ARRAY, /** - * Create new multidimensional array + * Create new multidimensional array. * + * @see NewMultiArrayInstruction * @see Opcode#MULTIANEWARRAY */ NEW_MULTI_ARRAY, /** - * Check whether object is of given type + * Check whether object is of given type. * + * @see TypeCheckInstruction * @see Opcode#CHECKCAST * @see Opcode#INSTANCEOF */ TYPE_CHECK, /** - * Load from array + * Load from array. * + * @see ArrayLoadInstruction * @see Opcode#IALOAD * @see Opcode#LALOAD * @see Opcode#FALOAD @@ -914,8 +2095,9 @@ public static enum Kind { ARRAY_LOAD, /** - * Store into array + * Store into array. * + * @see ArrayStoreInstruction * @see Opcode#IASTORE * @see Opcode#LASTORE * @see Opcode#FASTORE @@ -928,8 +2110,9 @@ public static enum Kind { ARRAY_STORE, /** - * Stack operations + * Stack operations. * + * @see StackInstruction * @see Opcode#POP * @see Opcode#POP2 * @see Opcode#DUP @@ -943,8 +2126,9 @@ public static enum Kind { STACK, /** - * Type conversions + * Type conversions. * + * @see ConvertInstruction * @see Opcode#I2L * @see Opcode#I2F * @see Opcode#I2D @@ -964,8 +2148,9 @@ public static enum Kind { CONVERT, /** - * Operators + * Operators. * + * @see OperatorInstruction * @see Opcode#IADD * @see Opcode#LADD * @see Opcode#FADD @@ -1012,8 +2197,9 @@ public static enum Kind { OPERATOR, /** - * Constants + * Constants. * + * @see ConstantInstruction * @see Opcode#ACONST_NULL * @see Opcode#ICONST_M1 * @see Opcode#ICONST_0 @@ -1038,35 +2224,37 @@ public static enum Kind { CONSTANT, /** - * Monitor + * Monitor. * + * @see MonitorInstruction * @see Opcode#MONITORENTER * @see Opcode#MONITOREXIT */ MONITOR, /** - * Do nothing + * Do nothing. * + * @see NopInstruction * @see Opcode#NOP */ NOP, /** - * Discontinued jump subroutine + * Discontinued jump subroutine. * + * @see DiscontinuedInstruction.JsrInstruction * @see Opcode#JSR * @see Opcode#JSR_W - * @see java.lang.classfile.instruction.DiscontinuedInstruction */ DISCONTINUED_JSR, /** - * Discontinued return from subroutine + * Discontinued return from subroutine. * + * @see DiscontinuedInstruction.RetInstruction * @see Opcode#RET * @see Opcode#RET_W - * @see java.lang.classfile.instruction.DiscontinuedInstruction */ DISCONTINUED_RET; } @@ -1090,7 +2278,10 @@ public static enum Kind { /** * {@return true if this is a pseudo-opcode modified by wide opcode} + *

    + * {@code wide} extends local variable index by additional bytes. * + * @jvms 6.5.wide wide * @see #ILOAD_W * @see #LLOAD_W * @see #FLOAD_W @@ -1109,11 +2300,14 @@ public static enum Kind { /** * {@return size of the instruction in bytes if fixed, or -1 otherwise} This size includes * the opcode itself. + * + * @see Instruction#sizeInBytes() Instruction::sizeInBytes */ public int sizeIfFixed() { return sizeIfFixed; } /** - * {@return instruction kind} + * {@return operation kind} Each kind of operation has its own modeling + * interface to model instructions belonging to that kind. */ public Kind kind() { return kind; } } diff --git a/src/java.base/share/classes/java/lang/classfile/TypeKind.java b/src/java.base/share/classes/java/lang/classfile/TypeKind.java index 5a6475aa801..e3fc11858f5 100644 --- a/src/java.base/share/classes/java/lang/classfile/TypeKind.java +++ b/src/java.base/share/classes/java/lang/classfile/TypeKind.java @@ -26,6 +26,9 @@ package java.lang.classfile; import java.lang.classfile.instruction.DiscontinuedInstruction; +import java.lang.classfile.instruction.LoadInstruction; +import java.lang.classfile.instruction.NewPrimitiveArrayInstruction; +import java.lang.classfile.instruction.StoreInstruction; import java.lang.constant.ClassDesc; import java.lang.constant.ConstantDescs; import java.lang.invoke.TypeDescriptor; @@ -33,13 +36,17 @@ import jdk.internal.vm.annotation.Stable; /** - * Describes the data types Java Virtual Machine operates on. - * This omits {@code returnAddress} (JVMS {@jvms 2.3.3}), - * which is only used by discontinued {@link - * DiscontinuedInstruction.JsrInstruction jsr} and {@link - * DiscontinuedInstruction.RetInstruction ret} instructions, - * and includes {@link #VOID void} (JVMS {@jvms 4.3.3}), which - * appears as a method return type. + * Describes the data types Java Virtual Machine operates on. This omits {@code + * returnAddress} (JVMS {@jvms 2.3.3}) and includes {@link #VOID void} (JVMS + * {@jvms 4.3.3}), which appears as a method return type. + *

    + * The {@index returnAddress} type is only used by discontinued + * {@linkplain DiscontinuedInstruction.JsrInstruction jump subroutine} and + * {@linkplain DiscontinuedInstruction.RetInstruction return from subroutine} + * instructions. Jump subroutine instructions push {@code returnAddress} to the + * operand stack; {@link StoreInstruction astore} instructions store {@code + * returnAddress} from the operand stack to local variables; return from + * subroutine instructions load {@code returnAddress} from local variables. * *

    Computational Type

    * In the {@code class} file format, local variables (JVMS {@jvms 2.6.1}), @@ -164,7 +171,10 @@ private ClassDesc fetchUpperBound() { /** * {@return the code used by the {@link Opcode#NEWARRAY newarray} instruction to create an array * of this component type, or {@code -1} if this type is not supported by {@code newarray}} - * @jvms 6.5.newarray newarray + * + * @jvms 6.5.newarray newarray + * @see NewPrimitiveArrayInstruction + * @see #fromNewarrayCode(int) fromNewarrayCode(int) */ public int newarrayCode() { return newarrayCode; @@ -175,6 +185,7 @@ public int newarrayCode() { * This is also the category of this type for instructions operating on the operand stack without * regard to type (JVMS {@jvms 2.11.1}), such as {@link Opcode#POP pop} versus {@link Opcode#POP2 * pop2}. + * * @jvms 2.6.1 Local Variables * @jvms 2.6.2 Operand Stacks */ @@ -185,6 +196,9 @@ public int slotSize() { /** * {@return the {@linkplain ##computational-type computational type} for this type, or {@link #VOID void} * for {@code void}} + * + * @see LoadInstruction + * @see StoreInstruction */ public TypeKind asLoadable() { return ordinal() < 4 ? INT : this; @@ -193,9 +207,12 @@ public TypeKind asLoadable() { /** * {@return the component type described by the array code used as an operand to {@link Opcode#NEWARRAY * newarray}} + * * @param newarrayCode the operand of the {@code newarray} instruction * @throws IllegalArgumentException if the code is invalid - * @jvms 6.5.newarray newarray + * @jvms 6.5.newarray newarray + * @see NewPrimitiveArrayInstruction + * @see #newarrayCode() newarrayCode() */ public static TypeKind fromNewarrayCode(int newarrayCode) { return switch (newarrayCode) { diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/ArrayLoadInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/ArrayLoadInstruction.java index cc0e0b89f80..49bb708403e 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/ArrayLoadInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/ArrayLoadInstruction.java @@ -24,6 +24,7 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; @@ -35,18 +36,29 @@ /** * Models an array load instruction in the {@code code} array of a {@code Code} - * attribute. Corresponding opcodes will have a {@code kind} of {@link - * Opcode.Kind#ARRAY_LOAD}. Delivered as a {@link CodeElement} when + * attribute. Corresponding opcodes have a {@linkplain Opcode#kind() kind} + * of {@link Opcode.Kind#ARRAY_LOAD}. Delivered as a {@link CodeElement} when * traversing the elements of a {@link CodeModel}. + *

    + * An array load instruction is composite: + * {@snippet lang=text : + * // @link substring="ArrayLoadInstruction" target="CodeBuilder#arrayLoad(TypeKind)" : + * ArrayLoadInstruction(TypeKind typeKind) // @link substring="typeKind" target="#typeKind" + * } + * where {@code typeKind} is not {@link TypeKind#VOID void}, and {@link + * TypeKind#BOOLEAN boolean} is converted to {@link TypeKind#BYTE byte}. * + * @see Opcode.Kind#ARRAY_LOAD + * @see CodeBuilder#arrayLoad CodeBuilder::arrayLoad * @since 24 */ public sealed interface ArrayLoadInstruction extends Instruction permits AbstractInstruction.UnboundArrayLoadInstruction { /** - * {@return the component type of the array} The {@link TypeKind#BYTE byte} + * {@return the component type of the array} The {@link TypeKind#BYTE byte} * type load instruction {@link Opcode#BALOAD baload} also operates on - * {@link TypeKind#BOOLEAN boolean} arrays. + * {@link TypeKind#BOOLEAN boolean} arrays, so this never returns + * {@code boolean}. */ TypeKind typeKind(); @@ -56,7 +68,7 @@ public sealed interface ArrayLoadInstruction extends Instruction * @param op the opcode for the specific type of array load instruction, * which must be of kind {@link Opcode.Kind#ARRAY_LOAD} * @throws IllegalArgumentException if the opcode kind is not - * {@link Opcode.Kind#ARRAY_LOAD}. + * {@link Opcode.Kind#ARRAY_LOAD} */ static ArrayLoadInstruction of(Opcode op) { Util.checkKind(op, Opcode.Kind.ARRAY_LOAD); diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/ArrayStoreInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/ArrayStoreInstruction.java index c350b3a5928..e5883a2cd2a 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/ArrayStoreInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/ArrayStoreInstruction.java @@ -24,6 +24,7 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; @@ -35,18 +36,29 @@ /** * Models an array store instruction in the {@code code} array of a {@code Code} - * attribute. Corresponding opcodes will have a {@code kind} of {@link - * Opcode.Kind#ARRAY_STORE}. Delivered as a {@link CodeElement} when + * attribute. Corresponding opcodes have a {@linkplain Opcode#kind() kind} + * of {@link Opcode.Kind#ARRAY_STORE}. Delivered as a {@link CodeElement} when * traversing the elements of a {@link CodeModel}. + *

    + * An array store instruction is composite: + * {@snippet lang=text : + * // @link substring="ArrayStoreInstruction" target="CodeBuilder#arrayStore(TypeKind)" : + * ArrayStoreInstruction(TypeKind typeKind) // @link substring="typeKind" target="#typeKind" + * } + * where {@code typeKind} is not {@link TypeKind#VOID void}, and {@link + * TypeKind#BOOLEAN boolean} is converted to {@link TypeKind#BYTE byte}. * + * @see Opcode.Kind#ARRAY_STORE + * @see CodeBuilder#arrayStore CodeBuilder::arrayStore * @since 24 */ public sealed interface ArrayStoreInstruction extends Instruction permits AbstractInstruction.UnboundArrayStoreInstruction { /** - * {@return the component type of the array} The {@link TypeKind#BYTE byte} + * {@return the component type of the array} The {@link TypeKind#BYTE byte} * type store instruction {@link Opcode#BASTORE bastore} also operates on - * {@link TypeKind#BOOLEAN boolean} arrays. + * {@link TypeKind#BOOLEAN boolean} arrays, so this never returns + * {@code boolean}. */ TypeKind typeKind(); @@ -56,7 +68,7 @@ public sealed interface ArrayStoreInstruction extends Instruction * @param op the opcode for the specific type of array store instruction, * which must be of kind {@link Opcode.Kind#ARRAY_STORE} * @throws IllegalArgumentException if the opcode kind is not - * {@link Opcode.Kind#ARRAY_STORE}. + * {@link Opcode.Kind#ARRAY_STORE} */ static ArrayStoreInstruction of(Opcode op) { Util.checkKind(op, Opcode.Kind.ARRAY_STORE); diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/BranchInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/BranchInstruction.java index 2fdc00fced1..a37e37980d4 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/BranchInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/BranchInstruction.java @@ -24,28 +24,41 @@ */ package java.lang.classfile.instruction; -import java.lang.classfile.CodeElement; -import java.lang.classfile.CodeModel; -import java.lang.classfile.Instruction; -import java.lang.classfile.Label; -import java.lang.classfile.Opcode; +import java.lang.classfile.*; import jdk.internal.classfile.impl.AbstractInstruction; import jdk.internal.classfile.impl.Util; /** * Models a branching instruction (conditional or unconditional) in the {@code - * code} array of a {@code Code} attribute. Corresponding opcodes will have a - * {@code kind} of {@link Opcode.Kind#BRANCH}. Delivered as a {@link - * CodeElement} when traversing the elements of a {@link CodeModel}. + * code} array of a {@code Code} attribute. Corresponding opcodes have a + * {@linkplain Opcode#kind() kind} of {@link Opcode.Kind#BRANCH}. Delivered as + * a {@link CodeElement} when traversing the elements of a {@link CodeModel}. + *

    + * A branch instruction is composite: + * {@snippet lang=text : + * // @link substring="BranchInstruction" target="#of": + * BranchInstruction( + * Opcode opcode, // @link substring="opcode" target="#opcode()" + * Label target // @link substring="target" target="#target()" + * ) + * } + *

    + * Due to physical restrictions, some types of instructions cannot encode labels + * too far away in the list of code elements. In such cases, the {@link + * ClassFile.ShortJumpsOption} controls how an invalid branch instruction model + * is written by a {@link CodeBuilder}. * + * @see Opcode.Kind#BRANCH + * @see CodeBuilder#branch CodeBuilder::branch + * @see ClassFile.ShortJumpsOption * @since 24 */ public sealed interface BranchInstruction extends Instruction permits AbstractInstruction.BoundBranchInstruction, AbstractInstruction.UnboundBranchInstruction { /** - * {@return the target of the branch} + * {@return the branch target of this instruction} */ Label target(); @@ -56,7 +69,7 @@ public sealed interface BranchInstruction extends Instruction * which must be of kind {@link Opcode.Kind#BRANCH} * @param target the target of the branch * @throws IllegalArgumentException if the opcode kind is not - * {@link Opcode.Kind#BRANCH}. + * {@link Opcode.Kind#BRANCH} */ static BranchInstruction of(Opcode op, Label target) { Util.checkKind(op, Opcode.Kind.BRANCH); diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/CharacterRange.java b/src/java.base/share/classes/java/lang/classfile/instruction/CharacterRange.java index d47639d7dd7..07d4c116b3a 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/CharacterRange.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/CharacterRange.java @@ -25,6 +25,7 @@ package java.lang.classfile.instruction; import java.lang.classfile.ClassFile; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Label; @@ -36,11 +37,31 @@ import jdk.internal.classfile.impl.BoundCharacterRange; /** - * A pseudo-instruction which models a single entry in the - * {@link CharacterRangeTableAttribute}. Delivered as a {@link CodeElement} - * during traversal of the elements of a {@link CodeModel}, according to - * the setting of the {@link ClassFile.DebugElementsOption} option. + * A pseudo-instruction which models a single entry in the {@link + * CharacterRangeTableAttribute CharacterRangeTable} attribute. Delivered as a + * {@link CodeElement} during traversal of the elements of a {@link CodeModel}, + * according to the setting of the {@link ClassFile.DebugElementsOption} option. + *

    + * A character range entry is composite: + * {@snippet lang=text : + * // @link substring="CharacterRange" target="#of": + * CharacterRange( + * Label startScope, // @link substring="startScope" target="#startScope" + * Label endScope, // @link substring="endScope" target="#endScope" + * int characterRangeStart, // @link substring="characterRangeStart" target="#characterRangeStart" + * int characterRangeEnd, // @link substring="characterRangeEnd" target="#characterRangeEnd" + * int flags // @link substring="flags" target="#flags" + * ) + * } + *

    + * Another model, {@link CharacterRangeInfo}, also models a character range + * entry; it has no dependency on a {@code CodeModel} and represents of bci + * values as {@code int}s instead of {@code Label}s, and is used as components + * of a {@link CharacterRangeTableAttribute}. * + * @see CharacterRangeInfo + * @see CodeBuilder#characterRange CodeBuilder::characterRange + * @see ClassFile.DebugElementsOption * @since 24 */ public sealed interface CharacterRange extends PseudoInstruction @@ -114,7 +135,7 @@ public sealed interface CharacterRange extends PseudoInstruction *

  • {@link #FLAG_BRANCH_FALSE} *
* - * @see java.lang.classfile.attribute.CharacterRangeInfo#flags() + * @see CharacterRangeInfo#flags() * * @return the flags */ diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/ConstantInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/ConstantInstruction.java index 312c1868f19..f11a90c7d4c 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/ConstantInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/ConstantInstruction.java @@ -24,6 +24,7 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; @@ -38,12 +39,22 @@ /** * Models a constant-load instruction in the {@code code} array of a {@code - * Code} attribute, including "intrinsic constant" instructions (e.g., {@code - * iconst_0}), "argument constant" instructions (e.g., {@code bipush}), and "load - * constant" instructions (e.g., {@code LDC}). Corresponding opcodes will have - * a {@code kind} of {@link Opcode.Kind#CONSTANT}. Delivered as a {@link - * CodeElement} when traversing the elements of a {@link CodeModel}. + * Code} attribute, including {@linkplain IntrinsicConstantInstruction + * "intrinsic"}, {@linkplain ArgumentConstantInstruction "argument"}, and + * {@linkplain LoadConstantInstruction "load"} constant instructions. + * Corresponding opcodes have a {@linkplain Opcode#kind() kind} of {@link + * Opcode.Kind#CONSTANT}. Delivered as a {@link CodeElement} when traversing + * the elements of a {@link CodeModel}. + *

+ * The loaded constant value is symbolically represented as a {@link ConstantDesc}: + * {@snippet lang=text : + * // @link substring="ConstantInstruction" target="CodeBuilder#loadConstant(ConstantDesc)" : + * ConstantInstruction(ConstantDesc constantValue) // @link substring="constantValue" target="#constantValue()" + * } * + * @see Opcode.Kind#CONSTANT + * @see CodeBuilder#loadConstant(ConstantDesc) CodeBuilder::loadConstant + * @sealedGraph * @since 24 */ public sealed interface ConstantInstruction extends Instruction { @@ -54,22 +65,36 @@ public sealed interface ConstantInstruction extends Instruction { ConstantDesc constantValue(); /** - * {@return the type of the constant} + * {@return the {@linkplain TypeKind##computational-type computational type} of the constant} + * This is derived from the {@link #constantValue() constantValue}. */ TypeKind typeKind(); /** - * Models an "intrinsic constant" instruction (e.g., {@code - * iconst_0}). + * Models an "intrinsic constant" instruction, which encodes + * the constant value in its opcode. Examples include {@link + * Opcode#ACONST_NULL aconst_null} and {@link + * Opcode#ICONST_0 iconst_0}. + *

+ * An intrinsic constant instruction is composite: + * {@snippet lang=text : + * // @link substring="IntrinsicConstantInstruction" target="#ofIntrinsic" : + * IntrinsicConstantInstruction(Opcode opcode) // @link substring="opcode" target="#opcode()" + * } + * where: + *

+ *
{@link #opcode() opcode}
+ *
Must be of the constant kind and have a {@linkplain + * Opcode#sizeIfFixed() fixed size} of 1.
+ *
* + * @see Opcode.Kind#CONSTANT + * @see ConstantInstruction#ofIntrinsic ConstantInstruction::ofIntrinsic * @since 24 */ sealed interface IntrinsicConstantInstruction extends ConstantInstruction permits AbstractInstruction.UnboundIntrinsicConstantInstruction { - /** - * {@return the type of the constant} - */ @Override default TypeKind typeKind() { return BytecodeHelpers.intrinsicConstantType(opcode()); @@ -77,9 +102,31 @@ default TypeKind typeKind() { } /** - * Models an "argument constant" instruction (e.g., {@code - * bipush}). + * Models an "argument constant" instruction, which encodes the + * constant value in the instruction directly. Includes {@link + * Opcode#BIPUSH bipush} and {@link Opcode#SIPUSH sipush} instructions. + *

+ * An argument constant instruction is composite: + * {@snippet lang=text : + * // @link substring="ArgumentConstantInstruction" target="#ofArgument" : + * ArgumentConstantInstruction( + * Opcode opcode, // @link substring="opcode" target="#opcode()" + * int constantValue // @link substring="constantValue" target="#constantValue()" + * ) + * } + * where: + *

    + *
  • {@code opcode} must be one of {@code bipush} or {@code sipush}. + *
  • {@code constantValue} must be in the range of {@code byte}, {@code + * [-128, 127]}, for {@code bipush}, and in the range of {@code short}, + * {@code [-32768, 32767]}, for {@code sipush}. + *
* + * @see Opcode.Kind#CONSTANT + * @see ConstantInstruction#ofArgument ConstantInstruction::ofArgument + * @see CodeBuilder#loadConstant(int) CodeBuilder::loadConstant(int) + * @see CodeBuilder#bipush CodeBuilder::bipush + * @see CodeBuilder#sipush CodeBuilder::sipush * @since 24 */ sealed interface ArgumentConstantInstruction extends ConstantInstruction @@ -89,9 +136,6 @@ sealed interface ArgumentConstantInstruction extends ConstantInstruction @Override Integer constantValue(); - /** - * {@return the type of the constant} - */ @Override default TypeKind typeKind() { return TypeKind.INT; @@ -99,9 +143,24 @@ default TypeKind typeKind() { } /** - * Models a "load constant" instruction (e.g., {@code - * ldc}). + * Models a "load constant" instruction, which encodes the constant value + * in the constant pool. Includes {@link Opcode#LDC ldc} and {@link + * Opcode#LDC_W ldc_w}, and {@link Opcode#LDC2_W ldc2_w} instructions. + *

+ * A load constant instruction is composite: + * {@snippet lang=text : + * // @link substring="LoadConstantInstruction" target="CodeBuilder#ldc(LoadableConstantEntry)" : + * LoadConstantInstruction(LoadableConstantEntry constantEntry) // @link substring="constantEntry" target="#constantEntry()" + * } + *

+ * A "load constant" instruction can load any constant value supported by + * other constant-load instructions. However, other instructions are + * usually more optimized, avoiding extra constant pool entries and being + * smaller. * + * @see Opcode.Kind#CONSTANT + * @see ConstantInstruction#ofLoad ConstantInstruction::ofLoad + * @see CodeBuilder#ldc CodeBuilder::ldc * @since 24 */ sealed interface LoadConstantInstruction extends ConstantInstruction @@ -113,9 +172,6 @@ sealed interface LoadConstantInstruction extends ConstantInstruction */ LoadableConstantEntry constantEntry(); - /** - * {@return the type of the constant} - */ @Override default TypeKind typeKind() { return constantEntry().typeKind(); @@ -139,6 +195,10 @@ static IntrinsicConstantInstruction ofIntrinsic(Opcode op) { /** * {@return an argument constant instruction} + *

+ * {@code value} must be in the range of {@code byte}, {@code [-128, 127]}, + * for {@link Opcode#BIPUSH}, and in the range of {@code short}, {@code + * [-32768, 32767]}, for {@link Opcode#SIPUSH}. * * @param op the opcode for the specific type of argument constant instruction, * which must be {@link Opcode#BIPUSH} or {@link Opcode#SIPUSH} diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/ConvertInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/ConvertInstruction.java index 468685779b9..0edffda1af1 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/ConvertInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/ConvertInstruction.java @@ -24,6 +24,7 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; @@ -36,10 +37,27 @@ /** * Models a primitive conversion instruction in the {@code code} array of a - * {@code Code} attribute, such as {@code i2l}. Corresponding opcodes will have - * a {@code kind} of {@link Opcode.Kind#CONVERT}. Delivered as a {@link - * CodeElement} when traversing the elements of a {@link CodeModel}. + * {@code Code} attribute, such as {@link Opcode#I2L i2l}. Corresponding opcodes + * have a {@linkplain Opcode#kind() kind} of {@link Opcode.Kind#CONVERT}. + * Delivered as a {@link CodeElement} when traversing the elements of a {@link CodeModel}. + *

+ * A primitive conversion instruction is composite: + * {@snippet lang=text : + * // @link substring="ConvertInstruction" target="#of(TypeKind, TypeKind)" : + * ConvertInstruction( + * TypeKind fromType, // @link substring="fromType" target="#fromType" + * TypeKind toType // @link substring="toType" target="#toType" + * ) + * } + * where these conversions are valid: + *

    + *
  • Between {@code int}, {@code long}, {@code float}, and {@code double}, where + * {@code fromType != toType}; + *
  • From {@code int} to {@code byte}, {@code char}, and {@code short}. + *
* + * @see Opcode.Kind#CONVERT + * @see CodeBuilder#conversion CodeBuilder::conversion * @since 24 */ public sealed interface ConvertInstruction extends Instruction @@ -55,10 +73,16 @@ public sealed interface ConvertInstruction extends Instruction TypeKind toType(); /** - * {@return A conversion instruction} + * {@return a conversion instruction} Valid conversions are: + *
    + *
  • Between {@code int}, {@code long}, {@code float}, and {@code double}, + * where {@code fromType != toType}; + *
  • From {@code int} to {@code byte}, {@code char}, and {@code short}. + *
* * @param fromType the type to convert from * @param toType the type to convert to + * @throws IllegalArgumentException if this is not a valid conversion */ static ConvertInstruction of(TypeKind fromType, TypeKind toType) { return of(BytecodeHelpers.convertOpcode(fromType, toType)); diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/DiscontinuedInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/DiscontinuedInstruction.java index 4e8ddcef385..4170e142ffe 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/DiscontinuedInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/DiscontinuedInstruction.java @@ -24,32 +24,54 @@ */ package java.lang.classfile.instruction; -import java.lang.classfile.CodeElement; -import java.lang.classfile.CodeModel; -import java.lang.classfile.Instruction; -import java.lang.classfile.Label; -import java.lang.classfile.Opcode; +import java.lang.classfile.*; import jdk.internal.classfile.impl.AbstractInstruction; import jdk.internal.classfile.impl.BytecodeHelpers; import jdk.internal.classfile.impl.Util; /** - * Models instruction discontinued from the {@code code} array of a {@code Code} - * attribute. Delivered as a {@link CodeElement} when traversing the elements of - * a {@link CodeModel}. + * Marker interface for instruction discontinued from the {@code code} array of + * a {@code Code} attribute. Delivered as a {@link CodeElement} when traversing + * the elements of a {@link CodeModel}. * + * @apiNote + * While most instructions have convenience factory methods in {@link + * CodeBuilder}, discontinued instructions can only be supplied to code builders + * explicitly with {@link CodeBuilder#with CodeBuilder::with} to discourage + * their use. + * + * @jvms 4.9.1 Static Constraints + * @sealedGraph * @since 24 */ public sealed interface DiscontinuedInstruction extends Instruction { /** - * Models JSR and JSR_W instructions discontinued from the {@code code} - * array of a {@code Code} attribute since class file version 51.0. - * Corresponding opcodes will have a {@code kind} of - * {@link Opcode.Kind#DISCONTINUED_JSR}. Delivered as a {@link CodeElement} - * when traversing the elements of a {@link CodeModel}. + * Models jump subroutine instructions discontinued from the {@code code} + * array of a {@code Code} attribute since class file major version {@value + * ClassFile#JAVA_7_VERSION} (JVMS {@jvms 4.9.1}). Corresponding opcodes + * have a {@linkplain Opcode#kind() kind} of {@link Opcode.Kind#DISCONTINUED_JSR}. + * Delivered as a {@link CodeElement} when traversing the elements of a + * {@link CodeModel}. + *

+ * A jump subroutine instruction is composite: + * {@snippet lang=text : + * // @link substring="JsrInstruction" target="#of(Label)" : + * JsrInstruction(Label target) // @link substring="target" target="#target()" + * } + *

+ * Due to physical restrictions, {@link Opcode#JSR jsr} instructions cannot + * encode labels too far away in the list of code elements. In such cases, + * the {@link ClassFile.ShortJumpsOption} controls how an invalid {@code jsr} + * instruction model is written by a {@link CodeBuilder}. + *

+ * Jump subroutine instructions push a {@link TypeKind##returnAddress + * returnAddress} value to the operand stack, and {@link StoreInstruction + * astore} series of instructions can then store this value to a local + * variable slot. * + * @see Opcode.Kind#DISCONTINUED_JSR * @since 24 */ sealed interface JsrInstruction extends DiscontinuedInstruction @@ -57,14 +79,18 @@ sealed interface JsrInstruction extends DiscontinuedInstruction AbstractInstruction.UnboundJsrInstruction { /** - * {@return the target of the JSR instruction} + * {@return the target of the jump subroutine instruction} */ Label target(); /** - * {@return a JSR instruction} + * {@return a jump subroutine instruction} * - * @param op the opcode for the specific type of JSR instruction, + * @apiNote + * The explicit {@code op} argument allows creating {@link Opcode#JSR_W + * jsr_w} instructions to avoid short jumps. + * + * @param op the opcode for the specific type of jump subroutine instruction, * which must be of kind {@link Opcode.Kind#DISCONTINUED_JSR} * @param target target label of the subroutine * @throws IllegalArgumentException if the opcode kind is not @@ -76,7 +102,7 @@ static JsrInstruction of(Opcode op, Label target) { } /** - * {@return a JSR instruction} + * {@return a jump subroutine instruction} * * @param target target label of the subroutine */ @@ -86,12 +112,26 @@ static JsrInstruction of(Label target) { } /** - * Models RET and RET_W instructions discontinued from the {@code code} - * array of a {@code Code} attribute since class file version 51.0. - * Corresponding opcodes will have a {@code kind} of + * Models return from subroutine instructions discontinued from the {@code + * code} array of a {@code Code} attribute since class file major version + * {@value ClassFile#JAVA_7_VERSION} (JVMS {@jvms 4.9.1}). + * Corresponding opcodes have a {@linkplain Opcode#kind() kind} of * {@link Opcode.Kind#DISCONTINUED_RET}. Delivered as a {@link CodeElement} * when traversing the elements of a {@link CodeModel}. + *

+ * A return from subroutine instruction is composite: + * {@snippet lang=text : + * // @link substring="RetInstruction" target="#of(int)" : + * RetInstruction(int slot) // @link substring="slot" target="#slot()" + * } + * where {@code slot} must be within {@code [0, 65535]}. + *

+ * {@link StoreInstruction astore} series of instructions store a {@link + * TypeKind##returnAddress returnAddress} value to a local variable slot, + * making the slot usable by a return from subroutine instruction. * + * @jvms 6.5.ret ret + * @see Opcode.Kind#DISCONTINUED_RET * @since 24 */ sealed interface RetInstruction extends DiscontinuedInstruction @@ -100,13 +140,23 @@ sealed interface RetInstruction extends DiscontinuedInstruction /** * {@return the local variable slot with return address} + * The value is within {@code [0, 65535]}. */ int slot(); /** - * {@return a RET or RET_W instruction} + * {@return a return from subroutine instruction} + *

+ * {@code slot} must be in the closed range of {@code [0, 255]} for + * {@link Opcode#RET ret}, or within {@code [0, 65535]} for {@link + * Opcode#RET_W wide ret}. + * + * @apiNote + * The explicit {@code op} argument allows creating {@code wide ret} + * instructions with {@code slot} in the range of regular {@code ret} + * instructions. * - * @param op the opcode for the specific type of RET instruction, + * @param op the opcode for the specific type of return from subroutine instruction, * which must be of kind {@link Opcode.Kind#DISCONTINUED_RET} * @param slot the local variable slot to load return address from * @throws IllegalArgumentException if the opcode kind is not @@ -118,7 +168,9 @@ static RetInstruction of(Opcode op, int slot) { } /** - * {@return a RET instruction} + * {@return a return from subroutine instruction} + *

+ * {@code slot} must be within {@code [0, 65535]}. * * @param slot the local variable slot to load return address from * @throws IllegalArgumentException if {@code slot} is out of range diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/ExceptionCatch.java b/src/java.base/share/classes/java/lang/classfile/instruction/ExceptionCatch.java index 885f029d108..2a86c4bd09c 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/ExceptionCatch.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/ExceptionCatch.java @@ -24,23 +24,37 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Label; import java.lang.classfile.PseudoInstruction; +import java.lang.classfile.attribute.CodeAttribute; import java.lang.classfile.constantpool.ClassEntry; import java.util.Optional; import jdk.internal.classfile.impl.AbstractPseudoInstruction; /** - * A pseudo-instruction modeling an entry in the exception table of a code - * attribute. Entries in the exception table model catch and finally blocks. - * Delivered as a {@link CodeElement} when traversing the contents - * of a {@link CodeModel}. - * - * @see PseudoInstruction + * A pseudo-instruction modeling an entry in the {@code exception_table} array + * of a {@link CodeAttribute Code} attribute. Catch (JVMS {@jvms 3.12}) and + * finally (JVMS {@jvms 3.14}) blocks in Java source code compile to exception + * table entries. Delivered as a {@link CodeElement} when traversing the + * contents of a {@link CodeModel}. + *

+ * An exception table entry is composite: + * {@snippet lang=text : + * // @link substring="ExceptionCatch" target="#of(Label, Label, Label, Optional)" : + * ExceptionCatch( + * Label handler, // @link substring="handler" target="#handler" + * Label tryStart, // @link substring="tryStart" target="#tryStart" + * Label tryEnd, // @link substring="tryEnd" target="#tryEnd" + * Optional catchType // @link substring="catchType" target="#catchType" + * ) + * } * + * @see CodeBuilder#exceptionCatch CodeBuilder::exceptionCatch + * @jvms 4.7.3 The {@code Code} Attribute * @since 24 */ public sealed interface ExceptionCatch extends PseudoInstruction @@ -61,8 +75,8 @@ public sealed interface ExceptionCatch extends PseudoInstruction Label tryEnd(); /** - * {@return the type of the exception to catch, or empty if this handler is - * unconditional} + * {@return the type of the exception to catch, or empty if this handler + * catches everything} */ Optional catchType(); @@ -80,10 +94,10 @@ static ExceptionCatch of(Label handler, Label tryStart, Label tryEnd, } /** - * {@return an exception table pseudo-instruction for an unconditional handler} + * {@return an exception table pseudo-instruction to catch everything} * @param handler the handler for the exception - * @param tryStart the beginning of the instruction range for the gaurded instructions - * @param tryEnd the end of the instruction range for the gaurded instructions + * @param tryStart the beginning of the instruction range for the guarded instructions + * @param tryEnd the end of the instruction range for the guarded instructions */ static ExceptionCatch of(Label handler, Label tryStart, Label tryEnd) { return new AbstractPseudoInstruction.ExceptionCatchImpl(handler, tryStart, tryEnd, (ClassEntry) null); diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/FieldInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/FieldInstruction.java index b547abd18ab..68d56667957 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/FieldInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/FieldInstruction.java @@ -24,6 +24,7 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; @@ -40,10 +41,21 @@ /** * Models a field access instruction in the {@code code} array of a {@code Code} - * attribute. Corresponding opcodes will have a {@code kind} of {@link - * Opcode.Kind#FIELD_ACCESS}. Delivered as a {@link CodeElement} when + * attribute. Corresponding opcodes have a {@linkplain Opcode#kind() kind} + * of {@link Opcode.Kind#FIELD_ACCESS}. Delivered as a {@link CodeElement} when * traversing the elements of a {@link CodeModel}. + *

+ * A field access instruction is composite: + * {@snippet lang=text : + * // @link substring="FieldInstruction" target="#of(Opcode, FieldRefEntry)" : + * FieldInstruction( + * Opcode opcode, // @link substring="opcode" target="#opcode()" + * FieldRefEntry field, // @link substring="field" target="#field()" + * ) + * } * + * @see Opcode.Kind#FIELD_ACCESS + * @see CodeBuilder#fieldAccess CodeBuilder::fieldAccess * @since 24 */ public sealed interface FieldInstruction extends Instruction @@ -68,7 +80,11 @@ default Utf8Entry name() { } /** - * {@return the field descriptor of the field} + * {@return the field descriptor string of the field} + * + * @apiNote + * A symbolic descriptor for the type of the field is available through + * {@link #typeSymbol() typeSymbol()}. */ default Utf8Entry type() { return field().nameAndType().type(); @@ -103,6 +119,8 @@ static FieldInstruction of(Opcode op, FieldRefEntry field) { * @param owner the class holding the field * @param name the name of the field * @param type the field descriptor + * @throws IllegalArgumentException if the opcode kind is not + * {@link Opcode.Kind#FIELD_ACCESS}. */ static FieldInstruction of(Opcode op, ClassEntry owner, @@ -118,6 +136,8 @@ static FieldInstruction of(Opcode op, * which must be of kind {@link Opcode.Kind#FIELD_ACCESS} * @param owner the class holding the field * @param nameAndType the name and field descriptor of the field + * @throws IllegalArgumentException if the opcode kind is not + * {@link Opcode.Kind#FIELD_ACCESS}. */ static FieldInstruction of(Opcode op, ClassEntry owner, diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/IncrementInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/IncrementInstruction.java index 7ea516c7cc5..a874ef0a954 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/IncrementInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/IncrementInstruction.java @@ -24,6 +24,7 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; @@ -33,10 +34,27 @@ /** * Models a local variable increment instruction in the {@code code} array of a - * {@code Code} attribute. Corresponding opcodes will have a {@code kind} of - * {@link Opcode.Kind#INCREMENT}. Delivered as a {@link CodeElement} when + * {@code Code} attribute. Corresponding opcodes have a {@linkplain Opcode#kind() + * kind} of {@link Opcode.Kind#INCREMENT}. Delivered as a {@link CodeElement} when * traversing the elements of a {@link CodeModel}. + *

+ * A local variable increment instruction is composite: + * {@snippet lang=text : + * // @link substring="IncrementInstruction" target="#of" : + * IncrementInstruction( + * int slot, // @link substring="slot" target="#slot()" + * int constant // @link substring="constant" target="#constant()" + * ) + * } + * where + *

    + *
  • {@code slot} must be within {@code [0, 65535]}. + *
  • {@code constant} must be within {@code [-32768, 32767]}. + *
* + * @see Opcode.Kind#INCREMENT + * @see CodeBuilder#iinc CodeBuilder::iinc + * @jvms 6.5.iinc iinc * @since 24 */ public sealed interface IncrementInstruction extends Instruction @@ -54,6 +72,10 @@ public sealed interface IncrementInstruction extends Instruction /** * {@return an increment instruction} + *
    + *
  • {@code slot} must be within {@code [0, 65535]}. + *
  • {@code constant} must be within {@code [-32768, 32767]}. + *
* * @param slot the local variable slot to increment * @param constant the value to increment by diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/InvokeDynamicInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/InvokeDynamicInstruction.java index 43907b2a518..7cad91b9d8d 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/InvokeDynamicInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/InvokeDynamicInstruction.java @@ -24,9 +24,11 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; +import java.lang.classfile.Opcode; import java.lang.classfile.constantpool.InvokeDynamicEntry; import java.lang.classfile.constantpool.LoadableConstantEntry; import java.lang.classfile.constantpool.Utf8Entry; @@ -40,10 +42,20 @@ import jdk.internal.classfile.impl.Util; /** - * Models an {@code invokedynamic} instruction in the {@code code} array of a - * {@code Code} attribute. Delivered as a {@link CodeElement} when traversing - * the elements of a {@link CodeModel}. + * Models a dynamically-computed call site invocation instruction in the + * {@code code} array of a {@code Code} attribute. The corresponding opcode is + * {@link Opcode#INVOKEDYNAMIC invokedynamic}. Delivered as a {@link + * CodeElement} when traversing the elements of a {@link CodeModel}. + *

+ * A dynamically-computed call site invocation instruction is composite: + * {@snippet lang=text : + * // @link substring="InvokeDynamicInstruction" target="#of" : + * InvokeDynamicInstruction(InvokeDynamicEntry invokedynamic) // @link substring="invokedynamic" target="#invokedynamic()" + * } * + * @see Opcode.Kind#INVOKE_DYNAMIC + * @see CodeBuilder#invokedynamic CodeBuilder::invokedynamic + * @jvms 6.5.invokedynamic invokedynamic * @since 24 */ public sealed interface InvokeDynamicInstruction extends Instruction @@ -62,6 +74,10 @@ default Utf8Entry name() { /** * {@return the invocation type of the call site} + * + * @apiNote + * A symbolic descriptor for the invocation typeis available through {@link + * #typeSymbol() typeSymbol()}. */ default Utf8Entry type() { return invokedynamic().type(); diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/InvokeInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/InvokeInstruction.java index 904a17375ac..50791cbd0ff 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/InvokeInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/InvokeInstruction.java @@ -24,10 +24,12 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; import java.lang.classfile.Opcode; +import java.lang.classfile.TypeKind; import java.lang.classfile.constantpool.ClassEntry; import java.lang.classfile.constantpool.InterfaceMethodRefEntry; import java.lang.classfile.constantpool.MemberRefEntry; @@ -42,10 +44,26 @@ /** * Models a method invocation instruction in the {@code code} array of a {@code - * Code} attribute, other than {@code invokedynamic}. Corresponding opcodes - * will have a {@code kind} of {@link Opcode.Kind#INVOKE}. Delivered as a - * {@link CodeElement} when traversing the elements of a {@link CodeModel}. + * Code} attribute, other than {@link InvokeDynamicInstruction invokedynamic}. + * Corresponding opcodes have a {@linkplain Opcode#kind() kind} of {@link Opcode.Kind#INVOKE}. + * Delivered as a {@link CodeElement} when traversing the elements of a {@link CodeModel}. + *

+ * A method invocation instruction is composite: + * {@snippet lang=text : + * // @link substring="InvokeInstruction" target="#of(Opcode, MemberRefEntry)" : + * InvokeInstruction( + * Opcode opcode, // @link substring="opcode" target="#opcode()" + * MethodRefEntry | InterfaceMethodRefEntry method) // @link substring="method" target="#method()" + * ) + * } + * where {@code method} must be an {@code InterfaceMethodRefEntry} for {@link + * Opcode#INVOKEINTERFACE invokeinterface} opcode, and must be a {@code + * MethodRefEntry} for {@link Opcode#INVOKEVIRTUAL invokevirtual} opcode. + * {@link Opcode#INVOKESTATIC invokestatic} and {@link Opcode#INVOKESPECIAL + * invokespecial} can have either type of entry for {@code method}. * + * @see Opcode.Kind#INVOKE + * @see CodeBuilder#invoke CodeBuilder::invoke * @since 24 */ public sealed interface InvokeInstruction extends Instruction @@ -57,18 +75,25 @@ public sealed interface InvokeInstruction extends Instruction MemberRefEntry method(); /** - * {@return whether the class holding the method is an interface} + * {@return whether the class or interface holding the method is an interface} */ boolean isInterface(); /** - * {@return the {@code count} value of an {@code invokeinterface} instruction, as defined in JVMS {@jvms 6.5} - * or {@code 0} for {@code invokespecial}, {@code invokestatic} and {@code invokevirtual} instructions} + * {@return the {@code count} value of an {@code invokeinterface} instruction, + * or {@code 0} for other instructions} + *

+ * For an {@code invokeinterface} instruction, this value must be equivalent + * to the sum of {@linkplain TypeKind#slotSize() slot sizes} of all arguments + * plus one, which is equal to the number of operand stack depth consumed by + * this interface method invocation instruction. + * + * @jvms 6.5.invokeinterface invokeinterface */ int count(); /** - * {@return the class holding the method} + * {@return the class or interface holding the method} */ default ClassEntry owner() { return method().owner(); @@ -82,7 +107,11 @@ default Utf8Entry name() { } /** - * {@return the method descriptor of the method} + * {@return the method descriptor string of the method} + * + * @apiNote + * A symbolic descriptor for the type of the method is available through + * {@link #typeSymbol() typeSymbol()}. */ default Utf8Entry type() { return method().nameAndType().type(); @@ -95,7 +124,6 @@ default MethodTypeDesc typeSymbol() { return Util.methodTypeSymbol(method().type()); } - /** * {@return an invocation instruction} * @@ -103,7 +131,7 @@ default MethodTypeDesc typeSymbol() { * which must be of kind {@link Opcode.Kind#INVOKE} * @param method a constant pool entry describing the method * @throws IllegalArgumentException if the opcode kind is not - * {@link Opcode.Kind#INVOKE}. + * {@link Opcode.Kind#INVOKE} */ static InvokeInstruction of(Opcode op, MemberRefEntry method) { Util.checkKind(op, Opcode.Kind.INVOKE); @@ -119,6 +147,8 @@ static InvokeInstruction of(Opcode op, MemberRefEntry method) { * @param name the name of the method * @param type the method descriptor * @param isInterface whether the class holding the method is an interface + * @throws IllegalArgumentException if the opcode kind is not + * {@link Opcode.Kind#INVOKE} */ static InvokeInstruction of(Opcode op, ClassEntry owner, @@ -136,6 +166,8 @@ static InvokeInstruction of(Opcode op, * @param owner the class holding the method * @param nameAndType the name and type of the method * @param isInterface whether the class holding the method is an interface + * @throws IllegalArgumentException if the opcode kind is not + * {@link Opcode.Kind#INVOKE} */ static InvokeInstruction of(Opcode op, ClassEntry owner, diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/LabelTarget.java b/src/java.base/share/classes/java/lang/classfile/instruction/LabelTarget.java index bc1deffc98b..c5b49973133 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/LabelTarget.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/LabelTarget.java @@ -24,10 +24,13 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; +import java.lang.classfile.CodeTransform; import java.lang.classfile.Label; import java.lang.classfile.PseudoInstruction; +import java.lang.classfile.attribute.CodeAttribute; import jdk.internal.classfile.impl.LabelImpl; @@ -35,9 +38,28 @@ * A pseudo-instruction which indicates that the specified label corresponds to * the current position in the {@code Code} attribute. Delivered as a {@link * CodeElement} during traversal of the elements of a {@link CodeModel}. + *

+ * This can be used to inspect the target position of labels across {@linkplain + * CodeTransform transformations}, as {@linkplain CodeAttribute#labelToBci bci} + * is not stable. + *

+ * When passed to a {@link CodeBuilder}, this pseudo-instruction sets the + * specified label to be bound at the current position in the builder. + *

+ * By design, {@code LabelTarget} cannot be created by users and can only be + * read from a code model. Use {@link CodeBuilder#labelBinding + * CodeBuilder::labelBinding} to bind arbitrary labels to a {@code CodeBuilder}. + *

+ * For a {@code CodeBuilder cob}, a {@code LabelTarget lt}, these two calls are + * equivalent: + * {@snippet lang=java : + * cob.with(lt); // @link substring="with" target="CodeBuilder#with" + * // @link substring="labelBinding" target="CodeBuilder#labelBinding" : + * cob.labelBinding(lt.label()); // @link substring="label" target="#label" + * } * - * @see PseudoInstruction - * + * @see Label + * @see CodeBuilder#labelBinding CodeBuilder::labelBinding * @since 24 */ public sealed interface LabelTarget extends PseudoInstruction diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/LineNumber.java b/src/java.base/share/classes/java/lang/classfile/instruction/LineNumber.java index a9a497708c0..3f10a3ada0d 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/LineNumber.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/LineNumber.java @@ -25,21 +25,42 @@ package java.lang.classfile.instruction; import java.lang.classfile.ClassFile; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.PseudoInstruction; +import java.lang.classfile.attribute.CodeAttribute; +import java.lang.classfile.attribute.LineNumberInfo; import java.lang.classfile.attribute.LineNumberTableAttribute; import jdk.internal.classfile.impl.LineNumberImpl; /** - * A pseudo-instruction which models a single entry in the - * {@link LineNumberTableAttribute}. Delivered as a {@link CodeElement} - * during traversal of the elements of a {@link CodeModel}, according to - * the setting of the {@link ClassFile.LineNumbersOption} option. + * A pseudo-instruction which indicates the code for a given line number starts + * after the current position in a {@link CodeAttribute Code} attribute. This + * models a single entry in the {@link LineNumberTableAttribute LineNumberTable} + * attribute. Delivered as a {@link CodeElement} during traversal of the + * elements of a {@link CodeModel}, according to the setting of the {@link + * ClassFile.LineNumbersOption} option. + *

+ * A line number entry is composite: + * {@snippet lang=text : + * // @link substring="LineNumber" target="#of" : + * LineNumber(int line) // @link substring="int line" target="#line" + * } + *

+ * Another model, {@link LineNumberInfo}, also models a line number entry; it + * has no dependency on a {@code CodeModel} and represents of bci values as + * {@code int}s instead of order of pseudo-instructions in the elements of a + * {@code CodeModel}, and is used as components of a {@link LineNumberTableAttribute}. * - * @see PseudoInstruction + * @apiNote + * Line numbers are represented with custom pseudo-instructions to avoid using + * labels, which usually indicate branching targets for the control flow. * + * @see LineNumberInfo + * @see CodeBuilder#lineNumber CodeBuilder::lineNumber + * @see ClassFile.LineNumbersOption * @since 24 */ public sealed interface LineNumber extends PseudoInstruction diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/LoadInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/LoadInstruction.java index c499dcc9944..81961320be3 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/LoadInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/LoadInstruction.java @@ -24,6 +24,7 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; @@ -36,10 +37,23 @@ /** * Models a local variable load instruction in the {@code code} array of a - * {@code Code} attribute. Corresponding opcodes will have a {@code kind} of - * {@link Opcode.Kind#LOAD}. Delivered as a {@link CodeElement} when - * traversing the elements of a {@link CodeModel}. + * {@code Code} attribute. Corresponding opcodes have a {@linkplain + * Opcode#kind() kind} of {@link Opcode.Kind#LOAD}. Delivered as a {@link + * CodeElement} when traversing the elements of a {@link CodeModel}. + *

+ * A local variable load instruction is composite: + * {@snippet lang=text : + * // @link substring="LoadInstruction" target="#of(TypeKind, int)" : + * LoadInstruction( + * TypeKind typeKind, // @link substring="typeKind" target="#typeKind" + * int slot // @link substring="slot" target="#slot" + * ) + * } + * where {@code TypeKind} is {@linkplain TypeKind##computational-type + * computational}, and {@code slot} is within {@code [0, 65535]}. * + * @see Opcode.Kind#LOAD + * @see CodeBuilder#loadLocal CodeBuilder::loadLocal * @since 24 */ public sealed interface LoadInstruction extends Instruction @@ -48,16 +62,21 @@ public sealed interface LoadInstruction extends Instruction /** * {@return the local variable slot to load from} + * The value is within {@code [0, 65535]}. */ int slot(); /** - * {@return the type of the value to be loaded} + * {@return the {@linkplain TypeKind##computational-type computational type} + * of the value to be loaded} */ TypeKind typeKind(); /** * {@return a local variable load instruction} + * {@code kind} is {@linkplain TypeKind#asLoadable() converted} to its + * computational type. + * {@code slot} must be within {@code [0, 65535]}. * * @param kind the type of the value to be loaded * @param slot the local variable slot to load from @@ -71,6 +90,20 @@ static LoadInstruction of(TypeKind kind, int slot) { /** * {@return a local variable load instruction} + *

+ * The range of {@code slot} is restricted by the {@code op} and its + * {@linkplain Opcode#sizeIfFixed() size}: + *

    + *
  • If {@code op} has size 1, {@code slot} must be exactly the slot value + * implied by the opcode. + *
  • If {@code op} has size 2, {@code slot} must be within {@code [0, 255]}. + *
  • If {@code op} has size 4, {@code slot} must be within {@code [0, 65535]}. + *
+ * + * @apiNote + * The explicit {@code op} argument allows creating {@code wide} or + * regular load instructions when the {@code slot} can be encoded + * with more optimized load instructions. * * @param op the opcode for the specific type of load instruction, * which must be of kind {@link Opcode.Kind#LOAD} diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/LocalVariable.java b/src/java.base/share/classes/java/lang/classfile/instruction/LocalVariable.java index 0f8cb672e51..f44a4e094f1 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/LocalVariable.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/LocalVariable.java @@ -25,10 +25,12 @@ package java.lang.classfile.instruction; import java.lang.classfile.ClassFile; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Label; import java.lang.classfile.PseudoInstruction; +import java.lang.classfile.attribute.LocalVariableInfo; import java.lang.classfile.attribute.LocalVariableTableAttribute; import java.lang.classfile.constantpool.Utf8Entry; import java.lang.constant.ClassDesc; @@ -39,19 +41,45 @@ import jdk.internal.classfile.impl.Util; /** - * A pseudo-instruction which models a single entry in the - * {@link LocalVariableTableAttribute}. Delivered as a {@link CodeElement} - * during traversal of the elements of a {@link CodeModel}, according to - * the setting of the {@link ClassFile.DebugElementsOption} option. + * A pseudo-instruction which models a single entry in the {@link + * LocalVariableTableAttribute LocalVariableTable} attribute. Delivered as a + * {@link CodeElement} during traversal of the elements of a {@link CodeModel}, + * according to the setting of the {@link ClassFile.DebugElementsOption} option. + *

+ * A local variable entry is composite: + * {@snippet lang=text : + * // @link substring="LocalVariable" target="#of(int, String, ClassDesc, Label, Label)" : + * LocalVariable( + * int slot, // @link substring="slot" target="#slot" + * String name, // @link substring="name" target="#name" + * ClassDesc type, // @link substring="type" target="#type" + * Label startScope, // @link substring="startScope" target="#startScope" + * Label endScope // @link substring="endScope" target="#endScope" + * ) + * } + * Where {@code slot} is within {@code [0, 65535]}. + *

+ * Another model, {@link LocalVariableInfo}, also models a local variable + * entry; it has no dependency on a {@code CodeModel} and represents of bci + * values as {@code int}s instead of {@code Label}s, and is used as components + * of a {@link LocalVariableTableAttribute}. * - * @see PseudoInstruction + * @apiNote + * {@code LocalVariable} is used for all local variables in Java source code. + * If a local variable has a parameterized type, a type argument, or an array + * type of one of the previous types, a {@link LocalVariableType} should be + * created for that local variable as well. * + * @see LocalVariableInfo + * @see CodeBuilder#localVariable CodeBuilder::localVariable + * @see ClassFile.DebugElementsOption * @since 24 */ public sealed interface LocalVariable extends PseudoInstruction permits AbstractPseudoInstruction.UnboundLocalVariable, BoundLocalVariable { /** * {@return the local variable slot} + * The value is within {@code [0, 65535]}. */ int slot(); @@ -61,7 +89,11 @@ public sealed interface LocalVariable extends PseudoInstruction Utf8Entry name(); /** - * {@return the local variable field descriptor} + * {@return the local variable field descriptor string} + * + * @apiNote + * A symbolic descriptor for the type of the local variable is available + * through {@link #typeSymbol() typeSymbol()}. */ Utf8Entry type(); @@ -84,6 +116,7 @@ default ClassDesc typeSymbol() { /** * {@return a local variable pseudo-instruction} + * {@code slot} must be within {@code [0, 65535]}. * * @param slot the local variable slot * @param nameEntry the local variable name @@ -99,6 +132,7 @@ static LocalVariable of(int slot, Utf8Entry nameEntry, Utf8Entry descriptorEntry /** * {@return a local variable pseudo-instruction} + * {@code slot} must be within {@code [0, 65535]}. * * @param slot the local variable slot * @param name the local variable name diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/LocalVariableType.java b/src/java.base/share/classes/java/lang/classfile/instruction/LocalVariableType.java index c9427491733..1e28804a837 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/LocalVariableType.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/LocalVariableType.java @@ -24,12 +24,8 @@ */ package java.lang.classfile.instruction; -import java.lang.classfile.ClassFile; -import java.lang.classfile.CodeElement; -import java.lang.classfile.CodeModel; -import java.lang.classfile.Label; -import java.lang.classfile.PseudoInstruction; -import java.lang.classfile.Signature; +import java.lang.classfile.*; +import java.lang.classfile.attribute.LocalVariableTypeInfo; import java.lang.classfile.attribute.LocalVariableTypeTableAttribute; import java.lang.classfile.constantpool.Utf8Entry; @@ -39,16 +35,44 @@ /** * A pseudo-instruction which models a single entry in the {@link - * LocalVariableTypeTableAttribute}. Delivered as a {@link CodeElement} during - * traversal of the elements of a {@link CodeModel}, according to the setting of - * the {@link ClassFile.DebugElementsOption} option. + * LocalVariableTypeTableAttribute LocalVariableTypeTable} attribute. Delivered + * as a {@link CodeElement} during traversal of the elements of a {@link CodeModel}, + * according to the setting of the {@link ClassFile.DebugElementsOption} option. + *

+ * A local variable type entry is composite: + * {@snippet lang=text : + * // @link substring="LocalVariableType" target="#of(int, String, Signature, Label, Label)" : + * LocalVariableType( + * int slot, // @link substring="slot" target="#slot" + * String name, // @link substring="name" target="#name" + * Signature signature, // @link substring="signature" target="#signatureSymbol" + * Label startScope, // @link substring="startScope" target="#startScope" + * Label endScope // @link substring="endScope" target="#endScope" + * ) + * } + * Where {@code slot} is within {@code [0, 65535]}. + *

+ * Another model, {@link LocalVariableTypeInfo}, also models a local variable + * type entry; it has no dependency on a {@code CodeModel} and represents of bci + * values as {@code int}s instead of {@code Label}s, and is used as components + * of a {@link LocalVariableTypeTableAttribute}. * + * @apiNote + * {@code LocalVariableType} is used if a local variable has a parameterized + * type, a type argument, or an array type of one of the previous types as its + * type. A {@link LocalVariable} with the erased type should still be created + * for that local variable. + * + * @see LocalVariableTypeInfo + * @see CodeBuilder#localVariableType CodeBuilder::localVariableType + * @see ClassFile.DebugElementsOption * @since 24 */ public sealed interface LocalVariableType extends PseudoInstruction permits AbstractPseudoInstruction.UnboundLocalVariableType, BoundLocalVariableType { /** * {@return the local variable slot} + * The value is within {@code [0, 65535]}. */ int slot(); @@ -58,12 +82,16 @@ public sealed interface LocalVariableType extends PseudoInstruction Utf8Entry name(); /** - * {@return the local variable signature} + * {@return the local variable generic signature string} + * + * @apiNote + * A symbolic generic signature of the local variable is available + * through {@link #signatureSymbol() signatureSymbol()}. */ Utf8Entry signature(); /** - * {@return the local variable signature} + * {@return the local variable generic signature} */ default Signature signatureSymbol() { return Signature.parseFrom(signature().stringValue()); @@ -81,6 +109,7 @@ default Signature signatureSymbol() { /** * {@return a local variable type pseudo-instruction} + * {@code slot} must be within {@code [0, 65535]}. * * @param slot the local variable slot * @param nameEntry the local variable name @@ -96,6 +125,7 @@ static LocalVariableType of(int slot, Utf8Entry nameEntry, Utf8Entry signatureEn /** * {@return a local variable type pseudo-instruction} + * {@code slot} must be within {@code [0, 65535]}. * * @param slot the local variable slot * @param name the local variable name diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/LookupSwitchInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/LookupSwitchInstruction.java index 7b286e9cfd2..33e3ec002fd 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/LookupSwitchInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/LookupSwitchInstruction.java @@ -24,19 +24,36 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; import java.lang.classfile.Label; +import java.lang.classfile.Opcode; import java.util.List; import jdk.internal.classfile.impl.AbstractInstruction; /** - * Models a {@code lookupswitch} instruction in the {@code code} array of a - * {@code Code} attribute. Delivered as a {@link CodeElement} when traversing - * the elements of a {@link CodeModel}. + * Models a {@link Opcode#LOOKUPSWITCH lookupswitch} instruction in the {@code + * code} array of a {@code Code} attribute. Delivered as a {@link CodeElement} + * when traversing the elements of a {@link CodeModel}. + *

+ * A lookup switch instruction is composite: + * {@snippet lang=text : + * // @link substring="LookupSwitchInstruction" target="#of" : + * LookupSwitchInstruction( + * Label defaultTarget, // @link substring="defaultTarget" target="#defaultTarget" + * List cases // @link substring="cases" target="#cases()" + * ) + * } + * If elements in {@code cases} are not sorted ascending by their {@link + * SwitchCase#caseValue caseValue}, a sorted version of the {@code cases} list + * will be written instead. * + * @see Opcode.Kind#LOOKUP_SWITCH + * @see CodeBuilder#lookupswitch CodeBuilder::lookupswitch + * @jvms 6.5.lookupswitch lookupswitch * @since 24 */ public sealed interface LookupSwitchInstruction extends Instruction diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/MonitorInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/MonitorInstruction.java index 1c8268cddd6..0efdfbdb34f 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/MonitorInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/MonitorInstruction.java @@ -24,6 +24,7 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; @@ -33,9 +34,17 @@ import jdk.internal.classfile.impl.Util; /** - * Models a {@code monitorenter} or {@code monitorexit} instruction in the - * {@code code} array of a {@code Code} attribute. Delivered as a {@link - * CodeElement} when traversing the elements of a {@link CodeModel}. + * Models a {@link Opcode#MONITORENTER monitorenter} or {@link Opcode#MONITOREXIT + * monitorexit} instruction in the {@code code} array of a {@code Code} attribute. + * Corresponding opcodes have a {@linkplain Opcode#kind() kind} of {@link + * Opcode.Kind#MONITOR}. Delivered as a {@link CodeElement} when traversing the + * elements of a {@link CodeModel}. + *

+ * A monitor instruction is composite: + * {@snippet lang=text : + * // @link substring="MonitorInstruction" target="#of(Opcode)" : + * MonitorInstruction(Opcode opcode) // @link substring="opcode" target="#opcode" + * } * * @since 24 */ diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/NewMultiArrayInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/NewMultiArrayInstruction.java index 4a1f6cfd170..f7efd144422 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/NewMultiArrayInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/NewMultiArrayInstruction.java @@ -24,19 +24,34 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; +import java.lang.classfile.Opcode; import java.lang.classfile.constantpool.ClassEntry; import jdk.internal.classfile.impl.AbstractInstruction; import jdk.internal.classfile.impl.BytecodeHelpers; /** - * Models a {@code multianewarray} invocation instruction in the {@code code} + * Models a {@link Opcode#MULTIANEWARRAY multianewarray} instruction in the {@code code} * array of a {@code Code} attribute. Delivered as a {@link CodeElement} * when traversing the elements of a {@link CodeModel}. + *

+ * A new multi-dimensional array instruction is composite: + * {@snippet lang=text : + * // @link substring="NewMultiArrayInstruction" target="#of" : + * NewMultiArrayInstruction( + * ClassEntry arrayType, // @link substring="arrayType" target="#arrayType" + * int dimensions // @link substring="dimensions" target="#dimensions" + * ) + * } + * where the {@code arrayType} is an array class. * + * @see Opcode.Kind#NEW_MULTI_ARRAY + * @see CodeBuilder#multianewarray CodeBuilder::multianewarray + * @jvms 6.5.multianewarray multianewarray * @since 24 */ public sealed interface NewMultiArrayInstruction extends Instruction @@ -44,7 +59,7 @@ public sealed interface NewMultiArrayInstruction extends Instruction AbstractInstruction.UnboundNewMultidimensionalArrayInstruction { /** - * {@return the type of the array, as a symbolic descriptor} + * {@return the type of the array} */ ClassEntry arrayType(); diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/NewObjectInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/NewObjectInstruction.java index f063733b64f..62b0233be87 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/NewObjectInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/NewObjectInstruction.java @@ -24,18 +24,30 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; +import java.lang.classfile.Opcode; import java.lang.classfile.constantpool.ClassEntry; import jdk.internal.classfile.impl.AbstractInstruction; /** - * Models a {@code new} instruction in the {@code code} array of a {@code Code} + * Models a {@link Opcode#NEW new} instruction in the {@code code} array of a {@code Code} * attribute. Delivered as a {@link CodeElement} when traversing the elements * of a {@link CodeModel}. + *

+ * A new object instruction is composite: + * {@snippet lang=text : + * // @link substring="NewObjectInstruction" target="#of" : + * NewObjectInstruction(ClassEntry className) // @link substring="className" target="#className" + * } + * where the {@code className} is a non-abstract class. * + * @see Opcode.Kind#NEW_OBJECT + * @see CodeBuilder#new_ CodeBuilder::new_ + * @jvms 6.5.new new * @since 24 */ public sealed interface NewObjectInstruction extends Instruction diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/NewPrimitiveArrayInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/NewPrimitiveArrayInstruction.java index 411bf7f6b55..c1e2c9d12fa 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/NewPrimitiveArrayInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/NewPrimitiveArrayInstruction.java @@ -24,18 +24,30 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; +import java.lang.classfile.Opcode; import java.lang.classfile.TypeKind; import jdk.internal.classfile.impl.AbstractInstruction; /** - * Models a {@code newarray} invocation instruction in the {@code code} + * Models a {@link Opcode#NEWARRAY newarray} instruction in the {@code code} * array of a {@code Code} attribute. Delivered as a {@link CodeElement} * when traversing the elements of a {@link CodeModel}. + *

+ * A new primitive array instruction is composite: + * {@snippet lang=text : + * // @link substring="NewPrimitiveArrayInstruction" target="#of" : + * NewPrimitiveArrayInstruction(TypeKind typeKind) // @link substring="typeKind" target="#typeKind" + * } + * where {@code typeKind} is primitive and not {@code void}. * + * @see Opcode.Kind#NEW_PRIMITIVE_ARRAY + * @see CodeBuilder#newarray CodeBuilder::newarray + * @jvms 6.5.newarray newarray * @since 24 */ public sealed interface NewPrimitiveArrayInstruction extends Instruction @@ -43,6 +55,10 @@ public sealed interface NewPrimitiveArrayInstruction extends Instruction AbstractInstruction.UnboundNewPrimitiveArrayInstruction { /** * {@return the component type of the array} + * + * @apiNote + * The backing array code for this instruction is available through + * {@link TypeKind#newarrayCode() typeKind().newarrayCode()}. */ TypeKind typeKind(); @@ -50,8 +66,9 @@ public sealed interface NewPrimitiveArrayInstruction extends Instruction * {@return a new primitive array instruction} * * @param typeKind the component type of the array - * @throws IllegalArgumentException when the {@code typeKind} is not a legal - * primitive array component type + * @throws IllegalArgumentException when {@code typeKind} is not primitive + * or is {@code void} + * @see TypeKind#fromNewarrayCode(int) TypeKind::fromNewarrayCode */ static NewPrimitiveArrayInstruction of(TypeKind typeKind) { // Implicit null-check: diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/NewReferenceArrayInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/NewReferenceArrayInstruction.java index c85ed9dd3d9..a092c068a36 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/NewReferenceArrayInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/NewReferenceArrayInstruction.java @@ -24,18 +24,29 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; +import java.lang.classfile.Opcode; import java.lang.classfile.constantpool.ClassEntry; import jdk.internal.classfile.impl.AbstractInstruction; /** - * Models a {@code anewarray} invocation instruction in the {@code code} + * Models a {@link Opcode#ANEWARRAY anewarray} instruction in the {@code code} * array of a {@code Code} attribute. Delivered as a {@link CodeElement} * when traversing the elements of a {@link CodeModel}. + *

+ * A new reference array instruction is composite: + * {@snippet lang=text : + * // @link substring="NewReferenceArrayInstruction" target="#of" : + * NewReferenceArrayInstruction(ClassEntry componentType) // @link substring="componentType" target="#componentType" + * } * + * @see Opcode.Kind#NEW_REF_ARRAY + * @see CodeBuilder#newarray CodeBuilder::anewarray + * @jvms 6.5.anewarray anewarray * @since 24 */ public sealed interface NewReferenceArrayInstruction extends Instruction diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/NopInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/NopInstruction.java index 3c11803109a..cf0b9f25ac9 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/NopInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/NopInstruction.java @@ -24,17 +24,23 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; +import java.lang.classfile.Opcode; import jdk.internal.classfile.impl.AbstractInstruction; /** - * Models a {@code nop} invocation instruction in the {@code code} + * Models a {@link Opcode#NOP nop} instruction in the {@code code} * array of a {@code Code} attribute. Delivered as a {@link CodeElement} * when traversing the elements of a {@link CodeModel}. + *

+ * A no-op instruction has no visible state. * + * @see CodeBuilder#nop CodeBuilder::nop + * @jvms 6.5.nop nop * @since 24 */ public sealed interface NopInstruction extends Instruction diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/OperatorInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/OperatorInstruction.java index d1eb8aa1a3d..b4daf55e3a5 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/OperatorInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/OperatorInstruction.java @@ -35,23 +35,31 @@ /** * Models an arithmetic operator instruction in the {@code code} array of a - * {@code Code} attribute. Corresponding opcodes will have a {@code kind} of + * {@code Code} attribute. Corresponding opcodes have a {@linkplain Opcode#kind() kind} of * {@link Opcode.Kind#OPERATOR}. Delivered as a {@link CodeElement} when * traversing the elements of a {@link CodeModel}. + *

+ * An operator instruction is composite: + * {@snippet lang=text : + * // @link substring="OperatorInstruction" target="#of" : + * OperatorInstruction(Opcode opcode) // @link substring="opcode" target="#opcode()" + * } * + * @see Opcode.Kind#OPERATOR * @since 24 */ public sealed interface OperatorInstruction extends Instruction permits AbstractInstruction.UnboundOperatorInstruction { /** * {@return the operand type of the instruction} + * This is derived from the {@link #opcode opcode}. */ TypeKind typeKind(); /** * {@return an operator instruction} * - * @param op the opcode for the specific type of array load instruction, + * @param op the opcode for the specific type of operator instruction, * which must be of kind {@link Opcode.Kind#OPERATOR} * @throws IllegalArgumentException if the opcode kind is not * {@link Opcode.Kind#OPERATOR}. diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/ReturnInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/ReturnInstruction.java index 3bbb96b1cbe..aca9196eabf 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/ReturnInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/ReturnInstruction.java @@ -24,6 +24,7 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; @@ -36,22 +37,35 @@ /** * Models a return-from-method instruction in the {@code code} array of a - * {@code Code} attribute. Corresponding opcodes will have a {@code kind} of + * {@code Code} attribute. Corresponding opcodes have a {@linkplain Opcode#kind() kind} of * {@link Opcode.Kind#RETURN}. Delivered as a {@link CodeElement} when * traversing the elements of a {@link CodeModel}. + *

+ * A return-from-method instruction is composite: + * {@snippet lang=text : + * // @link substring="ReturnInstruction" target="#of(TypeKind)" : + * ReturnInstruction(TypeKind typeKind) // @link substring="typeKind" target="#typeKind()" + * } + * where {@code typeKind} is {@linkplain TypeKind##computational-type + * computational} or {@link TypeKind#VOID void}. * + * @see Opcode.Kind#RETURN + * @see CodeBuilder#return_(TypeKind) CodeBuilder::return_ * @since 24 */ public sealed interface ReturnInstruction extends Instruction permits AbstractInstruction.UnboundReturnInstruction { /** - * {@return the type of the return instruction} + * {@return the {@linkplain TypeKind##computational-type computational type}, including + * {@link TypeKind#VOID void}, of the return instruction} */ TypeKind typeKind(); /** * {@return a return instruction} + * {@code typeKind} is {@linkplain TypeKind#asLoadable() converted} to its + * computational type. * * @param typeKind the type of the return instruction */ diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/StackInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/StackInstruction.java index b01b206e368..8ef413937bc 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/StackInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/StackInstruction.java @@ -34,10 +34,17 @@ /** * Models a stack manipulation instruction in the {@code code} array of a - * {@code Code} attribute. Corresponding opcodes will have a {@code kind} of + * {@code Code} attribute. Corresponding opcodes have a {@linkplain Opcode#kind() kind} of * {@link Opcode.Kind#STACK}. Delivered as a {@link CodeElement} when * traversing the elements of a {@link CodeModel}. + *

+ * A stack manipulation instruction is composite: + * {@snippet lang=text : + * // @link substring="StackInstruction" target="#of" : + * StackInstruction(Opcode opcode) // @link substring="opcode" target="#opcode()" + * } * + * @see Opcode.Kind#STACK * @since 24 */ public sealed interface StackInstruction extends Instruction diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/StoreInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/StoreInstruction.java index 1d7bdce1fdf..93d33e0b7c2 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/StoreInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/StoreInstruction.java @@ -24,6 +24,7 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; @@ -36,10 +37,28 @@ /** * Models a local variable store instruction in the {@code code} array of a - * {@code Code} attribute. Corresponding opcodes will have a {@code kind} of + * {@code Code} attribute. Corresponding opcodes have a {@linkplain Opcode#kind() kind} of * {@link Opcode.Kind#STORE}. Delivered as a {@link CodeElement} when * traversing the elements of a {@link CodeModel}. + *

+ * A local variable store instruction is composite: + * {@snippet lang=text : + * // @link substring="StoreInstruction" target="#of(TypeKind, int)" : + * StoreInstruction( + * TypeKind typeKind, // @link substring="typeKind" target="#typeKind" + * int slot // @link substring="slot" target="#slot" + * ) + * } + * where {@code TypeKind} is {@linkplain TypeKind##computational-type + * computational}, and {@code slot} is within {@code [0, 65535]}. + *

+ * {@code astore} series of instructions, or {@code reference} type store + * instructions, can also operate on the {@link TypeKind##returnAddress + * returnAddress} type from discontinued {@linkplain + * DiscontinuedInstruction.JsrInstruction jump subroutine instructions}. * + * @see Opcode.Kind#STORE + * @see CodeBuilder#storeLocal CodeBuilder::storeLocal * @since 24 */ public sealed interface StoreInstruction extends Instruction @@ -47,16 +66,23 @@ public sealed interface StoreInstruction extends Instruction /** * {@return the local variable slot to store to} + * The value is within {@code [0, 65535]}. */ int slot(); /** - * {@return the type of the value to be stored} + * {@return the {@linkplain TypeKind##computational-type computational type} + * of the value to be stored} The {@link TypeKind#REFERENCE reference} + * type store instructions also operate on the {@code returnAddress} type, + * which does not apply to {@code reference} type load instructions. */ TypeKind typeKind(); /** * {@return a local variable store instruction} + * {@code kind} is {@linkplain TypeKind#asLoadable() converted} to its + * computational type. + * {@code slot} must be within {@code [0, 65535]}. * * @param kind the type of the value to be stored * @param slot the local variable slot to store to @@ -70,6 +96,20 @@ static StoreInstruction of(TypeKind kind, int slot) { /** * {@return a local variable store instruction} + *

+ * The range of {@code slot} is restricted by the {@code op} and its + * {@linkplain Opcode#sizeIfFixed() size}: + *

    + *
  • If {@code op} has size 1, {@code slot} must be exactly the slot value + * implied by the opcode. + *
  • If {@code op} has size 2, {@code slot} must be within {@code [0, 255]}. + *
  • If {@code op} has size 4, {@code slot} must be within {@code [0, 65535]}. + *
+ * + * @apiNote + * The explicit {@code op} argument allows creating {@code wide} or + * regular store instructions when the {@code slot} can be encoded + * with more optimized store instructions. * * @param op the opcode for the specific type of store instruction, * which must be of kind {@link Opcode.Kind#STORE} diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/SwitchCase.java b/src/java.base/share/classes/java/lang/classfile/instruction/SwitchCase.java index 3f5f91031b6..cce8f8ef03a 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/SwitchCase.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/SwitchCase.java @@ -29,12 +29,20 @@ import jdk.internal.classfile.impl.AbstractInstruction; /** - * Models a single case in a {@code lookupswitch} or {@code tableswitch} - * instruction. + * Models a single case in a {@link LookupSwitchInstruction lookupswitch} or + * {@link TableSwitchInstruction tableswitch} instruction. + *

+ * A switch case is composite: + * {@snippet lang=text : + * // @link substring="SwitchCase" target="#of" : + * SwitchCase( + * int caseValue, // @link substring="caseValue" target="#caseValue" + * Label target // @link substring="target" target="#target" + * ) + * } * * @see LookupSwitchInstruction * @see TableSwitchInstruction - * * @since 24 */ public sealed interface SwitchCase @@ -47,11 +55,10 @@ public sealed interface SwitchCase Label target(); /** - * Create a {@linkplain SwitchCase} + * {@return a new switch case} * * @param caseValue the integer value for the case * @param target the branch target for the case - * @return the {@linkplain SwitchCase} */ static SwitchCase of(int caseValue, Label target) { return new AbstractInstruction.SwitchCaseImpl(caseValue, target); diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/TableSwitchInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/TableSwitchInstruction.java index bbe7a4d6c0c..3f7245fad49 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/TableSwitchInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/TableSwitchInstruction.java @@ -24,19 +24,45 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; import java.lang.classfile.Label; +import java.lang.classfile.Opcode; import java.util.List; import jdk.internal.classfile.impl.AbstractInstruction; /** - * Models a {@code tableswitch} instruction in the {@code code} array of a + * Models a {@link Opcode#TABLESWITCH tableswitch} instruction in the {@code code} array of a * {@code Code} attribute. Delivered as a {@link CodeElement} when traversing * the elements of a {@link CodeModel}. + *

+ * A table switch instruction is composite: + * {@snippet lang=text : + * // @link substring="TableSwitchInstruction" target="#of" : + * TableSwitchInstruction( + * int lowValue, // @link substring="int lowValue" target="#lowValue" + * int highValue, // @link substring="int highValue" target="#highValue" + * Label defaultTarget, // @link substring="defaultTarget" target="#defaultTarget" + * List cases // @link substring="cases" target="#cases()" + * ) + * } + *

+ * When read from {@code class} files, the {@code cases} may omit cases that + * duplicate the default target. The list is sorted ascending by the {@link + * SwitchCase#caseValue() caseValue}. + *

+ * When writing to {@code class} file, the order in the {@code cases} list does + * not matter, as there is only one valid order in the physical representation + * of table switch entries. Treatment of elements in {@code cases} whose value + * is less than {@code lowValue} or greater than {@code highValue}, and elements + * whose value duplicates that of another, is not specified. * + * @see Opcode.Kind#TABLE_SWITCH + * @see CodeBuilder#tableswitch CodeBuilder::tableswitch + * @jvms 6.5.tableswitch tableswitch * @since 24 */ public sealed interface TableSwitchInstruction extends Instruction @@ -67,7 +93,8 @@ public sealed interface TableSwitchInstruction extends Instruction * @param lowValue the low value of the switch target range, inclusive * @param highValue the high value of the switch target range, inclusive * @param defaultTarget the default target of the switch - * @param cases the cases of the switch + * @param cases the cases of the switch; duplicate or out of bound case + * handling is not specified */ static TableSwitchInstruction of(int lowValue, int highValue, Label defaultTarget, List cases) { return new AbstractInstruction.UnboundTableSwitchInstruction(lowValue, highValue, defaultTarget, cases); diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/ThrowInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/ThrowInstruction.java index ec6fdc38626..4504b855c4c 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/ThrowInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/ThrowInstruction.java @@ -24,17 +24,23 @@ */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; import java.lang.classfile.CodeElement; import java.lang.classfile.CodeModel; import java.lang.classfile.Instruction; +import java.lang.classfile.Opcode; import jdk.internal.classfile.impl.AbstractInstruction; /** - * Models an {@code athrow} instruction in the {@code code} array of a + * Models an {@link Opcode#ATHROW athrow} instruction in the {@code code} array of a * {@code Code} attribute. Delivered as a {@link CodeElement} when traversing * the elements of a {@link CodeModel}. + *

+ * A throw instruction has no visible state. * + * @see Opcode.Kind#THROW_EXCEPTION + * @see CodeBuilder#athrow CodeBuiler::athrow * @since 24 */ public sealed interface ThrowInstruction extends Instruction diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/TypeCheckInstruction.java b/src/java.base/share/classes/java/lang/classfile/instruction/TypeCheckInstruction.java index 032e7a8462b..3091cf05e71 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/TypeCheckInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/TypeCheckInstruction.java @@ -36,9 +36,24 @@ import jdk.internal.classfile.impl.Util; /** - * Models an {@code instanceof} or {@code checkcast} instruction in the {@code - * code} array of a {@code Code} attribute. Delivered as a {@link CodeElement} - * when traversing the elements of a {@link CodeModel}. + * Models an {@link Opcode#INSTANCEOF instanceof} or a {@link Opcode#CHECKCAST checkcast} + * instruction in the {@code code} array of a {@code Code} attribute. Corresponding + * opcodes have a {@linkplain Opcode#kind() kind} of {@link Opcode.Kind#TYPE_CHECK}. + * Delivered as a {@link CodeElement} when traversing the elements of a {@link CodeModel}. + *

+ * An {@code instanceof} checks the type and pushes an integer to the operand stack. + * A {@code checkcast} checks the type and throws a {@link ClassCastException} if + * the check fails. {@code instanceof} treat the {@code null} reference as a + * failure, while {@code checkcast} treat the {@code null} reference as a success. + *

+ * A type check instruction is composite: + * {@snippet lang=text : + * // @link substring="TypeCheckInstruction" target="#of(Opcode, ClassEntry)" : + * TypeCheckInstruction( + * Opcode opcode, // @link substring="opcode" target="#opcode" + * ClassEntry type // @link substring="type" target="#type" + * ) + * } * * @since 24 */ @@ -47,7 +62,7 @@ public sealed interface TypeCheckInstruction extends Instruction AbstractInstruction.UnboundTypeCheckInstruction { /** - * {@return the type against which the instruction checks or casts} + * {@return the type against which the instruction checks} */ ClassEntry type(); @@ -58,7 +73,7 @@ public sealed interface TypeCheckInstruction extends Instruction * which must be of kind {@link Opcode.Kind#TYPE_CHECK} * @param type the type against which to check or cast * @throws IllegalArgumentException if the opcode kind is not - * {@link Opcode.Kind#TYPE_CHECK}. + * {@link Opcode.Kind#TYPE_CHECK} */ static TypeCheckInstruction of(Opcode op, ClassEntry type) { Util.checkKind(op, Opcode.Kind.TYPE_CHECK); @@ -71,6 +86,8 @@ static TypeCheckInstruction of(Opcode op, ClassEntry type) { * @param op the opcode for the specific type of type check instruction, * which must be of kind {@link Opcode.Kind#TYPE_CHECK} * @param type the type against which to check or cast + * @throws IllegalArgumentException if the opcode kind is not + * {@link Opcode.Kind#TYPE_CHECK}, or if {@code type} is primitive */ static TypeCheckInstruction of(Opcode op, ClassDesc type) { return of(op, TemporaryConstantPool.INSTANCE.classEntry(type)); diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/package-info.java b/src/java.base/share/classes/java/lang/classfile/instruction/package-info.java index d2a36e16615..e732aadf1ec 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/package-info.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/package-info.java @@ -26,9 +26,45 @@ /** *

Provides interfaces describing code instructions for the {@link java.lang.classfile} library.

* - * The {@code java.lang.classfile.attribute} package contains interfaces describing code instructions. + * The {@code java.lang.classfile.instruction} package contains interfaces describing code instructions. + * Implementations of these interfaces are immutable. + *

+ * Unless otherwise specified, passing {@code null} or an array or collection containing a {@code null} element as an + * argument to a constructor or method of any Class-File API class or interface will cause a {@link NullPointerException} + * to be thrown. * + *

Reading of instructions

+ * Instructions and pseudo-instructions are usually accessed from a {@link CodeModel}, such as {@link CodeModel#forEach + * CodeModel::forEach}, and categorized by pattern-matching. + *

+ * When read from {@code class} files, instructions are lazily inflated; the contents of these instructions, besides the + * bare structure, are not evaluated to speed up parsing. Instructions to users interest, such as those filtered by the + * pattern matching, have their contents read on demand, to avoid unnecessary reading of unrelated instructions in a code + * array. + *

+ * Due to the lazy nature of {@code class} file parsing, {@link IllegalArgumentException} indicating malformed + * {@code class} file data can be thrown at any method invocation. For example, an instruction object for a {@link + * TypeCheckInstruction} may be obtained from a {@code CodeModel}, but the subsequent invocation of {@link + * TypeCheckInstruction#type() .type()} may fail with {@code IllegalArgumentException} because the instruction refers + * to a bad constant pool index. + * + *

Writing of instructions

+ * Writing of instructions happen on {@link CodeBuilder}. The most basic way to write instructions is to pass an + * instruction object to {@link CodeBuilder#with CodeBuilder::with}, which supports all valid instructions. + * Yet, {@code CodeBuilder} provides a lot of {@linkplain CodeBuilder##instruction-factories convenience factory methods} + * for easy creation of instructions, named by their mnemonic. These accessors are more concise, and often more + * efficient at run-time than passing instruction objects. + *

+ * Due to restrictions in the {@code class} file format, some instructions may not be representable in a {@code CodeBuilder}. + * In some scenarios, such as for {@link BranchInstruction}, Class-File API options control if alternatives can be used + * in code generation instead. Otherwise, they can be configured to fail-fast to ensure the parity of {@code CodeBuilder} + * commands with the generated {@code code} array data. + * + * @jvms 6.5 Instructions * @since 24 */ package java.lang.classfile.instruction; +import java.lang.classfile.CodeBuilder; +import java.lang.classfile.CodeModel; + From 950c8adfd7a19c1de3d0e36afdc17e5dad15bc30 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Wed, 11 Dec 2024 17:16:13 +0000 Subject: [PATCH 27/27] 8340212: -Xshare:off -XX:CompressedClassSpaceBaseAddress=0x40001000000 crashes on macos-aarch64 Reviewed-by: iklam Backport-of: a6277bb521e07e569cd75a4641b2a05a26f47b0a --- .../cpu/aarch64/compressedKlass_aarch64.cpp | 14 +++++- .../cpu/aarch64/macroAssembler_aarch64.cpp | 43 +++++++++++++------ .../cpu/aarch64/macroAssembler_aarch64.hpp | 13 +++++- src/hotspot/share/cds/metaspaceShared.cpp | 18 ++++++-- src/hotspot/share/oops/compressedKlass.cpp | 21 +++++++++ src/hotspot/share/oops/compressedKlass.hpp | 3 ++ test/hotspot/jtreg/ProblemList.txt | 4 -- ...CompressedClassPointersEncodingScheme.java | 31 +++++++++++++ 8 files changed, 123 insertions(+), 24 deletions(-) diff --git a/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp b/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp index b96241aab19..6ad6e3134bc 100644 --- a/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp @@ -24,12 +24,14 @@ */ #include "precompiled.hpp" -#include "asm/assembler.hpp" +#include "asm/macroAssembler.hpp" #include "logging/log.hpp" #include "oops/compressedKlass.hpp" #include "memory/metaspace.hpp" +#include "runtime/java.hpp" #include "runtime/os.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/formatBuffer.hpp" // Helper function; reserve at an address that is compatible with EOR static char* reserve_at_eor_compatible_address(size_t size, bool aslr) { @@ -79,6 +81,7 @@ static char* reserve_at_eor_compatible_address(size_t size, bool aslr) { } return result; } + char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size_t size, bool aslr, bool optimize_for_zero_base) { char* result = nullptr; @@ -117,3 +120,12 @@ char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size return result; } + +bool CompressedKlassPointers::check_klass_decode_mode(address base, int shift, const size_t range) { + return MacroAssembler::check_klass_decode_mode(base, shift, range); +} + +bool CompressedKlassPointers::set_klass_decode_mode() { + const size_t range = klass_range_end() - base(); + return MacroAssembler::set_klass_decode_mode(_base, _shift, range); +} diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index a836d71205e..d561fb912a3 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -5291,32 +5291,47 @@ void MacroAssembler::decode_heap_oop_not_null(Register dst, Register src) { MacroAssembler::KlassDecodeMode MacroAssembler::_klass_decode_mode(KlassDecodeNone); MacroAssembler::KlassDecodeMode MacroAssembler::klass_decode_mode() { - assert(UseCompressedClassPointers, "not using compressed class pointers"); assert(Metaspace::initialized(), "metaspace not initialized yet"); + assert(_klass_decode_mode != KlassDecodeNone, "should be initialized"); + return _klass_decode_mode; +} - if (_klass_decode_mode != KlassDecodeNone) { - return _klass_decode_mode; - } +MacroAssembler::KlassDecodeMode MacroAssembler::klass_decode_mode(address base, int shift, const size_t range) { + assert(UseCompressedClassPointers, "not using compressed class pointers"); + + // KlassDecodeMode shouldn't be set already. + assert(_klass_decode_mode == KlassDecodeNone, "set once"); - if (CompressedKlassPointers::base() == nullptr) { - return (_klass_decode_mode = KlassDecodeZero); + if (base == nullptr) { + return KlassDecodeZero; } if (operand_valid_for_logical_immediate( - /*is32*/false, (uint64_t)CompressedKlassPointers::base())) { - const size_t range = CompressedKlassPointers::klass_range_end() - CompressedKlassPointers::base(); + /*is32*/false, (uint64_t)base)) { const uint64_t range_mask = right_n_bits(log2i_ceil(range)); - if (((uint64_t)CompressedKlassPointers::base() & range_mask) == 0) { - return (_klass_decode_mode = KlassDecodeXor); + if (((uint64_t)base & range_mask) == 0) { + return KlassDecodeXor; } } const uint64_t shifted_base = - (uint64_t)CompressedKlassPointers::base() >> CompressedKlassPointers::shift(); - guarantee((shifted_base & 0xffff0000ffffffff) == 0, - "compressed class base bad alignment"); + (uint64_t)base >> shift; + if ((shifted_base & 0xffff0000ffffffff) == 0) { + return KlassDecodeMovk; + } + + // No valid encoding. + return KlassDecodeNone; +} + +// Check if one of the above decoding modes will work for given base, shift and range. +bool MacroAssembler::check_klass_decode_mode(address base, int shift, const size_t range) { + return klass_decode_mode(base, shift, range) != KlassDecodeNone; +} - return (_klass_decode_mode = KlassDecodeMovk); +bool MacroAssembler::set_klass_decode_mode(address base, int shift, const size_t range) { + _klass_decode_mode = klass_decode_mode(base, shift, range); + return _klass_decode_mode != KlassDecodeNone; } void MacroAssembler::encode_klass_not_null(Register dst, Register src) { diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp index d9686aec3a9..244de10d0e2 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp @@ -94,11 +94,22 @@ class MacroAssembler: public Assembler { KlassDecodeMovk }; - KlassDecodeMode klass_decode_mode(); + // Calculate decoding mode based on given parameters, used for checking then ultimately setting. + static KlassDecodeMode klass_decode_mode(address base, int shift, const size_t range); private: static KlassDecodeMode _klass_decode_mode; + // Returns above setting with asserts + static KlassDecodeMode klass_decode_mode(); + + public: + // Checks the decode mode and returns false if not compatible with preferred decoding mode. + static bool check_klass_decode_mode(address base, int shift, const size_t range); + + // Sets the decode mode and returns false if cannot be set. + static bool set_klass_decode_mode(address base, int shift, const size_t range); + public: MacroAssembler(CodeBuffer* code) : Assembler(code) {} diff --git a/src/hotspot/share/cds/metaspaceShared.cpp b/src/hotspot/share/cds/metaspaceShared.cpp index f21b9c9060d..6348b04cbe1 100644 --- a/src/hotspot/share/cds/metaspaceShared.cpp +++ b/src/hotspot/share/cds/metaspaceShared.cpp @@ -145,15 +145,16 @@ size_t MetaspaceShared::core_region_alignment() { } static bool shared_base_valid(char* shared_base) { - // We check user input for SharedBaseAddress at dump time. We must weed out values - // we already know to be invalid later. + // We check user input for SharedBaseAddress at dump time. // At CDS runtime, "shared_base" will be the (attempted) mapping start. It will also // be the encoding base, since the the headers of archived base objects (and with Lilliput, // the prototype mark words) carry pre-computed narrow Klass IDs that refer to the mapping // start as base. // - // Therefore, "shared_base" must be later usable as encoding base. + // On AARCH64, The "shared_base" may not be later usable as encoding base, depending on the + // total size of the reserved area and the precomputed_narrow_klass_shift. This is checked + // before reserving memory. Here we weed out values already known to be invalid later. return AARCH64_ONLY(is_aligned(shared_base, 4 * G)) NOT_AARCH64(true); } @@ -1486,6 +1487,15 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma const size_t total_range_size = archive_space_size + gap_size + class_space_size; + // Test that class space base address plus shift can be decoded by aarch64, when restored. + const int precomputed_narrow_klass_shift = ArchiveBuilder::precomputed_narrow_klass_shift(); + if (!CompressedKlassPointers::check_klass_decode_mode(base_address, precomputed_narrow_klass_shift, + total_range_size)) { + log_info(cds)("CDS initialization: Cannot use SharedBaseAddress " PTR_FORMAT " with precomputed shift %d.", + p2i(base_address), precomputed_narrow_klass_shift); + use_archive_base_addr = false; + } + assert(total_range_size > ccs_begin_offset, "must be"); if (use_windows_memory_mapping() && use_archive_base_addr) { if (base_address != nullptr) { @@ -1525,7 +1535,7 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma } // Paranoid checks: - assert(base_address == nullptr || (address)total_space_rs.base() == base_address, + assert(!use_archive_base_addr || (address)total_space_rs.base() == base_address, "Sanity (" PTR_FORMAT " vs " PTR_FORMAT ")", p2i(base_address), p2i(total_space_rs.base())); assert(is_aligned(total_space_rs.base(), base_address_alignment), "Sanity"); assert(total_space_rs.size() == total_range_size, "Sanity"); diff --git a/src/hotspot/share/oops/compressedKlass.cpp b/src/hotspot/share/oops/compressedKlass.cpp index f3c6fe92897..97415cf6e85 100644 --- a/src/hotspot/share/oops/compressedKlass.cpp +++ b/src/hotspot/share/oops/compressedKlass.cpp @@ -30,6 +30,7 @@ #include "runtime/java.hpp" #include "runtime/os.hpp" #include "utilities/debug.hpp" +#include "utilities/formatBuffer.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/ostream.hpp" @@ -176,6 +177,12 @@ void CompressedKlassPointers::initialize_for_given_encoding(address addr, size_t calc_lowest_highest_narrow_klass_id(); + // This has already been checked for SharedBaseAddress and if this fails, it's a bug in the allocation code. + if (!set_klass_decode_mode()) { + fatal("base=" PTR_FORMAT " given with shift %d, cannot be used to encode class pointers", + p2i(_base), _shift); + } + DEBUG_ONLY(sanity_check_after_initialization();) } @@ -267,6 +274,20 @@ void CompressedKlassPointers::initialize(address addr, size_t len) { calc_lowest_highest_narrow_klass_id(); + // Initialize klass decode mode and check compability with decode instructions + if (!set_klass_decode_mode()) { + + // Give fatal error if this is a specified address + if ((address)CompressedClassSpaceBaseAddress == _base) { + vm_exit_during_initialization( + err_msg("CompressedClassSpaceBaseAddress=" PTR_FORMAT " given with shift %d, cannot be used to encode class pointers", + CompressedClassSpaceBaseAddress, _shift)); + } else { + // If this fails, it's a bug in the allocation code. + fatal("CompressedClassSpaceBaseAddress=" PTR_FORMAT " given with shift %d, cannot be used to encode class pointers", + p2i(_base), _shift); + } + } #ifdef ASSERT sanity_check_after_initialization(); #endif diff --git a/src/hotspot/share/oops/compressedKlass.hpp b/src/hotspot/share/oops/compressedKlass.hpp index 9e3a09d73b9..f0615283f33 100644 --- a/src/hotspot/share/oops/compressedKlass.hpp +++ b/src/hotspot/share/oops/compressedKlass.hpp @@ -258,6 +258,9 @@ class CompressedKlassPointers : public AllStatic { is_aligned(addr, klass_alignment_in_bytes()); } + // Check that with the given base, shift and range, aarch64 an encode and decode the klass pointer. + static bool check_klass_decode_mode(address base, int shift, const size_t range) NOT_AARCH64({ return true;}); + static bool set_klass_decode_mode() NOT_AARCH64({ return true;}); // can be called after initialization }; #endif // SHARE_OOPS_COMPRESSEDKLASS_HPP diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 08678af706d..af16f9b228a 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -116,10 +116,6 @@ runtime/ErrorHandling/MachCodeFramesInErrorFile.java 8313315 linux-ppc64le runtime/cds/appcds/customLoader/HelloCustom_JFR.java 8241075 linux-all,windows-x64 runtime/NMT/VirtualAllocCommitMerge.java 8309698 linux-s390x -# Fails with +UseCompactObjectHeaders on aarch64 -runtime/cds/appcds/SharedBaseAddress.java 8340212 linux-aarch64,macosx-aarch64 -runtime/cds/SharedBaseAddress.java 8340212 linux-aarch64,macosx-aarch64 - applications/jcstress/copy.java 8229852 linux-all containers/docker/TestJcmd.java 8278102 linux-all diff --git a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointersEncodingScheme.java b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointersEncodingScheme.java index 665c4cb8b9f..6a7ab088fac 100644 --- a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointersEncodingScheme.java +++ b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointersEncodingScheme.java @@ -71,6 +71,33 @@ private static void test(long forceAddress, boolean COH, long classSpaceSize, lo output.shouldContain("Narrow klass base: " + expectedEncodingBaseString + ", Narrow klass shift: " + expectedEncodingShift); } + private static void testFailure(String forceAddressString) throws IOException { + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( + "-Xshare:off", // to make CompressedClassSpaceBaseAddress work + "-XX:+UnlockDiagnosticVMOptions", + "-XX:CompressedClassSpaceBaseAddress=" + forceAddressString, + "-Xmx128m", + "-Xlog:metaspace*", + "-version"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + + output.reportDiagnosticSummary(); + + // We ignore cases where we were not able to map at the force address + if (!output.contains("Successfully forced class space address to " + forceAddressString)) { + throw new SkippedException("Skipping because we cannot force ccs to " + forceAddressString); + } + + if (Platform.isAArch64()) { + output.shouldHaveExitValue(1); + output.shouldContain("Error occurred during initialization of VM"); + output.shouldContain("CompressedClassSpaceBaseAddress=" + forceAddressString + + " given with shift 0, cannot be used to encode class pointers"); + } else { + output.shouldHaveExitValue(0); + } + } + final static long K = 1024; final static long M = K * 1024; final static long G = M * 1024; @@ -123,5 +150,9 @@ public static void main(String[] args) throws Exception { expectedShift = 10; test(forceAddress, true, ccsSize, forceAddress, expectedShift); } + + // Test failure for -XX:CompressedClassBaseAddress and -Xshare:off + testFailure("0x0000040001000000"); + } }