From 5eef6b4a74a54d24cdd4c2b116885eda9cdf7114 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 4 Mar 2026 10:23:36 +0000 Subject: [PATCH 001/223] 8378775: Bump update version for OpenJDK: jdk-21.0.12 Reviewed-by: mbaesken --- .jcheck/conf | 2 +- make/conf/version-numbers.conf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.jcheck/conf b/.jcheck/conf index 8bd21f7117b3..fd9a62ff0a58 100644 --- a/.jcheck/conf +++ b/.jcheck/conf @@ -1,7 +1,7 @@ [general] project=jdk-updates jbs=JDK -version=21.0.11 +version=21.0.12 [checks] error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists diff --git a/make/conf/version-numbers.conf b/make/conf/version-numbers.conf index f7d91c667137..35cc3011cc7a 100644 --- a/make/conf/version-numbers.conf +++ b/make/conf/version-numbers.conf @@ -28,12 +28,12 @@ DEFAULT_VERSION_FEATURE=21 DEFAULT_VERSION_INTERIM=0 -DEFAULT_VERSION_UPDATE=11 +DEFAULT_VERSION_UPDATE=12 DEFAULT_VERSION_PATCH=0 DEFAULT_VERSION_EXTRA1=0 DEFAULT_VERSION_EXTRA2=0 DEFAULT_VERSION_EXTRA3=0 -DEFAULT_VERSION_DATE=2026-04-21 +DEFAULT_VERSION_DATE=2026-07-21 DEFAULT_VERSION_CLASSFILE_MAJOR=65 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" DEFAULT_VERSION_CLASSFILE_MINOR=0 DEFAULT_VERSION_DOCS_API_SINCE=11 From 33109d61cc5deb7b1c2c1583a679c9d6d5f47163 Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Sat, 7 Mar 2026 19:52:00 +0000 Subject: [PATCH 002/223] 8378353: [PPC64] StringCoding.countPositives causes errors when the length is not a proper 32 bit int Reviewed-by: mbaesken Backport-of: aee4b02ecdca43d66f4e0e4acc961e6efff56a6f --- src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp index d504c71e2b8b..608f8f919463 100644 --- a/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp @@ -594,9 +594,11 @@ void C2_MacroAssembler::count_positives(Register src, Register cnt, Register res bind(Lslow); // Fallback to slow version. subf(tmp0, src, result); // Bytes known positive. - subf_(tmp0, tmp0, cnt); // Remaining Bytes. + clrldi(tmp1, cnt, 32); // Clear garbage from upper 32 bits. + subf_(tmp0, tmp0, tmp1); // Remaining Bytes. beq(CCR0, Ldone); mtctr(tmp0); + bind(Lloop); lbz(tmp0, 0, result); andi_(tmp0, tmp0, 0x80); From f95246eb2c3c76fa8aafacd5f699fed92ef2b4ce Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Mon, 9 Mar 2026 08:29:50 +0000 Subject: [PATCH 003/223] 8374711: Hotspot runtime/CommandLine/OptionsValidation/TestOptionsWithRanges fails without printing the option name Backport-of: 78b1ca6cc14e1a92bf25cbcfb687067ac17af92b --- .../OptionsValidation/common/optionsvalidation/JVMOption.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java b/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java index 78a508343d67..d87ca25fc3cc 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java +++ b/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java @@ -116,7 +116,7 @@ static JVMOption createVMOption(String type, String name) { default: throw new Error("Expected only \"int\", \"intx\", \"size_t\", " + "\"uint\", \"uintx\", \"uint64_t\", or \"double\" " - + "option types! Got " + type + " type!"); + + "option types! Got " + type + " type for option " + name + "!"); } return parameter; From 7f146873f87eda7cdf30051d18536a6f0e8fd7fe Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Mon, 9 Mar 2026 12:02:26 +0000 Subject: [PATCH 004/223] 8373704: Improve "SocketException: Protocol family unavailable" message Backport-of: 163038222a371c07aff8bce50eee55bb389104d0 --- src/java.base/unix/native/libnet/net_util_md.c | 2 +- src/java.base/windows/native/libnet/net_util_md.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java.base/unix/native/libnet/net_util_md.c b/src/java.base/unix/native/libnet/net_util_md.c index 7be6d9a69fee..fdc984e6f57f 100644 --- a/src/java.base/unix/native/libnet/net_util_md.c +++ b/src/java.base/unix/native/libnet/net_util_md.c @@ -270,7 +270,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, } else { jint address; if (family != java_net_InetAddress_IPv4) { - JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Protocol family unavailable"); + JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "IPv6 protocol family unavailable"); return -1; } address = getInetAddress_addr(env, iaObj); diff --git a/src/java.base/windows/native/libnet/net_util_md.c b/src/java.base/windows/native/libnet/net_util_md.c index 3d7f226f171d..84fb971c0b20 100644 --- a/src/java.base/windows/native/libnet/net_util_md.c +++ b/src/java.base/windows/native/libnet/net_util_md.c @@ -601,7 +601,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, } else { jint address; if (family != java_net_InetAddress_IPv4) { - JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Protocol family unavailable"); + JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "IPv6 protocol family unavailable"); return -1; } address = getInetAddress_addr(env, iaObj); From 149e02b6ffd6976cf960f45b597082cac904efcc Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 10 Mar 2026 14:43:59 +0000 Subject: [PATCH 005/223] 8369851: Remove darcy author tags from langtools tests Backport-of: 70528bd39925fabf23aad25f0a58a61f746ca9d8 --- test/langtools/tools/javac/HexThree.java | 3 +-- .../tools/javac/StringsInSwitch/OneCaseSwitches.java | 1 - .../tools/javac/StringsInSwitch/StringSwitches.java | 3 +-- test/langtools/tools/javac/TryWithResources/BadTwr.java | 1 - test/langtools/tools/javac/TryWithResources/BadTwr.out | 8 ++++---- .../tools/javac/TryWithResources/BadTwrSyntax.java | 1 - .../tools/javac/TryWithResources/BadTwrSyntax.out | 2 +- .../tools/javac/TryWithResources/ExplicitFinal.java | 3 +-- test/langtools/tools/javac/TryWithResources/PlainTry.java | 3 +-- test/langtools/tools/javac/TryWithResources/PlainTry.out | 2 +- test/langtools/tools/javac/TryWithResources/TwrFlow.java | 1 - test/langtools/tools/javac/TryWithResources/TwrFlow.out | 4 ++-- test/langtools/tools/javac/TryWithResources/TwrLint.java | 1 - test/langtools/tools/javac/TryWithResources/TwrLint.out | 4 ++-- .../tools/javac/TryWithResources/TwrMultiCatch.java | 3 +-- .../tools/javac/TryWithResources/TwrOnNonResource.java | 1 - .../tools/javac/TryWithResources/TwrOnNonResource.out | 6 +++--- .../tools/javac/TryWithResources/TwrSuppression.java | 3 +-- test/langtools/tools/javac/TryWithResources/WeirdTwr.java | 1 - .../tools/javac/annotations/pos/TrailingComma.java | 3 +-- test/langtools/tools/javac/boxing/BoxingCaching.java | 3 +-- test/langtools/tools/javac/enum/6350057/T6350057.java | 3 +-- test/langtools/tools/javac/enum/AbstractEmptyEnum.java | 1 - test/langtools/tools/javac/enum/AbstractEmptyEnum.out | 2 +- .../tools/javac/enum/EnumImplicitPrivateConstructor.java | 3 +-- .../tools/javac/enum/EnumPrivateConstructor.java | 3 +-- .../tools/javac/enum/EnumProtectedConstructor.java | 1 - .../tools/javac/enum/EnumProtectedConstructor.out | 2 +- .../langtools/tools/javac/enum/EnumPublicConstructor.java | 1 - test/langtools/tools/javac/enum/EnumPublicConstructor.out | 2 +- .../tools/javac/enum/ExplicitlyAbstractEnum1.java | 1 - .../tools/javac/enum/ExplicitlyAbstractEnum1.out | 2 +- .../tools/javac/enum/ExplicitlyAbstractEnum2.java | 1 - .../tools/javac/enum/ExplicitlyAbstractEnum2.out | 2 +- test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.java | 1 - test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.out | 2 +- test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.java | 1 - test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.out | 2 +- test/langtools/tools/javac/enum/FauxEnum1.java | 1 - test/langtools/tools/javac/enum/FauxEnum1.out | 2 +- test/langtools/tools/javac/enum/FauxEnum3.java | 1 - test/langtools/tools/javac/enum/FauxEnum3.out | 2 +- test/langtools/tools/javac/enum/FauxSpecialEnum1.java | 1 - test/langtools/tools/javac/enum/FauxSpecialEnum1.out | 2 +- test/langtools/tools/javac/enum/FauxSpecialEnum2.java | 1 - test/langtools/tools/javac/enum/FauxSpecialEnum2.out | 2 +- .../tools/javac/generics/InheritanceConflict3.java | 1 - .../tools/javac/generics/InheritanceConflict3.out | 4 ++-- test/langtools/tools/javac/multicatch/Neg01.java | 1 - test/langtools/tools/javac/multicatch/Neg01.out | 2 +- test/langtools/tools/javac/multicatch/Neg01eff_final.java | 1 - test/langtools/tools/javac/multicatch/Neg01eff_final.out | 2 +- test/langtools/tools/javac/multicatch/Neg07.java | 1 - test/langtools/tools/javac/multicatch/Neg07.out | 2 +- test/langtools/tools/javac/multicatch/Pos10.java | 1 - .../tools/javac/processing/6365040/T6365040.java | 4 +--- .../tools/javac/processing/6378728/T6378728.java | 3 +-- .../tools/javac/processing/6634138/T6634138.java | 3 +-- .../javac/processing/completion/TestCompletions.java | 3 +-- .../javac/processing/environment/TestSourceVersion.java | 3 +-- .../environment/round/TestElementsAnnotatedWith.java | 3 +-- .../processing/errors/TestFatalityOfParseErrors.java | 1 - .../javac/processing/errors/TestOptionSyntaxErrors.java | 3 +-- .../tools/javac/processing/errors/TestReturnCode.java | 1 - .../javac/processing/filer/TestFilerConstraints.java | 3 +-- .../tools/javac/processing/filer/TestGetResource.java | 3 +-- .../tools/javac/processing/filer/TestPackageInfo.java | 1 - .../tools/javac/processing/messager/MessagerBasics.java | 1 - .../tools/javac/processing/model/TestExceptions.java | 3 +-- .../tools/javac/processing/model/TestSourceVersion.java | 3 +-- .../processing/model/element/TestAnonClassNames.java | 3 +-- .../tools/javac/processing/model/element/TestElement.java | 3 +-- .../processing/model/element/TestExecutableElement.java | 3 +-- .../tools/javac/processing/model/element/TestNames.java | 3 +-- .../processing/model/element/TestPackageElement.java | 3 +-- .../processing/model/element/TestResourceVariable.java | 3 +-- .../processing/model/type/MirroredTypeEx/NpeTest.java | 3 +-- .../processing/model/type/MirroredTypeEx/Plurality.java | 3 +-- .../tools/javac/processing/model/type/TestTypeKind.java | 3 +-- .../model/util/deprecation/TestDeprecation.java | 3 +-- .../model/util/elements/TestGetConstantExpression.java | 3 +-- .../processing/model/util/elements/TestGetPackageOf.java | 3 +-- .../model/util/elements/TestIsFunctionalInterface.java | 3 +-- .../javac/processing/model/util/elements/VacuousEnum.java | 3 +-- .../javac/processing/model/util/filter/TestIterables.java | 3 +-- .../model/util/types/TestPseudoTypeHandling.java | 3 +-- .../processing/warnings/TestSourceVersionWarnings.java | 4 ++-- 87 files changed, 69 insertions(+), 135 deletions(-) diff --git a/test/langtools/tools/javac/HexThree.java b/test/langtools/tools/javac/HexThree.java index a89db6e99f86..81c69a4f5329 100644 --- a/test/langtools/tools/javac/HexThree.java +++ b/test/langtools/tools/javac/HexThree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 4920023 * @summary Test hex floating-point literals - * @author darcy */ public class HexThree { diff --git a/test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.java b/test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.java index 160c3a3093d0..58dfc69ee2cf 100644 --- a/test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.java +++ b/test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.java @@ -4,7 +4,6 @@ * @summary Positive tests for strings in switch with few alternatives. * @compile OneCaseSwitches.java * @run main OneCaseSwitches - * @author Joseph D. Darcy */ import java.lang.reflect.*; diff --git a/test/langtools/tools/javac/StringsInSwitch/StringSwitches.java b/test/langtools/tools/javac/StringsInSwitch/StringSwitches.java index 2e6737e0c050..cd775a1bcb3b 100644 --- a/test/langtools/tools/javac/StringsInSwitch/StringSwitches.java +++ b/test/langtools/tools/javac/StringsInSwitch/StringSwitches.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6827009 7071246 * @summary Positive tests for strings in switch. - * @author Joseph D. Darcy */ public class StringSwitches { diff --git a/test/langtools/tools/javac/TryWithResources/BadTwr.java b/test/langtools/tools/javac/TryWithResources/BadTwr.java index 6043c527af17..a38300b70369 100644 --- a/test/langtools/tools/javac/TryWithResources/BadTwr.java +++ b/test/langtools/tools/javac/TryWithResources/BadTwr.java @@ -1,7 +1,6 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 - * @author Joseph D. Darcy * @summary Verify bad TWRs don't compile * @compile/fail/ref=BadTwr.out -XDrawDiagnostics BadTwr.java */ diff --git a/test/langtools/tools/javac/TryWithResources/BadTwr.out b/test/langtools/tools/javac/TryWithResources/BadTwr.out index ed8c2524c1b6..b4e951305a51 100644 --- a/test/langtools/tools/javac/TryWithResources/BadTwr.out +++ b/test/langtools/tools/javac/TryWithResources/BadTwr.out @@ -1,5 +1,5 @@ -BadTwr.java:12:46: compiler.err.already.defined: kindname.variable, r1, kindname.method, meth(java.lang.String...) -BadTwr.java:17:20: compiler.err.already.defined: kindname.variable, args, kindname.method, meth(java.lang.String...) -BadTwr.java:20:13: compiler.err.cant.assign.val.to.var: final, thatsIt -BadTwr.java:25:24: compiler.err.already.defined: kindname.variable, name, kindname.method, meth(java.lang.String...) +BadTwr.java:11:46: compiler.err.already.defined: kindname.variable, r1, kindname.method, meth(java.lang.String...) +BadTwr.java:16:20: compiler.err.already.defined: kindname.variable, args, kindname.method, meth(java.lang.String...) +BadTwr.java:19:13: compiler.err.cant.assign.val.to.var: final, thatsIt +BadTwr.java:24:24: compiler.err.already.defined: kindname.variable, name, kindname.method, meth(java.lang.String...) 4 errors diff --git a/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.java b/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.java index 988249cef200..fc31895315c9 100644 --- a/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.java +++ b/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.java @@ -1,7 +1,6 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 - * @author Joseph D. Darcy * @summary Verify bad TWRs don't compile * @compile/fail/ref=BadTwrSyntax.out -XDrawDiagnostics BadTwrSyntax.java */ diff --git a/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.out b/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.out index 0d7263710c58..44b283dc611f 100644 --- a/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.out +++ b/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.out @@ -1,2 +1,2 @@ -BadTwrSyntax.java:13:43: compiler.err.illegal.start.of.expr +BadTwrSyntax.java:12:43: compiler.err.illegal.start.of.expr 1 error diff --git a/test/langtools/tools/javac/TryWithResources/ExplicitFinal.java b/test/langtools/tools/javac/TryWithResources/ExplicitFinal.java index e77de854f472..472b9089c1e6 100644 --- a/test/langtools/tools/javac/TryWithResources/ExplicitFinal.java +++ b/test/langtools/tools/javac/TryWithResources/ExplicitFinal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, 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 @@ -24,7 +24,6 @@ /* * @test * @bug 7013420 - * @author Joseph D. Darcy * @summary Test that resource variables are accepted as explicitly final. */ diff --git a/test/langtools/tools/javac/TryWithResources/PlainTry.java b/test/langtools/tools/javac/TryWithResources/PlainTry.java index edbb233578b2..52c05a1ff7cc 100644 --- a/test/langtools/tools/javac/TryWithResources/PlainTry.java +++ b/test/langtools/tools/javac/TryWithResources/PlainTry.java @@ -1,9 +1,8 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 - * @author Joseph D. Darcy * @summary Test error messages for an unadorned try - * @compile/fail/ref=PlainTry.out -XDrawDiagnostics PlainTry.java + * @compile/fail/ref=PlainTry.out -XDrawDiagnostics PlainTry.java */ public class PlainTry { public static void meth() { diff --git a/test/langtools/tools/javac/TryWithResources/PlainTry.out b/test/langtools/tools/javac/TryWithResources/PlainTry.out index 9357cd8cdd79..0f8f16ae1e87 100644 --- a/test/langtools/tools/javac/TryWithResources/PlainTry.out +++ b/test/langtools/tools/javac/TryWithResources/PlainTry.out @@ -1,2 +1,2 @@ -PlainTry.java:10:9: compiler.err.try.without.catch.finally.or.resource.decls +PlainTry.java:9:9: compiler.err.try.without.catch.finally.or.resource.decls 1 error diff --git a/test/langtools/tools/javac/TryWithResources/TwrFlow.java b/test/langtools/tools/javac/TryWithResources/TwrFlow.java index 8ea54244570f..366648fb42e3 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrFlow.java +++ b/test/langtools/tools/javac/TryWithResources/TwrFlow.java @@ -1,7 +1,6 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 7013420 - * @author Joseph D. Darcy * @summary Test exception analysis of try-with-resources blocks * @compile/fail/ref=TwrFlow.out -XDrawDiagnostics TwrFlow.java */ diff --git a/test/langtools/tools/javac/TryWithResources/TwrFlow.out b/test/langtools/tools/javac/TryWithResources/TwrFlow.out index 23db6517c434..758fb778aae4 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrFlow.out +++ b/test/langtools/tools/javac/TryWithResources/TwrFlow.out @@ -1,3 +1,3 @@ -TwrFlow.java:14:11: compiler.err.except.never.thrown.in.try: java.io.IOException -TwrFlow.java:12:21: compiler.err.unreported.exception.implicit.close: CustomCloseException, twrFlow +TwrFlow.java:13:11: compiler.err.except.never.thrown.in.try: java.io.IOException +TwrFlow.java:11:21: compiler.err.unreported.exception.implicit.close: CustomCloseException, twrFlow 2 errors diff --git a/test/langtools/tools/javac/TryWithResources/TwrLint.java b/test/langtools/tools/javac/TryWithResources/TwrLint.java index 39c5ed67f8f8..ca45efc1e0a6 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrLint.java +++ b/test/langtools/tools/javac/TryWithResources/TwrLint.java @@ -1,7 +1,6 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 6965277 6967065 - * @author Joseph D. Darcy * @summary Check that -Xlint:twr warnings are generated as expected * @compile/ref=TwrLint.out -Xlint:try,deprecation -XDrawDiagnostics TwrLint.java */ diff --git a/test/langtools/tools/javac/TryWithResources/TwrLint.out b/test/langtools/tools/javac/TryWithResources/TwrLint.out index 6adfc5122b3b..28778b0e3a56 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrLint.out +++ b/test/langtools/tools/javac/TryWithResources/TwrLint.out @@ -1,3 +1,3 @@ -TwrLint.java:14:15: compiler.warn.try.explicit.close.call -TwrLint.java:13:21: compiler.warn.try.resource.not.referenced: r3 +TwrLint.java:13:15: compiler.warn.try.explicit.close.call +TwrLint.java:12:21: compiler.warn.try.resource.not.referenced: r3 2 warnings diff --git a/test/langtools/tools/javac/TryWithResources/TwrMultiCatch.java b/test/langtools/tools/javac/TryWithResources/TwrMultiCatch.java index dbbb633efe17..002e30277e39 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrMultiCatch.java +++ b/test/langtools/tools/javac/TryWithResources/TwrMultiCatch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, 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 @@ -24,7 +24,6 @@ /* * @test * @bug 6911256 6964740 7013420 - * @author Joseph D. Darcy * @summary Test that TWR and multi-catch play well together * @compile TwrMultiCatch.java * @run main TwrMultiCatch diff --git a/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.java b/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.java index ac0a72645ba3..0d6c2f4bc445 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.java +++ b/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.java @@ -1,7 +1,6 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 7013420 - * @author Joseph D. Darcy * @summary Verify invalid TWR block is not accepted. * @compile/fail/ref=TwrOnNonResource.out -XDrawDiagnostics TwrOnNonResource.java */ diff --git a/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.out b/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.out index 07488a78071f..9a01e28e1051 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.out +++ b/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.out @@ -1,4 +1,4 @@ -TwrOnNonResource.java:11:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) -TwrOnNonResource.java:14:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) -TwrOnNonResource.java:17:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) +TwrOnNonResource.java:10:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) +TwrOnNonResource.java:13:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) +TwrOnNonResource.java:16:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) 3 errors diff --git a/test/langtools/tools/javac/TryWithResources/TwrSuppression.java b/test/langtools/tools/javac/TryWithResources/TwrSuppression.java index 9834d5a17b2e..0c511d28cbcb 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrSuppression.java +++ b/test/langtools/tools/javac/TryWithResources/TwrSuppression.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, 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 @@ -24,7 +24,6 @@ /* * @test * @bug 6971877 - * @author Joseph D. Darcy * @summary Verify a primary exception suppresses all throwables */ diff --git a/test/langtools/tools/javac/TryWithResources/WeirdTwr.java b/test/langtools/tools/javac/TryWithResources/WeirdTwr.java index 6331507097c4..fbfbbe6ecd8b 100644 --- a/test/langtools/tools/javac/TryWithResources/WeirdTwr.java +++ b/test/langtools/tools/javac/TryWithResources/WeirdTwr.java @@ -1,7 +1,6 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 - * @author Joseph D. Darcy * @summary Strange TWRs * @compile WeirdTwr.java * @run main WeirdTwr diff --git a/test/langtools/tools/javac/annotations/pos/TrailingComma.java b/test/langtools/tools/javac/annotations/pos/TrailingComma.java index d6601ce419db..0fa4bdb3546d 100644 --- a/test/langtools/tools/javac/annotations/pos/TrailingComma.java +++ b/test/langtools/tools/javac/annotations/pos/TrailingComma.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6337964 * @summary javac incorrectly disallows trailing comma in annotation arrays - * @author darcy * @compile TrailingComma.java */ diff --git a/test/langtools/tools/javac/boxing/BoxingCaching.java b/test/langtools/tools/javac/boxing/BoxingCaching.java index 2d7acb817f02..f4c1337f240f 100644 --- a/test/langtools/tools/javac/boxing/BoxingCaching.java +++ b/test/langtools/tools/javac/boxing/BoxingCaching.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 4990346 8200478 * @summary Verify autoboxed values are cached as required. - * @author Joseph D. Darcy */ public class BoxingCaching { diff --git a/test/langtools/tools/javac/enum/6350057/T6350057.java b/test/langtools/tools/javac/enum/6350057/T6350057.java index ff96b710af6c..8eb0aa997b6c 100644 --- a/test/langtools/tools/javac/enum/6350057/T6350057.java +++ b/test/langtools/tools/javac/enum/6350057/T6350057.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6350057 7025809 * @summary Test that parameters on implicit enum methods have the right kind - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/enum/AbstractEmptyEnum.java b/test/langtools/tools/javac/enum/AbstractEmptyEnum.java index 38c13bde8287..7f5792167e8d 100644 --- a/test/langtools/tools/javac/enum/AbstractEmptyEnum.java +++ b/test/langtools/tools/javac/enum/AbstractEmptyEnum.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary empty enum cannot be abstract - * @author Joseph D. Darcy * * @compile/fail/ref=AbstractEmptyEnum.out -XDrawDiagnostics AbstractEmptyEnum.java */ diff --git a/test/langtools/tools/javac/enum/AbstractEmptyEnum.out b/test/langtools/tools/javac/enum/AbstractEmptyEnum.out index 933363a3fe6e..b6b2460bb68a 100644 --- a/test/langtools/tools/javac/enum/AbstractEmptyEnum.out +++ b/test/langtools/tools/javac/enum/AbstractEmptyEnum.out @@ -1,2 +1,2 @@ -AbstractEmptyEnum.java:10:8: compiler.err.does.not.override.abstract: AbstractEmptyEnum, m(), AbstractEmptyEnum +AbstractEmptyEnum.java:9:8: compiler.err.does.not.override.abstract: AbstractEmptyEnum, m(), AbstractEmptyEnum 1 error diff --git a/test/langtools/tools/javac/enum/EnumImplicitPrivateConstructor.java b/test/langtools/tools/javac/enum/EnumImplicitPrivateConstructor.java index 36c090668c4f..8ed9e1489782 100644 --- a/test/langtools/tools/javac/enum/EnumImplicitPrivateConstructor.java +++ b/test/langtools/tools/javac/enum/EnumImplicitPrivateConstructor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 5009601 5010455 5005748 * @summary enum constructors can be declared private - * @author Joseph D. Darcy */ import java.util.*; diff --git a/test/langtools/tools/javac/enum/EnumPrivateConstructor.java b/test/langtools/tools/javac/enum/EnumPrivateConstructor.java index 84a28a819769..412f79945c8b 100644 --- a/test/langtools/tools/javac/enum/EnumPrivateConstructor.java +++ b/test/langtools/tools/javac/enum/EnumPrivateConstructor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 5009601 * @summary enum constructors can be declared private - * @author Joseph D. Darcy * * @compile EnumPrivateConstructor.java */ diff --git a/test/langtools/tools/javac/enum/EnumProtectedConstructor.java b/test/langtools/tools/javac/enum/EnumProtectedConstructor.java index 481de39319c6..298dcc738c9d 100644 --- a/test/langtools/tools/javac/enum/EnumProtectedConstructor.java +++ b/test/langtools/tools/javac/enum/EnumProtectedConstructor.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum constructors cannot be declared public or protected - * @author Joseph D. Darcy * * @compile/fail/ref=EnumProtectedConstructor.out -XDrawDiagnostics EnumProtectedConstructor.java */ diff --git a/test/langtools/tools/javac/enum/EnumProtectedConstructor.out b/test/langtools/tools/javac/enum/EnumProtectedConstructor.out index 71826a2d331d..5cc734020acd 100644 --- a/test/langtools/tools/javac/enum/EnumProtectedConstructor.out +++ b/test/langtools/tools/javac/enum/EnumProtectedConstructor.out @@ -1,2 +1,2 @@ -EnumProtectedConstructor.java:16:15: compiler.err.mod.not.allowed.here: protected +EnumProtectedConstructor.java:15:15: compiler.err.mod.not.allowed.here: protected 1 error diff --git a/test/langtools/tools/javac/enum/EnumPublicConstructor.java b/test/langtools/tools/javac/enum/EnumPublicConstructor.java index 313605970358..b5c622208efa 100644 --- a/test/langtools/tools/javac/enum/EnumPublicConstructor.java +++ b/test/langtools/tools/javac/enum/EnumPublicConstructor.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum constructors cannot be declared public or protected - * @author Joseph D. Darcy * * @compile/fail/ref=EnumPublicConstructor.out -XDrawDiagnostics EnumPublicConstructor.java */ diff --git a/test/langtools/tools/javac/enum/EnumPublicConstructor.out b/test/langtools/tools/javac/enum/EnumPublicConstructor.out index 56c099f4330c..89ba98d1d81e 100644 --- a/test/langtools/tools/javac/enum/EnumPublicConstructor.out +++ b/test/langtools/tools/javac/enum/EnumPublicConstructor.out @@ -1,2 +1,2 @@ -EnumPublicConstructor.java:16:12: compiler.err.mod.not.allowed.here: public +EnumPublicConstructor.java:15:12: compiler.err.mod.not.allowed.here: public 1 error diff --git a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.java b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.java index 5af537686846..d04a25587150 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.java +++ b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum's cannot be explicitly declared abstract - * @author Joseph D. Darcy * @compile/fail/ref=ExplicitlyAbstractEnum1.out -XDrawDiagnostics ExplicitlyAbstractEnum1.java */ diff --git a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.out b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.out index 827e331a4913..902c9e5730fb 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.out +++ b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.out @@ -1,2 +1,2 @@ -ExplicitlyAbstractEnum1.java:9:10: compiler.err.mod.not.allowed.here: abstract +ExplicitlyAbstractEnum1.java:8:10: compiler.err.mod.not.allowed.here: abstract 1 error diff --git a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.java b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.java index cbd9bd512d68..293c36a867d1 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.java +++ b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum's cannot be explicitly declared abstract even if they are abstract - * @author Joseph D. Darcy * @compile/fail/ref=ExplicitlyAbstractEnum2.out -XDrawDiagnostics ExplicitlyAbstractEnum2.java */ diff --git a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.out b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.out index 8a35cec31802..f2c25ca5d4e7 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.out +++ b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.out @@ -1,2 +1,2 @@ -ExplicitlyAbstractEnum2.java:9:10: compiler.err.mod.not.allowed.here: abstract +ExplicitlyAbstractEnum2.java:8:10: compiler.err.mod.not.allowed.here: abstract 1 error diff --git a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.java b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.java index 1dba3d0dff5e..1e2bf650ca5d 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.java +++ b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum's cannot be explicitly declared final even if they are - * @author Joseph D. Darcy * @compile/fail/ref=ExplicitlyFinalEnum1.out -XDrawDiagnostics ExplicitlyFinalEnum1.java */ diff --git a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.out b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.out index 023d00e265fb..11bbdb690b6a 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.out +++ b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.out @@ -1,2 +1,2 @@ -ExplicitlyFinalEnum1.java:9:7: compiler.err.mod.not.allowed.here: final +ExplicitlyFinalEnum1.java:8:7: compiler.err.mod.not.allowed.here: final 1 error diff --git a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.java b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.java index 73d3b8acb7b4..0c02799c3d3e 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.java +++ b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum's cannot be explicitly declared final - * @author Joseph D. Darcy * @compile/fail/ref=ExplicitlyFinalEnum2.out -XDrawDiagnostics ExplicitlyFinalEnum2.java */ diff --git a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.out b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.out index 09cbf1461add..8d67c8888644 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.out +++ b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.out @@ -1,2 +1,2 @@ -ExplicitlyFinalEnum2.java:9:7: compiler.err.mod.not.allowed.here: final +ExplicitlyFinalEnum2.java:8:7: compiler.err.mod.not.allowed.here: final 1 error diff --git a/test/langtools/tools/javac/enum/FauxEnum1.java b/test/langtools/tools/javac/enum/FauxEnum1.java index 5ae6a8b090ca..7565633032fc 100644 --- a/test/langtools/tools/javac/enum/FauxEnum1.java +++ b/test/langtools/tools/javac/enum/FauxEnum1.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009574 * @summary verify java.lang.Enum can't be directly subclassed - * @author Joseph D. Darcy * * @compile/fail/ref=FauxEnum1.out -XDrawDiagnostics FauxEnum1.java */ diff --git a/test/langtools/tools/javac/enum/FauxEnum1.out b/test/langtools/tools/javac/enum/FauxEnum1.out index ff1e8fa73155..7cae5443e258 100644 --- a/test/langtools/tools/javac/enum/FauxEnum1.out +++ b/test/langtools/tools/javac/enum/FauxEnum1.out @@ -1,4 +1,4 @@ -FauxEnum1.java:10:8: compiler.err.enum.no.subclassing +FauxEnum1.java:9:8: compiler.err.enum.no.subclassing - compiler.note.unchecked.filename: FauxEnum1.java - compiler.note.unchecked.recompile 1 error diff --git a/test/langtools/tools/javac/enum/FauxEnum3.java b/test/langtools/tools/javac/enum/FauxEnum3.java index ec53aeb59519..6cf41cfa8890 100644 --- a/test/langtools/tools/javac/enum/FauxEnum3.java +++ b/test/langtools/tools/javac/enum/FauxEnum3.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009574 * @summary verify an enum type can't be directly subclassed - * @author Joseph D. Darcy * * @compile/fail/ref=FauxEnum3.out -XDrawDiagnostics FauxEnum3.java */ diff --git a/test/langtools/tools/javac/enum/FauxEnum3.out b/test/langtools/tools/javac/enum/FauxEnum3.out index 885154d073a8..33596c87b51f 100644 --- a/test/langtools/tools/javac/enum/FauxEnum3.out +++ b/test/langtools/tools/javac/enum/FauxEnum3.out @@ -1,2 +1,2 @@ -FauxEnum3.java:10:14: compiler.err.enum.types.not.extensible +FauxEnum3.java:9:14: compiler.err.enum.types.not.extensible 1 error diff --git a/test/langtools/tools/javac/enum/FauxSpecialEnum1.java b/test/langtools/tools/javac/enum/FauxSpecialEnum1.java index 5b427bb110de..578864061d03 100644 --- a/test/langtools/tools/javac/enum/FauxSpecialEnum1.java +++ b/test/langtools/tools/javac/enum/FauxSpecialEnum1.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary verify specialized enum classes can't be abstract - * @author Joseph D. Darcy * * @compile/fail/ref=FauxSpecialEnum1.out -XDrawDiagnostics FauxSpecialEnum1.java */ diff --git a/test/langtools/tools/javac/enum/FauxSpecialEnum1.out b/test/langtools/tools/javac/enum/FauxSpecialEnum1.out index 4530bf40a884..ed9a5feaf1f5 100644 --- a/test/langtools/tools/javac/enum/FauxSpecialEnum1.out +++ b/test/langtools/tools/javac/enum/FauxSpecialEnum1.out @@ -1,2 +1,2 @@ -FauxSpecialEnum1.java:14:5: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: FauxSpecialEnum1$2, test(), compiler.misc.anonymous.class: FauxSpecialEnum1$2 +FauxSpecialEnum1.java:13:5: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: FauxSpecialEnum1$2, test(), compiler.misc.anonymous.class: FauxSpecialEnum1$2 1 error diff --git a/test/langtools/tools/javac/enum/FauxSpecialEnum2.java b/test/langtools/tools/javac/enum/FauxSpecialEnum2.java index 5c0cc610fa2f..6bf9a97f29ca 100644 --- a/test/langtools/tools/javac/enum/FauxSpecialEnum2.java +++ b/test/langtools/tools/javac/enum/FauxSpecialEnum2.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary verify specialized enum classes can't be abstract - * @author Joseph D. Darcy * * @compile/fail/ref=FauxSpecialEnum2.out -XDrawDiagnostics FauxSpecialEnum2.java */ diff --git a/test/langtools/tools/javac/enum/FauxSpecialEnum2.out b/test/langtools/tools/javac/enum/FauxSpecialEnum2.out index 81de8f41726b..aa1cbc8e9cc5 100644 --- a/test/langtools/tools/javac/enum/FauxSpecialEnum2.out +++ b/test/langtools/tools/javac/enum/FauxSpecialEnum2.out @@ -1,2 +1,2 @@ -FauxSpecialEnum2.java:12:5: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: FauxSpecialEnum2$1, test(), compiler.misc.anonymous.class: FauxSpecialEnum2$1 +FauxSpecialEnum2.java:11:5: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: FauxSpecialEnum2$1, test(), compiler.misc.anonymous.class: FauxSpecialEnum2$1 1 error diff --git a/test/langtools/tools/javac/generics/InheritanceConflict3.java b/test/langtools/tools/javac/generics/InheritanceConflict3.java index ae725d6c1e28..d9f3c76b06e9 100644 --- a/test/langtools/tools/javac/generics/InheritanceConflict3.java +++ b/test/langtools/tools/javac/generics/InheritanceConflict3.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 4984158 * @summary two inherited methods with same signature - * @author darcy * * @compile/fail/ref=InheritanceConflict3.out -XDrawDiagnostics InheritanceConflict3.java */ diff --git a/test/langtools/tools/javac/generics/InheritanceConflict3.out b/test/langtools/tools/javac/generics/InheritanceConflict3.out index 60cfe5d21488..c168d4b2b86d 100644 --- a/test/langtools/tools/javac/generics/InheritanceConflict3.out +++ b/test/langtools/tools/javac/generics/InheritanceConflict3.out @@ -1,3 +1,3 @@ -InheritanceConflict3.java:14:10: compiler.err.name.clash.same.erasure: f(java.lang.Object), f(T) -InheritanceConflict3.java:17:1: compiler.err.concrete.inheritance.conflict: f(java.lang.Object), inheritance.conflict3.X1, f(T), inheritance.conflict3.X1, inheritance.conflict3.X1 +InheritanceConflict3.java:13:10: compiler.err.name.clash.same.erasure: f(java.lang.Object), f(T) +InheritanceConflict3.java:16:1: compiler.err.concrete.inheritance.conflict: f(java.lang.Object), inheritance.conflict3.X1, f(T), inheritance.conflict3.X1, inheritance.conflict3.X1 2 errors diff --git a/test/langtools/tools/javac/multicatch/Neg01.java b/test/langtools/tools/javac/multicatch/Neg01.java index 378e4f285cbd..86a2ae952a19 100644 --- a/test/langtools/tools/javac/multicatch/Neg01.java +++ b/test/langtools/tools/javac/multicatch/Neg01.java @@ -3,7 +3,6 @@ * @bug 6943289 * * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch') - * @author darcy * @compile/fail/ref=Neg01.out -XDrawDiagnostics Neg01.java */ diff --git a/test/langtools/tools/javac/multicatch/Neg01.out b/test/langtools/tools/javac/multicatch/Neg01.out index 56eb1958a526..f0ddda9bce65 100644 --- a/test/langtools/tools/javac/multicatch/Neg01.out +++ b/test/langtools/tools/javac/multicatch/Neg01.out @@ -1,2 +1,2 @@ -Neg01.java:22:19: compiler.err.except.never.thrown.in.try: Neg01.B2 +Neg01.java:21:19: compiler.err.except.never.thrown.in.try: Neg01.B2 1 error diff --git a/test/langtools/tools/javac/multicatch/Neg01eff_final.java b/test/langtools/tools/javac/multicatch/Neg01eff_final.java index e2c78f5e055c..933d7d1599dc 100644 --- a/test/langtools/tools/javac/multicatch/Neg01eff_final.java +++ b/test/langtools/tools/javac/multicatch/Neg01eff_final.java @@ -3,7 +3,6 @@ * @bug 6943289 * * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch') - * @author darcy * @compile/fail/ref=Neg01eff_final.out -XDrawDiagnostics Neg01eff_final.java */ diff --git a/test/langtools/tools/javac/multicatch/Neg01eff_final.out b/test/langtools/tools/javac/multicatch/Neg01eff_final.out index 4327ef45b9bd..b110d4468a1f 100644 --- a/test/langtools/tools/javac/multicatch/Neg01eff_final.out +++ b/test/langtools/tools/javac/multicatch/Neg01eff_final.out @@ -1,2 +1,2 @@ -Neg01eff_final.java:22:19: compiler.err.except.never.thrown.in.try: Neg01eff_final.B2 +Neg01eff_final.java:21:19: compiler.err.except.never.thrown.in.try: Neg01eff_final.B2 1 error diff --git a/test/langtools/tools/javac/multicatch/Neg07.java b/test/langtools/tools/javac/multicatch/Neg07.java index e5869e6a2ccf..a2c1704c6b2f 100644 --- a/test/langtools/tools/javac/multicatch/Neg07.java +++ b/test/langtools/tools/javac/multicatch/Neg07.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 7039822 * @summary Verify typing of lub of exception parameter w.r.t getClass - * @author Joseph D. Darcy * @compile/fail/ref=Neg07.out -XDrawDiagnostics Neg07.java */ diff --git a/test/langtools/tools/javac/multicatch/Neg07.out b/test/langtools/tools/javac/multicatch/Neg07.out index 32030e176957..0acdba265da4 100644 --- a/test/langtools/tools/javac/multicatch/Neg07.out +++ b/test/langtools/tools/javac/multicatch/Neg07.out @@ -1,2 +1,2 @@ -Neg07.java:14:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Class, java.lang.Class) +Neg07.java:13:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Class, java.lang.Class) 1 error diff --git a/test/langtools/tools/javac/multicatch/Pos10.java b/test/langtools/tools/javac/multicatch/Pos10.java index c66fa5334cd1..d108c8f9671a 100644 --- a/test/langtools/tools/javac/multicatch/Pos10.java +++ b/test/langtools/tools/javac/multicatch/Pos10.java @@ -25,7 +25,6 @@ * @test * @bug 7039822 * @summary Verify lub of an exception parameter can be an intersection type - * @author Joseph D. Darcy */ public class Pos10 { diff --git a/test/langtools/tools/javac/processing/6365040/T6365040.java b/test/langtools/tools/javac/processing/6365040/T6365040.java index 4413ff1375c9..c538609800d8 100644 --- a/test/langtools/tools/javac/processing/6365040/T6365040.java +++ b/test/langtools/tools/javac/processing/6365040/T6365040.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 6365040 6358129 * @summary Test -processor foo,bar,baz - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler @@ -13,7 +12,7 @@ * @compile -processor ProcFoo,ProcBar,T6365040 -proc:only T6365040.java * @compile -processor T6365040 -proc:only T6365040.java * @compile -processor T6365040,NotThere, -proc:only T6365040.java - * @compile/fail/ref=T6365040.out -XDrawDiagnostics -processor NotThere -proc:only T6365040.java + * @compile/fail/ref=T6365040.out -XDrawDiagnostics -processor NotThere -proc:only T6365040.java * @compile/fail/ref=T6365040.out -XDrawDiagnostics -processor NotThere,T6365040 -proc:only T6365040.java */ @@ -23,7 +22,6 @@ import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.element.TypeElement; - public class T6365040 extends JavacTestingAbstractProcessor { public boolean process(Set annotations, RoundEnvironment roundEnvironment) { diff --git a/test/langtools/tools/javac/processing/6378728/T6378728.java b/test/langtools/tools/javac/processing/6378728/T6378728.java index 9ee620510274..791296fb7549 100644 --- a/test/langtools/tools/javac/processing/6378728/T6378728.java +++ b/test/langtools/tools/javac/processing/6378728/T6378728.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -24,7 +24,6 @@ /* @test * @bug 6378728 * @summary Verify -proc:only doesn't produce class files - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler * @compile T6378728.java diff --git a/test/langtools/tools/javac/processing/6634138/T6634138.java b/test/langtools/tools/javac/processing/6634138/T6634138.java index 872192d51eca..baf9bff3b634 100644 --- a/test/langtools/tools/javac/processing/6634138/T6634138.java +++ b/test/langtools/tools/javac/processing/6634138/T6634138.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, 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 @@ -24,7 +24,6 @@ /* * @test * @bug 6634138 - * @author Joseph D. Darcy * @summary Verify source files output after processing is over are compiled * @library /tools/javac/lib * @modules java.compiler diff --git a/test/langtools/tools/javac/processing/completion/TestCompletions.java b/test/langtools/tools/javac/processing/completion/TestCompletions.java index 87d947f173e3..c181b0fc84de 100644 --- a/test/langtools/tools/javac/processing/completion/TestCompletions.java +++ b/test/langtools/tools/javac/processing/completion/TestCompletions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6341177 * @summary Some simple tests of the methods in Completions - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler */ diff --git a/test/langtools/tools/javac/processing/environment/TestSourceVersion.java b/test/langtools/tools/javac/processing/environment/TestSourceVersion.java index e31664b8a93b..473b14ad39c3 100644 --- a/test/langtools/tools/javac/processing/environment/TestSourceVersion.java +++ b/test/langtools/tools/javac/processing/environment/TestSourceVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6402506 8028545 8028543 * @summary Test that getSourceVersion works properly - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java b/test/langtools/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java index 33b19543ef7e..ddcaaf7b60db 100644 --- a/test/langtools/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java +++ b/test/langtools/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938 6911854 8030049 8038080 8032230 8190886 * @summary Tests that getElementsAnnotatedWith[Any] methods work properly. - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/errors/TestFatalityOfParseErrors.java b/test/langtools/tools/javac/processing/errors/TestFatalityOfParseErrors.java index 300afaad5248..3a7ee877c1f9 100644 --- a/test/langtools/tools/javac/processing/errors/TestFatalityOfParseErrors.java +++ b/test/langtools/tools/javac/processing/errors/TestFatalityOfParseErrors.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 6403459 * @summary Test that generating programs with syntax errors is a fatal condition - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/errors/TestOptionSyntaxErrors.java b/test/langtools/tools/javac/processing/errors/TestOptionSyntaxErrors.java index 8c397b20f629..bd1dea81a403 100644 --- a/test/langtools/tools/javac/processing/errors/TestOptionSyntaxErrors.java +++ b/test/langtools/tools/javac/processing/errors/TestOptionSyntaxErrors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6406212 * @summary Test that annotation processor options with illegal syntax are rejected - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules jdk.compiler/com.sun.tools.javac.main * @build JavacTestingAbstractProcessor CompileFail diff --git a/test/langtools/tools/javac/processing/errors/TestReturnCode.java b/test/langtools/tools/javac/processing/errors/TestReturnCode.java index 749044edd6f6..5ca6a50e3c64 100644 --- a/test/langtools/tools/javac/processing/errors/TestReturnCode.java +++ b/test/langtools/tools/javac/processing/errors/TestReturnCode.java @@ -25,7 +25,6 @@ * @test * @bug 6403468 * @summary Test that an erroneous return code results from raising an error. - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules jdk.compiler/com.sun.tools.javac.main * @build JavacTestingAbstractProcessor CompileFail diff --git a/test/langtools/tools/javac/processing/filer/TestFilerConstraints.java b/test/langtools/tools/javac/processing/filer/TestFilerConstraints.java index e522afa9ce8f..6eac5475c0b1 100644 --- a/test/langtools/tools/javac/processing/filer/TestFilerConstraints.java +++ b/test/langtools/tools/javac/processing/filer/TestFilerConstraints.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6380018 6453386 6457283 * @summary Test that the constraints guaranteed by the Filer and maintained - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/filer/TestGetResource.java b/test/langtools/tools/javac/processing/filer/TestGetResource.java index 073757d1217a..cf8ac2aafeba 100644 --- a/test/langtools/tools/javac/processing/filer/TestGetResource.java +++ b/test/langtools/tools/javac/processing/filer/TestGetResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6380018 6449798 * @summary Test Filer.getResource - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/filer/TestPackageInfo.java b/test/langtools/tools/javac/processing/filer/TestPackageInfo.java index 1e0659c9b120..1b11c75acde6 100644 --- a/test/langtools/tools/javac/processing/filer/TestPackageInfo.java +++ b/test/langtools/tools/javac/processing/filer/TestPackageInfo.java @@ -25,7 +25,6 @@ * @test * @bug 6380018 6392177 6993311 8193462 * @summary Test the ability to create and process package-info.java files - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/messager/MessagerBasics.java b/test/langtools/tools/javac/processing/messager/MessagerBasics.java index 35c3b64ca2d4..896f7b579b57 100644 --- a/test/langtools/tools/javac/processing/messager/MessagerBasics.java +++ b/test/langtools/tools/javac/processing/messager/MessagerBasics.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 6341173 6341072 * @summary Test presence of Messager methods - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/TestExceptions.java b/test/langtools/tools/javac/processing/model/TestExceptions.java index 993e084e157b..e9f5846a7caf 100644 --- a/test/langtools/tools/javac/processing/model/TestExceptions.java +++ b/test/langtools/tools/javac/processing/model/TestExceptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6794071 * @summary Test that exceptions have a proper parent class - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler */ diff --git a/test/langtools/tools/javac/processing/model/TestSourceVersion.java b/test/langtools/tools/javac/processing/model/TestSourceVersion.java index 3a56bf76007f..d53368d3b6df 100644 --- a/test/langtools/tools/javac/processing/model/TestSourceVersion.java +++ b/test/langtools/tools/javac/processing/model/TestSourceVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 7025809 8028543 6415644 8028544 8029942 8187951 8193291 8196551 8233096 8275308 * @summary Test latest, latestSupported, underscore as keyword, etc. - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler */ diff --git a/test/langtools/tools/javac/processing/model/element/TestAnonClassNames.java b/test/langtools/tools/javac/processing/model/element/TestAnonClassNames.java index c7504da4f893..de575841d122 100644 --- a/test/langtools/tools/javac/processing/model/element/TestAnonClassNames.java +++ b/test/langtools/tools/javac/processing/model/element/TestAnonClassNames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6449781 6930508 * @summary Test that reported names of anonymous classes are non-null. - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules jdk.compiler * @build JavacTestingAbstractProcessor TestAnonSourceNames diff --git a/test/langtools/tools/javac/processing/model/element/TestElement.java b/test/langtools/tools/javac/processing/model/element/TestElement.java index 9c8783191106..4bfe6280fd58 100644 --- a/test/langtools/tools/javac/processing/model/element/TestElement.java +++ b/test/langtools/tools/javac/processing/model/element/TestElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6453386 * @summary Test basic properties of javax.lang.element.Element - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/element/TestExecutableElement.java b/test/langtools/tools/javac/processing/model/element/TestExecutableElement.java index 4a37be9d7d75..2296214555f6 100644 --- a/test/langtools/tools/javac/processing/model/element/TestExecutableElement.java +++ b/test/langtools/tools/javac/processing/model/element/TestExecutableElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 8005046 8011052 8025087 * @summary Test basic properties of javax.lang.element.ExecutableElement - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/element/TestNames.java b/test/langtools/tools/javac/processing/model/element/TestNames.java index adbbf87c8e42..7e9ed193afd6 100644 --- a/test/langtools/tools/javac/processing/model/element/TestNames.java +++ b/test/langtools/tools/javac/processing/model/element/TestNames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6380016 * @summary Test that the constraints guaranteed by the Filer and maintained - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/element/TestPackageElement.java b/test/langtools/tools/javac/processing/model/element/TestPackageElement.java index f3749f6c5ffa..83d7515677b4 100644 --- a/test/langtools/tools/javac/processing/model/element/TestPackageElement.java +++ b/test/langtools/tools/javac/processing/model/element/TestPackageElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6449798 6399404 8173776 8163989 * @summary Test basic workings of PackageElement - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/element/TestResourceVariable.java b/test/langtools/tools/javac/processing/model/element/TestResourceVariable.java index a0f133779ab1..9a51613358a4 100644 --- a/test/langtools/tools/javac/processing/model/element/TestResourceVariable.java +++ b/test/langtools/tools/javac/processing/model/element/TestResourceVariable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6911256 6964740 6967842 6961571 7025809 * @summary Test that the resource variable kind is appropriately set - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules jdk.compiler * @build JavacTestingAbstractProcessor TestResourceVariable diff --git a/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/NpeTest.java b/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/NpeTest.java index 1e252c01cc06..849f8df7b710 100644 --- a/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/NpeTest.java +++ b/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/NpeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6593082 * @summary MirroredTypeException constructor should not accept null - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler */ diff --git a/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java b/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java index 38c2db7ca139..2487ac779105 100644 --- a/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java +++ b/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, 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 @@ -31,7 +31,6 @@ * @build JavacTestingAbstractProcessor * @compile Plurality.java * @compile -processor Plurality -proc:only Plurality.java - * @author Joseph D. Darcy */ import java.lang.annotation.*; import java.math.BigDecimal; diff --git a/test/langtools/tools/javac/processing/model/type/TestTypeKind.java b/test/langtools/tools/javac/processing/model/type/TestTypeKind.java index fc1ed62e2a58..9bc2e7e7cb62 100644 --- a/test/langtools/tools/javac/processing/model/type/TestTypeKind.java +++ b/test/langtools/tools/javac/processing/model/type/TestTypeKind.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6347716 * @summary Test TypeKind.isPrimitive - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler */ diff --git a/test/langtools/tools/javac/processing/model/util/deprecation/TestDeprecation.java b/test/langtools/tools/javac/processing/model/util/deprecation/TestDeprecation.java index d90b1ad34bf9..fe8e5262be4f 100644 --- a/test/langtools/tools/javac/processing/model/util/deprecation/TestDeprecation.java +++ b/test/langtools/tools/javac/processing/model/util/deprecation/TestDeprecation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6392818 * @summary Tests Elements.isDeprecated(Element) - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/util/elements/TestGetConstantExpression.java b/test/langtools/tools/javac/processing/model/util/elements/TestGetConstantExpression.java index a9827b2aacc1..b0b15cf92260 100644 --- a/test/langtools/tools/javac/processing/model/util/elements/TestGetConstantExpression.java +++ b/test/langtools/tools/javac/processing/model/util/elements/TestGetConstantExpression.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6471577 6517779 * @summary Test Elements.getConstantExpression - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/util/elements/TestGetPackageOf.java b/test/langtools/tools/javac/processing/model/util/elements/TestGetPackageOf.java index d82addd8b1fe..96c84db5bb7d 100644 --- a/test/langtools/tools/javac/processing/model/util/elements/TestGetPackageOf.java +++ b/test/langtools/tools/javac/processing/model/util/elements/TestGetPackageOf.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6453386 8216404 8230337 * @summary Test Elements.getPackageOf - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/util/elements/TestIsFunctionalInterface.java b/test/langtools/tools/javac/processing/model/util/elements/TestIsFunctionalInterface.java index f8292afd8155..ae048af45cc3 100644 --- a/test/langtools/tools/javac/processing/model/util/elements/TestIsFunctionalInterface.java +++ b/test/langtools/tools/javac/processing/model/util/elements/TestIsFunctionalInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 8007574 * @summary Test Elements.isFunctionalInterface - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/util/elements/VacuousEnum.java b/test/langtools/tools/javac/processing/model/util/elements/VacuousEnum.java index 2d16a8786255..6269d5c7334a 100644 --- a/test/langtools/tools/javac/processing/model/util/elements/VacuousEnum.java +++ b/test/langtools/tools/javac/processing/model/util/elements/VacuousEnum.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6937417 * @summary Test -Xprint on enum type with no constants - * @author Joseph D. Darcy * @compile -Xprint VacuousEnum.java */ public enum VacuousEnum { diff --git a/test/langtools/tools/javac/processing/model/util/filter/TestIterables.java b/test/langtools/tools/javac/processing/model/util/filter/TestIterables.java index a9bf8ecf8e69..6e9539b7a9e6 100644 --- a/test/langtools/tools/javac/processing/model/util/filter/TestIterables.java +++ b/test/langtools/tools/javac/processing/model/util/filter/TestIterables.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 6406164 * @summary Test that ElementFilter iterable methods behave properly. - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/util/types/TestPseudoTypeHandling.java b/test/langtools/tools/javac/processing/model/util/types/TestPseudoTypeHandling.java index 5359d26e53f7..b0898a30ca91 100644 --- a/test/langtools/tools/javac/processing/model/util/types/TestPseudoTypeHandling.java +++ b/test/langtools/tools/javac/processing/model/util/types/TestPseudoTypeHandling.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 8175335 * @summary Test Types methods on module and package TypeMirrors - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules jdk.compiler * @build JavacTestingAbstractProcessor TestPseudoTypeHandling diff --git a/test/langtools/tools/javac/processing/warnings/TestSourceVersionWarnings.java b/test/langtools/tools/javac/processing/warnings/TestSourceVersionWarnings.java index 54fe613acf18..24abf89ee029 100644 --- a/test/langtools/tools/javac/processing/warnings/TestSourceVersionWarnings.java +++ b/test/langtools/tools/javac/processing/warnings/TestSourceVersionWarnings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -21,11 +21,11 @@ * questions. */ + /* * @test * @bug 6376083 6376084 6458819 7025784 7025786 7025789 * @summary Test that warnings about source versions are output as expected. - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler * @compile TestSourceVersionWarnings.java From 6a9865e427533d586b1e45deba8bcaf690164ade Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 10 Mar 2026 14:47:09 +0000 Subject: [PATCH 006/223] 8373832: Test java/lang/invoke/TestVHInvokerCaching.java tests nothing Backport-of: e75726ee03ca4664827ca5d680c02bcf2a96f4ea --- test/jdk/java/lang/invoke/TestVHInvokerCaching.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/jdk/java/lang/invoke/TestVHInvokerCaching.java b/test/jdk/java/lang/invoke/TestVHInvokerCaching.java index ccd97f82e9b4..0a1ae5914ca0 100644 --- a/test/jdk/java/lang/invoke/TestVHInvokerCaching.java +++ b/test/jdk/java/lang/invoke/TestVHInvokerCaching.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -37,7 +37,7 @@ import java.util.List; import static java.lang.invoke.MethodHandles.lookup; -import static org.testng.Assert.assertSame; +import static org.testng.Assert.*; public class TestVHInvokerCaching { @@ -74,7 +74,7 @@ class Holder { MethodHandles.Lookup lookup = lookup(); - for (Field field : Holder.class.getFields()) { + for (Field field : Holder.class.getDeclaredFields()) { String fieldName = field.getName(); Class fieldType = field.getType(); @@ -82,6 +82,8 @@ class Holder { testHandles.add(lookup.findVarHandle(Holder.class, fieldName, fieldType)); } + assertFalse(testHandles.isEmpty()); + return testHandles.stream().map(vh -> new Object[]{ vh }).toArray(Object[][]::new); } } From 4db322c3c2fdabbbae9ec5827b3fbbf32ac9bbd8 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 10 Mar 2026 14:47:31 +0000 Subject: [PATCH 007/223] 8358058: sun/java2d/OpenGL/DrawImageBg.java Test fails intermittently Backport-of: ebeb77baaeb6d9098d7462f5ddf61d8583b1e493 --- test/jdk/ProblemList.txt | 1 + .../sun/java2d/OpenGL/DrawBitmaskImage.java | 173 ++++++ test/jdk/sun/java2d/OpenGL/DrawBufImgOp.java | 514 ++++++++++++++++++ test/jdk/sun/java2d/OpenGL/DrawImageBg.java | 145 +++++ test/jdk/sun/java2d/OpenGL/LargeOps.java | 138 +++++ test/jdk/sun/java2d/OpenGL/OpaqueDest.java | 180 ++++++ .../jdk/sun/java2d/OpenGL/ScaleParamsOOB.java | 198 +++++++ test/jdk/sun/java2d/OpenGL/ShapeClip.java | 140 +++++ test/jdk/sun/java2d/OpenGL/SrcMaskOps.java | 188 +++++++ .../sun/java2d/OpenGL/VolatileSubRegion.java | 166 ++++++ test/jdk/sun/java2d/OpenGL/XformVolatile.java | 146 +++++ 11 files changed, 1989 insertions(+) create mode 100644 test/jdk/sun/java2d/OpenGL/DrawBitmaskImage.java create mode 100644 test/jdk/sun/java2d/OpenGL/DrawBufImgOp.java create mode 100644 test/jdk/sun/java2d/OpenGL/DrawImageBg.java create mode 100644 test/jdk/sun/java2d/OpenGL/LargeOps.java create mode 100644 test/jdk/sun/java2d/OpenGL/OpaqueDest.java create mode 100644 test/jdk/sun/java2d/OpenGL/ScaleParamsOOB.java create mode 100644 test/jdk/sun/java2d/OpenGL/ShapeClip.java create mode 100644 test/jdk/sun/java2d/OpenGL/SrcMaskOps.java create mode 100644 test/jdk/sun/java2d/OpenGL/VolatileSubRegion.java create mode 100644 test/jdk/sun/java2d/OpenGL/XformVolatile.java diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index c97f6c21c3e5..6c7cf80dcab0 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -246,6 +246,7 @@ sun/awt/datatransfer/SuplementaryCharactersTransferTest.java 8011371 generic-all sun/awt/shell/ShellFolderMemoryLeak.java 8197794 windows-all sun/java2d/DirectX/OverriddenInsetsTest/OverriddenInsetsTest.java 8196102 generic-all sun/java2d/DirectX/RenderingToCachedGraphicsTest/RenderingToCachedGraphicsTest.java 8196180 windows-all,macosx-all +sun/java2d/OpenGL/OpaqueDest.java#id1 8367574 macosx-all sun/java2d/SunGraphics2D/EmptyClipRenderingTest.java 8144029 macosx-all,linux-all sun/java2d/SunGraphics2D/DrawImageBilinear.java 8297175 linux-all sun/java2d/SunGraphics2D/PolyVertTest.java 6986565 generic-all diff --git a/test/jdk/sun/java2d/OpenGL/DrawBitmaskImage.java b/test/jdk/sun/java2d/OpenGL/DrawBitmaskImage.java new file mode 100644 index 000000000000..d2730593b5b1 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/DrawBitmaskImage.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2004, 2025, 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 6248561 6264014 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that bitmask image copies work properly with the + * OGL pipeline when a SrcOver composite with extra alpha is involved. + * @run main/othervm -Dsun.java2d.opengl=True DrawBitmaskImage + * @run main/othervm DrawBitmaskImage + */ + +/* + * @test + * @bug 6248561 6264014 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that bitmask image copies work properly with the + * OGL pipeline when a SrcOver composite with extra alpha is involved. + * @run main/othervm -Dsun.java2d.opengl=True DrawBitmaskImage + * @run main/othervm DrawBitmaskImage + */ + +import java.awt.AlphaComposite; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Transparency; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.awt.image.IndexColorModel; +import java.io.File; +import javax.imageio.ImageIO; + +public class DrawBitmaskImage extends Panel { + + static final int TESTW = 200, TESTH = 200; + private static volatile DrawBitmaskImage test; + private static volatile Frame frame; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + g2d.setColor(Color.black); + g2d.fillRect(0, 0, getWidth(), getHeight()); + g2d.setComposite(AlphaComposite.SrcOver.derive(0.50f)); + + BufferedImage img = getGraphicsConfiguration().createCompatibleImage(50, 50, + Transparency.BITMASK); + Graphics2D gimg = img.createGraphics(); + gimg.setComposite(AlphaComposite.Src); + gimg.setColor(new Color(0, 0, 0, 0)); + gimg.fillRect(0, 0, 50, 50); + gimg.setColor(Color.red); + gimg.fillRect(10, 10, 30, 30); + gimg.dispose(); + + + g2d.drawImage(img, 10, 10, null); + + // draw a second time to ensure that the cached copy is used + g2d.drawImage(img, 80, 10, null); + } + + public Dimension getPreferredSize() { + return new Dimension(TESTW, TESTH); + } + + static void createUI() { + test = new DrawBitmaskImage(); + frame = new Frame("OpenGL DrawBitmaskImage Test"); + Panel p = new Panel(); + p.add(test); + frame.add(p); + frame.setSize(TESTW+100, TESTH+100); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + EventQueue.invokeAndWait(DrawBitmaskImage::createUI); + + robot.waitForIdle(); + robot.delay(2000); + + BufferedImage capture = null; + try { + GraphicsConfiguration gc = frame.getGraphicsConfiguration(); + if (gc.getColorModel() instanceof IndexColorModel) { + System.out.println("IndexColorModel detected: " + + "test considered PASSED"); + return; + } + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, TESTW, TESTH); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Test background color + int pixel = capture.getRGB(5, 10); + if (pixel != 0xff000000) { + saveImage(capture); + throw new RuntimeException("Failed: Incorrect color for " + + "background (actual=" + + Integer.toHexString(pixel) + ")"); + } + + // Test pixels (allow for small error in the actual red value) + pixel = capture.getRGB(25, 25); + System.out.println("pixel1 is " + Integer.toHexString(pixel)); + + if ((pixel < 0xff7e0000) || (pixel > 0xff900000)) { + saveImage(capture); + throw new RuntimeException("Failed: Incorrect color for " + + "first pixel (actual=" + + Integer.toHexString(pixel) + ")"); + } + + pixel = capture.getRGB(95, 25); + System.out.println("pixel2 is " + Integer.toHexString(pixel)); + if ((pixel < 0xff7e0000) || (pixel > 0xff900000)) { + saveImage(capture); + throw new RuntimeException("Failed: Incorrect color for " + + "second pixel (actual=" + + Integer.toHexString(pixel) + ")"); + } + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/DrawBufImgOp.java b/test/jdk/sun/java2d/OpenGL/DrawBufImgOp.java new file mode 100644 index 000000000000..5d60eb7e792a --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/DrawBufImgOp.java @@ -0,0 +1,514 @@ +/* + * Copyright (c) 2004, 2025, 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 6514990 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that calling + * Graphics2D.drawImage(BufferedImage, BufferedImageOp, x, y) to an + * OpenGL-accelerated destination produces the same results when performed + * in software via BufferedImageOp.filter(). + * @run main/othervm -Dsun.java2d.opengl=True DrawBufImgOp -ignore + */ + +/* + * @test + * @bug 6514990 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that calling + * Graphics2D.drawImage(BufferedImage, BufferedImageOp, x, y) to an + * OpenGL-accelerated destination produces the same results when performed + * in software via BufferedImageOp.filter(). + * @run main/othervm -Dsun.java2d.opengl=True DrawBufImgOp -ignore + */ + +import java.awt.AlphaComposite; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.awt.image.ByteLookupTable; +import java.awt.image.ColorModel; +import java.awt.image.ConvolveOp; +import java.awt.image.IndexColorModel; +import java.awt.image.Kernel; +import java.awt.image.LookupOp; +import java.awt.image.RescaleOp; +import java.awt.image.ShortLookupTable; +import java.awt.image.VolatileImage; +import java.io.File; +import javax.imageio.ImageIO; + +/** + * REMIND: This testcase was originally intended to automatically compare + * the results of the software BufferedImageOp implementations against + * the OGL-accelerated codepaths. However, there are just too many open + * bugs in the mediaLib-based codepaths (see below), which means that + * creating the reference image may cause crashes or exceptions, + * and even if we work around those cases using the "-ignore" flag, + * the visual results of the reference image are often buggy as well + * (so the comparison will fail even though the OGL results are correct). + * Therefore, for now we will run the testcase with the "-ignore" flag + * but without the "-compare" flag, so at least it will be checking for + * any exceptions/crashes in the OGL code. When we fix all of the + * outstanding bugs with the software codepaths, we can remove the + * "-ignore" flag and maybe even restore the "-compare" flag. In the + * meantime, it also functions well as a manual testcase (with either + * the "-show" or "-dump" options). + */ +public class DrawBufImgOp extends Canvas { + + private static final int TESTW = 600; + private static final int TESTH = 500; + + private static volatile DrawBufImgOp test; + private static volatile Frame frame; + + /* + * If true, skips tests that are known to trigger bugs (which in + * turn may cause crashes, exceptions, or other artifacts). + */ + private static boolean ignore; + + // Test both pow2 and non-pow2 sized images + private static final int[] srcSizes = { 32, 17 }; + private static final int[] srcTypes = { + BufferedImage.TYPE_INT_RGB, + BufferedImage.TYPE_INT_ARGB, + BufferedImage.TYPE_INT_ARGB_PRE, + BufferedImage.TYPE_INT_BGR, + BufferedImage.TYPE_3BYTE_BGR, + BufferedImage.TYPE_4BYTE_ABGR, + BufferedImage.TYPE_USHORT_565_RGB, + BufferedImage.TYPE_BYTE_GRAY, + BufferedImage.TYPE_USHORT_GRAY, + }; + + private static final RescaleOp + rescale1band, rescale3band, rescale4band; + private static final LookupOp + lookup1bandbyte, lookup3bandbyte, lookup4bandbyte; + private static final LookupOp + lookup1bandshort, lookup3bandshort, lookup4bandshort; + private static final ConvolveOp + convolve3x3zero, convolve5x5zero, convolve7x7zero; + private static final ConvolveOp + convolve3x3noop, convolve5x5noop, convolve7x7noop; + + static { + rescale1band = new RescaleOp(0.5f, 10.0f, null); + rescale3band = new RescaleOp( + new float[] { 0.6f, 0.4f, 0.6f }, + new float[] { 10.0f, -3.0f, 5.0f }, + null); + rescale4band = new RescaleOp( + new float[] { 0.6f, 0.4f, 0.6f, 0.9f }, + new float[] { -1.0f, 5.0f, 3.0f, 1.0f }, + null); + + // REMIND: we should probably test non-zero offsets, but that + // would require massaging the source image data to avoid going + // outside the lookup table array bounds + int offset = 0; + { + byte invert[] = new byte[256]; + byte halved[] = new byte[256]; + for (int j = 0; j < 256 ; j++) { + invert[j] = (byte) (255-j); + halved[j] = (byte) (j / 2); + } + ByteLookupTable lut1 = new ByteLookupTable(offset, invert); + lookup1bandbyte = new LookupOp(lut1, null); + ByteLookupTable lut3 = + new ByteLookupTable(offset, + new byte[][] {invert, halved, invert}); + lookup3bandbyte = new LookupOp(lut3, null); + ByteLookupTable lut4 = + new ByteLookupTable(offset, + new byte[][] {invert, halved, invert, halved}); + lookup4bandbyte = new LookupOp(lut4, null); + } + + { + short invert[] = new short[256]; + short halved[] = new short[256]; + for (int j = 0; j < 256 ; j++) { + invert[j] = (short) ((255-j) * 255); + halved[j] = (short) ((j / 2) * 255); + } + ShortLookupTable lut1 = new ShortLookupTable(offset, invert); + lookup1bandshort = new LookupOp(lut1, null); + ShortLookupTable lut3 = + new ShortLookupTable(offset, + new short[][] {invert, halved, invert}); + lookup3bandshort = new LookupOp(lut3, null); + ShortLookupTable lut4 = + new ShortLookupTable(offset, + new short[][] {invert, halved, invert, halved}); + lookup4bandshort = new LookupOp(lut4, null); + } + + // 3x3 blur + float[] data3 = { + 0.1f, 0.1f, 0.1f, + 0.1f, 0.2f, 0.1f, + 0.1f, 0.1f, 0.1f, + }; + Kernel k3 = new Kernel(3, 3, data3); + + // 5x5 edge + float[] data5 = { + -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, + -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, + -1.0f, -1.0f, 24.0f, -1.0f, -1.0f, + -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, + -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, + }; + Kernel k5 = new Kernel(5, 5, data5); + + // 7x7 blur + float[] data7 = { + 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, + 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, + 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, + 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, + 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, + 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, + 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, + }; + Kernel k7 = new Kernel(7, 7, data7); + + convolve3x3zero = new ConvolveOp(k3, ConvolveOp.EDGE_ZERO_FILL, null); + convolve5x5zero = new ConvolveOp(k5, ConvolveOp.EDGE_ZERO_FILL, null); + convolve7x7zero = new ConvolveOp(k7, ConvolveOp.EDGE_ZERO_FILL, null); + + convolve3x3noop = new ConvolveOp(k3, ConvolveOp.EDGE_NO_OP, null); + convolve5x5noop = new ConvolveOp(k5, ConvolveOp.EDGE_NO_OP, null); + convolve7x7noop = new ConvolveOp(k7, ConvolveOp.EDGE_NO_OP, null); + } + + public void paint(Graphics g) { + + VolatileImage vimg = createVolatileImage(TESTW, TESTH); + vimg.validate(getGraphicsConfiguration()); + + Graphics2D g2d = vimg.createGraphics(); + renderTest(g2d); + g2d.dispose(); + + g.drawImage(vimg, 0, 0, null); + } + + /* + * foreach source image size (once with pow2, once with non-pow2) + * + * foreach BufferedImage type + * + * RescaleOp (1 band) + * RescaleOp (3 bands, if src has 3 bands) + * RescaleOp (4 bands, if src has 4 bands) + * + * foreach LookupTable type (once with ByteLUT, once with ShortLUT) + * LookupOp (1 band) + * LookupOp (3 bands, if src has 3 bands) + * LookupOp (4 bands, if src has 4 bands) + * + * foreach edge condition (once with ZERO_FILL, once with EDGE_NO_OP) + * ConvolveOp (3x3) + * ConvolveOp (5x5) + * ConvolveOp (7x7) + */ + private void renderTest(Graphics2D g2d) { + g2d.setColor(Color.white); + g2d.fillRect(0, 0, TESTW, TESTH); + + int yorig = 2; + int xinc = 34; + int yinc = srcSizes[0] + srcSizes[1] + 2 + 2; + + for (int srcType : srcTypes) { + int y = yorig; + + for (int srcSize : srcSizes) { + int x = 2; + System.out.printf("type=%d size=%d\n", srcType, srcSize); + + BufferedImage srcImg = makeSourceImage(srcSize, srcType); + ColorModel srcCM = srcImg.getColorModel(); + + // RescaleOp + g2d.drawImage(srcImg, rescale1band, x, y); + x += xinc; + // REMIND: 3-band RescaleOp.filter() throws IAE for images + // that contain an alpha channel (bug to be filed) + if (srcCM.getNumColorComponents() == 3 && + !(ignore && srcCM.hasAlpha())) + { + g2d.drawImage(srcImg, rescale3band, x, y); + } + x += xinc; + if (srcCM.getNumComponents() == 4) { + g2d.drawImage(srcImg, rescale4band, x, y); + } + x += xinc; + + // LookupOp + // REMIND: Our LUTs are only 256 elements long, so won't + // currently work with USHORT_GRAY data + if (srcType != BufferedImage.TYPE_USHORT_GRAY) { + g2d.drawImage(srcImg, lookup1bandbyte, x, y); + x += xinc; + if (srcCM.getNumColorComponents() == 3) { + g2d.drawImage(srcImg, lookup3bandbyte, x, y); + } + x += xinc; + if (srcCM.getNumComponents() == 4) { + g2d.drawImage(srcImg, lookup4bandbyte, x, y); + } + x += xinc; + + // REMIND: LookupOp.createCompatibleDestImage() throws + // IAE for 3BYTE_BGR/4BYTE_ABGR (bug to be filed) + if (!(ignore && + (srcType == BufferedImage.TYPE_3BYTE_BGR || + srcType == BufferedImage.TYPE_4BYTE_ABGR))) + { + g2d.drawImage(srcImg, lookup1bandshort, x, y); + x += xinc; + // REMIND: 3-band LookupOp.filter() throws IAE for + // images that contain an alpha channel + // (bug to be filed) + if (srcCM.getNumColorComponents() == 3 && + !(ignore && srcCM.hasAlpha())) + { + g2d.drawImage(srcImg, lookup3bandshort, x, y); + } + x += xinc; + if (srcCM.getNumComponents() == 4) { + g2d.drawImage(srcImg, lookup4bandshort, x, y); + } + x += xinc; + } else { + x += 3*xinc; + } + } else { + x += 6*xinc; + } + + // ConvolveOp + // REMIND: ConvolveOp.filter() throws ImagingOpException + // for 3BYTE_BGR (see 4957775) + if (srcType != BufferedImage.TYPE_3BYTE_BGR) { + g2d.drawImage(srcImg, convolve3x3zero, x, y); + x += xinc; + g2d.drawImage(srcImg, convolve5x5zero, x, y); + x += xinc; + g2d.drawImage(srcImg, convolve7x7zero, x, y); + x += xinc; + + g2d.drawImage(srcImg, convolve3x3noop, x, y); + x += xinc; + g2d.drawImage(srcImg, convolve5x5noop, x, y); + x += xinc; + g2d.drawImage(srcImg, convolve7x7noop, x, y); + x += xinc; + } else { + x += 6*xinc; + } + + y += srcSize + 2; + } + + yorig += yinc; + } + } + + private BufferedImage makeSourceImage(int size, int type) { + int s2 = size/2; + BufferedImage img = new BufferedImage(size, size, type); + Graphics2D g2d = img.createGraphics(); + g2d.setComposite(AlphaComposite.Src); + g2d.setColor(Color.orange); + g2d.fillRect(0, 0, size, size); + g2d.setColor(Color.red); + g2d.fillRect(0, 0, s2, s2); + g2d.setColor(Color.green); + g2d.fillRect(s2, 0, s2, s2); + g2d.setColor(Color.blue); + g2d.fillRect(0, s2, s2, s2); + g2d.setColor(new Color(255, 255, 0, 128)); + g2d.fillRect(s2, s2, s2, s2); + g2d.setColor(Color.pink); + g2d.fillOval(s2-3, s2-3, 6, 6); + g2d.dispose(); + return img; + } + + public BufferedImage makeReferenceImage() { + BufferedImage img = new BufferedImage(TESTW, TESTH, + BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = img.createGraphics(); + renderTest(g2d); + g2d.dispose(); + return img; + } + + public Dimension getPreferredSize() { + return new Dimension(TESTW, TESTH); + } + + private static void compareImages(BufferedImage refImg, + BufferedImage testImg, + int tolerance) + { + int x1 = 0; + int y1 = 0; + int x2 = refImg.getWidth(); + int y2 = refImg.getHeight(); + + for (int y = y1; y < y2; y++) { + for (int x = x1; x < x2; x++) { + Color expected = new Color(refImg.getRGB(x, y)); + Color actual = new Color(testImg.getRGB(x, y)); + if (!isSameColor(expected, actual, tolerance)) { + saveImage("referenceimage", refImg); + saveImage("testimage", testImg); + throw new RuntimeException("Test failed at x="+x+" y="+y+ + " (expected="+expected+ + " actual="+actual+ + ")"); + } + } + } + } + + private static boolean isSameColor(Color c1, Color c2, int e) { + int r1 = c1.getRed(); + int g1 = c1.getGreen(); + int b1 = c1.getBlue(); + int r2 = c2.getRed(); + int g2 = c2.getGreen(); + int b2 = c2.getBlue(); + int rmin = Math.max(r2-e, 0); + int gmin = Math.max(g2-e, 0); + int bmin = Math.max(b2-e, 0); + int rmax = Math.min(r2+e, 255); + int gmax = Math.min(g2+e, 255); + int bmax = Math.min(b2+e, 255); + if (r1 >= rmin && r1 <= rmax && + g1 >= gmin && g1 <= gmax && + b1 >= bmin && b1 <= bmax) + { + return true; + } + return false; + } + + + static void createUI() { + test = new DrawBufImgOp(); + Panel panel = new Panel(); + panel.add(test); + frame = new Frame("OpenGL DrawBufImgOp Test"); + frame.add(panel); + frame.setSize(TESTW+100, TESTH+100); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + + boolean show = false; + boolean dump = false; + boolean compare = false; + + for (String arg : args) { + if (arg.equals("-show")) { + show = true; + } else if (arg.equals("-dump")) { + dump = true; + } else if (arg.equals("-compare")) { + compare = true; + } else if (arg.equals("-ignore")) { + ignore = true; + } + } + + Robot robot = new Robot(); + + EventQueue.invokeAndWait(DrawBufImgOp::createUI); + + robot.waitForIdle(); + robot.delay(2000); + + BufferedImage capture = null; + try { + GraphicsConfiguration gc = frame.getGraphicsConfiguration(); + if (gc.getColorModel() instanceof IndexColorModel) { + System.out.println("IndexColorModel detected: " + + "test considered PASSED"); + return; + } + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, TESTW, TESTH); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Compare the images (allow for +/- 1 bit differences in color comps) + if (dump || compare) { + BufferedImage ref = test.makeReferenceImage(); + if (dump) { + saveImage("DrawBufImgOp_ref", ref); + saveImage("DrawBufImgOp_cap", capture); + } + if (compare) { + test.compareImages(ref, capture, 1); + } + } + } + + static void saveImage(String name, BufferedImage img) { + try { + File file = new File(name + ".png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/DrawImageBg.java b/test/jdk/sun/java2d/OpenGL/DrawImageBg.java new file mode 100644 index 000000000000..7fc38d91b06e --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/DrawImageBg.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2004, 2025, 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 4993274 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that managed image copies and transforms work properly + * with the OGL pipeline when a background color is specified. + * @run main/othervm -Dsun.java2d.opengl=True DrawImageBg + * @run main/othervm DrawImageBg + */ + +/* + * @test + * @bug 4993274 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that managed image copies and transforms work properly + * with the OGL pipeline when a background color is specified. + * @run main/othervm -Dsun.java2d.opengl=True DrawImageBg + * @run main/othervm DrawImageBg + */ + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Transparency; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class DrawImageBg extends Panel { + + static volatile Frame frame; + static volatile DrawImageBg test; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + g2d.setColor(Color.black); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + BufferedImage img = getGraphicsConfiguration().createCompatibleImage(50, 50, + Transparency.BITMASK); + Graphics2D gimg = img.createGraphics(); + gimg.setComposite(AlphaComposite.Src); + gimg.setColor(new Color(0, 0, 0, 0)); + gimg.fillRect(0, 0, 50, 50); + gimg.setColor(Color.red); + gimg.fillRect(10, 10, 30, 30); + gimg.dispose(); + + g2d.drawImage(img, 10, 10, Color.blue, null); + + // draw a second time to ensure that the cached copy is used + g2d.drawImage(img, 80, 10, Color.blue, null); + } + + static void createUI() { + frame = new Frame("OpenGL DrawImageBg Test"); + test = new DrawImageBg(); + frame.add(test); + frame.setSize(300, 300); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + + BufferedImage capture = null; + Robot robot = new Robot(); + try { + EventQueue.invokeAndWait(DrawImageBg::createUI); + robot.waitForIdle(); + robot.delay(3000); + + // Grab the screen region + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x+80, pt1.y, 80, 80); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + if (capture == null) { + throw new RuntimeException("Screen capture is null"); + } + + // Test inner and outer pixels + int pixel1 = capture.getRGB(5, 10); + if (pixel1 != 0xff0000ff) { + saveImage(capture); + throw new RuntimeException(getMsg("outer", pixel1)); + } + int pixel2 = capture.getRGB(25, 25); + if (pixel2 != 0xffff0000) { + saveImage(capture); + throw new RuntimeException(getMsg("inner", pixel2)); + } + } + + static String getMsg(String r, int p1) { + return "Failed: Incorrect color for " + r + " pixel: got " + Integer.toHexString(p1); + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/LargeOps.java b/test/jdk/sun/java2d/OpenGL/LargeOps.java new file mode 100644 index 000000000000..ace60b7a3c49 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/LargeOps.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2004, 2025, 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 6219284 6358147 6274813 6578452 + * @key headful + * @summary Verifies that OGLRenderer.drawPoly(), + * OGLTextRenderer.drawGlyphList(), and OGLMaskFill work properly when the + * operation parameters exceed the capacity of the render queue. With the + * single-threaded OpenGL pipeline, there are some operations that require + * a separate buffer to be spawned if the parameters cannot fit entirely on + * the standard buffer. This test exercises this special case. + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.lcdshader=true LargeOps + */ + +import java.awt.Canvas; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.Robot; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class LargeOps extends Canvas { + + private static final int NUM_POINTS = 8000; + private int[] xPoints, yPoints; + private String str; + + public LargeOps() { + xPoints = new int[NUM_POINTS]; + yPoints = new int[NUM_POINTS]; + for (int i = 0; i < NUM_POINTS; i++) { + xPoints[i] = (i % 2 == 0) ? 10 : 400; + yPoints[i] = (i % 2 == 1) ? i+3 : i; + } + + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < NUM_POINTS; i+=11) { + sb.append("ThisIsATest"); + } + str = sb.toString(); + } + + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D)g; + g2d.setColor(Color.white); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + // draw large polyline + g2d.setColor(Color.green); + g2d.drawPolyline(xPoints, yPoints, NUM_POINTS); + + // draw long string + g2d.setColor(Color.blue); + g2d.drawString(str, 10, 100); + + // draw long string with larger pt size + Font font = g2d.getFont(); + g2d.setFont(font.deriveFont(40.0f)); + g2d.drawString(str, 10, 150); + + // do the same with LCD hints enabled + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); + g2d.setFont(font); + g2d.drawString(str, 10, 200); + g2d.setFont(font.deriveFont(43.0f)); + g2d.drawString(str, 10, 250); + + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HBGR); + g2d.setFont(font); + g2d.drawString(str, 10, 300); + g2d.setFont(font.deriveFont(37.0f)); + g2d.drawString(str, 10, 350); + } + + static volatile Frame frame; + static volatile LargeOps test; + + static void createUI() { + frame = new Frame("OpenGL LargeOps Test"); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + frame.dispose(); + } + }); + test = new LargeOps(); + frame.add(test); + frame.setSize(600, 600); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + EventQueue.invokeAndWait(LargeOps::createUI); + robot.waitForIdle(); + robot.delay(6000); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/OpaqueDest.java b/test/jdk/sun/java2d/OpenGL/OpaqueDest.java new file mode 100644 index 000000000000..508963161090 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/OpaqueDest.java @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2004, 2025, 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 6277977 6319663 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that blending operations do not inadvertantly leave + * non-opaque alpha values in the framebuffer. Note that this test is + * intended to run on GraphicsConfigs that support a stored alpha channel + * (to verify the bug at hand), but it is also a useful for testing the + * compositing results on any configuration. + * @run main/othervm -Dsun.java2d.opengl=True OpaqueDest + * @run main/othervm OpaqueDest + */ + +/* + * @test + * @bug 6277977 6319663 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that blending operations do not inadvertantly leave + * non-opaque alpha values in the framebuffer. Note that this test is + * intended to run on GraphicsConfigs that support a stored alpha channel + * (to verify the bug at hand), but it is also a useful for testing the + * compositing results on any configuration. + * @run main/othervm -Dsun.java2d.opengl=True OpaqueDest + * @run main/othervm OpaqueDest + */ + +import java.awt.AlphaComposite; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.awt.image.IndexColorModel; +import java.io.File; +import javax.imageio.ImageIO; + +public class OpaqueDest extends Canvas { + + private static volatile Frame frame; + private static volatile OpaqueDest test; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + + g2d.setColor(Color.red); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + // This will clear the rectangle to black + g2d.setComposite(AlphaComposite.Clear); + g2d.fillRect(10, 10, 80, 80); + + // If everything is working properly, then this will fill the + // rectangle with red again. Before this bug was fixed, the previous + // Clear operation would leave zero values in the destination's + // alpha channel (if present), and therefore a SrcIn operation + // would result in all-black. + g2d.setComposite(AlphaComposite.SrcIn); + g2d.fillRect(10, 10, 80, 80); + } + + public Dimension getPreferredSize() { + return new Dimension(100, 100); + } + + static void createUI() { + test = new OpaqueDest(); + frame = new Frame("OpenGL OpaqueDest Test"); + Panel p = new Panel(); + p.add(test); + frame.add(p); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + EventQueue.invokeAndWait(OpaqueDest::createUI); + + robot.waitForIdle(); + robot.delay(2000); + + BufferedImage capture = null; + try { + GraphicsConfiguration gc = frame.getGraphicsConfiguration(); + if (gc.getColorModel() instanceof IndexColorModel) { + System.out.println("IndexColorModel detected: " + + "test considered PASSED"); + return; + } + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, 100, 100); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + + // Test all pixels (every one should be red) + for (int y = 0; y < 100; y++) { + for (int x = 0; x < 100; x++) { + int actual = capture.getRGB(x, y); + int expected = 0xffff0000; + if (!similar(actual, expected)) { + saveImage(capture); + throw new RuntimeException("Test failed at x="+x+" y="+y+ + " (expected="+ + Integer.toHexString(expected) + + " actual="+ + Integer.toHexString(actual) + + ")"); + } + } + } + } + + static boolean similar(int p1, int p2) { + int a1 = (p1 >> 24) & 0xff; + int r1 = (p1 >> 16) & 0xff; + int g1 = (p1 >> 8) & 0xff; + int b1 = p1 & 0xff; + int a2 = (p2 >> 24) & 0xff; + int r2 = (p2 >> 16) & 0xff; + int g2 = (p2 >> 8) & 0xff; + int b2 = p2 & 0xff; + + int allowedDiff = 0x01; // tiny rounding error allowed. + return + (Math.abs(a1 - a2) <= allowedDiff) && + (Math.abs(r1 - r2) <= allowedDiff) && + (Math.abs(g1 - g2) <= allowedDiff) && + (Math.abs(b1 - b2) <= allowedDiff); + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/ScaleParamsOOB.java b/test/jdk/sun/java2d/OpenGL/ScaleParamsOOB.java new file mode 100644 index 000000000000..b3d866cfd757 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/ScaleParamsOOB.java @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2004, 2025, 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 5104584 8237244 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that scaling an image works properly when the + * source parameters are outside the source bounds. + * @run main/othervm -Dsun.java2d.opengl=True ScaleParamsOOB + * @run main/othervm ScaleParamsOOB + */ + +/* + * @test + * @bug 5104584 8237244 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that scaling an image works properly when the + * source parameters are outside the source bounds. + * @run main/othervm -Dsun.java2d.opengl=True ScaleParamsOOB + * @run main/othervm ScaleParamsOOB + */ + + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class ScaleParamsOOB extends Panel { + + private static final int TOLERANCE = 12; + + private static volatile ScaleParamsOOB test; + private static volatile Frame frame; + + private BufferedImage img; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + g2d.setColor(Color.black); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + BufferedImage img = getGraphicsConfiguration().createCompatibleImage(40, 40); + Graphics2D gimg = img.createGraphics(); + gimg.setColor(Color.red); + gimg.fillRect(0, 0, 40, 40); + gimg.dispose(); + + // first time will be a sw->surface blit + g2d.drawImage(img, + 10, 10, 90, 90, + -60, -60, 100, 100, + null); + + // second time will be a texture->surface blit + g2d.drawImage(img, + 110, 10, 190, 90, + -60, -60, 100, 100, + null); + } + + public Dimension getPreferredSize() { + return new Dimension(300, 200); + } + + private static void testRegion(BufferedImage bi, + Rectangle wholeRegion, + Rectangle affectedRegion) + { + int x1 = wholeRegion.x; + int y1 = wholeRegion.y; + int x2 = x1 + wholeRegion.width; + int y2 = y1 + wholeRegion.height; + + for (int y = y1; y < y2; y++) { + for (int x = x1; x < x2; x++) { + int actual = bi.getRGB(x, y); + int expected = 0; + if (affectedRegion.contains(x, y)) { + expected = Color.red.getRGB(); + } else { + expected = Color.black.getRGB(); + } + int alpha = (actual >> 24) & 0xFF; + int red = (actual >> 16) & 0xFF; + int green = (actual >> 8) & 0xFF; + int blue = (actual) & 0xFF; + + int standardAlpha = (expected >> 24) & 0xFF; + int standardRed = (expected >> 16) & 0xFF; + int standardGreen = (expected >> 8) & 0xFF; + int standardBlue = (expected) & 0xFF; + + if ((Math.abs(alpha - standardAlpha) > TOLERANCE) || + (Math.abs(red - standardRed) > TOLERANCE) || + (Math.abs(green - standardGreen) > TOLERANCE) || + (Math.abs(blue - standardBlue) > TOLERANCE)) { + saveImage(bi); + throw new RuntimeException("Test failed at x="+x+" y="+y+ + " (expected="+ + Integer.toHexString(expected) + + " actual="+ + Integer.toHexString(actual) + + ")"); + } + } + } + } + + private static void createAndShowGUI() { + test = new ScaleParamsOOB(); + frame = new Frame("OpenGL ScaleParamsOOB Test"); + frame.setAlwaysOnTop(true); + frame.add(test); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + EventQueue.invokeAndWait(() -> createAndShowGUI()); + + robot.waitForIdle(); + robot.delay(2000); + + // Grab the screen region + BufferedImage capture = null; + try { + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, 200, 200); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Test background color + int pixel = capture.getRGB(5, 5); + if (pixel != 0xff000000) { + saveImage(capture); + throw new RuntimeException("Failed: Incorrect color for " + + "background: " + Integer.toHexString(pixel)); + } + + // Test pixels + testRegion(capture, + new Rectangle(5, 5, 90, 90), + new Rectangle(40, 40, 20, 20)); + testRegion(capture, + new Rectangle(105, 5, 90, 90), + new Rectangle(140, 40, 20, 20)); + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/ShapeClip.java b/test/jdk/sun/java2d/OpenGL/ShapeClip.java new file mode 100644 index 000000000000..f50b7aff5a64 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/ShapeClip.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2004, 2025, 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 5002133 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that the OpenGL pipeline does not affect the color + * buffer when setting up a complex (shape) clip region. The test fails if + * the circular clip region is filled with a green color (the green region + * should not be visible at all). + * @run main/othervm -Dsun.java2d.opengl=True ShapeClip + * @run main/othervm ShapeClip + */ + +/* + * @test + * @bug 5002133 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that the OpenGL pipeline does not affect the color + * buffer when setting up a complex (shape) clip region. The test fails if + * the circular clip region is filled with a green color (the green region + * should not be visible at all). + * @run main/othervm -Dsun.java2d.opengl=True ShapeClip + * @run main/othervm ShapeClip + */ + +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.geom.Ellipse2D; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class ShapeClip extends Panel { + + private static volatile Frame frame; + private static volatile ShapeClip test; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + + int width = getWidth(); + int height = getHeight(); + + g2d.setColor(Color.black); + g2d.fillRect(0, 0, width, height); + + g2d.setColor(Color.green); + g2d.fillRect(0, 0, 1, 1); + g2d.setClip(new Ellipse2D.Double(10, 10, 100, 100)); + g2d.setColor(Color.blue); + g2d.fillRect(30, 30, 20, 20); + } + + static void createUI() { + test = new ShapeClip(); + frame = new Frame("OpenGL ShapeClip Test"); + frame.add(test); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + EventQueue.invokeAndWait(ShapeClip::createUI); + + robot.waitForIdle(); + robot.delay(2000); + + // Grab the screen region + BufferedImage capture = null; + try { + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, 80, 80); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Test blue rectangle + int pixel1 = capture.getRGB(40, 40); + if (pixel1 != 0xff0000ff) { + saveImage(capture); + throw new RuntimeException("Failed: Incorrect color for " + + "rectangle " + Integer.toHexString(pixel1)); + } + + // Test clip region (should be same color as background) + int pixel2 = capture.getRGB(60, 40); + if (pixel2 != 0xff000000) { + saveImage(capture); + throw new RuntimeException("Failed: Incorrect color for " + + "clip region " + Integer.toHexString(pixel2)); + } + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/SrcMaskOps.java b/test/jdk/sun/java2d/OpenGL/SrcMaskOps.java new file mode 100644 index 000000000000..9908cffdefb0 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/SrcMaskOps.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2004, 2025, 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 4942939 4970674 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that OGLMaskFill, OGLMaskBlit, and OGLTextRenderer + * operations work properly for non-SrcOver composites. + * @run main/othervm -Dsun.java2d.opengl=True SrcMaskOps + * @run main/othervm SrcMaskOps + */ + +/* + * @test + * @bug 4942939 4970674 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that OGLMaskFill, OGLMaskBlit, and OGLTextRenderer + * operations work properly for non-SrcOver composites. + * @run main/othervm -Dsun.java2d.opengl=True SrcMaskOps + * @run main/othervm SrcMaskOps + */ + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Font; +import java.awt.Frame; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class SrcMaskOps extends Panel { + + static volatile Frame frame; + static volatile SrcMaskOps test; + + static final int SRX = 50; + static final int SRY = 50; + static final int GPX = 90; + static final int GPY = 50; + static final int DTX = 120; + static final int DTY = 70; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + + g2d.setColor(Color.white); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setComposite(AlphaComposite.Src); + + g2d.setColor(Color.blue); + g2d.drawRect(SRX, SRY, 20, 20); + + g2d.setPaint(new GradientPaint(0.0f, 0.0f, Color.red, + 100.0f, 100.f, Color.red, true)); + g2d.drawRect(GPX, GPY, 20, 20); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_OFF); + + g2d.setColor(Color.red); + Font font = new Font(Font.DIALOG, Font.PLAIN, 20); + g2d.setFont(font); + g2d.drawString("HELLO", DTX, DTY); + } + + static void createUI() { + frame = new Frame("OpenGL SrcMaskOps Test"); + test = new SrcMaskOps(); + frame.add(test); + frame.setSize(300, 300); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + + Robot robot = new Robot(); + BufferedImage capture = null; + try { + EventQueue.invokeAndWait(SrcMaskOps::createUI); + robot.waitForIdle(); + robot.delay(3000); + + // Grab the screen region + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, 300, 300); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Test solid rectangle + int pixel1, pixel2; + pixel1 = capture.getRGB(SRX, SRY); + pixel2 = capture.getRGB(SRX+2, SRY+2); + if (!similar(pixel1, 0xff0000ff) || !similar(pixel2, 0xffffffff)) { + saveImage(capture); + throw new RuntimeException(getMsg("solid rectangle", pixel1, pixel2)); + } + + // Test GradientPaint rectangle + pixel1 = capture.getRGB(GPX, GPY); + pixel2 = capture.getRGB(GPX+2, GPY+2); + if (!similar(pixel1, 0xffff0000) || !similar(pixel2, 0xffffffff)) { + saveImage(capture); + throw new RuntimeException(getMsg("GradientPaint rectangle", pixel1, pixel2)); + } + + // Test solid text + pixel1 = capture.getRGB(DTX+2, DTY-5); + pixel2 = capture.getRGB(DTX+5, DTY-5); + if (!similar(pixel1, 0xffff0000) || !similar(pixel2, 0xffffffff)) { + saveImage(capture); + throw new RuntimeException(getMsg("solid text", pixel1, pixel2)); + } + + } + + static boolean similar(int p1, int p2) { + int a1 = (p1 >> 24) & 0xff; + int r1 = (p1 >> 16) & 0xff; + int g1 = (p1 >> 8) & 0xff; + int b1 = p1 & 0xff; + int a2 = (p2 >> 24) & 0xff; + int r2 = (p2 >> 16) & 0xff; + int g2 = (p2 >> 8) & 0xff; + int b2 = p2 & 0xff; + + int allowedDiff = 0x10; + return + (Math.abs(a1 - a2) <= allowedDiff) && + (Math.abs(r1 - r2) <= allowedDiff) && + (Math.abs(g1 - g2) <= allowedDiff) && + (Math.abs(b1 - b2) <= allowedDiff); + } + + static String getMsg(String r, int p1, int p2) { + return "Failed: Incorrect color[s] for " + r + " got " + + Integer.toHexString(p1) + " and " + Integer.toHexString(p2); + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/VolatileSubRegion.java b/test/jdk/sun/java2d/OpenGL/VolatileSubRegion.java new file mode 100644 index 000000000000..7ec350bc9587 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/VolatileSubRegion.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2004, 2025, 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 6244071 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that copying a subregion from a VolatileImage works + * properly with the OGL pipeline. + * @run main/othervm VolatileSubRegion + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=true VolatileSubRegion + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=false VolatileSubRegion + */ + +/* + * @test + * @bug 6244071 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that copying a subregion from a VolatileImage works + * properly with the OGL pipeline. + * @run main/othervm VolatileSubRegion + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=true VolatileSubRegion + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=false VolatileSubRegion + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.awt.image.IndexColorModel; +import java.awt.image.VolatileImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class VolatileSubRegion extends Panel { + + private VolatileImage img; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + + if (img == null) { + img = createVolatileImage(200, 200); + Graphics2D goff = img.createGraphics(); + goff.setColor(Color.green); + goff.fillRect(50, 0, 100, 50); + goff.setColor(Color.blue); + goff.fillRect(0, 0, 200, 200); + goff.setColor(Color.red); + goff.fillRect(50, 50, 100, 100); + goff.setColor(Color.yellow); + goff.fillRect(50, 150, 100, 50); + goff.dispose(); + } + + g2d.setColor(Color.white); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + g2d.drawImage(img, + 50, 50, 200, 200, + 50, 50, 200, 200, + null); + + } + + + private static volatile VolatileSubRegion test; + private static volatile Frame frame; + + static void createUI() { + test = new VolatileSubRegion(); + frame = new Frame("OpenGL VolatileSubRegion Test"); + frame.add(test); + frame.setSize(300, 300); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + EventQueue.invokeAndWait(VolatileSubRegion::createUI); + + robot.waitForIdle(); + robot.delay(2000); + + BufferedImage capture = null; + try { + GraphicsConfiguration gc = frame.getGraphicsConfiguration(); + if (gc.getColorModel() instanceof IndexColorModel) { + System.out.println("IndexColorModel detected: " + + "test considered PASSED"); + return; + } + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, 200, 200); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Test pixels + int pixel1 = capture.getRGB(49, 50); + if (pixel1 != 0xffffffff) { + saveImage(capture); + throw new RuntimeException(getMsg("background pixel", pixel1)); + } + int pixel2 = capture.getRGB(50, 50); + if (pixel2 != 0xffff0000) { + saveImage(capture); + throw new RuntimeException(getMsg("red region", pixel2)); + } + int pixel3 = capture.getRGB(50, 150); + if (pixel3 != 0xffffff00) { + saveImage(capture); + throw new RuntimeException(getMsg("yellow region", pixel3)); + } + } + + static String getMsg(String r, int p1) { + return "Failed: Incorrect color for " + r + " : got " + Integer.toHexString(p1); + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/test/jdk/sun/java2d/OpenGL/XformVolatile.java b/test/jdk/sun/java2d/OpenGL/XformVolatile.java new file mode 100644 index 000000000000..44e7c7ee8ba7 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/XformVolatile.java @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2004, 2025, 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 4970836 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that transformed VolatileImage copies work properly with + * the OGL pipeline. + * @run main/othervm XformVolatile + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=true XformVolatile + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=false XformVolatile + */ + +/* + * @test + * @bug 4970836 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that transformed VolatileImage copies work properly with + * the OGL pipeline. + * @run main/othervm XformVolatile + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=true XformVolatile + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=false XformVolatile + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.awt.image.VolatileImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class XformVolatile extends Panel { + + private static volatile Frame frame; + private static volatile XformVolatile test; + private volatile VolatileImage img; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + + if (img == null) { + img = createVolatileImage(200, 200); + Graphics2D goff = img.createGraphics(); + goff.setColor(Color.blue); + goff.fillRect(0, 0, 200, 200); + goff.setColor(Color.red); + goff.fillPolygon(new int[] {10, 100, 190}, + new int[] {190, 10, 190}, 3); + goff.dispose(); + } + + g2d.setColor(Color.black); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + g2d.rotate(Math.toRadians(3.0)); + g2d.drawImage(img, 0, 0, null); + } + + static void createUI() { + test = new XformVolatile(); + frame = new Frame("OpenGL XformVolatile Test"); + frame.add(test); + frame.setSize(300, 300); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + + Robot robot = new Robot(); + + EventQueue.invokeAndWait(XformVolatile::createUI); + + robot.waitForIdle(); + robot.delay(2000); + + // Grab the screen region + BufferedImage capture = null; + try { + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, 200, 200); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Test inner and outer pixels + int pixel1 = capture.getRGB(5, 175); + if (pixel1 != 0xff0000ff) { + saveImage(capture); + throw new RuntimeException(getMsg("inner", pixel1)); + } + int pixel2 = capture.getRGB(5, 188); + if (pixel2 != 0xffff0000) { + saveImage(capture); + throw new RuntimeException(getMsg("inner", pixel2)); + } + } + + static String getMsg(String r, int p1) { + return "Failed: Incorrect color for " + r + " pixel: got " + Integer.toHexString(p1); + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} From f7e8c8d6841ea8d36072054449f384de2b065ee5 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 10 Mar 2026 14:48:02 +0000 Subject: [PATCH 008/223] 8371262: sun/security/pkcs11/Cipher/KeyWrap tests may silently skip Backport-of: 8ae4ea8114c4c7616a3e882aca71f882630a8e02 --- .../pkcs11/Cipher/KeyWrap/NISTWrapKAT.java | 77 +++++++++++++------ .../pkcs11/Cipher/KeyWrap/TestGeneral.java | 46 ++++++++--- .../pkcs11/Cipher/KeyWrap/XMLEncKAT.java | 19 +++-- 3 files changed, 101 insertions(+), 41 deletions(-) diff --git a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java index e1f32ea80765..e8f637e0b0c7 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java +++ b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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,13 +29,19 @@ * @summary Verify that the AES-Key-Wrap and AES-Key-Wrap-Pad ciphers * work as expected using NIST test vectors. */ +import jtreg.SkippedException; + import java.security.Key; import java.security.AlgorithmParameters; import java.security.Provider; -import javax.crypto.*; -import javax.crypto.spec.*; +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.util.ArrayList; import java.util.Arrays; import java.math.BigInteger; +import java.util.List; // adapted from com/sun/crypto/provider/Cipher/KeyWrap/NISTWrapKAT.java public class NISTWrapKAT extends PKCS11Test { @@ -73,8 +79,11 @@ public class NISTWrapKAT extends PKCS11Test { "308D49692B5F8CF638D54BB4B985633504237329964C76EBB3F669870A708DBC"; private static String KWP_AES256_224 = "0942747DB07032A3F04CDB2E7DE1CBA038F92BC355393AE9A0E4AE8C901912AC3D3AF0F16D240607"; - // from RFC 5649 sec6 - private static String KEK2 = "5840DF6E29B02AF1AB493B705BF16EA1AE8338F4DCC176A8"; + // from RFC 5649 sec6 + private static String KEK2 = + "5840DF6E29B02AF1AB493B705BF16EA1AE8338F4DCC176A8"; + + private static final List skippedList = new ArrayList <>(); private static byte[] toBytes(String hex, int hexLen) { if (hexLen < hex.length()) { @@ -91,10 +100,18 @@ private static byte[] toBytes(String hex, int hexLen) { byte[] out = new byte[outLen]; if (val.length < outLen) { // enlarge - System.arraycopy(val, 0, out, outLen - val.length, val.length); + System.arraycopy(val, + 0, + out, + outLen - val.length, + val.length); } else { // truncate - System.arraycopy(val, val.length - outLen, out, 0, outLen); + System.arraycopy(val, + val.length - outLen, + out, + 0, + outLen); } return out; } @@ -143,7 +160,8 @@ public Object[][] testData() { "AFBEB0F07DFBF5419200F2CCB50BB24F" }, { "AES/KWP/NoPadding", KEK2, 24, "C37B7E6492584340BED12207808941155068F738", 20, - "138BDEAA9B8FA7FC61F97742E72248EE5AE6AE5360D1AE6A5F54F373FA543B6A" }, + "138BDEAA9B8FA7FC61F97742E72248EE5AE6AE5360D1AE6A5F54F373FA543B6A" + }, // some more test vectors for KW and KWP // from csrc.nist.gov/groups/STM/cavp/documents/mac/kwtestvectors.zip { "AES/KW/NoPadding", "7575da3a93607cc2bfd8cec7aadfd9a6", 16, @@ -257,6 +275,9 @@ public void testKeyWrap(String algo, String key, int keyLen, int allowed = Cipher.getMaxAllowedKeyLength("AES"); if (keyLen > allowed) { System.out.println("=> skip, exceeds max allowed size " + allowed); + skippedList.add(algo + " Cipher with wrapping " + + dataLen + "-byte key with " + 8 * keyLen + + "-bit KEK exceeds max allowed size " + allowed); return; } Cipher c1 = Cipher.getInstance(algo, @@ -275,7 +296,8 @@ public void testKeyWrap(String algo, String key, int keyLen, c1.init(Cipher.WRAP_MODE, cipherKey); IvParameterSpec ivSpec = new IvParameterSpec(c1.getIV()); c2.init(Cipher.WRAP_MODE, cipherKey, ivSpec); - AlgorithmParameters params = AlgorithmParameters.getInstance("AES"); + AlgorithmParameters params = + AlgorithmParameters.getInstance("AES"); params.init(ivSpec); c3.init(Cipher.WRAP_MODE, cipherKey, params); @@ -300,9 +322,12 @@ public void testKeyWrap(String algo, String key, int keyLen, params.init(ivSpec); c3.init(Cipher.UNWRAP_MODE, cipherKey, params); - Key unwrapped = c1.unwrap(wrapped, "AES", Cipher.SECRET_KEY); - Key unwrapped2 = c2.unwrap(wrapped, "AES", Cipher.SECRET_KEY); - Key unwrapped3 = c3.unwrap(wrapped, "AES", Cipher.SECRET_KEY); + Key unwrapped = + c1.unwrap(wrapped, "AES", Cipher.SECRET_KEY); + Key unwrapped2 = + c2.unwrap(wrapped, "AES", Cipher.SECRET_KEY); + Key unwrapped3 = + c3.unwrap(wrapped, "AES", Cipher.SECRET_KEY); if (!Arrays.equals(unwrapped.getEncoded(), dataVal) || !Arrays.equals(unwrapped2.getEncoded(), dataVal) || @@ -320,6 +345,9 @@ public void testEnc(String algo, String key, int keyLen, String data, int allowed = Cipher.getMaxAllowedKeyLength("AES"); if (keyLen > allowed) { System.out.println("=> skip, exceeds max allowed size " + allowed); + skippedList.add(algo + " Cipher with enc " + + dataLen + "-byte data with " + 8 * keyLen + + "-bit KEK exceeds max allowed size " + allowed); return; } Cipher c1 = Cipher.getInstance(algo, @@ -336,7 +364,8 @@ public void testEnc(String algo, String key, int keyLen, String data, c1.init(Cipher.ENCRYPT_MODE, cipherKey); IvParameterSpec ivSpec = new IvParameterSpec(c1.getIV()); c2.init(Cipher.ENCRYPT_MODE, cipherKey, ivSpec); - AlgorithmParameters params = AlgorithmParameters.getInstance("AES"); + AlgorithmParameters params = + AlgorithmParameters.getInstance("AES"); params.init(ivSpec); c3.init(Cipher.ENCRYPT_MODE, cipherKey, params); @@ -384,18 +413,22 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { Object[][] testDatum = testData(); - for (int i = 0; i < testDatum.length; i++) { - Object[] td = testDatum[i]; + for (Object[] td : testDatum) { String algo = (String) td[0]; if (p.getService("Cipher", algo) == null) { - System.out.println("Skip, due to no support: " + algo); - continue; + skippedList.add("No support for " + algo); } - testKeyWrap(algo, (String)td[1], (int)td[2], (String)td[3], - (int)td[4], (String)td[5], p); - testEnc(algo, (String)td[1], (int)td[2], (String)td[3], - (int)td[4], (String)td[5], p); + testKeyWrap(algo, (String) td[1], (int) td[2], (String) td[3], + (int) td[4], (String) td[5], p); + testEnc(algo, (String) td[1], (int) td[2], (String) td[3], + (int) td[4], (String) td[5], p); + } + + if (!skippedList.isEmpty()) { + throw new SkippedException("One or more tests skipped " + + skippedList); + } else { + System.out.println("All Tests Passed"); } - System.out.println("Test Passed"); } } diff --git a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java index 0cfb4557572c..f5e4494fc59b 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java +++ b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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,18 +29,30 @@ * @library /test/lib ../.. * @run main/othervm TestGeneral */ +import jtreg.SkippedException; + import java.nio.ByteBuffer; +import java.security.AlgorithmParameters; +import java.security.InvalidAlgorithmParameterException; +import java.security.Key; +import java.security.KeyPairGenerator; +import java.security.PrivateKey; +import java.security.Provider; +import java.util.ArrayList; import java.util.Arrays; import java.util.HexFormat; -import java.security.*; -import javax.crypto.*; -import javax.crypto.spec.*; +import java.util.List; +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; // adapted from com/sun/crypto/provider/Cipher/KeyWrap/TestGeneral.java public class TestGeneral extends PKCS11Test { private static final byte[] DATA_32 = - Arrays.copyOf("1234567890123456789012345678901234".getBytes(), 32); + Arrays.copyOf("1234567890123456789012345678901234".getBytes(), + 32); private static final SecretKey KEY = new SecretKeySpec(DATA_32, 0, 16, "AES"); private static final int KW_IV_LEN = 8; @@ -49,7 +61,8 @@ public class TestGeneral extends PKCS11Test { private static final int MAX_KWP_PAD_LEN = 7; // 0-7 public static void testEnc(Cipher c, byte[] in, int startLen, int inc, - IvParameterSpec[] ivs, int maxPadLen) throws Exception { + IvParameterSpec[] ivs, int maxPadLen) + throws Exception { System.out.println("testEnc, input len=" + startLen + " w/ inc=" + inc); @@ -96,7 +109,7 @@ public static void testEnc(Cipher c, byte[] in, int startLen, int inc, } public static void testKAT(Cipher c, String keyStr, String inStr, - String expectedStr) throws Exception { + String expectedStr) throws Exception { System.out.println("testKAT, input len: " + inStr.length()/2); @@ -245,16 +258,21 @@ public void main(Provider p) throws Exception { SecretKey aes256 = new SecretKeySpec(DATA_32, "AES"); SecretKey any256 = new SecretKeySpec(DATA_32, "ANY"); PrivateKey priv = KeyPairGenerator.getInstance - ("RSA", System.getProperty("test.provider.name","SunRsaSign")) + ("RSA", + System.getProperty( + "test.provider.name", + "SunRsaSign")) .generateKeyPair().getPrivate(); String[] algos = { "AES/KW/PKCS5Padding", "AES/KW/NoPadding", "AES/KWP/NoPadding" }; + + final List skippedList = new ArrayList<>(); + for (String a : algos) { if (p.getService("Cipher", a) == null) { - System.out.println("Skip, due to no support: " + a); - continue; + skippedList.add(a); } System.out.println("Testing " + a); @@ -329,6 +347,12 @@ public void main(Provider p) throws Exception { testWrap(c, keys, ivs, padLen); testIv(c, ivLen, allowCustomIv); } - System.out.println("All Tests Passed"); + + if (!skippedList.isEmpty()) { + throw new SkippedException("One or more tests skipped " + + "due to no support " + skippedList); + } else { + System.out.println("All Tests Passed"); + } } } diff --git a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/XMLEncKAT.java b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/XMLEncKAT.java index 1857e619cc64..5ba02416c8b2 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/XMLEncKAT.java +++ b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/XMLEncKAT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -28,14 +28,16 @@ * @library /test/lib ../.. * @run main/othervm XMLEncKAT */ +import jtreg.SkippedException; + import java.util.Base64; import java.security.Key; -import java.security.AlgorithmParameters; import java.security.Provider; -import javax.crypto.*; -import javax.crypto.spec.*; +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; import java.io.UnsupportedEncodingException; -import java.io.IOException; // adapted from com/sun/crypto/provider/Cipher/KeyWrap/XMLEncKAT.java public class XMLEncKAT extends PKCS11Test { @@ -105,7 +107,9 @@ private void testKeyWrap(Provider p, String cAlg, byte[] cKeyVal, // first test UNWRAP with known values for (int i = 0; i < base64Wrapped.length; i++) { byte[] wrappedKey = base64D.decode(base64Wrapped[i]); - key[i] = c.unwrap(wrappedKey, "AES", Cipher.SECRET_KEY); + key[i] = c.unwrap(wrappedKey, + "AES", + Cipher.SECRET_KEY); if (c.getIV() != null) { params[i] = new IvParameterSpec(c.getIV()); } @@ -131,8 +135,7 @@ public void main(Provider p) throws Exception { String wrapAlg = "AESWrap"; if (p.getService("Cipher", wrapAlg) == null) { - System.out.println("Skip, due to no support: " + wrapAlg); - return; + throw new SkippedException("No support " + wrapAlg); } String keyAlg = "AES"; From 3df27b24ede213a96406e1c39a11fab7c91c0257 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 10 Mar 2026 14:48:35 +0000 Subject: [PATCH 009/223] 8368866: compiler/codecache/stress/UnexpectedDeoptimizationTest.java intermittent timed out Backport-of: cc563c87cd277fbc96fb77af1e99f6c018ccc020 --- .../stress/UnexpectedDeoptimizationTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/hotspot/jtreg/compiler/codecache/stress/UnexpectedDeoptimizationTest.java b/test/hotspot/jtreg/compiler/codecache/stress/UnexpectedDeoptimizationTest.java index b3def9455c42..5ad047c826e6 100644 --- a/test/hotspot/jtreg/compiler/codecache/stress/UnexpectedDeoptimizationTest.java +++ b/test/hotspot/jtreg/compiler/codecache/stress/UnexpectedDeoptimizationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -31,26 +31,26 @@ * * @build jdk.test.whitebox.WhiteBox compiler.codecache.stress.Helper compiler.codecache.stress.TestCaseImpl * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * @run main/othervm/timeout=240 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI * -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method * -XX:-SegmentedCodeCache * compiler.codecache.stress.UnexpectedDeoptimizationTest - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * @run main/othervm/timeout=240 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI * -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method * -XX:+SegmentedCodeCache * compiler.codecache.stress.UnexpectedDeoptimizationTest - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * @run main/othervm/timeout=240 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI * -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method * -XX:-SegmentedCodeCache * -DhelperVirtualThread=true * compiler.codecache.stress.UnexpectedDeoptimizationTest - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * @run main/othervm/timeout=240 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI * -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method @@ -75,7 +75,7 @@ public static void main(String[] args) { public void run() { Helper.WHITE_BOX.deoptimizeFrames(rng.nextBoolean()); // Sleep a short while to allow the stacks to grow - otherwise - // we end up running almost all code in the interpreter + // we end up running almost all code in the interpreter try { Thread.sleep(10); } catch (Exception e) { From 4ed8c0c9bc25e1536a1b87ce993770ec20f76d9a Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 10 Mar 2026 14:51:10 +0000 Subject: [PATCH 010/223] 8286865: vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/Test.java fails with Out of space in CodeCache Backport-of: 1b11bea76ba29d1dfa414ad7e10693cf054bb96f --- .../meth/stress/jni/nativeAndMH/Test.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/Test.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/Test.java index c8264e8f9631..abb771e30e79 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, 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 @@ -33,6 +33,7 @@ * another method handle and so on. * The test verifies that arguments are correctly passed between native methods and MHs. * + * @requires vm.compMode != "Xcomp" * @library /vmTestbase * /test/lib * @@ -62,26 +63,32 @@ public class Test extends MultiThreadedTest { private static final String RETURN_VALUE = "test"; + private static final MethodType MT_calledFromNative = MethodType.methodType( + Object.class, + Object.class, Object.class, int.class, long.class, double.class, float.class); + + private static MethodHandle mh; + static { System.loadLibrary("nativeAndMH"); + try { + mh = MethodHandles.lookup().findStatic( + Test.class, + "calledFromNative", + MT_calledFromNative); + } catch (Exception ex) { + throw new RuntimeException("TEST FAILED - Unable to lookup \"calledFromNative\""); + } } private static native Object native01(Object a1, String a2, Object a3, Object a4, Object a5, Object a6, MethodHandle mh); - private static final MethodType MT_calledFromNative = MethodType.methodType( - Object.class, - Object.class, Object.class, int.class, long.class, double.class, float.class); - private static Object calledFromNative(Object s1, Object s2, int i, long l, double d, float f) { return RETURN_VALUE; } @Override protected boolean runThread(int threadNum) throws Throwable { - MethodHandle mh = MethodHandles.lookup().findStatic( - Test.class, - "calledFromNative", - MT_calledFromNative); Stresser stresser = createStresser(); stresser.start(1); From 415434e59c2389a3c8738532bed9185537361084 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 10 Mar 2026 14:51:32 +0000 Subject: [PATCH 011/223] 8365861: test/jdk/sun/security/pkcs11/Provider/ tests skipped without SkippedException Backport-of: 969eb1ce2419324582ee8d8108031323f82e125e --- .../security/pkcs11/Provider/Absolute.java | 9 +++++---- .../pkcs11/Provider/ConfigShortPath.java | 19 ++++++++++++------- .../security/pkcs11/Provider/LoginISE.java | 19 ++++++++++++------- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/test/jdk/sun/security/pkcs11/Provider/Absolute.java b/test/jdk/sun/security/pkcs11/Provider/Absolute.java index c298c076b30f..07a934030dbf 100644 --- a/test/jdk/sun/security/pkcs11/Provider/Absolute.java +++ b/test/jdk/sun/security/pkcs11/Provider/Absolute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, 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 @@ -28,6 +28,8 @@ * @summary load DLLs and launch executables using fully qualified path */ +import jtreg.SkippedException; + import java.security.InvalidParameterException; import java.security.Provider; @@ -40,12 +42,11 @@ public static void main(String[] args) throws Exception { try { Provider p = PKCS11Test.getSunPKCS11(config); if (p == null) { - System.out.println("Skipping test - no PKCS11 provider available"); + throw new SkippedException("Skipping test - no PKCS11 provider available"); } } catch (InvalidParameterException ipe) { Throwable ex = ipe.getCause(); - if (ex.getMessage().indexOf( - "Absolute path required for library value:") != -1) { + if (ex.getMessage().contains("Absolute path required for library value:")) { System.out.println("Test Passed: expected exception thrown"); } else { // rethrow diff --git a/test/jdk/sun/security/pkcs11/Provider/ConfigShortPath.java b/test/jdk/sun/security/pkcs11/Provider/ConfigShortPath.java index f229360f1afd..120f289d211b 100644 --- a/test/jdk/sun/security/pkcs11/Provider/ConfigShortPath.java +++ b/test/jdk/sun/security/pkcs11/Provider/ConfigShortPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, 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 @@ -25,11 +25,17 @@ * @bug 6581254 6986789 7196009 8062170 * @summary Allow '~', '+', and quoted paths in config file * @author Valerie Peng + * @library /test/lib */ -import java.security.*; -import java.io.*; -import java.lang.reflect.*; +import jtreg.SkippedException; + +import java.io.File; +import java.io.IOException; +import java.security.InvalidParameterException; +import java.security.Provider; +import java.security.ProviderException; +import java.security.Security; public class ConfigShortPath { @@ -43,8 +49,7 @@ public class ConfigShortPath { public static void main(String[] args) throws Exception { Provider p = Security.getProvider("SunPKCS11"); if (p == null) { - System.out.println("Skipping test - no PKCS11 provider available"); - return; + throw new SkippedException("Skipping test - no PKCS11 provider available"); } String osInfo = System.getProperty("os.name", ""); @@ -65,7 +70,7 @@ public static void main(String[] args) throws Exception { if (cause.getClass().getName().equals ("sun.security.pkcs11.ConfigurationException")) { // Error occurred during parsing - if (cause.getMessage().indexOf("Unexpected") != -1) { + if (cause.getMessage().contains("Unexpected")) { throw (ProviderException) cause; } } diff --git a/test/jdk/sun/security/pkcs11/Provider/LoginISE.java b/test/jdk/sun/security/pkcs11/Provider/LoginISE.java index 5027770c5e67..d131a8572164 100644 --- a/test/jdk/sun/security/pkcs11/Provider/LoginISE.java +++ b/test/jdk/sun/security/pkcs11/Provider/LoginISE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -21,16 +21,22 @@ * questions. */ -import java.io.*; -import java.util.*; -import java.security.*; -import javax.security.auth.callback.*; +import jtreg.SkippedException; + +import java.io.IOException; +import java.security.AuthProvider; +import java.security.Provider; +import java.security.Security; +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; /** * @test * @bug 8130648 * @summary make sure IllegalStateException is thrown for uninitialized * SunPKCS11 provider instance + * @library /test/lib */ public class LoginISE { @@ -38,8 +44,7 @@ public static void main(String[] args) throws Exception { Provider p = Security.getProvider("SunPKCS11"); if (p == null) { - System.out.println("No un-initialized PKCS11 provider available; skip"); - return; + throw new SkippedException("No un-initialized PKCS11 provider available; skip"); } if (!(p instanceof AuthProvider)) { throw new RuntimeException("Error: expect AuthProvider!"); From 35a542a7ab2523baa5f6fd14c09810632166bf5d Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 10 Mar 2026 14:51:56 +0000 Subject: [PATCH 012/223] 8360882: Tests throw SkippedException when they should fail Reviewed-by: phh Backport-of: 26b5708c47150023798a1546ba095c1b0b7807e1 --- test/jdk/sun/security/pkcs11/PKCS11Test.java | 7 +++- .../test/lib/artifacts/ArtifactResolver.java | 9 +++-- .../lib/security/OpensslArtifactFetcher.java | 35 ++++++++++--------- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/test/jdk/sun/security/pkcs11/PKCS11Test.java b/test/jdk/sun/security/pkcs11/PKCS11Test.java index c231791e9728..8e09a00b468e 100644 --- a/test/jdk/sun/security/pkcs11/PKCS11Test.java +++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java @@ -747,7 +747,12 @@ private static Path fetchNssLib(String osId, Path libraryName) throws IOExceptio } private static Path fetchNssLib(Class clazz, Path libraryName) throws IOException { - Path p = ArtifactResolver.fetchOne(clazz); + Path p; + try { + p = ArtifactResolver.fetchOne(clazz); + } catch (IOException exc) { + throw new SkippedException("Could not find NSS", exc); + } return findNSSLibrary(p, libraryName); } diff --git a/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java b/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java index 83e381356a08..fb67ce83bbe1 100644 --- a/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java +++ b/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java @@ -23,8 +23,7 @@ package jdk.test.lib.artifacts; -import jtreg.SkippedException; - +import java.io.IOException; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; @@ -90,15 +89,15 @@ public static Path resolve(String name, Map artifactDescription, * @return the local path to the artifact. If the artifact is a compressed * file that gets unpacked, this path will point to the root * directory of the uncompressed file(s). - * @throws SkippedException thrown if the artifact cannot be found + * @throws IOException thrown if the artifact cannot be found */ - public static Path fetchOne(Class klass) { + public static Path fetchOne(Class klass) throws IOException { try { return ArtifactResolver.resolve(klass).entrySet().stream() .findAny().get().getValue(); } catch (ArtifactResolverException e) { Artifact artifact = klass.getAnnotation(Artifact.class); - throw new SkippedException("Cannot find the artifact " + artifact.name(), e); + throw new IOException("Cannot find the artifact " + artifact.name(), e); } } diff --git a/test/lib/jdk/test/lib/security/OpensslArtifactFetcher.java b/test/lib/jdk/test/lib/security/OpensslArtifactFetcher.java index 88508f89587f..32041a93701a 100644 --- a/test/lib/jdk/test/lib/security/OpensslArtifactFetcher.java +++ b/test/lib/jdk/test/lib/security/OpensslArtifactFetcher.java @@ -23,6 +23,7 @@ package jdk.test.lib.security; +import java.io.IOException; import java.nio.file.Path; import jdk.test.lib.Platform; import jdk.test.lib.process.ProcessTools; @@ -49,42 +50,40 @@ public class OpensslArtifactFetcher { * * @return openssl binary path of the current version * @throws SkippedException if a valid version of OpenSSL cannot be found + * or if OpenSSL is not available on the target platform */ public static String getOpensslPath() { String path = getOpensslFromSystemProp(OPENSSL_BUNDLE_VERSION); if (path != null) { + System.out.println("Using OpenSSL from system property."); return path; } + path = getDefaultSystemOpensslPath(OPENSSL_BUNDLE_VERSION); if (path != null) { + System.out.println("Using OpenSSL from system."); return path; } + if (Platform.isX64()) { if (Platform.isLinux()) { - path = fetchOpenssl(LINUX_X64.class); + return fetchOpenssl(LINUX_X64.class); } else if (Platform.isOSX()) { - path = fetchOpenssl(MACOSX_X64.class); + return fetchOpenssl(MACOSX_X64.class); } else if (Platform.isWindows()) { - path = fetchOpenssl(WINDOWS_X64.class); + return fetchOpenssl(WINDOWS_X64.class); } } else if (Platform.isAArch64()) { if (Platform.isLinux()) { - path = fetchOpenssl(LINUX_AARCH64.class); + return fetchOpenssl(LINUX_AARCH64.class); } if (Platform.isOSX()) { - path = fetchOpenssl(MACOSX_AARCH64.class); + return fetchOpenssl(MACOSX_AARCH64.class); } } - if (!verifyOpensslVersion(path, OPENSSL_BUNDLE_VERSION)) { - String exMsg = "Can't find the version: " - + OpensslArtifactFetcher.getTestOpensslBundleVersion() - + " of openssl binary on this machine, please install" - + " and set openssl path with property 'test.openssl.path'"; - throw new SkippedException(exMsg); - } else { - return path; - } + throw new SkippedException(String.format("No OpenSSL %s found for %s/%s", + OPENSSL_BUNDLE_VERSION, Platform.getOsName(), Platform.getOsArch())); } private static String getOpensslFromSystemProp(String version) { @@ -120,9 +119,13 @@ private static boolean verifyOpensslVersion(String path, String version) { } private static String fetchOpenssl(Class clazz) { - return ArtifactResolver.fetchOne(clazz) - .resolve("openssl").resolve("bin").resolve("openssl") + try { + return ArtifactResolver.fetchOne(clazz) + .resolve("openssl").resolve("bin").resolve("openssl") .toString(); + } catch (IOException exc) { + throw new SkippedException("Could not find openssl", exc); + } } // retrieve the provider directory path from /bin/openssl From 8084a067b86d53ad0067d2bf62db22177aa745a4 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 10 Mar 2026 14:55:25 +0000 Subject: [PATCH 013/223] 8366182: Some PKCS11Tests are being skipped when they shouldn't Backport-of: cc9483b4da1a0f65f8773d0c7f35f2e6a7e1bd4f --- .../security/pkcs11/Cipher/TestKATForGCM.java | 13 ++- .../pkcs11/KeyStore/SecretKeysBasic.java | 17 ++-- test/jdk/sun/security/pkcs11/PKCS11Test.java | 79 +++++++++---------- .../pkcs11/Secmod/AddTrustedCert.java | 10 +-- .../pkcs11/Signature/TestDSAKeyLength.java | 18 +++-- test/jdk/sun/security/pkcs11/ec/TestECDH.java | 1 + 6 files changed, 73 insertions(+), 65 deletions(-) diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java b/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java index 95e6e5b1a0a8..fecf5813ceab 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java @@ -320,14 +320,19 @@ public void main(Provider p) throws Exception { System.out.println("Test Passed!"); } } catch (Exception e) { - System.out.println("Exception occured using " + p.getName() + " version " + p.getVersionStr()); + System.out.println("Exception occured using " + p.getName() + + " version " + p.getVersionStr()); if (isNSS(p)) { - double ver = getNSSInfo("nss"); + Version ver = getNSSInfo("nss"); String osName = System.getProperty("os.name"); - if (ver > 3.139 && ver < 3.15 && osName.equals("Linux")) { + + if (osName.equals("Linux") && + ver.major() == 3 && ver.minor() < 15 + && (ver.minor() > 13 && ver.patch() >= 9)) { // warn about buggy behaviour on Linux with nss 3.14 - System.out.println("Warning: old NSS " + ver + " might be problematic, consider upgrading it"); + System.out.println("Warning: old NSS " + ver + + " might be problematic, consider upgrading it"); } } throw e; diff --git a/test/jdk/sun/security/pkcs11/KeyStore/SecretKeysBasic.java b/test/jdk/sun/security/pkcs11/KeyStore/SecretKeysBasic.java index 4d876604c018..1ff80fcaf07f 100644 --- a/test/jdk/sun/security/pkcs11/KeyStore/SecretKeysBasic.java +++ b/test/jdk/sun/security/pkcs11/KeyStore/SecretKeysBasic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -116,11 +116,14 @@ private static boolean checkSecretKeyEntry(String alias, // A bug in NSS 3.12 (Mozilla bug 471665) causes AES key lengths // to be read incorrectly. Checking for improper 16 byte length // in key string. - if (isNSS(provider) && expected.getAlgorithm().equals("AES") && - (getNSSVersion() >= 3.12 && getNSSVersion() <= 3.122)) { - System.out.println("NSS 3.12 bug returns incorrect AES key "+ - "length breaking key storage. Aborting..."); - return true; + if (isNSS(provider) && expected.getAlgorithm().equals("AES")) { + Version version = getNSSVersion(); + if (version.major() == 3 && version.minor() == 12 + && version.patch() <= 2) { + System.out.println("NSS 3.12 bug returns incorrect AES key " + + "length breaking key storage. Aborting..."); + return true; + } } if (saveBeforeCheck) { @@ -168,7 +171,7 @@ private static void dumpKey(String info, SecretKey key) { private static void doTest() throws Exception { // Make sure both NSS libraries are the same version. if (isNSS(provider) && - (getLibsoftokn3Version() != getLibnss3Version())) { + (!getLibsoftokn3Version().equals(getLibnss3Version()))) { System.out.println("libsoftokn3 and libnss3 versions do not match. Aborting test..."); return; } diff --git a/test/jdk/sun/security/pkcs11/PKCS11Test.java b/test/jdk/sun/security/pkcs11/PKCS11Test.java index 8e09a00b468e..717d3823136c 100644 --- a/test/jdk/sun/security/pkcs11/PKCS11Test.java +++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java @@ -85,7 +85,7 @@ public abstract class PKCS11Test { private static final String NSS_BUNDLE_VERSION = "3.111"; private static final String NSSLIB = "jpg.tests.jdk.nsslib"; - static double nss_version = -1; + static Version nss_version = null; static ECCState nss_ecc_status = ECCState.Basic; // The NSS library we need to search for in getNSSLibDir() @@ -95,8 +95,8 @@ public abstract class PKCS11Test { // NSS versions of each library. It is simpler to keep nss_version // for quick checking for generic testing than many if-else statements. - static double softoken3_version = -1; - static double nss3_version = -1; + static Version softoken3_version = null; + static Version nss3_version = null; static Provider pkcs11 = newPKCS11Provider(); private static String PKCS11_BASE; private static Map osMap; @@ -271,13 +271,29 @@ private static String getOsId() { } static boolean isBadNSSVersion(Provider p) { - double nssVersion = getNSSVersion(); - if (isNSS(p) && nssVersion >= 3.11 && nssVersion < 3.12) { - System.out.println("NSS 3.11 has a DER issue that recent " + - "version do not, skipping"); - return true; + Version nssVersion = getNSSVersion(); + if (isNSS(p)) { + // bad version is just between [3.11,3.12) + return nssVersion.major == 3 && 11 == nssVersion.minor; + } else { + return false; } - return false; + } + + public record Version(int major, int minor, int patch) {} + + protected static Version parseVersionString(String version) { + String [] parts = version.split("\\."); + int major = Integer.parseInt(parts[0]); + int minor = 0; + int patch = 0; + if (parts.length >= 2) { + minor = Integer.parseInt(parts[1]); + } + if (parts.length >= 3) { + patch = Integer.parseInt(parts[2]); + } + return new Version(major, minor, patch); } protected static void safeReload(String lib) { @@ -306,26 +322,26 @@ public static boolean isNSS(Provider p) { return p.getName().equalsIgnoreCase("SUNPKCS11-NSS"); } - static double getNSSVersion() { - if (nss_version == -1) + static Version getNSSVersion() { + if (nss_version == null) getNSSInfo(); return nss_version; } static ECCState getNSSECC() { - if (nss_version == -1) + if (nss_version == null) getNSSInfo(); return nss_ecc_status; } - public static double getLibsoftokn3Version() { - if (softoken3_version == -1) + public static Version getLibsoftokn3Version() { + if (softoken3_version == null) return getNSSInfo("softokn3"); return softoken3_version; } - public static double getLibnss3Version() { - if (nss3_version == -1) + public static Version getLibnss3Version() { + if (nss3_version == null) return getNSSInfo("nss3"); return nss3_version; } @@ -340,7 +356,7 @@ static void getNSSInfo() { // $Header: NSS // Version: NSS // Here, stands for NSS version. - static double getNSSInfo(String library) { + static Version getNSSInfo(String library) { // look for two types of headers in NSS libraries String nssHeader1 = "$Header: NSS"; String nssHeader2 = "Version: NSS"; @@ -349,15 +365,15 @@ static double getNSSInfo(String library) { int i = 0; Path libfile = null; - if (library.compareTo("softokn3") == 0 && softoken3_version > -1) + if (library.compareTo("softokn3") == 0 && softoken3_version != null) return softoken3_version; - if (library.compareTo("nss3") == 0 && nss3_version > -1) + if (library.compareTo("nss3") == 0 && nss3_version != null) return nss3_version; try { libfile = getNSSLibPath(); if (libfile == null) { - return 0.0; + return parseVersionString("0.0"); } try (InputStream is = Files.newInputStream(libfile)) { byte[] data = new byte[1000]; @@ -393,7 +409,7 @@ static double getNSSInfo(String library) { if (!found) { System.out.println("lib" + library + " version not found, set to 0.0: " + libfile); - nss_version = 0.0; + nss_version = parseVersionString("0.0"); return nss_version; } @@ -406,26 +422,7 @@ static double getNSSInfo(String library) { version.append(c); } - // If a "dot dot" release, strip the extra dots for double parsing - String[] dot = version.toString().split("\\."); - if (dot.length > 2) { - version = new StringBuilder(dot[0] + "." + dot[1]); - for (int j = 2; dot.length > j; j++) { - version.append(dot[j]); - } - } - - // Convert to double for easier version value checking - try { - nss_version = Double.parseDouble(version.toString()); - } catch (NumberFormatException e) { - System.out.println("===== Content start ====="); - System.out.println(s); - System.out.println("===== Content end ====="); - System.out.println("Failed to parse lib" + library + - " version. Set to 0.0"); - e.printStackTrace(); - } + nss_version = parseVersionString(version.toString()); System.out.print("library: " + library + ", version: " + version + ". "); diff --git a/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java b/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java index 9792a80de8dc..d8619ef87675 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java +++ b/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -133,10 +133,10 @@ public static void main(String[] args) throws Exception { } private static boolean improperNSSVersion(Provider p) { - double nssVersion = getNSSVersion(); - if (p.getName().equalsIgnoreCase("SunPKCS11-NSSKeyStore") - && nssVersion >= 3.28 && nssVersion < 3.35) { - return true; + Version nssVersion = getNSSVersion(); + if (p.getName().equalsIgnoreCase("SunPKCS11-NSSKeyStore")) { + return nssVersion.major() == 3 && + (nssVersion.minor() >= 28 && nssVersion.minor() < 35); } return false; diff --git a/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java b/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java index d2515fa0f5a2..0ab17a31c5b0 100644 --- a/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java +++ b/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, 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,13 +48,15 @@ public static void main(String[] args) throws Exception { @Override protected boolean skipTest(Provider provider) { - double version = getNSSVersion(); - String[] versionStrs = Double.toString(version).split("\\."); - int major = Integer.parseInt(versionStrs[0]); - int minor = Integer.parseInt(versionStrs[1]); - if (isNSS(provider) && (version == 0.0 || (major >= 3 && minor >= 14))) { - System.out.println("Skip testing NSS " + version); - return true; + if (isNSS(provider)) { + Version version = getNSSVersion(); + if (version == null) { + return true; + } + if (version.major() >= 3 && version.minor() >= 14){ + System.out.println("Skip testing NSS " + version); + return true; + } } return false; diff --git a/test/jdk/sun/security/pkcs11/ec/TestECDH.java b/test/jdk/sun/security/pkcs11/ec/TestECDH.java index d2a45f3842db..cce51efbea25 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestECDH.java +++ b/test/jdk/sun/security/pkcs11/ec/TestECDH.java @@ -112,6 +112,7 @@ protected boolean skipTest(Provider p) { * PKCS11Test.main will remove this provider if needed */ Providers.setAt(p, 1); + System.out.println("Testing provider " + p.getName()); if (false) { KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", p); From 39318072517fa345d6eb076dd7f6cc6607a0c332 Mon Sep 17 00:00:00 2001 From: Min Choi Date: Tue, 10 Mar 2026 17:49:32 +0000 Subject: [PATCH 014/223] 8378802: [21u] backport changes to TKit.java by JDK-8352419 8375080: The tools/jpackage/windows/Win8365790Test.java may fail with ClassNotFoundException: jtreg.SkippedException Reviewed-by: phh Backport-of: 70e325004536eb9b79f4943f27eed4ac6cec8bd5 --- .../helpers/jdk/jpackage/test/TKit.java | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java index 70a727d157b3..626ebaf12641 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java @@ -41,6 +41,7 @@ import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; +import java.util.Base64; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -505,9 +506,9 @@ public static RuntimeException throwUnknownPlatformError() { public static RuntimeException throwSkippedException(String reason) { trace("Skip the test: " + reason); - RuntimeException ex = ThrowingSupplier.toSupplier( - () -> (RuntimeException) Class.forName("jtreg.SkippedException").getConstructor( - String.class).newInstance(reason)).get(); + RuntimeException ex = ThrowingSupplier.toSupplier(() -> { + return JtregSkippedExceptionClass.INSTANCE.getConstructor(String.class).newInstance(reason); + }).get(); currentTest.notifySkipped(ex); throw ex; @@ -1074,4 +1075,29 @@ static Set tokenizeConfigProperty(String propertyName) { VERBOSE_TEST_SETUP = isNonOf.test(Set.of("init", "i")); } } + + private static final class JtregSkippedExceptionClass extends ClassLoader { + @SuppressWarnings("unchecked") + JtregSkippedExceptionClass() { + super(TKit.class.getClassLoader()); + + final byte[] bytes = Base64.getDecoder().decode( + // Base64-encoded "jtreg/SkippedException.class" file + // emitted by jdk8's javac from "$OPEN_JDK/test/lib/jtreg/SkippedException.java" + "yv66vgAAADQAFQoABAARCgAEABIHABMHABQBABBzZXJpYWxWZXJzaW9uVUlEAQABSgEADUNvbnN0" + + "YW50VmFsdWUFErH6BHk+kr0BAAY8aW5pdD4BACooTGphdmEvbGFuZy9TdHJpbmc7TGphdmEvbGFu" + + "Zy9UaHJvd2FibGU7KVYBAARDb2RlAQAPTGluZU51bWJlclRhYmxlAQAVKExqYXZhL2xhbmcvU3Ry" + + "aW5nOylWAQAKU291cmNlRmlsZQEAFVNraXBwZWRFeGNlcHRpb24uamF2YQwACgALDAAKAA4BABZq" + + "dHJlZy9Ta2lwcGVkRXhjZXB0aW9uAQAaamF2YS9sYW5nL1J1bnRpbWVFeGNlcHRpb24AMQADAAQA" + + "AAABABoABQAGAAEABwAAAAIACAACAAEACgALAAEADAAAACMAAwADAAAAByorLLcAAbEAAAABAA0A" + + "AAAKAAIAAAAiAAYAIwABAAoADgABAAwAAAAiAAIAAgAAAAYqK7cAArEAAAABAA0AAAAKAAIAAAAm" + + "AAUAJwABAA8AAAACABA"); + + clazz = (Class)defineClass("jtreg.SkippedException", bytes, 0, bytes.length); + } + + private final Class clazz; + + static final Class INSTANCE = new JtregSkippedExceptionClass().clazz; + } } From 8585198d8fbf9f706d45a2f03af1c8fbc2591c0b Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 12 Mar 2026 13:14:00 +0000 Subject: [PATCH 015/223] 8341427: JFR: Adjust object sampler span handling Backport-of: 822a1554cb059580ab76bae7963827146b8f5aee --- .../leakprofiler/sampling/objectSampler.cpp | 28 +++++++++++++++---- .../leakprofiler/sampling/objectSampler.hpp | 1 + 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp index 311c54becd8e..465491cd1d5a 100644 --- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp +++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp @@ -236,12 +236,25 @@ void ObjectSampler::add(HeapWord* obj, size_t allocated, traceid thread_id, bool // quick reject, will not fit return; } - sample = _list->reuse(_priority_queue->pop()); + ObjectSample* popped = _priority_queue->pop(); + size_t popped_span = popped->span(); + ObjectSample* previous = popped->prev(); + sample = _list->reuse(popped); + assert(sample != nullptr, "invariant"); + if (previous != nullptr) { + push_span(previous, popped_span); + sample->set_span(span); + } else { + // The removed sample was the youngest sample in the list, which means the new sample is now the youngest + // sample. It should cover the spans of both. + sample->set_span(span + popped_span); + } } else { sample = _list->get(); + assert(sample != nullptr, "invariant"); + sample->set_span(span); } - assert(sample != nullptr, "invariant"); sample->set_thread_id(thread_id); if (virtual_thread) { sample->set_thread_is_virtual(); @@ -255,7 +268,6 @@ void ObjectSampler::add(HeapWord* obj, size_t allocated, traceid thread_id, bool sample->set_stack_trace_hash(stacktrace_hash); } - sample->set_span(allocated); sample->set_object(cast_to_oop(obj)); sample->set_allocated(allocated); sample->set_allocation_time(JfrTicks::now()); @@ -282,14 +294,18 @@ void ObjectSampler::remove_dead(ObjectSample* sample) { ObjectSample* const previous = sample->prev(); // push span onto previous if (previous != nullptr) { - _priority_queue->remove(previous); - previous->add_span(sample->span()); - _priority_queue->push(previous); + push_span(previous, sample->span()); } _priority_queue->remove(sample); _list->release(sample); } +void ObjectSampler::push_span(ObjectSample* sample, size_t span) { + _priority_queue->remove(sample); + sample->add_span(span); + _priority_queue->push(sample); +} + ObjectSample* ObjectSampler::last() const { return _list->last(); } diff --git a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.hpp b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.hpp index 3789227b6008..6ae1b0a06833 100644 --- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.hpp +++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.hpp @@ -64,6 +64,7 @@ class ObjectSampler : public CHeapObj { void add(HeapWord* object, size_t size, traceid thread_id, bool virtual_thread, const JfrBlobHandle& bh, JavaThread* thread); void scavenge(); void remove_dead(ObjectSample* sample); + void push_span(ObjectSample* sample, size_t span); const ObjectSample* item_at(int index) const; ObjectSample* item_at(int index); From d70e3989ad1f58a27243802a890cdbce7ff5933e Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 12 Mar 2026 13:16:49 +0000 Subject: [PATCH 016/223] 8357280: (bf) Remove @requires tags from java/nio/Buffer/LimitDirectMemory[NegativeTest].java Backport-of: 275cfd323b1b7b5e8927e7be2f229d200bac9980 --- test/jdk/java/nio/Buffer/LimitDirectMemory.java | 3 +-- test/jdk/java/nio/Buffer/LimitDirectMemoryNegativeTest.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/test/jdk/java/nio/Buffer/LimitDirectMemory.java b/test/jdk/java/nio/Buffer/LimitDirectMemory.java index 2116a20748dd..353044bc454a 100644 --- a/test/jdk/java/nio/Buffer/LimitDirectMemory.java +++ b/test/jdk/java/nio/Buffer/LimitDirectMemory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 4627316 6743526 * @summary Test option to limit direct memory allocation - * @requires (os.arch == "x86_64") | (os.arch == "amd64") | (os.arch == "aarch64") * @library /test/lib * * @summary Test: memory is properly limited using multiple buffers diff --git a/test/jdk/java/nio/Buffer/LimitDirectMemoryNegativeTest.java b/test/jdk/java/nio/Buffer/LimitDirectMemoryNegativeTest.java index 0d6666cc2e39..9b0fc9fec0d8 100644 --- a/test/jdk/java/nio/Buffer/LimitDirectMemoryNegativeTest.java +++ b/test/jdk/java/nio/Buffer/LimitDirectMemoryNegativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -26,7 +26,6 @@ * @bug 4627316 6743526 * @summary Test option to limit direct memory allocation, * various bad values fail to launch the VM - * @requires (os.arch == "x86_64") | (os.arch == "amd64") * @library /test/lib * @build jdk.test.lib.Utils * jdk.test.lib.Asserts From da867ae46c231761cce887318b1111dcbefadabc Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 12 Mar 2026 13:21:59 +0000 Subject: [PATCH 017/223] 8364190: JFR: RemoteRecordingStream withers don't work Backport-of: da0d9598d049b17c04da95b61214b093c97fb60e --- .../management/jfr/RemoteRecordingStream.java | 14 +- .../jfr/jmx/streaming/TestEnableDisable.java | 4 +- .../jdk/jfr/jmx/streaming/TestWithers.java | 141 ++++++++++++++++++ 3 files changed, 151 insertions(+), 8 deletions(-) create mode 100644 test/jdk/jdk/jfr/jmx/streaming/TestWithers.java diff --git a/src/jdk.management.jfr/share/classes/jdk/management/jfr/RemoteRecordingStream.java b/src/jdk.management.jfr/share/classes/jdk/management/jfr/RemoteRecordingStream.java index a4c35941081a..5a8927850863 100644 --- a/src/jdk.management.jfr/share/classes/jdk/management/jfr/RemoteRecordingStream.java +++ b/src/jdk.management.jfr/share/classes/jdk/management/jfr/RemoteRecordingStream.java @@ -101,10 +101,12 @@ static final class RemoteSettings implements EventSettingsModifier { private final FlightRecorderMXBean mbean; private final long recordingId; + private final String identifier; - RemoteSettings(FlightRecorderMXBean mbean, long recordingId) { + RemoteSettings(FlightRecorderMXBean mbean, long recordingId, String identifier) { this.mbean = mbean; this.recordingId = recordingId; + this.identifier = identifier; } @Override @@ -114,7 +116,7 @@ public void with(String name, String value) { // FlightRecorderMXBean implementation always returns // new instance of Map so no need to create new here. Map newSettings = getEventSettings(); - newSettings.put(name, value); + newSettings.put(identifier + "#" + name, value); mbean.setRecordingSettings(recordingId, newSettings); } @@ -356,9 +358,9 @@ public void setSettings(Map settings) { */ public EventSettings disable(String name) { Objects.requireNonNull(name, "name"); - EventSettings s = ManagementSupport.newEventSettings(new RemoteSettings(mbean, recordingId)); + EventSettings s = ManagementSupport.newEventSettings(new RemoteSettings(mbean, recordingId, name)); try { - return s.with(name + "#" + ENABLED, "false"); + return s.with(ENABLED, "false"); } catch (Exception e) { ManagementSupport.logDebug(e.getMessage()); close(); @@ -380,9 +382,9 @@ public EventSettings disable(String name) { */ public EventSettings enable(String name) { Objects.requireNonNull(name, "name"); - EventSettings s = ManagementSupport.newEventSettings(new RemoteSettings(mbean, recordingId)); + EventSettings s = ManagementSupport.newEventSettings(new RemoteSettings(mbean, recordingId, name)); try { - return s.with(name + "#" + ENABLED, "true"); + return s.with(ENABLED, "true"); } catch (Exception e) { ManagementSupport.logDebug(e.getMessage()); close(); diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java b/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java index 6a07c57ff787..62d22c821713 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -36,7 +36,7 @@ /** * @test * @key jfr - * @summary Tests that event settings for a RemoteRecordingStream can be changed + * @summary Tests that the enabled setting can be configured for a RemoteRecordingStream * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.streaming.TestEnableDisable diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestWithers.java b/test/jdk/jdk/jfr/jmx/streaming/TestWithers.java new file mode 100644 index 000000000000..933337ef76b9 --- /dev/null +++ b/test/jdk/jdk/jfr/jmx/streaming/TestWithers.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2025, 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. + */ +package jdk.jfr.jmx.streaming; + +import java.lang.management.ManagementFactory; +import java.time.Duration; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import java.util.function.Consumer; +import java.util.function.Predicate; + +import javax.management.MBeanServerConnection; + +import jdk.jfr.Event; +import jdk.jfr.EventSettings; +import jdk.jfr.FlightRecorder; +import jdk.jfr.Name; +import jdk.jfr.Period; +import jdk.jfr.StackTrace; +import jdk.jfr.Threshold; +import jdk.jfr.consumer.RecordedEvent; +import jdk.jfr.consumer.RecordedStackTrace; +import jdk.management.jfr.RemoteRecordingStream; + +/** + * @test + * @requires vm.flagless + * @summary Tests that event settings for a RemoteRecordingStream can be changed + * @requires vm.hasJFR + * @library /test/lib /test/jdk + * @run main/othervm jdk.jfr.jmx.streaming.TestWithers + */ +public class TestWithers { + private static final Set RESULT = Collections.synchronizedSet(new HashSet<>()); + + @Name("AA") + @StackTrace(false) + static class A extends Event { + } + + @Name("BB") + @StackTrace(true) + static class B extends Event { + } + + @Name("CC") + @Threshold("10 h") + static class C extends Event { + } + + @Name("DD") + @Threshold("10 h") + static class D extends Event { + } + + @Name("EE") + @StackTrace(false) + static class E extends Event { + } + + @Name("FF") + @Period("10 h") + static class F extends Event { + } + + public static void main(String... args) throws Exception { + MBeanServerConnection conn = ManagementFactory.getPlatformMBeanServer(); + try (RemoteRecordingStream stream = new RemoteRecordingStream(conn)) { + addCheck(stream, es -> es.withStackTrace(), "AA", TestWithers::hasStackTrace); + addCheck(stream, es -> es.withoutStackTrace(), "BB", e -> !hasStackTrace(e)); + addCheck(stream, es -> es.withThreshold(Duration.ofMillis(0)), "CC", e -> true); + addCheck(stream, es -> es.withoutThreshold(), "DD", e -> true); + addCheck(stream, es -> es.with("stackTrace", "true"), "EE", TestWithers::hasStackTrace); + addCheck(stream, es -> es.withPeriod(Duration.ofMillis(700)), "FF", e -> true); + FlightRecorder.addPeriodicEvent(F.class, () -> { + F f = new F(); + f.commit(); + }); + stream.onFlush(() -> { + System.out.println(RESULT); + if (RESULT.size() == 6) { + stream.close(); + } + }); + + stream.startAsync(); + A a = new A(); + a.commit(); + + B b = new B(); + b.commit(); + + C c = new C(); + c.commit(); + + D d = new D(); + d.commit(); + + E e = new E(); + e.commit(); + + stream.awaitTermination(); + } + } + + private static void addCheck(RemoteRecordingStream stream, Consumer es, String eventName, Predicate validator) { + es.accept(stream.enable(eventName)); + stream.onEvent(eventName, e -> { + System.out.println(e); + if (validator.test(e)) { + RESULT.add(eventName); + } + }); + } + + private static boolean hasStackTrace(RecordedEvent e) { + RecordedStackTrace rs = e.getStackTrace(); + return rs != null && !rs.getFrames().isEmpty(); + } +} \ No newline at end of file From c280d9789bdc8441978febf28f3cb7a8dcef6aa3 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 12 Mar 2026 13:24:14 +0000 Subject: [PATCH 018/223] 8365379: SU3.applyInsets may produce wrong results Backport-of: 4b544f93ad0e2beae4c80e060cae727d143151ac --- .../com/sun/java/swing/SwingUtilities3.java | 10 ++- .../swing/plaf/basic/BasicMenuItemUI.java | 6 +- .../swing/plaf/synth/SynthGraphicsUtils.java | 14 +--- .../SwingUtilities3/ApplyInsetsTest.java | 65 +++++++++++++++++++ 4 files changed, 76 insertions(+), 19 deletions(-) create mode 100644 test/jdk/com/sun/java/swing/SwingUtilities3/ApplyInsetsTest.java diff --git a/src/java.desktop/share/classes/com/sun/java/swing/SwingUtilities3.java b/src/java.desktop/share/classes/com/sun/java/swing/SwingUtilities3.java index dffc0c8f2cd9..91bf0edc5479 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/SwingUtilities3.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/SwingUtilities3.java @@ -152,11 +152,15 @@ public static RepaintManager getDelegateRepaintManager(Component } public static void applyInsets(Rectangle rect, Insets insets) { + applyInsets(rect, insets, true); + } + + public static void applyInsets(Rectangle rect, Insets insets, boolean leftToRight) { if (insets != null) { - rect.x += insets.left; + rect.x += leftToRight ? insets.left : insets.right; rect.y += insets.top; - rect.width -= (insets.right + rect.x); - rect.height -= (insets.bottom + rect.y); + rect.width -= (insets.left + insets.right); + rect.height -= (insets.top + insets.bottom); } } diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java index d361906b291f..348d58bab212 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java @@ -682,7 +682,7 @@ protected void paintMenuItem(Graphics g, JComponent c, g.setFont(mi.getFont()); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); - applyInsets(viewRect, mi.getInsets()); + SwingUtilities3.applyInsets(viewRect, mi.getInsets()); MenuItemLayoutHelper lh = new MenuItemLayoutHelper(mi, checkIcon, arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, @@ -741,10 +741,6 @@ private void paintArrowIcon(Graphics g, MenuItemLayoutHelper lh, SwingUtilities3.paintArrowIcon(g, lh, lr, foreground); } - private void applyInsets(Rectangle rect, Insets insets) { - SwingUtilities3.applyInsets(rect, insets); - } - /** * Draws the background of the menu item. * diff --git a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java index 487a90d51199..374e8b6473b0 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -41,6 +41,7 @@ import javax.swing.plaf.basic.BasicHTML; import javax.swing.text.View; +import com.sun.java.swing.SwingUtilities3; import sun.swing.MenuItemLayoutHelper; import sun.swing.SwingUtilities2; @@ -552,15 +553,6 @@ static Dimension getPreferredMenuItemSize(SynthContext context, return result; } - static void applyInsets(Rectangle rect, Insets insets, boolean leftToRight) { - if (insets != null) { - rect.x += (leftToRight ? insets.left : insets.right); - rect.y += insets.top; - rect.width -= (leftToRight ? insets.right : insets.left) + rect.x; - rect.height -= (insets.bottom + rect.y); - } - } - static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) { @@ -570,7 +562,7 @@ static void paint(SynthContext context, SynthContext accContext, Graphics g, Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi); - applyInsets(viewRect, mi.getInsets(), leftToRight); + SwingUtilities3.applyInsets(viewRect, mi.getInsets(), leftToRight); SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper( context, accContext, mi, checkIcon, arrowIcon, viewRect, diff --git a/test/jdk/com/sun/java/swing/SwingUtilities3/ApplyInsetsTest.java b/test/jdk/com/sun/java/swing/SwingUtilities3/ApplyInsetsTest.java new file mode 100644 index 000000000000..047eaff66d4a --- /dev/null +++ b/test/jdk/com/sun/java/swing/SwingUtilities3/ApplyInsetsTest.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2025, 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.awt.Insets; +import java.awt.Rectangle; + +import com.sun.java.swing.SwingUtilities3; + +/* + * @test + * @bug 8365379 + * @summary Verify SwingUtilities3 insets return correct result + * independent of initial values + * @modules java.desktop/com.sun.java.swing + * @run main ApplyInsetsTest + */ + +public class ApplyInsetsTest { + public static void main(String[] args) { + Rectangle rect = new Rectangle(10, 20, 60, 60); + Insets insets = new Insets(5, 10, 15, 20); + Rectangle expected = + new Rectangle(rect.x + insets.left, + rect.y + insets.top, + rect.width - (insets.left + insets.right), + rect.height - (insets.top + insets.bottom)); + + SwingUtilities3.applyInsets(rect, insets); + if (!rect.equals(expected)) { + throw new RuntimeException("Test failed: expected " + expected + + " but got " + rect); + } + + // Right to left test + rect.setRect(10, 20, 60, 60); + expected.x = rect.x + insets.right; + SwingUtilities3.applyInsets(rect, insets, false); + if (!rect.equals(expected)) { + throw new RuntimeException("Right to left test failed: expected " + + expected + " but got " + rect); + } + + System.out.println("Test passed."); + } +} From 6f8efdf109d73003406146897083dd78ed7a65f3 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 12 Mar 2026 13:26:25 +0000 Subject: [PATCH 019/223] 8365625: Can't change accelerator colors in Windows L&F Backport-of: a1302e5fbc1e1b41bc0b334c2502e487fa42209f --- .../windows/WindowsCheckBoxMenuItemUI.java | 17 +- .../swing/plaf/windows/WindowsMenuItemUI.java | 46 ++--- .../swing/plaf/windows/WindowsMenuUI.java | 20 +- .../windows/WindowsRadioButtonMenuItemUI.java | 17 +- .../MenuItem/MenuItemAcceleratorColor.java | 193 ++++++++++++++++++ 5 files changed, 236 insertions(+), 57 deletions(-) create mode 100644 test/jdk/com/sun/java/swing/plaf/windows/MenuItem/MenuItemAcceleratorColor.java diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java index dbc913582f2a..7cb43a5ea54d 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java @@ -73,19 +73,20 @@ protected void paintBackground(Graphics g, JMenuItem menuItem, super.paintBackground(g, menuItem, bgColor); } - /** - * Paint MenuItem. - */ + @Override protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap) { if (WindowsMenuItemUI.isVistaPainting()) { - WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, - arrowIcon, background, foreground, - disabledForeground, acceleratorSelectionForeground, - acceleratorForeground, defaultTextIconGap, - menuItem, getPropertyPrefix()); + WindowsMenuItemUI.paintMenuItem(accessor, g, c, + checkIcon, arrowIcon, + background, foreground, + disabledForeground, + acceleratorSelectionForeground, + acceleratorForeground, + defaultTextIconGap, + menuItem, getPropertyPrefix()); return; } super.paintMenuItem(g, c, checkIcon, arrowIcon, background, diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java index 0fa284294e27..6578ed921e7e 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java @@ -29,16 +29,11 @@ import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; -import java.awt.Insets; import java.awt.Rectangle; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.util.Enumeration; -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; import javax.swing.ButtonModel; -import javax.swing.DefaultButtonModel; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JMenu; @@ -129,27 +124,6 @@ public void propertyChange(PropertyChangeEvent e) { menuItem.addPropertyChangeListener(changeListener); } - protected void installDefaults() { - super.installDefaults(); - String prefix = getPropertyPrefix(); - - if (acceleratorSelectionForeground == null || - acceleratorSelectionForeground instanceof UIResource) { - acceleratorSelectionForeground = - UIManager.getColor(prefix + ".acceleratorSelectionForeground"); - } - if (acceleratorForeground == null || - acceleratorForeground instanceof UIResource) { - acceleratorForeground = - UIManager.getColor(prefix + ".acceleratorForeground"); - } - if (disabledForeground == null || - disabledForeground instanceof UIResource) { - disabledForeground = - UIManager.getColor(prefix + ".disabledForeground"); - } - } - /** * {@inheritDoc} */ @@ -162,15 +136,19 @@ protected void uninstallListeners() { changeListener = null; } + @Override protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap) { if (WindowsMenuItemUI.isVistaPainting()) { - WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, - arrowIcon, background, foreground, - disabledForeground, acceleratorSelectionForeground, - acceleratorForeground, defaultTextIconGap, menuItem, + WindowsMenuItemUI.paintMenuItem(accessor, g, c, + checkIcon, arrowIcon, + background, foreground, + disabledForeground, + acceleratorSelectionForeground, + acceleratorForeground, + defaultTextIconGap, menuItem, getPropertyPrefix()); return; } @@ -179,12 +157,16 @@ protected void paintMenuItem(Graphics g, JComponent c, } static void paintMenuItem(WindowsMenuItemUIAccessor accessor, Graphics g, - JComponent c, Icon checkIcon, Icon arrowIcon, + JComponent c, + Icon checkIcon, Icon arrowIcon, Color background, Color foreground, Color disabledForeground, Color acceleratorSelectionForeground, Color acceleratorForeground, - int defaultTextIconGap, JMenuItem menuItem, String prefix) { + int defaultTextIconGap, JMenuItem menuItem, + String prefix) { + assert c == menuItem : "menuItem passed as 'c' must be the same"; + // Save original graphics font and color Font holdf = g.getFont(); Color holdc = g.getColor(); diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java index d2d07fd79502..d4e1d1a95301 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java @@ -127,18 +127,20 @@ protected void installDefaults() { hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true; } - /** - * Paint MenuItem. - */ + @Override protected void paintMenuItem(Graphics g, JComponent c, - Icon checkIcon, Icon arrowIcon, - Color background, Color foreground, - int defaultTextIconGap) { + Icon checkIcon, Icon arrowIcon, + Color background, Color foreground, + int defaultTextIconGap) { + assert c == menuItem : "menuItem passed as 'c' must be the same"; if (WindowsMenuItemUI.isVistaPainting()) { - WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, arrowIcon, + WindowsMenuItemUI.paintMenuItem(accessor, g, c, + checkIcon, arrowIcon, background, foreground, - disabledForeground, acceleratorSelectionForeground, - acceleratorForeground, defaultTextIconGap, menuItem, + disabledForeground, + acceleratorSelectionForeground, + acceleratorForeground, + defaultTextIconGap, menuItem, getPropertyPrefix()); return; } diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java index 4ca4517638a1..31ed16c77a21 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java @@ -73,19 +73,20 @@ protected void paintBackground(Graphics g, JMenuItem menuItem, super.paintBackground(g, menuItem, bgColor); } - /** - * Paint MenuItem. - */ + @Override protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap) { if (WindowsMenuItemUI.isVistaPainting()) { - WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, - arrowIcon, background, foreground, - disabledForeground, acceleratorSelectionForeground, - acceleratorForeground, defaultTextIconGap, - menuItem, getPropertyPrefix()); + WindowsMenuItemUI.paintMenuItem(accessor, g, c, + checkIcon, arrowIcon, + background, foreground, + disabledForeground, + acceleratorSelectionForeground, + acceleratorForeground, + defaultTextIconGap, + menuItem, getPropertyPrefix()); return; } super.paintMenuItem(g, c, checkIcon, arrowIcon, background, diff --git a/test/jdk/com/sun/java/swing/plaf/windows/MenuItem/MenuItemAcceleratorColor.java b/test/jdk/com/sun/java/swing/plaf/windows/MenuItem/MenuItemAcceleratorColor.java new file mode 100644 index 000000000000..f098be4fdbd6 --- /dev/null +++ b/test/jdk/com/sun/java/swing/plaf/windows/MenuItem/MenuItemAcceleratorColor.java @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2025, 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.awt.BorderLayout; +import java.awt.Color; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; + +import javax.swing.Box; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.KeyStroke; +import javax.swing.UIManager; + +import static javax.swing.BorderFactory.createEmptyBorder; + +/* + * @test id=windows + * @bug 8348760 8365375 8365389 8365625 + * @requires (os.family == "windows") + * @summary Verify that Windows Look & Feel allows changing + * accelerator colors + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuItemAcceleratorColor + */ + +/* + * @test id=classic + * @bug 8348760 8365375 8365389 8365625 + * @requires (os.family == "windows") + * @summary Verify that Windows Classic Look & Feel allows changing + * accelerator colors + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuItemAcceleratorColor classic + */ +public final class MenuItemAcceleratorColor { + private static final String INSTRUCTIONS = + "Click the Menu to open it.\n" + + "\n" + + "Verify that the first and the last menu items render " + + "their accelerators using the default colors, the color " + + "should match that of the menu item itself in regular and " + + "selected states.\n" + + "\n" + + "Verify that the second menu item renders its accelerator " + + "with green and that the color changes to red when selected.\n" + + "\n" + + "Verify that the third menu item renders its accelerator " + + "with magenta and yellow correspondingly.\n" + + "\n" + + "Verify that only the fifth menu item renders its accelerator " + + "with blue; both the fourth and sixth should render their " + + "accelerator with a shade of gray.\n" + + "\n" + + "If the above conditions are satisfied, press the Pass button; " + + "otherwise, press the Fail button."; + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel((args.length > 0 && "classic".equals(args[0])) + ? "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel" + : "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .rows(20) + .columns(60) + .testUI(MenuItemAcceleratorColor::createUI) + .build() + .awaitAndCheck(); + } + + private static Box createInfoPanel() { + Box box = Box.createVerticalBox(); + box.add(new JLabel("Look and Feel: " + + UIManager.getLookAndFeel() + .getName())); + box.add(new JLabel("Java version: " + + System.getProperty("java.runtime.version"))); + return box; + } + + private static JFrame createUI() { + JPanel content = new JPanel(new BorderLayout()); + content.setBorder(createEmptyBorder(8, 8, 8, 8)); + content.add(createInfoPanel(), + BorderLayout.SOUTH); + + JFrame frame = new JFrame("Accelerator colors in Windows L&F"); + frame.setJMenuBar(createMenuBar()); + frame.add(content, BorderLayout.CENTER); + frame.setSize(350, 370); + return frame; + } + + private static JMenuBar createMenuBar() { + JMenuItem first = new JMenuItem("First menu item"); + first.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, + InputEvent.CTRL_DOWN_MASK)); + + // Modify colors for accelerator rendering + Color acceleratorForeground = UIManager.getColor("MenuItem.acceleratorForeground"); + Color acceleratorSelectionForeground = UIManager.getColor("MenuItem.acceleratorSelectionForeground"); + UIManager.put("MenuItem.acceleratorForeground", Color.GREEN); + UIManager.put("MenuItem.acceleratorSelectionForeground", Color.RED); + + JMenuItem second = new JMenuItem("Second menu item"); + second.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, + InputEvent.SHIFT_DOWN_MASK + | InputEvent.CTRL_DOWN_MASK)); + + UIManager.put("MenuItem.acceleratorForeground", Color.MAGENTA); + UIManager.put("MenuItem.acceleratorSelectionForeground", Color.YELLOW); + JMenuItem third = new JMenuItem("Third menu item"); + third.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, + InputEvent.ALT_DOWN_MASK)); + + // Restore colors + UIManager.put("MenuItem.acceleratorForeground", acceleratorForeground); + UIManager.put("MenuItem.acceleratorSelectionForeground", acceleratorSelectionForeground); + + + // Disabled foreground + JMenuItem fourth = new JMenuItem("Fourth menu item"); + fourth.setEnabled(false); + fourth.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, + InputEvent.CTRL_DOWN_MASK)); + + Color disabledForeground = UIManager.getColor("MenuItem.disabledForeground"); + UIManager.put("MenuItem.disabledForeground", Color.BLUE); + + JMenuItem fifth = new JMenuItem("Fifth menu item"); + fifth.setEnabled(false); + fifth.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, + InputEvent.CTRL_DOWN_MASK + | InputEvent.SHIFT_DOWN_MASK)); + + // Restore disabled foreground + UIManager.put("MenuItem.disabledForeground", disabledForeground); + + JMenuItem sixth = new JMenuItem("Sixth menu item"); + sixth.setEnabled(false); + sixth.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, + InputEvent.CTRL_DOWN_MASK + | InputEvent.ALT_DOWN_MASK)); + + + JMenuItem quit = new JMenuItem("Quit"); + quit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, + InputEvent.CTRL_DOWN_MASK)); + + JMenu menu = new JMenu("Menu"); + menu.add(first); + menu.add(second); + menu.add(third); + menu.addSeparator(); + menu.add(fourth); + menu.add(fifth); + menu.add(sixth); + menu.addSeparator(); + menu.add(quit); + + JMenuBar menuBar = new JMenuBar(); + menuBar.add(menu); + + return menuBar; + } +} From ae1f6e9d4ff43787a1c91d9d2141ce81f112cfb3 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 12 Mar 2026 13:28:51 +0000 Subject: [PATCH 020/223] 8373650: Test "javax/swing/JMenuItem/6458123/ManualBug6458123.java" fails because the check icons are not aligned properly as expected Backport-of: e45f5656bc90421c9acb0cbf87164162039ddf81 --- .../plaf/windows/WindowsIconFactory.java | 44 +++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java index 3fc04bb93b98..417f2ab1898b 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, 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 @@ -873,10 +873,46 @@ public void paintIcon(Component c, Graphics g, int x, int y) { XPStyle xp = XPStyle.getXP(); if (xp != null) { Skin skin = xp.getSkin(c, part); - if (icon == null || icon.getIconHeight() <= 16) { - skin.paintSkin(g, x + OFFSET, y + OFFSET, state); + if (WindowsGraphicsUtils.isLeftToRight(c)) { + if (icon == null || icon.getIconHeight() <= 16) { + skin.paintSkin(g, x + OFFSET, y + OFFSET, state); + } else { + skin.paintSkin(g, x + OFFSET, y + icon.getIconHeight() / 2, state); + } } else { - skin.paintSkin(g, x + OFFSET, y + icon.getIconHeight() / 2, state); + if (icon == null) { + skin.paintSkin(g, x + 4 * OFFSET, y + OFFSET, state); + } else { + int ycoord = (icon.getIconHeight() <= 16) + ? y + OFFSET + : (y + icon.getIconHeight() / 2); + if (icon.getIconWidth() <= 8) { + skin.paintSkin(g, x + OFFSET, ycoord, state); + } else if (icon.getIconWidth() <= 16) { + if (menuItem.getText().isEmpty()) { + skin.paintSkin(g, + (menuItem.getAccelerator() != null) + ? (x + 2 * OFFSET) : (x + 3 * OFFSET), + ycoord, state); + } else { + skin.paintSkin(g, + (type == JRadioButtonMenuItem.class) + ? (x + 4 * OFFSET) : (x + 3 * OFFSET), + ycoord, state); + } + } else { + if (menuItem.getText().isEmpty() + || menuItem.getAccelerator() != null) { + skin.paintSkin(g, + (type == JRadioButtonMenuItem.class) + ? (x + 3 * OFFSET) : (x + 4 * OFFSET), + ycoord, state); + } else { + skin.paintSkin(g, x + 7 * OFFSET, + ycoord, state); + } + } + } } } } From ef145aca5a46ae1a58dc4fdd11d450d6369fd950 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 12 Mar 2026 13:31:25 +0000 Subject: [PATCH 021/223] 8374506: Incorrect positioning of arrow icon in parent JMenu in Windows L&F Backport-of: 9a10cceeafa5d332aa571f0d62acf50032a597d4 --- .../swing/plaf/windows/WindowsMenuItemUI.java | 11 ++- .../LargeMenuTextArrowIconPosition.java | 92 +++++++++++++++++++ 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 test/jdk/javax/swing/JMenuItem/LargeMenuTextArrowIconPosition.java diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java index 6578ed921e7e..de9a5afa547e 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, 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 @@ -234,6 +234,15 @@ static void paintMenuItem(WindowsMenuItemUIAccessor accessor, Graphics g, SwingUtilities3.paintAccText(g, lh, lr, disabledForeground, acceleratorSelectionForeground, acceleratorForeground); + if (lh.getCheckIcon() != null && lh.useCheckAndArrow()) { + Rectangle rect = lr.getArrowRect(); + if (menuItem.getComponentOrientation().isLeftToRight()) { + rect.x += lh.getAfterCheckIconGap(); + } else { + rect.x -= lh.getAfterCheckIconGap(); + } + lr.setArrowRect(rect); + } SwingUtilities3.paintArrowIcon(g, lh, lr, foreground); // Restore original graphics font and color diff --git a/test/jdk/javax/swing/JMenuItem/LargeMenuTextArrowIconPosition.java b/test/jdk/javax/swing/JMenuItem/LargeMenuTextArrowIconPosition.java new file mode 100644 index 000000000000..72512560cffa --- /dev/null +++ b/test/jdk/javax/swing/JMenuItem/LargeMenuTextArrowIconPosition.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2026, 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 8374506 + * @summary Verify if arrow icon positioning is correct in + * parent JMenu in Windows L&F + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual LargeMenuTextArrowIconPosition + */ + +import java.awt.BorderLayout; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.UIManager; + +public class LargeMenuTextArrowIconPosition { + + private static final String INSTRUCTIONS = """ + A frame will be shown with a label. + Right click on the label. + + Check the arrow icon at the end of + "Really long Menu-Text" text. + If it overlaps with the menu text, + press Fail else press Pass."""; + + public static void main(String[] args) throws Throwable { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(LargeMenuTextArrowIconPosition::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + + JFrame frame = new JFrame("LargeMenuTextArrowIcon"); + frame.setSize(300, 150); + frame.setLayout(new BorderLayout()); + + JPopupMenu popupMenu = new JPopupMenu(); + popupMenu.add(new JCheckBoxMenuItem("CheckBox On", true)); + popupMenu.add(new JCheckBoxMenuItem("CheckBox Icon On", + UIManager.getIcon("FileView.floppyDriveIcon"), true)); + popupMenu.add(new JCheckBoxMenuItem("CheckBox Icon Off", + UIManager.getIcon("FileView.floppyDriveIcon"), false)); + + JMenu menu = new JMenu("Really long Menu-Text"); + menu.add(new JMenuItem("Sub-MenuItem")); + menu.add(new JCheckBoxMenuItem("Sub-CheckBox On", true)); + + popupMenu.add(menu); + + JLabel lbl = new JLabel("Right click to invoke popupMenu"); + lbl.setComponentPopupMenu(popupMenu); + frame.add(lbl, BorderLayout.CENTER); + + return frame; + } + +} From 917d67e469612ba4f2a1406e6121cdc9cdc1b969 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Thu, 12 Mar 2026 15:06:42 +0000 Subject: [PATCH 022/223] 8369335: Two sun/java2d/OpenGL tests fail on Windows after JDK-8358058 Backport-of: d6ca382f4ee5793dfa191bba694a7fef88c591fc --- test/jdk/sun/java2d/OpenGL/OpaqueDest.java | 30 +++++++++++-------- .../jdk/sun/java2d/OpenGL/ScaleParamsOOB.java | 28 ++++++++++++----- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/test/jdk/sun/java2d/OpenGL/OpaqueDest.java b/test/jdk/sun/java2d/OpenGL/OpaqueDest.java index 508963161090..397d516f9ae3 100644 --- a/test/jdk/sun/java2d/OpenGL/OpaqueDest.java +++ b/test/jdk/sun/java2d/OpenGL/OpaqueDest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 6277977 6319663 + * @bug 6277977 6319663 8369335 * @key headful * @requires (os.family != "mac") * @summary Verifies that blending operations do not inadvertantly leave @@ -71,6 +71,7 @@ public class OpaqueDest extends Canvas { private static volatile Frame frame; private static volatile OpaqueDest test; + private static final int W = 100, H = 100; public void paint(Graphics g) { @@ -93,7 +94,7 @@ public void paint(Graphics g) { } public Dimension getPreferredSize() { - return new Dimension(100, 100); + return new Dimension(W, H); } static void createUI() { @@ -124,7 +125,7 @@ public static void main(String[] args) throws Exception { return; } Point pt1 = test.getLocationOnScreen(); - Rectangle rect = new Rectangle(pt1.x, pt1.y, 100, 100); + Rectangle rect = new Rectangle(pt1.x, pt1.y, W, H); capture = robot.createScreenCapture(rect); } finally { if (frame != null) { @@ -134,18 +135,23 @@ public static void main(String[] args) throws Exception { // Test all pixels (every one should be red) - for (int y = 0; y < 100; y++) { - for (int x = 0; x < 100; x++) { + for (int y = 0; y < W; y++) { + for (int x = 0; x < H; x++) { int actual = capture.getRGB(x, y); int expected = 0xffff0000; if (!similar(actual, expected)) { - saveImage(capture); - throw new RuntimeException("Test failed at x="+x+" y="+y+ - " (expected="+ - Integer.toHexString(expected) + - " actual="+ - Integer.toHexString(actual) + - ")"); + String msg = "Test failed at x="+x+" y="+y+ + " (expected="+ + Integer.toHexString(expected) + + " actual="+ + Integer.toHexString(actual) + + ")"; + if ( ( x== 0) || ( x == W) || ( y == 0) || ( y == H)) { + System.err.println(msg); + } else { + saveImage(capture); + throw new RuntimeException(msg); + } } } } diff --git a/test/jdk/sun/java2d/OpenGL/ScaleParamsOOB.java b/test/jdk/sun/java2d/OpenGL/ScaleParamsOOB.java index b3d866cfd757..acb5e41ce6f6 100644 --- a/test/jdk/sun/java2d/OpenGL/ScaleParamsOOB.java +++ b/test/jdk/sun/java2d/OpenGL/ScaleParamsOOB.java @@ -23,7 +23,7 @@ /* * @test - * @bug 5104584 8237244 + * @bug 5104584 8237244 8369335 * @key headful * @requires (os.family != "mac") * @summary Verifies that scaling an image works properly when the @@ -105,6 +105,11 @@ private static void testRegion(BufferedImage bi, int x2 = x1 + wholeRegion.width; int y2 = y1 + wholeRegion.height; + int ax1 = affectedRegion.x; + int ay1 = affectedRegion.y; + int ax2 = ax1 + affectedRegion.width; + int ay2 = ay1 + affectedRegion.height; + for (int y = y1; y < y2; y++) { for (int x = x1; x < x2; x++) { int actual = bi.getRGB(x, y); @@ -128,13 +133,20 @@ private static void testRegion(BufferedImage bi, (Math.abs(red - standardRed) > TOLERANCE) || (Math.abs(green - standardGreen) > TOLERANCE) || (Math.abs(blue - standardBlue) > TOLERANCE)) { - saveImage(bi); - throw new RuntimeException("Test failed at x="+x+" y="+y+ - " (expected="+ - Integer.toHexString(expected) + - " actual="+ - Integer.toHexString(actual) + - ")"); + + String msg = ("Test failed at x="+x+" y="+y+ + " (expected="+ + Integer.toHexString(expected) + + " actual="+ + Integer.toHexString(actual) + + ")"); + // log edge pixel differences, but don't fail the test. + if ((x == ax1) || (x == ax2) || (y == ay1) || (y == ay2)) { + System.err.println(msg); + } else { + saveImage(bi); + throw new RuntimeException(msg); + } } } } From d44cf2cca62e301bb6571db6cd2c318cc813a659 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Thu, 12 Mar 2026 15:07:16 +0000 Subject: [PATCH 023/223] 8378113: Add sun/java2d/OpenGL/ScaleParamsOOB.java to the ProblemList.txt file Backport-of: 2bc436816f86187335846b289fac0fd8ebb3759e --- test/jdk/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 6c7cf80dcab0..98bdc0da5e6a 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -247,6 +247,7 @@ sun/awt/shell/ShellFolderMemoryLeak.java 8197794 windows-all sun/java2d/DirectX/OverriddenInsetsTest/OverriddenInsetsTest.java 8196102 generic-all sun/java2d/DirectX/RenderingToCachedGraphicsTest/RenderingToCachedGraphicsTest.java 8196180 windows-all,macosx-all sun/java2d/OpenGL/OpaqueDest.java#id1 8367574 macosx-all +sun/java2d/OpenGL/ScaleParamsOOB.java#id0 8377908 linux-all sun/java2d/SunGraphics2D/EmptyClipRenderingTest.java 8144029 macosx-all,linux-all sun/java2d/SunGraphics2D/DrawImageBilinear.java 8297175 linux-all sun/java2d/SunGraphics2D/PolyVertTest.java 6986565 generic-all From 1c6848deeee7b7e50511b16eba70af0046232ed2 Mon Sep 17 00:00:00 2001 From: Chad Rakoczy Date: Thu, 12 Mar 2026 15:43:09 +0000 Subject: [PATCH 024/223] 8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking Backport-of: 46ae1ee87152742082e6047d0556944d7ae4567d --- .../prims/jvmtiClassFileReconstituter.cpp | 5 + src/hotspot/share/prims/jvmtiEnv.cpp | 22 ++- .../instrument/RetransformBigClassTest.java | 161 ++++++++++++++++++ 3 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 test/jdk/java/lang/instrument/RetransformBigClassTest.java diff --git a/src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp b/src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp index 566406433b7f..ccebb272fa50 100644 --- a/src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp +++ b/src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp @@ -992,6 +992,11 @@ void JvmtiClassFileReconstituter::write_u8(u8 x) { void JvmtiClassFileReconstituter::copy_bytecodes(const methodHandle& mh, unsigned char* bytecodes) { + // We must copy bytecodes only from linked classes. + // Being linked guarantees we are not getting bytecodes at + // the same time the linking process is rewriting them. + guarantee(mh->method_holder()->is_linked(), "Bytecodes must be copied from a linked class"); + // use a BytecodeStream to iterate over the bytecodes. JVM/fast bytecodes // and the breakpoint bytecode are converted to their original bytecodes. diff --git a/src/hotspot/share/prims/jvmtiEnv.cpp b/src/hotspot/share/prims/jvmtiEnv.cpp index e3f64b59325a..ed3eeeb36c8b 100644 --- a/src/hotspot/share/prims/jvmtiEnv.cpp +++ b/src/hotspot/share/prims/jvmtiEnv.cpp @@ -452,6 +452,18 @@ JvmtiEnv::RetransformClasses(jint class_count, const jclass* classes) { InstanceKlass* ik = InstanceKlass::cast(klass); if (ik->get_cached_class_file_bytes() == nullptr) { + // Link the class to avoid races with the rewriter. This will call the verifier also + // on the class. Linking is also done in VM_RedefineClasses below, but we need + // to keep that for other VM_RedefineClasses callers. + JavaThread* THREAD = current_thread; + ik->link_class(THREAD); + if (HAS_PENDING_EXCEPTION) { + // Retransform/JVMTI swallows error messages. Using this class will rerun the verifier in a context + // that propagates the VerifyError, if thrown. + CLEAR_PENDING_EXCEPTION; + return JVMTI_ERROR_INVALID_CLASS; + } + // Not cached, we need to reconstitute the class file from the // VM representation. We don't attach the reconstituted class // bytes to the InstanceKlass here because they have not been @@ -3600,7 +3612,8 @@ jvmtiError JvmtiEnv::GetBytecodes(Method* method, jint* bytecode_count_ptr, unsigned char** bytecodes_ptr) { NULL_CHECK(method, JVMTI_ERROR_INVALID_METHODID); - methodHandle mh(Thread::current(), method); + JavaThread* current_thread = JavaThread::current(); + methodHandle mh(current_thread, method); jint size = (jint)mh->code_size(); jvmtiError err = allocate(size, bytecodes_ptr); if (err != JVMTI_ERROR_NONE) { @@ -3609,6 +3622,13 @@ JvmtiEnv::GetBytecodes(Method* method, jint* bytecode_count_ptr, unsigned char** (*bytecode_count_ptr) = size; // get byte codes + // Make sure the class is verified and rewritten first. + JavaThread* THREAD = current_thread; + mh->method_holder()->link_class(THREAD); + if (HAS_PENDING_EXCEPTION) { + CLEAR_PENDING_EXCEPTION; + return JVMTI_ERROR_INVALID_CLASS; + } JvmtiClassFileReconstituter::copy_bytecodes(mh, *bytecodes_ptr); return JVMTI_ERROR_NONE; diff --git a/test/jdk/java/lang/instrument/RetransformBigClassTest.java b/test/jdk/java/lang/instrument/RetransformBigClassTest.java new file mode 100644 index 000000000000..c4788217be16 --- /dev/null +++ b/test/jdk/java/lang/instrument/RetransformBigClassTest.java @@ -0,0 +1,161 @@ +/* + * 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. + * + */ + +/* + * @test + * @bug 8277444 + * + * @library /test/lib + * @compile SimpleIdentityTransformer.java + * @run shell MakeJAR.sh retransformAgent + * @run main/othervm -javaagent:retransformAgent.jar RetransformBigClassTest + */ + +import jdk.test.lib.compiler.InMemoryJavaCompiler; + +/* + * JvmtiClassFileReconstituter::copy_bytecodes restores bytecodes rewritten + * by the linking process. It is used by RetransformClasses. + * JDK-8277444 is a data race between copy_bytecodes and the linking process. + * This test puts the linking process in one thread and the retransforming process + * in another thread. The test uses Class.forName("BigClass", false, classLoader) + * which does not link the class. When the class is used, the linking process starts. + * In another thread retransforming of the class is happening. + * We generate a class with big methods. A number of methods and their size are + * chosen to make the linking and retransforming processes run concurrently. + * We delay the retransforming process to follow the linking process. + * If there is no synchronization between the processes, a data race will happen. + */ +public class RetransformBigClassTest extends AInstrumentationTestCase { + + private static final Object LOCK = new Object(); + private static final int COUNTER_INC_COUNT = 2000; // A number of 'c+=1;' statements in methods of a class. + private static final int MIN_LINK_TIME_MS = 60; // Large enough so the linking and retransforming processes run in parallel. + private static final int RETRANSFORM_CLASSES_DELAY_MS = 37; // We manage to create a data race when a delay is in the range 0.52x - 0.62x of MIN_LINK_TIME_MS. + + private static Class bigClass; + private static byte[] bigClassBytecode; + + private Thread retransformThread; + + RetransformBigClassTest() { + super("RetransformBigClassTest"); + } + + public static void main(String[] args) throws Throwable { + new RetransformBigClassTest().runTest(); + } + + protected final void doRunTest() throws Throwable { + ClassLoader classLoader = new ClassLoader() { + @Override + protected Class findClass(String name) throws ClassNotFoundException { + if (name.equals("BigClass")) { + return defineClass(name, bigClassBytecode, 0, bigClassBytecode.length); + } + + return super.findClass(name); + } + }; + synchronized (LOCK) { + bigClass = Class.forName("BigClass", false, classLoader); + LOCK.notify(); + } + // Make a use of the BigClass + assertTrue(bigClass.getConstructor().newInstance().hashCode() != 0); + retransformThread.join(); + } + + private byte[] createClassBytecode(String className, int methodCount) throws Exception { + String methodBody = ""; + for (int j = 0; j < COUNTER_INC_COUNT; j++) { + methodBody += "c+=1;"; + } + + String classSrc = "public class " + className + " { int c;"; + + for (int i = 0; i < methodCount; i++) { + classSrc += "\npublic void m" + i + "(){"; + classSrc += methodBody; + classSrc += "\n}"; + } + classSrc += "\n}"; + + return InMemoryJavaCompiler.compile(className, classSrc); + } + + // We need a number of methods such that the linking time is greater than + // or equal to MIN_LINK_TIME_MS. + // We create a class having 5 methods and trigger the linking process. + // We measure the time taken and use it to calculate the needed number. + private int findMethodCount() throws Exception { + int methodCount = 5; + final String className = "BigClass" + methodCount; + final byte[] bytecode = createClassBytecode(className, methodCount); + ClassLoader classLoader = new ClassLoader() { + @Override + protected Class findClass(String name) throws ClassNotFoundException { + if (name.equals(className)) { + return defineClass(name, bytecode, 0, bytecode.length); + } + + return super.findClass(name); + } + }; + var bigClass = Class.forName(className, false, classLoader); + long startTime = System.nanoTime(); + assertTrue(bigClass.getConstructor().newInstance().hashCode() != 0); + double linkTimeMs = (System.nanoTime() - startTime) / 1000000.0; + System.out.println("Link time for a class with " + methodCount + " methods each having " + COUNTER_INC_COUNT + " counter increments: " + Math.round(linkTimeMs)); + if (linkTimeMs < MIN_LINK_TIME_MS) { + methodCount = (int)Math.round((MIN_LINK_TIME_MS * methodCount) / linkTimeMs); + } + System.out.println("The number of methods to exceed " + MIN_LINK_TIME_MS + " ms linking time: " + methodCount); + return methodCount; + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + + bigClassBytecode = createClassBytecode("BigClass", findMethodCount()); + fInst.addTransformer(new SimpleIdentityTransformer()); + retransformThread = new Thread(() -> { + try { + synchronized (LOCK) { + while (bigClass == null) { + System.out.println("[retransformThread]: Waiting for bigClass"); + LOCK.wait(); + } + } + Thread.sleep(RETRANSFORM_CLASSES_DELAY_MS); + fInst.retransformClasses(bigClass); + } catch (Exception e) { + e.printStackTrace(); + } + }); + retransformThread.start(); + Thread.sleep(100); + } +} From da58434d84c5b644be047da04b575f19daccecec Mon Sep 17 00:00:00 2001 From: Arno Zeller Date: Thu, 12 Mar 2026 22:01:14 +0000 Subject: [PATCH 025/223] 8183336: Better cleanup for jdk/test/java/lang/module/customfs/ModulesInCustomFileSystem.java Backport-of: 87092ef1d97e00ddb6674b0e309f2f904d307604 --- .../java/lang/module/customfs/ModulesInCustomFileSystem.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/jdk/java/lang/module/customfs/ModulesInCustomFileSystem.java b/test/jdk/java/lang/module/customfs/ModulesInCustomFileSystem.java index 801f2e5fca6c..e023a3a5839b 100644 --- a/test/jdk/java/lang/module/customfs/ModulesInCustomFileSystem.java +++ b/test/jdk/java/lang/module/customfs/ModulesInCustomFileSystem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -28,7 +28,7 @@ * @library /test/lib * @build ModulesInCustomFileSystem m1/* m2/* * jdk.test.lib.util.JarUtils - * @run testng/othervm ModulesInCustomFileSystem + * @run testng/othervm -Djava.io.tmpdir=. ModulesInCustomFileSystem * @summary Test ModuleFinder to find modules in a custom file system */ From 68d3c7330a81123834a26ecd1b9934107b2c05e9 Mon Sep 17 00:00:00 2001 From: Francesco Andreuzzi Date: Thu, 12 Mar 2026 22:19:03 +0000 Subject: [PATCH 026/223] 8359472: JVM crashes when attaching a dynamic agent before JVMTI_PHASE_LIVE Backport-of: 2a8cbd944ba4d8896e48181e396c65f70e5aa215 --- src/hotspot/share/prims/jvmtiAgentList.cpp | 5 + .../EarlyDynamicLoad/EarlyDynamicLoad.java | 103 ++++++++++++++++++ .../EarlyDynamicLoad/libEarlyDynamicLoad.cpp | 59 ++++++++++ 3 files changed, 167 insertions(+) create mode 100644 test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/EarlyDynamicLoad.java create mode 100644 test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/libEarlyDynamicLoad.cpp diff --git a/src/hotspot/share/prims/jvmtiAgentList.cpp b/src/hotspot/share/prims/jvmtiAgentList.cpp index 2a0f71728888..2857927ac31a 100644 --- a/src/hotspot/share/prims/jvmtiAgentList.cpp +++ b/src/hotspot/share/prims/jvmtiAgentList.cpp @@ -200,6 +200,11 @@ void JvmtiAgentList::load_xrun_agents() { // Invokes Agent_OnAttach for agents loaded dynamically during runtime. void JvmtiAgentList::load_agent(const char* agent_name, bool is_absolute_path, const char* options, outputStream* st) { + if (JvmtiEnvBase::get_phase() != JVMTI_PHASE_LIVE) { + st->print_cr("Dynamic agent loading is only permitted in the live phase"); + return; + } + JvmtiAgent* const agent = new JvmtiAgent(agent_name, options, is_absolute_path, /* dynamic agent */ true); if (agent->load(st)) { add(agent); diff --git a/test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/EarlyDynamicLoad.java b/test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/EarlyDynamicLoad.java new file mode 100644 index 000000000000..cb1596da08cc --- /dev/null +++ b/test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/EarlyDynamicLoad.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2025, 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 com.sun.tools.attach.VirtualMachine; +import com.sun.tools.attach.AgentLoadException; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.AfterAll; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.concurrent.TimeUnit; +import jdk.test.lib.dcmd.PidJcmdExecutor; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.Utils; + +/* + * @test EarlyDynamicLoad + * @summary Test that dynamic attach fails gracefully when the JVM is not in live phase. + * @requires vm.jvmti + * @library /test/lib + * @run junit EarlyDynamicLoad + */ +public class EarlyDynamicLoad { + private static final String EXPECTED_MESSAGE = "Dynamic agent loading is only permitted in the live phase"; + + private static Process child; + + @BeforeAll + static void startAndWaitChild() throws Exception { + child = ProcessTools.createTestJavaProcessBuilder( + "-XX:+StartAttachListener", + "-agentpath:" + Utils.TEST_NATIVE_PATH + File.separator + System.mapLibraryName("EarlyDynamicLoad"), + "--version").start(); + + // Wait until the process enters VMStartCallback + try (InputStream is = child.getInputStream()) { + is.read(); + } + } + + @AfterAll + static void stopChild() throws Exception { + try (OutputStream os = child.getOutputStream()) { + os.write(0); + } + + if (!child.waitFor(5, TimeUnit.SECONDS)) { + child.destroyForcibly(); + throw new AssertionError("Timed out while waiting child process to complete"); + } + + OutputAnalyzer analyzer = new OutputAnalyzer(child); + analyzer.shouldHaveExitValue(0); + analyzer.stderrShouldBeEmpty(); + } + + @Test + public void virtualMachine() throws Exception { + try { + VirtualMachine vm = VirtualMachine.attach(String.valueOf(child.pid())); + vm.loadAgent("some.jar"); + vm.detach(); + throw new AssertionError("Should have failed with AgentLoadException"); + } catch(AgentLoadException exception) { + if (!exception.getMessage().contains(EXPECTED_MESSAGE)) { + throw new AssertionError("Unexpected error message", exception); + } + } + } + + @Test + public void jcmd() throws Exception { + PidJcmdExecutor executor = new PidJcmdExecutor(String.valueOf(child.pid())); + OutputAnalyzer out = executor.execute("JVMTI.agent_load some.jar"); + + out.shouldHaveExitValue(0); + out.stdoutShouldContain(EXPECTED_MESSAGE); + } +} diff --git a/test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/libEarlyDynamicLoad.cpp b/test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/libEarlyDynamicLoad.cpp new file mode 100644 index 000000000000..3991926306e4 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/libEarlyDynamicLoad.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2025, 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. + */ + +#include +#include +#include + +extern "C" { + +static void JNICALL VMStartCallback(jvmtiEnv* jvmti, JNIEnv* env) { + putchar('1'); + fflush(stdout); + getchar(); +} + +JNIEXPORT int Agent_OnLoad(JavaVM* vm, char* options, void* reserved) { + jvmtiEnv* jvmti; + if (vm->GetEnv((void**) &jvmti, JVMTI_VERSION_1_0) != JVMTI_ERROR_NONE) { + fprintf(stderr, "JVMTI error occurred during GetEnv\n"); + return JNI_ERR; + } + + jvmtiEventCallbacks callbacks; + memset(&callbacks, 0, sizeof(callbacks)); + callbacks.VMStart = VMStartCallback; + + if (jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)) != JVMTI_ERROR_NONE) { + fprintf(stderr, "JVMTI error occurred during SetEventCallbacks\n"); + return JNI_ERR; + } + if (jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr) != JVMTI_ERROR_NONE) { + fprintf(stderr, "JVMTI error occurred during SetEventNotificationMode\n"); + return JNI_ERR; + } + + return JNI_OK; +} + +} From d37e42da91e5e0f178e490b57c90a3760f646043 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Mon, 16 Mar 2026 02:43:44 +0000 Subject: [PATCH 027/223] 8298783: java/lang/ref/FinalizerHistogramTest.java failed with "RuntimeException: MyObject is not found in test output" Backport-of: fe29cad5e0b10cd088fc39967599f5a8dcaa445c --- .../java/lang/ref/FinalizerHistogramTest.java | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/test/jdk/java/lang/ref/FinalizerHistogramTest.java b/test/jdk/java/lang/ref/FinalizerHistogramTest.java index 66cf76ea7f22..192c229c7b58 100644 --- a/test/jdk/java/lang/ref/FinalizerHistogramTest.java +++ b/test/jdk/java/lang/ref/FinalizerHistogramTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -21,8 +21,9 @@ * questions. */ -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Condition; +import jdk.test.whitebox.WhiteBox; + +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.ReentrantLock; import java.lang.reflect.Method; @@ -32,37 +33,49 @@ * @test * @summary Unit test for FinalizerHistogram * @modules java.base/java.lang.ref:open - * @run main FinalizerHistogramTest + * @library /test/lib + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run main/othervm + * -Xbootclasspath/a:. + * -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * FinalizerHistogramTest */ public class FinalizerHistogramTest { static ReentrantLock lock = new ReentrantLock(); - static volatile int wasInitialized = 0; - static volatile int wasTrapped = 0; - static final int objectsCount = 1000; + static final AtomicInteger initializedCount = new AtomicInteger(0); + static final int OBJECTS_COUNT = 1000; + + static WhiteBox wb; static class MyObject { public MyObject() { // Make sure object allocation/deallocation is not optimized out - wasInitialized += 1; + initializedCount.incrementAndGet(); } protected void finalize() { // Trap the object in a finalization queue - wasTrapped += 1; lock.lock(); } } - public static void main(String[] argvs) { + public static void main(String[] argvs) throws InterruptedException { try { lock.lock(); - for(int i = 0; i < objectsCount; ++i) { + for(int i = 0; i < OBJECTS_COUNT; ++i) { new MyObject(); } - System.out.println("Objects intialized: " + objectsCount); - System.gc(); - while(wasTrapped < 1); + System.out.println("Objects intialized: " + initializedCount.get()); + wb = WhiteBox.getWhiteBox(); + wb.fullGC(); + boolean refProResult; + do { + refProResult = wb.waitForReferenceProcessing(); + System.out.println("waitForReferenceProcessing returned: " + refProResult); + } while (refProResult); Class klass = Class.forName("java.lang.ref.FinalizerHistogram"); From 5abfad74d66f99c9884914d0c03967a3d431e169 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Mon, 16 Mar 2026 03:55:25 +0000 Subject: [PATCH 028/223] 8378561: Mark gc/shenandoah/compiler/TestLinkToNativeRBP.java as /native Backport-of: d7f4365b296d120521e16666e2ce2177a8d2c44d --- .../jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java b/test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java index e9bd47a8f55a..cea16a375951 100644 --- a/test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java +++ b/test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java @@ -31,7 +31,7 @@ * @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "ppc64" | os.arch == "ppc64le" * @requires vm.gc.Shenandoah * - * @run main/othervm --enable-native-access=ALL-UNNAMED -XX:+UnlockDiagnosticVMOptions + * @run main/native/othervm --enable-native-access=ALL-UNNAMED -XX:+UnlockDiagnosticVMOptions * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive TestLinkToNativeRBP * */ From 319c311604224b21adc71c44f648f34ee32af282 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Mon, 16 Mar 2026 03:58:51 +0000 Subject: [PATCH 029/223] 8368625: com/sun/net/httpserver/ServerStopTerminationTest.java fails intermittently Backport-of: 13b3d2fca1af71d0aa9908e19630c2e965dd7134 --- .../httpserver/ServerStopTerminationTest.java | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/test/jdk/com/sun/net/httpserver/ServerStopTerminationTest.java b/test/jdk/com/sun/net/httpserver/ServerStopTerminationTest.java index 815611607258..e8f365b715b1 100644 --- a/test/jdk/com/sun/net/httpserver/ServerStopTerminationTest.java +++ b/test/jdk/com/sun/net/httpserver/ServerStopTerminationTest.java @@ -124,13 +124,16 @@ public void shouldAwaitActiveExchange() throws InterruptedException { // Complete the exchange one second into the future final Duration exchangeDuration = Duration.ofSeconds(1); + // taking start time before entering completeExchange to account for possible + // delays in reaching server.stop(). + final long startTime = System.nanoTime(); completeExchange(exchangeDuration); log("Complete Exchange triggered"); // Time the shutdown sequence - final Duration delayDuration = Duration.ofSeconds(Utils.adjustTimeout(5)); + final Duration delayDuration = Duration.ofSeconds(Utils.adjustTimeout(20)); log("Shutdown triggered with the delay of " + delayDuration.getSeconds()); - final long elapsed = timeShutdown(delayDuration); + final long elapsed = timeShutdown(delayDuration, startTime); log("Shutdown complete"); // The shutdown should take at least as long as the exchange duration @@ -151,31 +154,20 @@ public void shouldAwaitActiveExchange() throws InterruptedException { * @throws InterruptedException if an unexpected interruption occurs */ @Test - public void shouldCompeteAfterDelay() throws InterruptedException { + public void shouldCompleteAfterDelay() throws InterruptedException { // Initiate an exchange startExchange(); // Wait for the server to receive the exchange start.await(); log("Exchange started"); - // Complete the exchange 10 second into the future. - // Runs in parallel, so won't block the server stop - final Duration exchangeDuration = Duration.ofSeconds(Utils.adjustTimeout(10)); - completeExchange(exchangeDuration); - log("Complete Exchange triggered"); - - // Time the shutdown sequence final Duration delayDuration = Duration.ofSeconds(1); log("Shutdown triggered with the delay of " + delayDuration.getSeconds()); final long elapsed = timeShutdown(delayDuration); log("Shutdown complete"); - - - // The shutdown should not await the exchange to complete - if (elapsed >= exchangeDuration.toNanos()) { - fail("HttpServer.stop terminated too late"); - } + complete.countDown(); + log("Exchange completed"); // The shutdown delay should have expired if (elapsed < delayDuration.toNanos()) { @@ -277,7 +269,14 @@ public void shouldAllowRepeatedStop() { */ private long timeShutdown(Duration delayDuration) { final long startTime = System.nanoTime(); + return timeShutdown(delayDuration, startTime); + } + /** + * This allows passing a custom start time + */ + private long timeShutdown(Duration delayDuration, + long startTime) { server.stop((int) delayDuration.toSeconds()); return System.nanoTime() - startTime; } From 25676b321f223b35c9f3649e8e9df1188fea8bae Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Mon, 16 Mar 2026 06:46:58 +0000 Subject: [PATCH 030/223] 8371503: RETAIN_IMAGE_AFTER_TEST do not work for some tests Backport-of: 34f241317ecd7473cfb6dcc2e6e5cf3a40299e2c --- test/hotspot/jtreg/containers/docker/DockerBasicTest.java | 4 +--- test/hotspot/jtreg/containers/docker/ShareTmpDir.java | 4 +--- test/hotspot/jtreg/containers/docker/TestCPUAwareness.java | 4 +--- test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java | 4 +--- test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java | 4 +--- test/hotspot/jtreg/containers/docker/TestPids.java | 4 +--- .../jdk/internal/platform/docker/TestDockerMemoryMetrics.java | 4 +--- .../internal/platform/docker/TestGetFreeSwapSpaceSize.java | 4 +--- test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java | 4 +--- test/jdk/jdk/internal/platform/docker/TestPidsLimit.java | 4 +--- test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java | 2 ++ 11 files changed, 12 insertions(+), 30 deletions(-) diff --git a/test/hotspot/jtreg/containers/docker/DockerBasicTest.java b/test/hotspot/jtreg/containers/docker/DockerBasicTest.java index 8e2c0b6a85a9..e908f2a5bf32 100644 --- a/test/hotspot/jtreg/containers/docker/DockerBasicTest.java +++ b/test/hotspot/jtreg/containers/docker/DockerBasicTest.java @@ -56,9 +56,7 @@ public static void main(String[] args) throws Exception { testHelloDocker(); testJavaVersionWithCgMounts(); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageNameAndTag); - } + DockerTestUtils.removeDockerImage(imageNameAndTag); } } diff --git a/test/hotspot/jtreg/containers/docker/ShareTmpDir.java b/test/hotspot/jtreg/containers/docker/ShareTmpDir.java index 9a4748563bd7..48876ca37fe2 100644 --- a/test/hotspot/jtreg/containers/docker/ShareTmpDir.java +++ b/test/hotspot/jtreg/containers/docker/ShareTmpDir.java @@ -59,9 +59,7 @@ public static void main(String[] args) throws Exception { try { test(); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java b/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java index 99220201f666..dc73dd1b5445 100644 --- a/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java +++ b/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java @@ -86,9 +86,7 @@ public static void main(String[] args) throws Exception { } } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java b/test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java index 7b05669085c9..e8cb54d7d7b9 100644 --- a/test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java +++ b/test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java @@ -64,9 +64,7 @@ public static void main(String[] args) throws Exception { try { testLimitUpdates(); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java b/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java index 06a874e008ae..a5fb3f829135 100644 --- a/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java +++ b/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java @@ -105,9 +105,7 @@ public static void main(String[] args) throws Exception { testMetricsSwapExceedingPhysical(); testContainerMemExceedsPhysical(); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/hotspot/jtreg/containers/docker/TestPids.java b/test/hotspot/jtreg/containers/docker/TestPids.java index 62bd70dc61fb..07a0cbd295dc 100644 --- a/test/hotspot/jtreg/containers/docker/TestPids.java +++ b/test/hotspot/jtreg/containers/docker/TestPids.java @@ -64,9 +64,7 @@ public static void main(String[] args) throws Exception { try { testPids(); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java index 2afb5ed93b1e..8d63e76c141e 100644 --- a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java +++ b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java @@ -82,9 +82,7 @@ public static void main(String[] args) throws Exception { testMemorySoftLimit("500m","200m"); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java b/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java index b9d031f03090..5a89c04796aa 100644 --- a/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java +++ b/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java @@ -53,9 +53,7 @@ public static void main(String[] args) throws Exception { "150M", Integer.toString(0) ); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java b/test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java index 31e90e8802a9..ee9e7f41ab0e 100644 --- a/test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java +++ b/test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java @@ -64,9 +64,7 @@ public static void main(String[] args) throws Exception { try { testLimitUpdates(); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java b/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java index 6b19bb475f13..04c172b13b8f 100644 --- a/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java +++ b/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java @@ -60,9 +60,7 @@ public static void main(String[] args) throws Exception { testPidsLimit("2000"); testPidsLimit("Unlimited"); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java b/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java index 3d721b598b93..eb8b630e408d 100644 --- a/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java +++ b/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java @@ -281,7 +281,9 @@ public static OutputAnalyzer dockerRunJava(DockerRunOptions opts) throws Excepti * @throws Exception */ public static void removeDockerImage(String imageNameAndTag) throws Exception { + if(!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { execute(Container.ENGINE_COMMAND, "rmi", "--force", imageNameAndTag); + } } From 3a55353cb4f97328f9aa93914935a92726c35cc7 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 16 Mar 2026 10:05:16 +0000 Subject: [PATCH 031/223] 8357086: os::xxx functions returning memory size should return size_t Reviewed-by: rrich Backport-of: d5d94db12a6d82a6fe9da18b5f8ce3733a6ee7e7 --- src/hotspot/os/aix/os_aix.cpp | 23 +++---- src/hotspot/os/aix/os_aix.hpp | 8 +-- src/hotspot/os/bsd/os_bsd.cpp | 36 ++++++----- src/hotspot/os/bsd/os_bsd.hpp | 8 +-- .../os/linux/cgroupSubsystem_linux.cpp | 10 ++-- src/hotspot/os/linux/cgroupUtil_linux.cpp | 2 +- src/hotspot/os/linux/os_linux.cpp | 60 +++++++++++-------- src/hotspot/os/linux/os_linux.hpp | 8 +-- src/hotspot/os/windows/os_windows.cpp | 32 ++++++---- src/hotspot/os/windows/os_windows.hpp | 8 +-- src/hotspot/share/compiler/compileBroker.cpp | 4 +- src/hotspot/share/gc/shared/gcInitLogger.cpp | 5 +- src/hotspot/share/gc/x/xLargePages.cpp | 3 +- src/hotspot/share/gc/z/zLargePages.cpp | 3 +- src/hotspot/share/jfr/jni/jfrJniMethod.cpp | 4 +- .../share/jfr/periodic/jfrPeriodic.cpp | 7 ++- .../share/prims/jvmtiRedefineClasses.cpp | 20 ++++--- src/hotspot/share/prims/whitebox.cpp | 4 +- src/hotspot/share/runtime/arguments.cpp | 7 ++- src/hotspot/share/runtime/os.cpp | 9 +-- src/hotspot/share/runtime/os.hpp | 6 +- src/hotspot/share/services/management.cpp | 2 +- 22 files changed, 155 insertions(+), 114 deletions(-) diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 71e1ab893084..35b948b189b7 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -177,7 +177,7 @@ static void vmembk_print_on(outputStream* os); //////////////////////////////////////////////////////////////////////////////// // global variables (for a description see os_aix.hpp) -julong os::Aix::_physical_memory = 0; +size_t os::Aix::_physical_memory = 0; pthread_t os::Aix::_main_thread = ((pthread_t)0); @@ -265,28 +265,29 @@ static bool is_close_to_brk(address a) { return false; } -julong os::free_memory() { - return Aix::available_memory(); +bool os::free_memory(size_t& value) { + return Aix::available_memory(value); } -julong os::available_memory() { - return Aix::available_memory(); +bool os::available_memory(size_t& value) { + return Aix::available_memory(value); } -julong os::Aix::available_memory() { +bool os::Aix::available_memory(size_t& value) { // Avoid expensive API call here, as returned value will always be null. if (os::Aix::on_pase()) { return 0x0LL; } os::Aix::meminfo_t mi; if (os::Aix::get_meminfo(&mi)) { - return mi.real_free; + value = static_cast(mi.real_free); + return true; } else { - return ULONG_MAX; + return false; } } -julong os::physical_memory() { +size_t os::physical_memory() { return Aix::physical_memory(); } @@ -357,7 +358,7 @@ void os::Aix::initialize_system_info() { if (!os::Aix::get_meminfo(&mi)) { assert(false, "os::Aix::get_meminfo failed."); } - _physical_memory = (julong) mi.real_total; + _physical_memory = static_cast(mi.real_total); } // Helper function for tracing page sizes. @@ -2402,7 +2403,7 @@ jint os::init_2(void) { } trcVerbose("processor count: %d", os::_processor_count); - trcVerbose("physical memory: %lu", Aix::_physical_memory); + trcVerbose("physical memory: %zu", Aix::_physical_memory); // Initially build up the loaded dll map. LoadedLibraries::reload(); diff --git a/src/hotspot/os/aix/os_aix.hpp b/src/hotspot/os/aix/os_aix.hpp index 8cb49b5fe74a..2bd82219f591 100644 --- a/src/hotspot/os/aix/os_aix.hpp +++ b/src/hotspot/os/aix/os_aix.hpp @@ -35,7 +35,7 @@ class os::Aix { private: - static julong _physical_memory; + static size_t _physical_memory; static pthread_t _main_thread; // -1 = uninitialized, 0 = AIX, 1 = OS/400 (PASE) @@ -58,9 +58,9 @@ class os::Aix { // 1 - EXTSHM=ON static int _extshm; - static julong available_memory(); - static julong free_memory(); - static julong physical_memory() { return _physical_memory; } + static bool available_memory(size_t& value); + static bool free_memory(size_t& value); + static size_t physical_memory() { return _physical_memory; } static void initialize_system_info(); // OS recognitions (PASE/AIX, OS level) call this before calling any diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index eca9aa9c92ac..b5f361f11be9 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -120,7 +120,7 @@ //////////////////////////////////////////////////////////////////////////////// // global variables -julong os::Bsd::_physical_memory = 0; +size_t os::Bsd::_physical_memory = 0; #ifdef __APPLE__ mach_timebase_info_data_t os::Bsd::_timebase_info = {0, 0}; @@ -139,17 +139,17 @@ static volatile int processor_id_next = 0; //////////////////////////////////////////////////////////////////////////////// // utility functions -julong os::available_memory() { - return Bsd::available_memory(); +bool os::available_memory(size_t& value) { + return Bsd::available_memory(value); } -julong os::free_memory() { - return Bsd::available_memory(); +bool os::free_memory(size_t& value) { + return Bsd::available_memory(value); } // available here means free -julong os::Bsd::available_memory() { - uint64_t available = physical_memory() >> 2; +bool os::Bsd::available_memory(size_t& value) { + uint64_t available = static_cast(physical_memory() >> 2); #ifdef __APPLE__ mach_msg_type_number_t count = HOST_VM_INFO64_COUNT; vm_statistics64_data_t vmstat; @@ -159,9 +159,12 @@ julong os::Bsd::available_memory() { "host_statistics64 failed - check mach_host_self() and count"); if (kerr == KERN_SUCCESS) { available = vmstat.free_count * os::vm_page_size(); + } else { + return false; } #endif - return available; + value = static_cast(available); + return true; } // for more info see : @@ -180,7 +183,7 @@ void os::Bsd::print_uptime_info(outputStream* st) { } } -julong os::physical_memory() { +size_t os::physical_memory() { return Bsd::physical_memory(); } @@ -254,7 +257,7 @@ void os::Bsd::initialize_system_info() { len = sizeof(mem_val); if (sysctl(mib, 2, &mem_val, &len, nullptr, 0) != -1) { assert(len == sizeof(mem_val), "unexpected data size"); - _physical_memory = mem_val; + _physical_memory = static_cast(mem_val); } else { _physical_memory = 256 * 1024 * 1024; // fallback (XXXBSD?) } @@ -265,7 +268,7 @@ void os::Bsd::initialize_system_info() { // datasize rlimit restricts us anyway. struct rlimit limits; getrlimit(RLIMIT_DATA, &limits); - _physical_memory = MIN2(_physical_memory, (julong)limits.rlim_cur); + _physical_memory = MIN2(_physical_memory, static_cast(limits.rlim_cur)); } #endif } @@ -1411,10 +1414,13 @@ void os::print_memory_info(outputStream* st) { st->print("Memory:"); st->print(" " SIZE_FORMAT "k page", os::vm_page_size()>>10); - st->print(", physical " UINT64_FORMAT "k", - os::physical_memory() >> 10); - st->print("(" UINT64_FORMAT "k free)", - os::available_memory() >> 10); + size_t phys_mem = os::physical_memory(); + st->print(", physical %zuk", + phys_mem >> 10); + size_t avail_mem = 0; + (void)os::available_memory(avail_mem); + st->print("(%zuk free)", + avail_mem >> 10); if((sysctlbyname("vm.swapusage", &swap_usage, &size, nullptr, 0) == 0) || (errno == ENOMEM)) { if (size >= offset_of(xsw_usage, xsu_used)) { diff --git a/src/hotspot/os/bsd/os_bsd.hpp b/src/hotspot/os/bsd/os_bsd.hpp index f79212bc43c0..c1cb360dee24 100644 --- a/src/hotspot/os/bsd/os_bsd.hpp +++ b/src/hotspot/os/bsd/os_bsd.hpp @@ -42,12 +42,12 @@ class os::Bsd { protected: - static julong _physical_memory; + static size_t _physical_memory; static pthread_t _main_thread; - static julong available_memory(); - static julong free_memory(); - static julong physical_memory() { return _physical_memory; } + static bool available_memory(size_t& value); + static bool free_memory(size_t& value); + static size_t physical_memory() { return _physical_memory; } static void initialize_system_info(); static void rebuild_cpu_to_node_map(); diff --git a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp index 1186c78b865a..6e152a8ac4ff 100644 --- a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp +++ b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp @@ -669,8 +669,8 @@ jlong CgroupSubsystem::memory_limit_in_bytes() { if (!memory_limit->should_check_metric()) { return memory_limit->value(); } - jlong phys_mem = os::Linux::physical_memory(); - log_trace(os, container)("total physical memory: " JLONG_FORMAT, phys_mem); + julong phys_mem = static_cast(os::Linux::physical_memory()); + log_trace(os, container)("total physical memory: " JULONG_FORMAT, phys_mem); jlong mem_limit = contrl->controller()->read_memory_limit_in_bytes(phys_mem); // Update cached metric to avoid re-reading container settings too often memory_limit->set_value(mem_limit, OSCONTAINER_CACHE_TIMEOUT); @@ -840,13 +840,13 @@ jlong CgroupController::limit_from_str(char* limit_str) { // CgroupSubsystem implementations jlong CgroupSubsystem::memory_and_swap_limit_in_bytes() { - julong phys_mem = os::Linux::physical_memory(); + julong phys_mem = static_cast(os::Linux::physical_memory()); julong host_swap = os::Linux::host_swap(); return memory_controller()->controller()->memory_and_swap_limit_in_bytes(phys_mem, host_swap); } jlong CgroupSubsystem::memory_soft_limit_in_bytes() { - julong phys_mem = os::Linux::physical_memory(); + julong phys_mem = static_cast(os::Linux::physical_memory()); return memory_controller()->controller()->memory_soft_limit_in_bytes(phys_mem); } @@ -879,6 +879,6 @@ int CgroupSubsystem::cpu_shares() { } void CgroupSubsystem::print_version_specific_info(outputStream* st) { - julong phys_mem = os::Linux::physical_memory(); + julong phys_mem = static_cast(os::Linux::physical_memory()); memory_controller()->controller()->print_version_specific_info(st, phys_mem); } diff --git a/src/hotspot/os/linux/cgroupUtil_linux.cpp b/src/hotspot/os/linux/cgroupUtil_linux.cpp index b52ef87dcaee..72dda36504d3 100644 --- a/src/hotspot/os/linux/cgroupUtil_linux.cpp +++ b/src/hotspot/os/linux/cgroupUtil_linux.cpp @@ -65,7 +65,7 @@ void CgroupUtil::adjust_controller(CgroupMemoryController* mem) { char* cg_path = os::strdup(orig); char* last_slash; assert(cg_path[0] == '/', "cgroup path must start with '/'"); - julong phys_mem = os::Linux::physical_memory(); + julong phys_mem = static_cast(os::Linux::physical_memory()); char* limit_cg_path = nullptr; jlong limit = mem->read_memory_limit_in_bytes(phys_mem); jlong lowest_limit = limit < 0 ? phys_mem : limit; diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index daec53fa1328..d5a44dfa91ac 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -161,7 +161,7 @@ enum CoredumpFilterBit { //////////////////////////////////////////////////////////////////////////////// // global variables -julong os::Linux::_physical_memory = 0; +size_t os::Linux::_physical_memory = 0; address os::Linux::_initial_thread_stack_bottom = nullptr; uintptr_t os::Linux::_initial_thread_stack_size = 0; @@ -236,15 +236,16 @@ julong os::Linux::available_memory_in_container() { return avail_mem; } -julong os::available_memory() { - return Linux::available_memory(); +bool os::available_memory(size_t& value) { + return Linux::available_memory(value); } -julong os::Linux::available_memory() { +bool os::Linux::available_memory(size_t& value) { julong avail_mem = available_memory_in_container(); if (avail_mem != static_cast(-1L)) { log_trace(os)("available container memory: " JULONG_FORMAT, avail_mem); - return avail_mem; + value = static_cast(avail_mem); + return true; } FILE *fp = os::fopen("/proc/meminfo", "r"); @@ -259,43 +260,52 @@ julong os::Linux::available_memory() { fclose(fp); } if (avail_mem == static_cast(-1L)) { - avail_mem = free_memory(); + size_t free_mem = 0; + if (!free_memory(free_mem)) { + return false; + } + avail_mem = static_cast(free_mem); } log_trace(os)("available memory: " JULONG_FORMAT, avail_mem); - return avail_mem; + value = static_cast(avail_mem); + return true; } -julong os::free_memory() { - return Linux::free_memory(); +bool os::free_memory(size_t& value) { + return Linux::free_memory(value); } -julong os::Linux::free_memory() { +bool os::Linux::free_memory(size_t& value) { // values in struct sysinfo are "unsigned long" struct sysinfo si; julong free_mem = available_memory_in_container(); if (free_mem != static_cast(-1L)) { log_trace(os)("free container memory: " JULONG_FORMAT, free_mem); - return free_mem; + value = static_cast(free_mem); + return true; } - sysinfo(&si); + int ret = sysinfo(&si); + if (ret != 0) { + return false; + } free_mem = (julong)si.freeram * si.mem_unit; log_trace(os)("free memory: " JULONG_FORMAT, free_mem); - return free_mem; + value = static_cast(free_mem); + return true; } -julong os::physical_memory() { - jlong phys_mem = 0; +size_t os::physical_memory() { if (OSContainer::is_containerized()) { jlong mem_limit; if ((mem_limit = OSContainer::memory_limit_in_bytes()) > 0) { log_trace(os)("total container memory: " JLONG_FORMAT, mem_limit); - return mem_limit; + return static_cast(mem_limit); } } - phys_mem = Linux::physical_memory(); - log_trace(os)("total system memory: " JLONG_FORMAT, phys_mem); + size_t phys_mem = Linux::physical_memory(); + log_trace(os)("total system memory: %zu", phys_mem); return phys_mem; } @@ -452,7 +462,7 @@ void os::Linux::initialize_system_info() { fclose(fp); } } - _physical_memory = (julong)sysconf(_SC_PHYS_PAGES) * (julong)sysconf(_SC_PAGESIZE); + _physical_memory = static_cast(sysconf(_SC_PHYS_PAGES)) * static_cast(sysconf(_SC_PAGESIZE)); assert(processor_count() > 0, "linux error"); } @@ -2432,11 +2442,13 @@ void os::print_memory_info(outputStream* st) { // values in struct sysinfo are "unsigned long" struct sysinfo si; sysinfo(&si); - - st->print(", physical " UINT64_FORMAT "k", - os::physical_memory() >> 10); - st->print("(" UINT64_FORMAT "k free)", - os::available_memory() >> 10); + size_t phys_mem = physical_memory(); + st->print(", physical %zuk", + phys_mem >> 10); + size_t avail_mem = 0; + (void)os::available_memory(avail_mem); + st->print("(%zuk free)", + avail_mem >> 10); st->print(", swap " UINT64_FORMAT "k", ((jlong)si.totalswap * si.mem_unit) >> 10); st->print("(" UINT64_FORMAT "k free)", diff --git a/src/hotspot/os/linux/os_linux.hpp b/src/hotspot/os/linux/os_linux.hpp index 49f2777d1396..b2f09be921ae 100644 --- a/src/hotspot/os/linux/os_linux.hpp +++ b/src/hotspot/os/linux/os_linux.hpp @@ -51,11 +51,11 @@ class os::Linux { protected: - static julong _physical_memory; + static size_t _physical_memory; static pthread_t _main_thread; - static julong available_memory(); - static julong free_memory(); + static bool available_memory(size_t& value); + static bool free_memory(size_t& value); static void initialize_system_info(); @@ -127,7 +127,7 @@ class os::Linux { static address initial_thread_stack_bottom(void) { return _initial_thread_stack_bottom; } static uintptr_t initial_thread_stack_size(void) { return _initial_thread_stack_size; } - static julong physical_memory() { return _physical_memory; } + static size_t physical_memory() { return _physical_memory; } static julong host_swap(); static intptr_t* ucontext_get_sp(const ucontext_t* uc); diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 2107b8365d07..b01b003bdbe6 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -832,25 +832,30 @@ jlong os::elapsed_frequency() { } -julong os::available_memory() { - return win32::available_memory(); +bool os::available_memory(size_t& value) { + return win32::available_memory(value); } -julong os::free_memory() { - return win32::available_memory(); +bool os::free_memory(size_t& value) { + return win32::available_memory(value); } -julong os::win32::available_memory() { +bool os::win32::available_memory(size_t& value) { // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect // value if total memory is larger than 4GB MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); - GlobalMemoryStatusEx(&ms); - - return (julong)ms.ullAvailPhys; + BOOL res = GlobalMemoryStatusEx(&ms); + if (res == TRUE) { + value = static_cast(ms.ullAvailPhys); + return true; + } else { + assert(false, "GlobalMemoryStatusEx failed in os::win32::available_memory(): %lu", ::GetLastError()); + return false; + } } -julong os::physical_memory() { +size_t os::physical_memory() { return win32::physical_memory(); } @@ -4065,7 +4070,7 @@ int os::current_process_id() { int os::win32::_processor_type = 0; // Processor level is not available on non-NT systems, use vm_version instead int os::win32::_processor_level = 0; -julong os::win32::_physical_memory = 0; +size_t os::win32::_physical_memory = 0; bool os::win32::_is_windows_server = false; @@ -4295,8 +4300,11 @@ void os::win32::initialize_system_info() { // also returns dwAvailPhys (free physical memory bytes), dwTotalVirtual, dwAvailVirtual, // dwMemoryLoad (% of memory in use) - GlobalMemoryStatusEx(&ms); - _physical_memory = ms.ullTotalPhys; + BOOL res = GlobalMemoryStatusEx(&ms); + if (res != TRUE) { + assert(false, "GlobalMemoryStatusEx failed in os::win32::initialize_system_info(): %lu", ::GetLastError()); + } + _physical_memory = static_cast(ms.ullTotalPhys); if (FLAG_IS_DEFAULT(MaxRAM)) { // Adjust MaxRAM according to the maximum virtual address space available. diff --git a/src/hotspot/os/windows/os_windows.hpp b/src/hotspot/os/windows/os_windows.hpp index c4e5483ce8e3..2c5fc5c942cd 100644 --- a/src/hotspot/os/windows/os_windows.hpp +++ b/src/hotspot/os/windows/os_windows.hpp @@ -40,7 +40,7 @@ class os::win32 { protected: static int _processor_type; static int _processor_level; - static julong _physical_memory; + static size_t _physical_memory; static bool _is_windows_server; static bool _has_exit_bug; static bool _processor_group_warning_displayed; @@ -102,9 +102,9 @@ class os::win32 { static int processor_level() { return _processor_level; } - static julong available_memory(); - static julong free_memory(); - static julong physical_memory() { return _physical_memory; } + static bool available_memory(size_t& value); + static bool free_memory(size_t& value); + static size_t physical_memory() { return _physical_memory; } // load dll from Windows system directory or Windows directory static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen); diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index b6b681472506..3da934b2cc01 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -1033,7 +1033,9 @@ void CompileBroker::possibly_add_compiler_threads(JavaThread* THREAD) { if (new_c2_count <= old_c2_count && new_c1_count <= old_c1_count) return; // Now, we do the more expensive operations. - julong free_memory = os::free_memory(); + size_t free_memory = 0; + // Return value ignored - defaulting to 0 on failure. + (void)os::free_memory(free_memory); // If SegmentedCodeCache is off, both values refer to the single heap (with type CodeBlobType::All). size_t available_cc_np = CodeCache::unallocated_capacity(CodeBlobType::MethodNonProfiled), available_cc_p = CodeCache::unallocated_capacity(CodeBlobType::MethodProfiled); diff --git a/src/hotspot/share/gc/shared/gcInitLogger.cpp b/src/hotspot/share/gc/shared/gcInitLogger.cpp index 1dfc27c53337..88ce43201bb3 100644 --- a/src/hotspot/share/gc/shared/gcInitLogger.cpp +++ b/src/hotspot/share/gc/shared/gcInitLogger.cpp @@ -63,9 +63,8 @@ void GCInitLogger::print_cpu() { } void GCInitLogger::print_memory() { - julong memory = os::physical_memory(); - log_info_p(gc, init)("Memory: " JULONG_FORMAT "%s", - byte_size_in_proper_unit(memory), proper_unit_for_byte_size(memory)); + size_t memory = os::physical_memory(); + log_info_p(gc, init)("Memory: " PROPERFMT, PROPERFMTARGS(memory)); } void GCInitLogger::print_large_pages() { diff --git a/src/hotspot/share/gc/x/xLargePages.cpp b/src/hotspot/share/gc/x/xLargePages.cpp index 13da763c6a39..0afb4ac6d702 100644 --- a/src/hotspot/share/gc/x/xLargePages.cpp +++ b/src/hotspot/share/gc/x/xLargePages.cpp @@ -31,7 +31,8 @@ XLargePages::State XLargePages::_state; void XLargePages::initialize() { pd_initialize(); - log_info_p(gc, init)("Memory: " JULONG_FORMAT "M", os::physical_memory() / M); + const size_t memory = os::physical_memory(); + log_info_p(gc, init)("Memory: " PROPERFMT, PROPERFMTARGS(memory)); log_info_p(gc, init)("Large Page Support: %s", to_string()); } diff --git a/src/hotspot/share/gc/z/zLargePages.cpp b/src/hotspot/share/gc/z/zLargePages.cpp index 88656d153811..f4dbfb224337 100644 --- a/src/hotspot/share/gc/z/zLargePages.cpp +++ b/src/hotspot/share/gc/z/zLargePages.cpp @@ -31,7 +31,8 @@ ZLargePages::State ZLargePages::_state; void ZLargePages::initialize() { pd_initialize(); - log_info_p(gc, init)("Memory: " JULONG_FORMAT "M", os::physical_memory() / M); + const size_t memory = os::physical_memory(); + log_info_p(gc, init)("Memory: " PROPERFMT, PROPERFMTARGS(memory)); log_info_p(gc, init)("Large Page Support: %s", to_string()); } diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp index 7157c346db01..e78bd11fb647 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp @@ -402,9 +402,9 @@ JVM_ENTRY_NO_ENV(jlong, jfr_host_total_memory(JNIEnv* env, jobject jvm)) #ifdef LINUX // We want the host memory, not the container limit. // os::physical_memory() would return the container limit. - return os::Linux::physical_memory(); + return static_cast(os::Linux::physical_memory()); #else - return os::physical_memory(); + return static_cast(os::physical_memory()); #endif JVM_END diff --git a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp index ff52b4104fdb..eddc5c03310a 100644 --- a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp +++ b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp @@ -515,10 +515,13 @@ TRACE_REQUEST_FUNC(ThreadAllocationStatistics) { * the total memory reported is the amount of memory configured for the guest OS by the hypervisor. */ TRACE_REQUEST_FUNC(PhysicalMemory) { - u8 totalPhysicalMemory = os::physical_memory(); + u8 totalPhysicalMemory = static_cast(os::physical_memory()); EventPhysicalMemory event; event.set_totalSize(totalPhysicalMemory); - event.set_usedSize(totalPhysicalMemory - os::available_memory()); + size_t avail_mem = 0; + // Return value ignored - defaulting to 0 on failure. + (void)os::available_memory(avail_mem); + event.set_usedSize(totalPhysicalMemory - static_cast(avail_mem)); event.commit(); } diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp index 000c1207e70e..633dd82dd742 100644 --- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp +++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp @@ -1375,10 +1375,12 @@ jvmtiError VM_RedefineClasses::load_new_class_versions() { // constant pools HandleMark hm(current); InstanceKlass* the_class = get_ik(_class_defs[i].klass); - + size_t avail_mem = 0; + // Return value ignored - defaulting to 0 on failure. + (void)os::available_memory(avail_mem); log_debug(redefine, class, load) - ("loading name=%s kind=%d (avail_mem=" UINT64_FORMAT "K)", - the_class->external_name(), _class_load_kind, os::available_memory() >> 10); + ("loading name=%s kind=%d (avail_mem=%zuK)", + the_class->external_name(), _class_load_kind, avail_mem >> 10); ClassFileStream st((u1*)_class_defs[i].class_bytes, _class_defs[i].class_byte_count, @@ -1543,9 +1545,10 @@ jvmtiError VM_RedefineClasses::load_new_class_versions() { return JVMTI_ERROR_INTERNAL; } } - + // Return value ignored - defaulting to 0 on failure. + (void)os::available_memory(avail_mem); log_debug(redefine, class, load) - ("loaded name=%s (avail_mem=" UINT64_FORMAT "K)", the_class->external_name(), os::available_memory() >> 10); + ("loaded name=%s (avail_mem=%zuK)", the_class->external_name(), avail_mem >> 10); } return JVMTI_ERROR_NONE; @@ -4453,9 +4456,12 @@ void VM_RedefineClasses::redefine_single_class(Thread* current, jclass the_jclas ResourceMark rm(current); // increment the classRedefinedCount field in the_class and in any // direct and indirect subclasses of the_class + size_t avail_mem = 0; + // Return value ignored - defaulting to 0 on failure. + (void)os::available_memory(avail_mem); log_info(redefine, class, load) - ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)", - the_class->external_name(), java_lang_Class::classRedefinedCount(the_class->java_mirror()), os::available_memory() >> 10); + ("redefined name=%s, count=%d (avail_mem=%zuK)", + the_class->external_name(), java_lang_Class::classRedefinedCount(the_class->java_mirror()), avail_mem >> 10); Events::log_redefinition(current, "redefined class name=%s, count=%d", the_class->external_name(), java_lang_Class::classRedefinedCount(the_class->java_mirror())); diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index c1dbb482f5fb..3288f5f27d61 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -2408,8 +2408,8 @@ WB_END // Physical memory of the host machine (including containers) WB_ENTRY(jlong, WB_HostPhysicalMemory(JNIEnv* env, jobject o)) - LINUX_ONLY(return os::Linux::physical_memory();) - return os::physical_memory(); + LINUX_ONLY(return static_cast(os::Linux::physical_memory());) + return static_cast(os::physical_memory()); WB_END // Physical swap of the host machine (including containers), Linux only. diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index ece795dd9de8..aad46fa6091a 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -1552,13 +1552,13 @@ void Arguments::set_heap_size() { !FLAG_IS_DEFAULT(MaxRAM)); if (override_coop_limit) { if (FLAG_IS_DEFAULT(MaxRAM)) { - phys_mem = os::physical_memory(); + phys_mem = static_cast(os::physical_memory()); FLAG_SET_ERGO(MaxRAM, (uint64_t)phys_mem); } else { phys_mem = (julong)MaxRAM; } } else { - phys_mem = FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM) + phys_mem = FLAG_IS_DEFAULT(MaxRAM) ? MIN2(static_cast(os::physical_memory()), (julong)MaxRAM) : (julong)MaxRAM; } @@ -1694,7 +1694,8 @@ jint Arguments::set_aggressive_heap_flags() { // Thus, we need to make sure we're using a julong for intermediate // calculations. julong initHeapSize; - julong total_memory = os::physical_memory(); + size_t phys_mem = os::physical_memory(); + julong total_memory = static_cast(phys_mem); if (total_memory < (julong) 256 * M) { jio_fprintf(defaultStream::error_stream(), diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index fd44971fe63b..a2e4f125d624 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -1174,9 +1174,10 @@ void os::print_summary_info(outputStream* st, char* buf, size_t buflen) { #endif // PRODUCT get_summary_cpu_info(buf, buflen); st->print("%s, ", buf); - size_t mem = physical_memory()/G; + size_t phys_mem = physical_memory(); + size_t mem = phys_mem/G; if (mem == 0) { // for low memory systems - mem = physical_memory()/M; + mem = phys_mem/M; st->print("%d cores, " SIZE_FORMAT "M, ", processor_count(), mem); } else { st->print("%d cores, " SIZE_FORMAT "G, ", processor_count(), mem); @@ -1907,10 +1908,10 @@ bool os::is_server_class_machine() { // We allow some part (1/8?) of the memory to be "missing", // based on the sizes of DIMMs, and maybe graphics cards. const julong missing_memory = 256UL * M; - + size_t phys_mem = os::physical_memory(); /* Is this a server class machine? */ if ((os::active_processor_count() >= (int)server_processors) && - (os::physical_memory() >= (server_memory - missing_memory))) { + (phys_mem >= (server_memory - missing_memory))) { const unsigned int logical_processors = VM_Version::logical_processors_per_package(); if (logical_processors > 1) { diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index 13629829d9e2..89064873f111 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -320,10 +320,10 @@ class os: AllStatic { // For example, on Linux, "available" memory (`MemAvailable` in `/proc/meminfo`) is greater // than "free" memory (`MemFree` in `/proc/meminfo`) because Linux can free memory // aggressively (e.g. clear caches) so that it becomes available. - static julong available_memory(); - static julong free_memory(); + [[nodiscard]] static bool available_memory(size_t& value); + [[nodiscard]] static bool free_memory(size_t& value); - static julong physical_memory(); + static size_t physical_memory(); static bool has_allocatable_memory_limit(size_t* limit); static bool is_server_class_machine(); diff --git a/src/hotspot/share/services/management.cpp b/src/hotspot/share/services/management.cpp index a9c50a8bf06d..a8690743ef62 100644 --- a/src/hotspot/share/services/management.cpp +++ b/src/hotspot/share/services/management.cpp @@ -978,7 +978,7 @@ static jlong get_long_attribute(jmmLongAttribute att) { return ClassLoadingService::class_method_data_size(); case JMM_OS_MEM_TOTAL_PHYSICAL_BYTES: - return os::physical_memory(); + return static_cast(os::physical_memory()); default: return -1; From de7d89dc9ec0ab816c988de8067ab8c0cb8ebdcd Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 16 Mar 2026 10:28:02 +0000 Subject: [PATCH 032/223] 8368670: Deadlock in JFR on event register + class load Backport-of: 5fccabff15ae8bcc3d03156fa331bbc0fefb0cbe --- .../share/classes/jdk/jfr/internal/MetadataRepository.java | 2 +- src/jdk.jfr/share/classes/jdk/jfr/internal/SettingsManager.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java index 9429d6e5c940..994735e89fe7 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java @@ -277,7 +277,7 @@ private byte[] getBinaryRepresentation() { } } - synchronized boolean isEnabled(String eventName) { + boolean isEnabled(String eventName) { return settingsManager.isEnabled(eventName); } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/SettingsManager.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/SettingsManager.java index c94f7e57d7ba..020f06ff041b 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/SettingsManager.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/SettingsManager.java @@ -128,7 +128,7 @@ public void finish() { } } - private Map availableSettings = new LinkedHashMap<>(); + private volatile Map availableSettings = new LinkedHashMap<>(); void setSettings(List> activeSettings, boolean writeSettingEvents) { // store settings so they are available if a new event class is loaded From 1ea1fe9bd21253d5f959f8458cf8af60740dfe1a Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Mon, 16 Mar 2026 22:53:28 +0000 Subject: [PATCH 033/223] 8368181: ProblemList java/awt/Dialog/ModalExcludedTest/ModalExcludedTest.java Backport-of: 7d3452b37eceff7309dc6b5285e3da31a3c398ec --- test/jdk/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 98bdc0da5e6a..f4db1a188af3 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -270,6 +270,7 @@ java/awt/Clipboard/ClipboardSecurity.java 8054809 macosx-all java/awt/Clipboard/GetAltContentsTest/SystemClipboardTest.java 8234140 macosx-all java/awt/Clipboard/ImageTransferTest.java 8030710 generic-all java/awt/Clipboard/NoDataConversionFailureTest.java 8234140 macosx-all +java/awt/Dialog/ModalExcludedTest.java 7125054 macosx-all java/awt/Frame/MiscUndecorated/RepaintTest.java 8266244 macosx-aarch64 java/awt/Modal/FileDialog/FileDialogAppModal1Test.java 7186009 macosx-all java/awt/Modal/FileDialog/FileDialogAppModal2Test.java 7186009 macosx-all From 7206cc37fc988fbfc7a8b63d8941be286001b739 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Tue, 17 Mar 2026 05:44:56 +0000 Subject: [PATCH 034/223] 8370492: [Linux] Update cpu shares to cpu.weight mapping function Backport-of: 5d65c23cd99b72527dcfab9eb6da9510e7dc6330 --- .../os/linux/cgroupV2Subsystem_linux.cpp | 31 ++++++++--- .../platform/cgroupv2/CgroupV2Subsystem.java | 31 ++++++++--- .../jtreg/containers/docker/TestMisc.java | 52 ++++++++++++++++++- .../platform/docker/MetricsCpuTester.java | 10 ++-- 4 files changed, 107 insertions(+), 17 deletions(-) diff --git a/src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp b/src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp index 4367eba4c43a..31534efb89db 100644 --- a/src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp +++ b/src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp @@ -25,6 +25,8 @@ #include "cgroupV2Subsystem_linux.hpp" #include "cgroupUtil_linux.hpp" +#include + // Constructor CgroupV2Controller::CgroupV2Controller(char* mount_path, char *cgroup_path, @@ -60,22 +62,39 @@ int CgroupV2CpuController::cpu_shares() { log_debug(os, container)("CPU Shares is: %d", -1); return -1; } + // cg v2 values must be in range [1-10000] + assert(shares_int >= 1 && shares_int <= 10000, "invariant"); // CPU shares (OCI) value needs to get translated into // a proper Cgroups v2 value. See: - // https://github.com/containers/crun/blob/master/crun.1.md#cpu-controller + // https://github.com/containers/crun/blob/1.24/crun.1.md#cpu-controller // // Use the inverse of (x == OCI value, y == cgroupsv2 value): - // ((262142 * y - 1)/9999) + 2 = x + // y = 10^(log2(x)^2/612 + 125/612 * log2(x) - 7.0/34.0) + // + // By re-arranging it to the standard quadratic form: + // log2(x)^2 + 125 * log2(x) - (126 + 612 * log_10(y)) = 0 + // + // Therefore, log2(x) = (-125 + sqrt( 125^2 - 4 * (-(126 + 612 * log_10(y)))))/2 + // + // As a result we have the inverse (we can discount substraction of the + // square root value since those values result in very small numbers and the + // cpu shares values - OCI - are in range [2,262144]): + // + // x = 2^((-125 + sqrt(16129 + 2448* log10(y)))/2) // - int x = 262142 * shares_int - 1; - double frac = x/9999.0; - x = ((int)frac) + 2; + double log_multiplicand = log10(shares_int); + double discriminant = 16129 + 2448 * log_multiplicand; + double square_root = sqrt(discriminant); + double exponent = (-125 + square_root)/2; + double scaled_val = pow(2, exponent); + int x = (int) scaled_val; log_trace(os, container)("Scaled CPU shares value is: %d", x); // Since the scaled value is not precise, return the closest // multiple of PER_CPU_SHARES for a more conservative mapping if ( x <= PER_CPU_SHARES ) { - // will always map to 1 CPU + // Don't do the multiples of PER_CPU_SHARES mapping since we + // have a value <= PER_CPU_SHARES log_debug(os, container)("CPU Shares is: %d", x); return x; } diff --git a/src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java b/src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java index ddb4d8e27183..3bdd7dc2a64e 100644 --- a/src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java +++ b/src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java @@ -154,22 +154,39 @@ private long getFromCpuMax(int tokenIdx) { @Override public long getCpuShares() { long sharesRaw = getLongVal("cpu.weight"); - if (sharesRaw == 100 || sharesRaw <= 0) { + // cg v2 value must be in range [1,10000] + if (sharesRaw == 100 || sharesRaw <= 0 || sharesRaw > 10000) { return CgroupSubsystem.LONG_RETVAL_UNLIMITED; } int shares = (int)sharesRaw; // CPU shares (OCI) value needs to get translated into // a proper Cgroups v2 value. See: - // https://github.com/containers/crun/blob/master/crun.1.md#cpu-controller + // https://github.com/containers/crun/blob/1.24/crun.1.md#cpu-controller // // Use the inverse of (x == OCI value, y == cgroupsv2 value): - // ((262142 * y - 1)/9999) + 2 = x + // y = 10^(log2(x)^2/612 + 125/612 * log2(x) - 7.0/34.0) // - int x = 262142 * shares - 1; - double frac = x/9999.0; - x = ((int)frac) + 2; + // By re-arranging it to the standard quadratic form: + // log2(x)^2 + 125 * log2(x) - (126 + 612 * log_10(y)) = 0 + // + // Therefore, log2(x) = (-125 + sqrt( 125^2 - 4 * (-(126 + 612 * log_10(y)))))/2 + // + // As a result we have the inverse (we can discount substraction of the + // square root value since those values result in very small numbers and the + // cpu shares values - OCI - are in range [2-262144]) + // + // x = 2^((-125 + sqrt(16129 + 2448* log10(y)))/2) + // + double logMultiplicand = Math.log10(shares); + double discriminant = 16129 + 2448 * logMultiplicand; + double squareRoot = Math.sqrt(discriminant); + double exponent = (-125 + squareRoot)/2; + double scaledValue = Math.pow(2, exponent); + + int x = (int)scaledValue; if ( x <= PER_CPU_SHARES ) { - return PER_CPU_SHARES; // mimic cgroups v1 + // Return the back-mapped value. + return x; } int f = x/PER_CPU_SHARES; int lower_multiple = f * PER_CPU_SHARES; diff --git a/test/hotspot/jtreg/containers/docker/TestMisc.java b/test/hotspot/jtreg/containers/docker/TestMisc.java index 4da130673994..1db65b615588 100644 --- a/test/hotspot/jtreg/containers/docker/TestMisc.java +++ b/test/hotspot/jtreg/containers/docker/TestMisc.java @@ -29,20 +29,24 @@ * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.misc + * java.base/jdk.internal.platform * java.management * jdk.jartool/sun.tools.jar * @build CheckContainerized jdk.test.whitebox.WhiteBox PrintContainerInfo * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar whitebox.jar jdk.test.whitebox.WhiteBox * @run driver TestMisc */ +import jdk.internal.platform.Metrics; import jdk.test.lib.containers.docker.Common; import jdk.test.lib.containers.docker.DockerTestUtils; import jdk.test.lib.containers.docker.DockerRunOptions; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; +import jtreg.SkippedException; public class TestMisc { + private static final Metrics metrics = Metrics.systemMetrics(); private static final String imageName = Common.imageName("misc"); public static void main(String[] args) throws Exception { @@ -58,6 +62,7 @@ public static void main(String[] args) throws Exception { testIsContainerized(); testPrintContainerInfo(); testPrintContainerInfoActiveProcessorCount(); + testPrintContainerInfoCPUShares(); } finally { DockerTestUtils.removeDockerImage(imageName); } @@ -94,8 +99,53 @@ private static void testPrintContainerInfo() throws Exception { checkContainerInfo(Common.run(opts)); } + // Test the mapping function on cgroups v2. Should also pass on cgroups v1 as it's + // a direct mapping there. + private static void testPrintContainerInfoCPUShares() throws Exception { + // Test won't work on cgv1 rootless podman since resource limits don't + // work there. + if ("cgroupv1".equals(metrics.getProvider()) && + DockerTestUtils.isPodman() && + DockerTestUtils.isRootless()) { + throw new SkippedException("Resource limits required for testPrintContainerInfoCPUShares(). " + + "This is cgv1 with podman in rootless mode. Test skipped."); + } + // Anything less than 1024 should return the back-mapped cpu-shares value without + // rounding to next multiple of 1024 (on cg v2). Only ensure that we get + // 'cpu_shares: ' over 'cpu_shares: no shares'. + printContainerInfo(512, 1024, false); + // Don't use 1024 exactly so as to avoid mapping to the unlimited/uset case. + // Use a value > 100 post-mapping so as to hit the non-default branch: 1052 => 103 + printContainerInfo(1052, 1024, true); + // need at least 2 CPU cores for this test to work + if (Runtime.getRuntime().availableProcessors() >= 2) { + printContainerInfo(2048, 2048, true); + } + } + + private static void printContainerInfo(int cpuShares, int expected, boolean numberMatch) throws Exception { + Common.logNewTestCase("Test print_container_info() - cpu shares - given: " + cpuShares + ", expected: " + expected); + + DockerRunOptions opts = Common.newOpts(imageName, "PrintContainerInfo"); + Common.addWhiteBoxOpts(opts); + opts.addDockerOpts("--cpu-shares", Integer.valueOf(cpuShares).toString()); + + OutputAnalyzer out = Common.run(opts); + String str = out.getOutput(); + boolean isCgroupV2 = str.contains("cgroupv2"); + // cg v1 maps cpu shares values verbatim. Only cg v2 uses the + // mapping function. + if (numberMatch) { + int valueExpected = isCgroupV2 ? expected : cpuShares; + out.shouldContain("cpu_shares: " + valueExpected); + } else { + // must not print "no shares" + out.shouldNotContain("cpu_shares: no shares"); + } + } + private static void testPrintContainerInfoActiveProcessorCount() throws Exception { - Common.logNewTestCase("Test print_container_info()"); + Common.logNewTestCase("Test print_container_info() - ActiveProcessorCount"); DockerRunOptions opts = Common.newOpts(imageName, "PrintContainerInfo").addJavaOpts("-XX:ActiveProcessorCount=2"); Common.addWhiteBoxOpts(opts); diff --git a/test/jdk/jdk/internal/platform/docker/MetricsCpuTester.java b/test/jdk/jdk/internal/platform/docker/MetricsCpuTester.java index ff5d52d95a65..62549e7b5183 100644 --- a/test/jdk/jdk/internal/platform/docker/MetricsCpuTester.java +++ b/test/jdk/jdk/internal/platform/docker/MetricsCpuTester.java @@ -145,9 +145,13 @@ private static void testCpuSetMemNodes(String cpusetMems) { private static void testCpuShares(long shares) { Metrics metrics = Metrics.systemMetrics(); if ("cgroupv2".equals(metrics.getProvider()) && shares < 1024) { - // Adjust input shares for < 1024 cpu shares as the - // impl. rounds up to the next multiple of 1024 - shares = 1024; + // Don't assert for shares values less than 1024 as we don't + // have a 1-to-1 mapping from the cgroup v2 value to the OCI + // value. + System.out.println("Debug: cgv2 - Got CPU shares of: " + + metrics.getCpuShares() + " - Skipping assert."); + System.out.println("TEST PASSED!!!"); + return; } long newShares = metrics.getCpuShares(); if (newShares != shares) { From 1a002f2fe5c00a2a1d00b80aba12c0ba576f2e9e Mon Sep 17 00:00:00 2001 From: Arno Zeller Date: Wed, 18 Mar 2026 08:22:24 +0000 Subject: [PATCH 035/223] 8366031: Mark com/sun/nio/sctp/SctpChannel/CloseDescriptors.java as intermittent Backport-of: efb81dafaf6da334674e52dbb509208d7d872440 --- test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java | 1 + 1 file changed, 1 insertion(+) diff --git a/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java b/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java index 33b68fafd520..5d62b88f23e2 100644 --- a/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java +++ b/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java @@ -24,6 +24,7 @@ /* * @test * @bug 8238274 + * @key intermittent * @summary Potential leak file descriptor for SCTP * @requires (os.family == "linux") * @library /test/lib From 81127c3c6811330d05feffe7e9589d97a2e76e36 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 18 Mar 2026 13:57:09 +0000 Subject: [PATCH 036/223] 8367485: os::physical_memory is broken in 32-bit JVMs when running on 64-bit OSes Reviewed-by: rrich Backport-of: 2746c1a555891564963299182b3b0293eaefc901 --- src/hotspot/os/aix/os_aix.cpp | 16 ++++---- src/hotspot/os/aix/os_aix.hpp | 8 ++-- src/hotspot/os/bsd/os_bsd.cpp | 26 ++++++------- src/hotspot/os/bsd/os_bsd.hpp | 8 ++-- src/hotspot/os/linux/os_linux.cpp | 38 +++++++++---------- src/hotspot/os/linux/os_linux.hpp | 8 ++-- src/hotspot/os/windows/os_windows.cpp | 34 ++++++++--------- src/hotspot/os/windows/os_windows.hpp | 30 +++++++-------- src/hotspot/share/compiler/compileBroker.cpp | 2 +- src/hotspot/share/gc/shared/gcInitLogger.cpp | 5 ++- src/hotspot/share/gc/z/zLargePages.cpp | 2 +- .../share/jfr/periodic/jfrPeriodic.cpp | 6 +-- .../share/prims/jvmtiRedefineClasses.cpp | 10 ++--- src/hotspot/share/runtime/arguments.cpp | 2 +- src/hotspot/share/runtime/os.cpp | 20 +++++----- src/hotspot/share/runtime/os.hpp | 6 +-- .../share/utilities/globalDefinitions.hpp | 6 +++ 17 files changed, 117 insertions(+), 110 deletions(-) diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 35b948b189b7..ec2eda18bd3c 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -177,7 +177,7 @@ static void vmembk_print_on(outputStream* os); //////////////////////////////////////////////////////////////////////////////// // global variables (for a description see os_aix.hpp) -size_t os::Aix::_physical_memory = 0; +physical_memory_size_type os::Aix::_physical_memory = 0; pthread_t os::Aix::_main_thread = ((pthread_t)0); @@ -265,29 +265,29 @@ static bool is_close_to_brk(address a) { return false; } -bool os::free_memory(size_t& value) { +bool os::free_memory(physical_memory_size_type& value) { return Aix::available_memory(value); } -bool os::available_memory(size_t& value) { +bool os::available_memory(physical_memory_size_type& value) { return Aix::available_memory(value); } -bool os::Aix::available_memory(size_t& value) { +bool os::Aix::available_memory(physical_memory_size_type& value) { // Avoid expensive API call here, as returned value will always be null. if (os::Aix::on_pase()) { return 0x0LL; } os::Aix::meminfo_t mi; if (os::Aix::get_meminfo(&mi)) { - value = static_cast(mi.real_free); + value = static_cast(mi.real_free); return true; } else { return false; } } -size_t os::physical_memory() { +physical_memory_size_type os::physical_memory() { return Aix::physical_memory(); } @@ -358,7 +358,7 @@ void os::Aix::initialize_system_info() { if (!os::Aix::get_meminfo(&mi)) { assert(false, "os::Aix::get_meminfo failed."); } - _physical_memory = static_cast(mi.real_total); + _physical_memory = static_cast(mi.real_total); } // Helper function for tracing page sizes. @@ -2403,7 +2403,7 @@ jint os::init_2(void) { } trcVerbose("processor count: %d", os::_processor_count); - trcVerbose("physical memory: %zu", Aix::_physical_memory); + trcVerbose("physical memory: " PHYS_MEM_TYPE_FORMAT, Aix::_physical_memory); // Initially build up the loaded dll map. LoadedLibraries::reload(); diff --git a/src/hotspot/os/aix/os_aix.hpp b/src/hotspot/os/aix/os_aix.hpp index 2bd82219f591..7e47ced50887 100644 --- a/src/hotspot/os/aix/os_aix.hpp +++ b/src/hotspot/os/aix/os_aix.hpp @@ -35,7 +35,7 @@ class os::Aix { private: - static size_t _physical_memory; + static physical_memory_size_type _physical_memory; static pthread_t _main_thread; // -1 = uninitialized, 0 = AIX, 1 = OS/400 (PASE) @@ -58,9 +58,9 @@ class os::Aix { // 1 - EXTSHM=ON static int _extshm; - static bool available_memory(size_t& value); - static bool free_memory(size_t& value); - static size_t physical_memory() { return _physical_memory; } + static bool available_memory(physical_memory_size_type& value); + static bool free_memory(physical_memory_size_type& value); + static physical_memory_size_type physical_memory() { return _physical_memory; } static void initialize_system_info(); // OS recognitions (PASE/AIX, OS level) call this before calling any diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index b5f361f11be9..0a5e29d1fcb3 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -120,7 +120,7 @@ //////////////////////////////////////////////////////////////////////////////// // global variables -size_t os::Bsd::_physical_memory = 0; +physical_memory_size_type os::Bsd::_physical_memory = 0; #ifdef __APPLE__ mach_timebase_info_data_t os::Bsd::_timebase_info = {0, 0}; @@ -139,17 +139,17 @@ static volatile int processor_id_next = 0; //////////////////////////////////////////////////////////////////////////////// // utility functions -bool os::available_memory(size_t& value) { +bool os::available_memory(physical_memory_size_type& value) { return Bsd::available_memory(value); } -bool os::free_memory(size_t& value) { +bool os::free_memory(physical_memory_size_type& value) { return Bsd::available_memory(value); } // available here means free -bool os::Bsd::available_memory(size_t& value) { - uint64_t available = static_cast(physical_memory() >> 2); +bool os::Bsd::available_memory(physical_memory_size_type& value) { + physical_memory_size_type available = physical_memory() >> 2; #ifdef __APPLE__ mach_msg_type_number_t count = HOST_VM_INFO64_COUNT; vm_statistics64_data_t vmstat; @@ -163,7 +163,7 @@ bool os::Bsd::available_memory(size_t& value) { return false; } #endif - value = static_cast(available); + value = available; return true; } @@ -183,7 +183,7 @@ void os::Bsd::print_uptime_info(outputStream* st) { } } -size_t os::physical_memory() { +physical_memory_size_type os::physical_memory() { return Bsd::physical_memory(); } @@ -257,7 +257,7 @@ void os::Bsd::initialize_system_info() { len = sizeof(mem_val); if (sysctl(mib, 2, &mem_val, &len, nullptr, 0) != -1) { assert(len == sizeof(mem_val), "unexpected data size"); - _physical_memory = static_cast(mem_val); + _physical_memory = static_cast(mem_val); } else { _physical_memory = 256 * 1024 * 1024; // fallback (XXXBSD?) } @@ -268,7 +268,7 @@ void os::Bsd::initialize_system_info() { // datasize rlimit restricts us anyway. struct rlimit limits; getrlimit(RLIMIT_DATA, &limits); - _physical_memory = MIN2(_physical_memory, static_cast(limits.rlim_cur)); + _physical_memory = MIN2(_physical_memory, static_cast(limits.rlim_cur)); } #endif } @@ -1414,12 +1414,12 @@ void os::print_memory_info(outputStream* st) { st->print("Memory:"); st->print(" " SIZE_FORMAT "k page", os::vm_page_size()>>10); - size_t phys_mem = os::physical_memory(); - st->print(", physical %zuk", + physical_memory_size_type phys_mem = os::physical_memory(); + st->print(", physical " PHYS_MEM_TYPE_FORMAT "k", phys_mem >> 10); - size_t avail_mem = 0; + physical_memory_size_type avail_mem = 0; (void)os::available_memory(avail_mem); - st->print("(%zuk free)", + st->print("(" PHYS_MEM_TYPE_FORMAT "k free)", avail_mem >> 10); if((sysctlbyname("vm.swapusage", &swap_usage, &size, nullptr, 0) == 0) || (errno == ENOMEM)) { diff --git a/src/hotspot/os/bsd/os_bsd.hpp b/src/hotspot/os/bsd/os_bsd.hpp index c1cb360dee24..f8317ed0c8d7 100644 --- a/src/hotspot/os/bsd/os_bsd.hpp +++ b/src/hotspot/os/bsd/os_bsd.hpp @@ -42,12 +42,12 @@ class os::Bsd { protected: - static size_t _physical_memory; + static physical_memory_size_type _physical_memory; static pthread_t _main_thread; - static bool available_memory(size_t& value); - static bool free_memory(size_t& value); - static size_t physical_memory() { return _physical_memory; } + static bool available_memory(physical_memory_size_type& value); + static bool free_memory(physical_memory_size_type& value); + static physical_memory_size_type physical_memory() { return _physical_memory; } static void initialize_system_info(); static void rebuild_cpu_to_node_map(); diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index d5a44dfa91ac..db86de1fbf48 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -161,7 +161,7 @@ enum CoredumpFilterBit { //////////////////////////////////////////////////////////////////////////////// // global variables -size_t os::Linux::_physical_memory = 0; +physical_memory_size_type os::Linux::_physical_memory = 0; address os::Linux::_initial_thread_stack_bottom = nullptr; uintptr_t os::Linux::_initial_thread_stack_size = 0; @@ -236,15 +236,15 @@ julong os::Linux::available_memory_in_container() { return avail_mem; } -bool os::available_memory(size_t& value) { +bool os::available_memory(physical_memory_size_type& value) { return Linux::available_memory(value); } -bool os::Linux::available_memory(size_t& value) { +bool os::Linux::available_memory(physical_memory_size_type& value) { julong avail_mem = available_memory_in_container(); if (avail_mem != static_cast(-1L)) { log_trace(os)("available container memory: " JULONG_FORMAT, avail_mem); - value = static_cast(avail_mem); + value = static_cast(avail_mem); return true; } @@ -260,28 +260,28 @@ bool os::Linux::available_memory(size_t& value) { fclose(fp); } if (avail_mem == static_cast(-1L)) { - size_t free_mem = 0; + physical_memory_size_type free_mem = 0; if (!free_memory(free_mem)) { return false; } avail_mem = static_cast(free_mem); } log_trace(os)("available memory: " JULONG_FORMAT, avail_mem); - value = static_cast(avail_mem); + value = static_cast(avail_mem); return true; } -bool os::free_memory(size_t& value) { +bool os::free_memory(physical_memory_size_type& value) { return Linux::free_memory(value); } -bool os::Linux::free_memory(size_t& value) { +bool os::Linux::free_memory(physical_memory_size_type& value) { // values in struct sysinfo are "unsigned long" struct sysinfo si; julong free_mem = available_memory_in_container(); if (free_mem != static_cast(-1L)) { log_trace(os)("free container memory: " JULONG_FORMAT, free_mem); - value = static_cast(free_mem); + value = static_cast(free_mem); return true; } @@ -291,21 +291,21 @@ bool os::Linux::free_memory(size_t& value) { } free_mem = (julong)si.freeram * si.mem_unit; log_trace(os)("free memory: " JULONG_FORMAT, free_mem); - value = static_cast(free_mem); + value = static_cast(free_mem); return true; } -size_t os::physical_memory() { +physical_memory_size_type os::physical_memory() { if (OSContainer::is_containerized()) { jlong mem_limit; if ((mem_limit = OSContainer::memory_limit_in_bytes()) > 0) { log_trace(os)("total container memory: " JLONG_FORMAT, mem_limit); - return static_cast(mem_limit); + return static_cast(mem_limit); } } - size_t phys_mem = Linux::physical_memory(); - log_trace(os)("total system memory: %zu", phys_mem); + physical_memory_size_type phys_mem = Linux::physical_memory(); + log_trace(os)("total system memory: " PHYS_MEM_TYPE_FORMAT, phys_mem); return phys_mem; } @@ -462,7 +462,7 @@ void os::Linux::initialize_system_info() { fclose(fp); } } - _physical_memory = static_cast(sysconf(_SC_PHYS_PAGES)) * static_cast(sysconf(_SC_PAGESIZE)); + _physical_memory = static_cast(sysconf(_SC_PHYS_PAGES)) * static_cast(sysconf(_SC_PAGESIZE)); assert(processor_count() > 0, "linux error"); } @@ -2442,12 +2442,12 @@ void os::print_memory_info(outputStream* st) { // values in struct sysinfo are "unsigned long" struct sysinfo si; sysinfo(&si); - size_t phys_mem = physical_memory(); - st->print(", physical %zuk", + physical_memory_size_type phys_mem = physical_memory(); + st->print(", physical " PHYS_MEM_TYPE_FORMAT "k", phys_mem >> 10); - size_t avail_mem = 0; + physical_memory_size_type avail_mem = 0; (void)os::available_memory(avail_mem); - st->print("(%zuk free)", + st->print("(" PHYS_MEM_TYPE_FORMAT "k free)", avail_mem >> 10); st->print(", swap " UINT64_FORMAT "k", ((jlong)si.totalswap * si.mem_unit) >> 10); diff --git a/src/hotspot/os/linux/os_linux.hpp b/src/hotspot/os/linux/os_linux.hpp index b2f09be921ae..ed6c52aade44 100644 --- a/src/hotspot/os/linux/os_linux.hpp +++ b/src/hotspot/os/linux/os_linux.hpp @@ -51,11 +51,11 @@ class os::Linux { protected: - static size_t _physical_memory; + static physical_memory_size_type _physical_memory; static pthread_t _main_thread; - static bool available_memory(size_t& value); - static bool free_memory(size_t& value); + static bool available_memory(physical_memory_size_type& value); + static bool free_memory(physical_memory_size_type& value); static void initialize_system_info(); @@ -127,7 +127,7 @@ class os::Linux { static address initial_thread_stack_bottom(void) { return _initial_thread_stack_bottom; } static uintptr_t initial_thread_stack_size(void) { return _initial_thread_stack_size; } - static size_t physical_memory() { return _physical_memory; } + static physical_memory_size_type physical_memory() { return _physical_memory; } static julong host_swap(); static intptr_t* ucontext_get_sp(const ucontext_t* uc); diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index b01b003bdbe6..8b3c0dcedc11 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -832,22 +832,22 @@ jlong os::elapsed_frequency() { } -bool os::available_memory(size_t& value) { +bool os::available_memory(physical_memory_size_type& value) { return win32::available_memory(value); } -bool os::free_memory(size_t& value) { +bool os::free_memory(physical_memory_size_type& value) { return win32::available_memory(value); } -bool os::win32::available_memory(size_t& value) { +bool os::win32::available_memory(physical_memory_size_type& value) { // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect // value if total memory is larger than 4GB MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); BOOL res = GlobalMemoryStatusEx(&ms); if (res == TRUE) { - value = static_cast(ms.ullAvailPhys); + value = static_cast(ms.ullAvailPhys); return true; } else { assert(false, "GlobalMemoryStatusEx failed in os::win32::available_memory(): %lu", ::GetLastError()); @@ -855,7 +855,7 @@ bool os::win32::available_memory(size_t& value) { } } -size_t os::physical_memory() { +physical_memory_size_type os::physical_memory() { return win32::physical_memory(); } @@ -4067,25 +4067,25 @@ int os::current_process_id() { return (_initial_pid ? _initial_pid : _getpid()); } -int os::win32::_processor_type = 0; +int os::win32::_processor_type = 0; // Processor level is not available on non-NT systems, use vm_version instead -int os::win32::_processor_level = 0; -size_t os::win32::_physical_memory = 0; +int os::win32::_processor_level = 0; +physical_memory_size_type os::win32::_physical_memory = 0; -bool os::win32::_is_windows_server = false; +bool os::win32::_is_windows_server = false; // 6573254 // Currently, the bug is observed across all the supported Windows releases, // including the latest one (as of this writing - Windows Server 2012 R2) -bool os::win32::_has_exit_bug = true; +bool os::win32::_has_exit_bug = true; -int os::win32::_major_version = 0; -int os::win32::_minor_version = 0; -int os::win32::_build_number = 0; -int os::win32::_build_minor = 0; +int os::win32::_major_version = 0; +int os::win32::_minor_version = 0; +int os::win32::_build_number = 0; +int os::win32::_build_minor = 0; -bool os::win32::_processor_group_warning_displayed = false; -bool os::win32::_job_object_processor_group_warning_displayed = false; +bool os::win32::_processor_group_warning_displayed = false; +bool os::win32::_job_object_processor_group_warning_displayed = false; void getWindowsInstallationType(char* buffer, int bufferSize) { HKEY hKey; @@ -4304,7 +4304,7 @@ void os::win32::initialize_system_info() { if (res != TRUE) { assert(false, "GlobalMemoryStatusEx failed in os::win32::initialize_system_info(): %lu", ::GetLastError()); } - _physical_memory = static_cast(ms.ullTotalPhys); + _physical_memory = static_cast(ms.ullTotalPhys); if (FLAG_IS_DEFAULT(MaxRAM)) { // Adjust MaxRAM according to the maximum virtual address space available. diff --git a/src/hotspot/os/windows/os_windows.hpp b/src/hotspot/os/windows/os_windows.hpp index 2c5fc5c942cd..abbccbf234cb 100644 --- a/src/hotspot/os/windows/os_windows.hpp +++ b/src/hotspot/os/windows/os_windows.hpp @@ -38,18 +38,18 @@ class os::win32 { friend class os; protected: - static int _processor_type; - static int _processor_level; - static size_t _physical_memory; - static bool _is_windows_server; - static bool _has_exit_bug; - static bool _processor_group_warning_displayed; - static bool _job_object_processor_group_warning_displayed; - - static int _major_version; - static int _minor_version; - static int _build_number; - static int _build_minor; + static int _processor_type; + static int _processor_level; + static physical_memory_size_type _physical_memory; + static bool _is_windows_server; + static bool _has_exit_bug; + static bool _processor_group_warning_displayed; + static bool _job_object_processor_group_warning_displayed; + + static int _major_version; + static int _minor_version; + static int _build_number; + static int _build_minor; static void print_windows_version(outputStream* st); static void print_uptime_info(outputStream* st); @@ -102,9 +102,9 @@ class os::win32 { static int processor_level() { return _processor_level; } - static bool available_memory(size_t& value); - static bool free_memory(size_t& value); - static size_t physical_memory() { return _physical_memory; } + static bool available_memory(physical_memory_size_type& value); + static bool free_memory(physical_memory_size_type& value); + static physical_memory_size_type physical_memory() { return _physical_memory; } // load dll from Windows system directory or Windows directory static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen); diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index 3da934b2cc01..63378b244775 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -1033,7 +1033,7 @@ void CompileBroker::possibly_add_compiler_threads(JavaThread* THREAD) { if (new_c2_count <= old_c2_count && new_c1_count <= old_c1_count) return; // Now, we do the more expensive operations. - size_t free_memory = 0; + physical_memory_size_type free_memory = 0; // Return value ignored - defaulting to 0 on failure. (void)os::free_memory(free_memory); // If SegmentedCodeCache is off, both values refer to the single heap (with type CodeBlobType::All). diff --git a/src/hotspot/share/gc/shared/gcInitLogger.cpp b/src/hotspot/share/gc/shared/gcInitLogger.cpp index 88ce43201bb3..5956122323d4 100644 --- a/src/hotspot/share/gc/shared/gcInitLogger.cpp +++ b/src/hotspot/share/gc/shared/gcInitLogger.cpp @@ -63,8 +63,9 @@ void GCInitLogger::print_cpu() { } void GCInitLogger::print_memory() { - size_t memory = os::physical_memory(); - log_info_p(gc, init)("Memory: " PROPERFMT, PROPERFMTARGS(memory)); + physical_memory_size_type memory = os::physical_memory(); + log_info_p(gc, init)("Memory: " PHYS_MEM_TYPE_FORMAT "%s", + byte_size_in_proper_unit(memory), proper_unit_for_byte_size(memory)); } void GCInitLogger::print_large_pages() { diff --git a/src/hotspot/share/gc/z/zLargePages.cpp b/src/hotspot/share/gc/z/zLargePages.cpp index f4dbfb224337..9a35e246f4b6 100644 --- a/src/hotspot/share/gc/z/zLargePages.cpp +++ b/src/hotspot/share/gc/z/zLargePages.cpp @@ -31,7 +31,7 @@ ZLargePages::State ZLargePages::_state; void ZLargePages::initialize() { pd_initialize(); - const size_t memory = os::physical_memory(); + const size_t memory = static_cast(os::physical_memory()); log_info_p(gc, init)("Memory: " PROPERFMT, PROPERFMTARGS(memory)); log_info_p(gc, init)("Large Page Support: %s", to_string()); } diff --git a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp index eddc5c03310a..80a160ab84ba 100644 --- a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp +++ b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp @@ -515,13 +515,13 @@ TRACE_REQUEST_FUNC(ThreadAllocationStatistics) { * the total memory reported is the amount of memory configured for the guest OS by the hypervisor. */ TRACE_REQUEST_FUNC(PhysicalMemory) { - u8 totalPhysicalMemory = static_cast(os::physical_memory()); + physical_memory_size_type totalPhysicalMemory = os::physical_memory(); EventPhysicalMemory event; event.set_totalSize(totalPhysicalMemory); - size_t avail_mem = 0; + physical_memory_size_type avail_mem = 0; // Return value ignored - defaulting to 0 on failure. (void)os::available_memory(avail_mem); - event.set_usedSize(totalPhysicalMemory - static_cast(avail_mem)); + event.set_usedSize(totalPhysicalMemory - avail_mem); event.commit(); } diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp index 633dd82dd742..009f3972fe13 100644 --- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp +++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp @@ -1375,11 +1375,11 @@ jvmtiError VM_RedefineClasses::load_new_class_versions() { // constant pools HandleMark hm(current); InstanceKlass* the_class = get_ik(_class_defs[i].klass); - size_t avail_mem = 0; + physical_memory_size_type avail_mem = 0; // Return value ignored - defaulting to 0 on failure. (void)os::available_memory(avail_mem); log_debug(redefine, class, load) - ("loading name=%s kind=%d (avail_mem=%zuK)", + ("loading name=%s kind=%d (avail_mem=" PHYS_MEM_TYPE_FORMAT "K)", the_class->external_name(), _class_load_kind, avail_mem >> 10); ClassFileStream st((u1*)_class_defs[i].class_bytes, @@ -1548,7 +1548,7 @@ jvmtiError VM_RedefineClasses::load_new_class_versions() { // Return value ignored - defaulting to 0 on failure. (void)os::available_memory(avail_mem); log_debug(redefine, class, load) - ("loaded name=%s (avail_mem=%zuK)", the_class->external_name(), avail_mem >> 10); + ("loaded name=%s (avail_mem=" PHYS_MEM_TYPE_FORMAT "K)", the_class->external_name(), avail_mem >> 10); } return JVMTI_ERROR_NONE; @@ -4456,11 +4456,11 @@ void VM_RedefineClasses::redefine_single_class(Thread* current, jclass the_jclas ResourceMark rm(current); // increment the classRedefinedCount field in the_class and in any // direct and indirect subclasses of the_class - size_t avail_mem = 0; + physical_memory_size_type avail_mem = 0; // Return value ignored - defaulting to 0 on failure. (void)os::available_memory(avail_mem); log_info(redefine, class, load) - ("redefined name=%s, count=%d (avail_mem=%zuK)", + ("redefined name=%s, count=%d (avail_mem=" PHYS_MEM_TYPE_FORMAT "K)", the_class->external_name(), java_lang_Class::classRedefinedCount(the_class->java_mirror()), avail_mem >> 10); Events::log_redefinition(current, "redefined class name=%s, count=%d", the_class->external_name(), diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index aad46fa6091a..0076b9f0bf55 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -1694,7 +1694,7 @@ jint Arguments::set_aggressive_heap_flags() { // Thus, we need to make sure we're using a julong for intermediate // calculations. julong initHeapSize; - size_t phys_mem = os::physical_memory(); + physical_memory_size_type phys_mem = os::physical_memory(); julong total_memory = static_cast(phys_mem); if (total_memory < (julong) 256 * M) { diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index a2e4f125d624..77f6ef463bf3 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -1174,13 +1174,13 @@ void os::print_summary_info(outputStream* st, char* buf, size_t buflen) { #endif // PRODUCT get_summary_cpu_info(buf, buflen); st->print("%s, ", buf); - size_t phys_mem = physical_memory(); - size_t mem = phys_mem/G; + physical_memory_size_type phys_mem = physical_memory(); + physical_memory_size_type mem = phys_mem/G; if (mem == 0) { // for low memory systems mem = phys_mem/M; - st->print("%d cores, " SIZE_FORMAT "M, ", processor_count(), mem); + st->print("%d cores, " PHYS_MEM_TYPE_FORMAT "M, ", processor_count(), mem); } else { - st->print("%d cores, " SIZE_FORMAT "G, ", processor_count(), mem); + st->print("%d cores, " PHYS_MEM_TYPE_FORMAT "G, ", processor_count(), mem); } get_summary_os_info(buf, buflen); st->print_raw(buf); @@ -1901,17 +1901,17 @@ bool os::is_server_class_machine() { return true; } // Then actually look at the machine - bool result = false; - const unsigned int server_processors = 2; - const julong server_memory = 2UL * G; + bool result = false; + const unsigned int server_processors = 2; + const physical_memory_size_type server_memory = 2UL * G; // We seem not to get our full complement of memory. // We allow some part (1/8?) of the memory to be "missing", // based on the sizes of DIMMs, and maybe graphics cards. - const julong missing_memory = 256UL * M; - size_t phys_mem = os::physical_memory(); + const physical_memory_size_type missing_memory = 256UL * M; + physical_memory_size_type phys_mem = os::physical_memory(); /* Is this a server class machine? */ if ((os::active_processor_count() >= (int)server_processors) && - (phys_mem >= (server_memory - missing_memory))) { + (phys_mem >= server_memory - missing_memory)) { const unsigned int logical_processors = VM_Version::logical_processors_per_package(); if (logical_processors > 1) { diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index 89064873f111..5fa1afe65729 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -320,10 +320,10 @@ class os: AllStatic { // For example, on Linux, "available" memory (`MemAvailable` in `/proc/meminfo`) is greater // than "free" memory (`MemFree` in `/proc/meminfo`) because Linux can free memory // aggressively (e.g. clear caches) so that it becomes available. - [[nodiscard]] static bool available_memory(size_t& value); - [[nodiscard]] static bool free_memory(size_t& value); + [[nodiscard]] static bool available_memory(physical_memory_size_type& value); + [[nodiscard]] static bool free_memory(physical_memory_size_type& value); - static size_t physical_memory(); + static physical_memory_size_type physical_memory(); static bool has_allocatable_memory_limit(size_t* limit); static bool is_server_class_machine(); diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index 9d4cae2a08d4..2711a4e30079 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -131,6 +131,7 @@ class oopDesc; #define UINT64_FORMAT_X "0x%" PRIx64 #define UINT64_FORMAT_X_0 "0x%016" PRIx64 #define UINT64_FORMAT_W(width) "%" #width PRIu64 +#define PHYS_MEM_TYPE_FORMAT "%" PRIu64 // Format integers which change size between 32- and 64-bit. #define SSIZE_FORMAT "%" PRIdPTR @@ -426,6 +427,11 @@ inline size_t byte_size_in_exact_unit(size_t s) { #define HEAP_CHANGE_FORMAT_ARGS(_name_, _prev_used_, _prev_capacity_, _used_, _capacity_) \ (_name_), (_prev_used_) / K, (_prev_capacity_) / K, (_used_) / K, (_capacity_) / K +// This typedef is to address the issue of running a 32-bit VM. In this case the amount +// of physical memory may not fit in size_t, so we have to have a larger type. Once 32-bit +// is deprecated, one can use size_t. +typedef uint64_t physical_memory_size_type; + //---------------------------------------------------------------------------------------------------- // VM type definitions From 9a6c80c780f1300f77ff886b309a87c12bc22b15 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 18 Mar 2026 14:00:55 +0000 Subject: [PATCH 037/223] 8338883: Show warning when CreateCoredumpOnCrash set, but core dump will not happen Reviewed-by: rrich Backport-of: c34fb2c989562206a2506a2fbbfb584e223bb828 --- src/hotspot/os/posix/os_posix.cpp | 67 +++++++++---------- src/hotspot/os/windows/os_windows.cpp | 60 ++++++++++------- src/hotspot/share/runtime/os.hpp | 2 +- src/hotspot/share/runtime/thread.cpp | 2 + src/hotspot/share/runtime/threads.cpp | 6 ++ src/hotspot/share/utilities/vmError.cpp | 4 +- .../ErrorHandling/CreateCoredumpOnCrash.java | 59 +++++++++++++--- 7 files changed, 126 insertions(+), 74 deletions(-) diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index 7f95560a19e1..94084d1239d7 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -105,49 +105,44 @@ static int clock_tics_per_sec = 100; size_t os::_os_min_stack_allowed = PTHREAD_STACK_MIN; // Check core dump limit and report possible place where core can be found -void os::check_dump_limit(char* buffer, size_t bufferSize) { +void os::check_core_dump_prerequisites(char* buffer, size_t bufferSize, bool check_only) { if (!FLAG_IS_DEFAULT(CreateCoredumpOnCrash) && !CreateCoredumpOnCrash) { jio_snprintf(buffer, bufferSize, "CreateCoredumpOnCrash is disabled from command line"); VMError::record_coredump_status(buffer, false); - return; - } - - int n; - struct rlimit rlim; - bool success; - - char core_path[PATH_MAX]; - n = get_core_path(core_path, PATH_MAX); - - if (n <= 0) { - jio_snprintf(buffer, bufferSize, "core.%d (may not exist)", current_process_id()); - success = true; + } else { + struct rlimit rlim; + bool success = true; + bool warn = true; + char core_path[PATH_MAX]; + if (get_core_path(core_path, PATH_MAX) <= 0) { + jio_snprintf(buffer, bufferSize, "core.%d (may not exist)", current_process_id()); #ifdef LINUX - } else if (core_path[0] == '"') { // redirect to user process - jio_snprintf(buffer, bufferSize, "Core dumps may be processed with %s", core_path); - success = true; + } else if (core_path[0] == '"') { // redirect to user process + jio_snprintf(buffer, bufferSize, "Core dumps may be processed with %s", core_path); #endif - } else if (getrlimit(RLIMIT_CORE, &rlim) != 0) { - jio_snprintf(buffer, bufferSize, "%s (may not exist)", core_path); - success = true; - } else { - switch(rlim.rlim_cur) { - case RLIM_INFINITY: - jio_snprintf(buffer, bufferSize, "%s", core_path); - success = true; - break; - case 0: - jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again"); - success = false; - break; - default: - jio_snprintf(buffer, bufferSize, "%s (max size " UINT64_FORMAT " k). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", core_path, uint64_t(rlim.rlim_cur) / K); - success = true; - break; + } else if (getrlimit(RLIMIT_CORE, &rlim) != 0) { + jio_snprintf(buffer, bufferSize, "%s (may not exist)", core_path); + } else { + switch(rlim.rlim_cur) { + case RLIM_INFINITY: + jio_snprintf(buffer, bufferSize, "%s", core_path); + warn = false; + break; + case 0: + jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again"); + success = false; + break; + default: + jio_snprintf(buffer, bufferSize, "%s (max size " UINT64_FORMAT " k). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", core_path, uint64_t(rlim.rlim_cur) / K); + break; + } + } + if (!check_only) { + VMError::record_coredump_status(buffer, success); + } else if (warn) { + warning("CreateCoredumpOnCrash specified, but %s", buffer); } } - - VMError::record_coredump_status(buffer, success); } int os::get_native_stack(address* stack, int frames, int toSkip) { diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 8b3c0dcedc11..a1ee6bc51d64 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -1274,38 +1274,50 @@ void os::shutdown() { static HANDLE dumpFile = nullptr; -// Check if dump file can be created. -void os::check_dump_limit(char* buffer, size_t buffsz) { - bool status = true; +// Check if core dump is active and if a core dump file can be created +void os::check_core_dump_prerequisites(char* buffer, size_t bufferSize, bool check_only) { if (!FLAG_IS_DEFAULT(CreateCoredumpOnCrash) && !CreateCoredumpOnCrash) { - jio_snprintf(buffer, buffsz, "CreateCoredumpOnCrash is disabled from command line"); - status = false; - } - + jio_snprintf(buffer, bufferSize, "CreateCoredumpOnCrash is disabled from command line"); + VMError::record_coredump_status(buffer, false); + } else { + bool success = true; + bool warn = true; #ifndef ASSERT - if (!os::win32::is_windows_server() && FLAG_IS_DEFAULT(CreateCoredumpOnCrash)) { - jio_snprintf(buffer, buffsz, "Minidumps are not enabled by default on client versions of Windows"); - status = false; - } + if (!os::win32::is_windows_server() && FLAG_IS_DEFAULT(CreateCoredumpOnCrash)) { + jio_snprintf(buffer, bufferSize, "Minidumps are not enabled by default on client versions of Windows"); + success = false; + warn = true; + } #endif - if (status) { - const char* cwd = get_current_directory(nullptr, 0); - int pid = current_process_id(); - if (cwd != nullptr) { - jio_snprintf(buffer, buffsz, "%s\\hs_err_pid%u.mdmp", cwd, pid); - } else { - jio_snprintf(buffer, buffsz, ".\\hs_err_pid%u.mdmp", pid); + if (success) { + if (!check_only) { + const char* cwd = get_current_directory(nullptr, 0); + int pid = current_process_id(); + if (cwd != nullptr) { + jio_snprintf(buffer, bufferSize, "%s\\hs_err_pid%u.mdmp", cwd, pid); + } else { + jio_snprintf(buffer, bufferSize, ".\\hs_err_pid%u.mdmp", pid); + } + + if (dumpFile == nullptr && + (dumpFile = CreateFile(buffer, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr)) + == INVALID_HANDLE_VALUE) { + jio_snprintf(buffer, bufferSize, "Failed to create minidump file (0x%x).", GetLastError()); + success = false; + } + } else { + // For now on Windows, there are no more checks that we can do + warn = false; + } } - if (dumpFile == nullptr && - (dumpFile = CreateFile(buffer, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr)) - == INVALID_HANDLE_VALUE) { - jio_snprintf(buffer, buffsz, "Failed to create minidump file (0x%x).", GetLastError()); - status = false; + if (!check_only) { + VMError::record_coredump_status(buffer, success); + } else if (warn) { + warning("CreateCoredumpOnCrash specified, but %s", buffer); } } - VMError::record_coredump_status(buffer, status); } void os::abort(bool dump_core, void* siginfo, const void* context) { diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index 5fa1afe65729..8186d23b4726 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -925,7 +925,7 @@ class os: AllStatic { // provided buffer as a scratch buffer. The status message which will be written // into the error log either is file location or a short error message, depending // on the checking result. - static void check_dump_limit(char* buffer, size_t bufferSize); + static void check_core_dump_prerequisites(char* buffer, size_t bufferSize, bool check_only = false); // Get the default path to the core file // Returns the length of the string diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index ce4c3b9cc14d..b0c43d146245 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -36,6 +36,8 @@ #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" +#include "runtime/globals.hpp" +#include "runtime/globals_extension.hpp" #include "runtime/handles.inline.hpp" #include "runtime/javaThread.inline.hpp" #include "runtime/nonJavaThread.hpp" diff --git a/src/hotspot/share/runtime/threads.cpp b/src/hotspot/share/runtime/threads.cpp index 4ee798ef167c..618bf77768d3 100644 --- a/src/hotspot/share/runtime/threads.cpp +++ b/src/hotspot/share/runtime/threads.cpp @@ -63,6 +63,7 @@ #include "runtime/flags/jvmFlagLimit.hpp" #include "runtime/handles.inline.hpp" #include "runtime/globals.hpp" +#include "runtime/globals_extension.hpp" #include "runtime/interfaceSupport.inline.hpp" #include "runtime/java.hpp" #include "runtime/javaCalls.hpp" @@ -682,6 +683,11 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { log_info(os)("Initialized VM with process ID %d", os::current_process_id()); + if (!FLAG_IS_DEFAULT(CreateCoredumpOnCrash) && CreateCoredumpOnCrash) { + char buffer[2*JVM_MAXPATHLEN]; + os::check_core_dump_prerequisites(buffer, sizeof(buffer), true); + } + // Signal Dispatcher needs to be started before VMInit event is posted os::initialize_jdk_signal_support(CHECK_JNI_ERR); diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 5604c7c9d568..65a52a0f3c77 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -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. * Copyright (c) 2017, 2020 SAP SE. All rights reserved. * Copyright (c) 2023, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1704,7 +1704,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt ShowMessageBoxOnError = false; } - os::check_dump_limit(buffer, sizeof(buffer)); + os::check_core_dump_prerequisites(buffer, sizeof(buffer)); // reset signal handlers or exception filter; make sure recursive crashes // are handled properly. diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java b/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java index e9bc29f1d1b2..e2b525581f00 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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,7 @@ * java.management * jdk.internal.jvmstat/sun.jvmstat.monitor * @run driver CreateCoredumpOnCrash - * @requires !vm.asan + * @requires !vm.asan & vm.flagless */ import jdk.test.lib.process.ProcessTools; @@ -44,24 +44,61 @@ public static void main(String[] args) { } } + private static String ulimitString(int limit) { + String string = "ulimit -c "; + if (limit != Integer.MAX_VALUE) { + string += limit; + } else { + string += "unlimited"; + } + return string+";"; + } + public static void main(String[] args) throws Exception { runTest("-XX:-CreateCoredumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped") - .shouldNotHaveExitValue(0); + .shouldNotHaveExitValue(0); if (Platform.isWindows()) { // The old CreateMinidumpOnCrash option should still work runTest("-XX:-CreateMinidumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped") - .shouldNotHaveExitValue(0); + .shouldNotHaveExitValue(0); } else { - runTest("-XX:+CreateCoredumpOnCrash").shouldNotContain("CreateCoredumpOnCrash turned off, no core file dumped") - .shouldNotHaveExitValue(0); - } + String exec_cmd[] = {"sh", "-c", "ulimit -c"}; + OutputAnalyzer oa = new OutputAnalyzer(Runtime.getRuntime().exec(exec_cmd)); + oa.shouldHaveExitValue(0); + if (!oa.contains("0\n")) { + oa = runTest("-XX:+CreateCoredumpOnCrash"); + oa.shouldContain("Core dump will be written."); + oa.shouldNotHaveExitValue(0); + oa = runTest("-XX:+CreateCoredumpOnCrash", ulimitString(1024)); + oa.shouldContain("warning: CreateCoredumpOnCrash specified, but"); + oa.shouldNotHaveExitValue(0); + + oa = runTest("-XX:+CreateCoredumpOnCrash", ulimitString(0)); + oa.shouldContain("warning: CreateCoredumpOnCrash specified, but"); + oa.shouldNotHaveExitValue(0); + } else { + throw new Exception("ulimit is not set correctly, try 'ulimit -c unlimited' and re-run."); + } + } } + public static OutputAnalyzer runTest(String option) throws Exception { - return new OutputAnalyzer( - ProcessTools.createLimitedTestJavaProcessBuilder( - "-Xmx128m", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", option, Crasher.class.getName()) - .start()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xmx128m", + "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", + option, Crasher.class.getName()); + return new OutputAnalyzer(pb.start()); + } + public static OutputAnalyzer runTest(String option, String limit) throws Exception { + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xmx128m", + "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", + option, new String("'"+Crasher.class.getName()+"'")); + String args = ""; + for (String s:pb.command()) { + args += s+" "; + } + String exec_cmd[] = {"sh", "-c", limit+args}; + return new OutputAnalyzer(Runtime.getRuntime().exec(exec_cmd)); } } From ae77f10bc42200d518a0cf3268a3d0e243ce224b Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 18 Mar 2026 14:03:51 +0000 Subject: [PATCH 038/223] 8350749: Upgrade JLine to 3.29.0 Reviewed-by: mdoerr Backport-of: 9a17a6ff0f7b53e9d87bf5db85399aabeb2582c8 --- .../internal/org/jline/reader/LineReader.java | 7 +- .../jline/reader/UserInterruptException.java | 5 ++ .../jline/reader/impl/DefaultHighlighter.java | 8 ++ .../org/jline/reader/impl/LineReaderImpl.java | 15 ++-- .../impl/completer/SystemCompleter.java | 9 +- .../reader/impl/history/DefaultHistory.java | 2 +- .../org/jline/terminal/TerminalBuilder.java | 44 ++++++++++ .../terminal/impl/AbstractPosixTerminal.java | 9 ++ .../jline/terminal/impl/AbstractTerminal.java | 8 ++ .../org/jline/terminal/impl/Diag.java | 85 +++++++++++++------ .../org/jline/terminal/impl/exec/ExecPty.java | 2 +- .../impl/exec/ExecTerminalProvider.java | 3 + .../jdk/internal/org/jline/utils/Display.java | 6 +- .../org/jline/utils/InputStreamReader.java | 3 +- .../jdk/internal/org/jline/utils/Status.java | 8 +- src/jdk.internal.le/share/legal/jline.md | 2 +- 16 files changed, 170 insertions(+), 46 deletions(-) diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/LineReader.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/LineReader.java index bc513f5f636a..ca1c34ef4eed 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/LineReader.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/LineReader.java @@ -10,6 +10,7 @@ import java.io.File; import java.io.InputStream; +import java.nio.file.Path; import java.util.Collection; import java.util.Map; import java.util.function.IntConsumer; @@ -766,7 +767,11 @@ String readLine(String prompt, String rightPrompt, MaskingCallback maskingCallba void addCommandsInBuffer(Collection commands); - void editAndAddInBuffer(File file) throws Exception; + default void editAndAddInBuffer(File file) throws Exception { + editAndAddInBuffer(file != null ? file.toPath() : null); + } + + void editAndAddInBuffer(Path file) throws Exception; String getLastBinding(); diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/UserInterruptException.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/UserInterruptException.java index 68bec8041faa..e5bc5b3180c6 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/UserInterruptException.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/UserInterruptException.java @@ -19,6 +19,11 @@ public class UserInterruptException extends RuntimeException { private final String partialLine; + public UserInterruptException(Throwable cause) { + super(cause); + this.partialLine = null; + } + public UserInterruptException(String partialLine) { this.partialLine = partialLine; } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/DefaultHighlighter.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/DefaultHighlighter.java index 55d39efde27d..87bf06d00734 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/DefaultHighlighter.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/DefaultHighlighter.java @@ -38,6 +38,7 @@ public AttributedString highlight(LineReader reader, String buffer) { int underlineEnd = -1; int negativeStart = -1; int negativeEnd = -1; + boolean first = true; String search = reader.getSearchTerm(); if (search != null && search.length() > 0) { underlineStart = buffer.indexOf(search); @@ -65,6 +66,7 @@ public AttributedString highlight(LineReader reader, String buffer) { } AttributedStringBuilder sb = new AttributedStringBuilder(); + commandStyle(reader, sb, true); for (int i = 0; i < buffer.length(); i++) { if (i == underlineStart) { sb.style(AttributedStyle::underline); @@ -77,6 +79,10 @@ public AttributedString highlight(LineReader reader, String buffer) { } char c = buffer.charAt(i); + if (first && Character.isSpaceChar(c)) { + first = false; + commandStyle(reader, sb, false); + } if (c == '\t' || c == '\n') { sb.append(c); } else if (c < 32) { @@ -105,4 +111,6 @@ public AttributedString highlight(LineReader reader, String buffer) { } return sb.toAttributedString(); } + + protected void commandStyle(LineReader reader, AttributedStringBuilder sb, boolean enable) {} } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java index da69d08b23c8..302254ab61fa 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java @@ -10,7 +10,6 @@ import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; import java.io.FileWriter; import java.io.Flushable; import java.io.IOError; @@ -1131,16 +1130,16 @@ public void addCommandsInBuffer(Collection commands) { } @Override - public void editAndAddInBuffer(File file) throws Exception { + public void editAndAddInBuffer(Path file) throws Exception { if (isSet(Option.BRACKETED_PASTE)) { terminal.writer().write(BRACKETED_PASTE_OFF); } - Constructor ctor = Class.forName("org.jline.builtins.Nano").getConstructor(Terminal.class, File.class); - Editor editor = (Editor) ctor.newInstance(terminal, new File(file.getParent())); + Constructor ctor = Class.forName("org.jline.builtins.Nano").getConstructor(Terminal.class, Path.class); + Editor editor = (Editor) ctor.newInstance(terminal, file.getParent()); editor.setRestricted(true); - editor.open(Collections.singletonList(file.getName())); + editor.open(Collections.singletonList(file.getFileName().toString())); editor.run(); - try (BufferedReader br = new BufferedReader(new FileReader(file))) { + try (BufferedReader br = Files.newBufferedReader(file)) { String line; commandsBuffer.clear(); while ((line = br.readLine()) != null) { @@ -3529,7 +3528,7 @@ protected boolean viPutAfter() { buf.move(1); putString(yankBuffer); buf.move(-yankBuffer.length()); - } else if (yankBuffer.length() != 0) { + } else if (!yankBuffer.isEmpty()) { if (buf.cursor() < buf.length()) { buf.move(1); } @@ -3547,7 +3546,7 @@ protected boolean viPutBefore() { ; putString(yankBuffer); buf.move(-yankBuffer.length()); - } else if (yankBuffer.length() != 0) { + } else if (!yankBuffer.isEmpty()) { if (buf.cursor() > 0) { buf.move(-1); } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/completer/SystemCompleter.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/completer/SystemCompleter.java index 2fe6f8df4921..642cf275142a 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/completer/SystemCompleter.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/completer/SystemCompleter.java @@ -9,6 +9,8 @@ package jdk.internal.org.jline.reader.impl.completer; import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; import jdk.internal.org.jline.reader.Candidate; import jdk.internal.org.jline.reader.Completer; @@ -24,6 +26,7 @@ public class SystemCompleter implements Completer { private Map> completers = new HashMap<>(); private Map aliasCommand = new HashMap<>(); + private Map descriptions = new HashMap<>(); private StringsCompleter commands; private boolean compiled = false; @@ -124,6 +127,10 @@ private Map getAliases() { } public void compile() { + compile(s -> new Candidate(AttributedString.stripAnsi(s), s, null, null, null, null, true)); + } + + public void compile(Function candidateBuilder) { if (compiled) { return; } @@ -139,7 +146,7 @@ public void compile() { completers = compiledCompleters; Set cmds = new HashSet<>(completers.keySet()); cmds.addAll(aliasCommand.keySet()); - commands = new StringsCompleter(cmds); + commands = new StringsCompleter(cmds.stream().map(candidateBuilder).collect(Collectors.toList())); compiled = true; } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/history/DefaultHistory.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/history/DefaultHistory.java index c696b33ba9e5..ca275c43c6da 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/history/DefaultHistory.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/history/DefaultHistory.java @@ -200,7 +200,7 @@ public void purge() throws IOException { public void write(Path file, boolean incremental) throws IOException { Path path = file != null ? file : getPath(); if (path != null && Files.exists(path)) { - path.toFile().delete(); + Files.deleteIfExists(path); } internalWrite(path, incremental ? getLastLoaded(path) : 0); } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/TerminalBuilder.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/TerminalBuilder.java index 3b02ec2d8d8a..d66b124448e3 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/TerminalBuilder.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/TerminalBuilder.java @@ -209,41 +209,85 @@ public TerminalBuilder systemOutput(SystemOutput systemOutput) { return this; } + /** + * Forces the usage of the give terminal provider. + * + * @param provider The {@link TerminalProvider}'s name to use when creating the Terminal. + * @return The builder. + */ public TerminalBuilder provider(String provider) { this.provider = provider; return this; } + /** + * Sets the list of providers to try when creating the terminal. + * If not specified, the system property {@link #PROP_PROVIDERS} will be used if set. + * Else, the value {@link #PROP_PROVIDERS_DEFAULT} will be used. + * + * @param providers The list of {@link TerminalProvider}'s names to check when creating the Terminal. + * @return The builder. + */ public TerminalBuilder providers(String providers) { this.providers = providers; return this; } + /** + * Enables or disables the {@link #PROP_PROVIDER_JNA}/{@code jna} terminal provider. + * If not specified, the system property {@link #PROP_JNA} will be used if set. + * If not specified, the provider will be checked. + */ public TerminalBuilder jna(boolean jna) { this.jna = jna; return this; } + /** + * Enables or disables the {@link #PROP_PROVIDER_JANSI}/{@code jansi} terminal provider. + * If not specified, the system property {@link #PROP_JANSI} will be used if set. + * If not specified, the provider will be checked. + */ public TerminalBuilder jansi(boolean jansi) { this.jansi = jansi; return this; } + /** + * Enables or disables the {@link #PROP_PROVIDER_JNI}/{@code jni} terminal provider. + * If not specified, the system property {@link #PROP_JNI} will be used if set. + * If not specified, the provider will be checked. + */ public TerminalBuilder jni(boolean jni) { this.jni = jni; return this; } + /** + * Enables or disables the {@link #PROP_PROVIDER_EXEC}/{@code exec} terminal provider. + * If not specified, the system property {@link #PROP_EXEC} will be used if set. + * If not specified, the provider will be checked. + */ public TerminalBuilder exec(boolean exec) { this.exec = exec; return this; } + /** + * Enables or disables the {@link #PROP_PROVIDER_FFM}/{@code ffm} terminal provider. + * If not specified, the system property {@link #PROP_FFM} will be used if set. + * If not specified, the provider will be checked. + */ public TerminalBuilder ffm(boolean ffm) { this.ffm = ffm; return this; } + /** + * Enables or disables the {@link #PROP_PROVIDER_DUMB}/{@code dumb} terminal provider. + * If not specified, the system property {@link #PROP_DUMB} will be used if set. + * If not specified, the provider will be checked. + */ public TerminalBuilder dumb(boolean dumb) { this.dumb = dumb; return this; diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractPosixTerminal.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractPosixTerminal.java index 5d000d070837..862bf93cd46a 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractPosixTerminal.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractPosixTerminal.java @@ -94,4 +94,13 @@ public TerminalProvider getProvider() { public SystemStream getSystemStream() { return getPty().getSystemStream(); } + + @Override + public String toString() { + return getKind() + "[" + "name='" + + name + '\'' + ", pty='" + + pty + '\'' + ", type='" + + type + '\'' + ", size='" + + getSize() + '\'' + ']'; + } } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractTerminal.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractTerminal.java index 2608e2e5f37c..34b070487908 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractTerminal.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractTerminal.java @@ -287,4 +287,12 @@ public boolean paused() { public ColorPalette getPalette() { return palette; } + + @Override + public String toString() { + return getKind() + "[" + "name='" + + name + '\'' + ", type='" + + type + '\'' + ", size='" + + getSize() + '\'' + ']'; + } } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/Diag.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/Diag.java index dc54ea2157d8..7b7d17499b6a 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/Diag.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/Diag.java @@ -10,7 +10,7 @@ import java.io.PrintStream; import java.nio.charset.StandardCharsets; -import java.util.ServiceLoader; +import java.util.Arrays; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.TimeUnit; @@ -24,10 +24,26 @@ public class Diag { public static void main(String[] args) { - diag(System.out); + diag(System.out, Arrays.asList(args).contains("--verbose")); } public static void diag(PrintStream out) { + diag(out, true); + } + + public static void diag(PrintStream out, boolean verbose) { + new Diag(out, verbose).run(); + } + + private final PrintStream out; + private final boolean verbose; + + public Diag(PrintStream out, boolean verbose) { + this.out = out; + this.verbose = verbose; + } + + public void run() { out.println("System properties"); out.println("================="); out.println("os.name = " + System.getProperty("os.name")); @@ -56,9 +72,9 @@ public static void diag(PrintStream out) { out.println("================="); try { TerminalProvider provider = TerminalProvider.load("ffm"); - testProvider(out, provider); + testProvider(provider); } catch (Throwable t) { - out.println("FFM support not available: " + t); + error("FFM support not available", t); } out.println(); @@ -66,9 +82,9 @@ public static void diag(PrintStream out) { out.println("================="); try { TerminalProvider provider = TerminalProvider.load("jna"); - testProvider(out, provider); + testProvider(provider); } catch (Throwable t) { - out.println("JNA support not available: " + t); + error("JNA support not available", t); } out.println(); @@ -76,9 +92,9 @@ public static void diag(PrintStream out) { out.println("================="); try { TerminalProvider provider = TerminalProvider.load("jansi"); - testProvider(out, provider); + testProvider(provider); } catch (Throwable t) { - out.println("Jansi 2 support not available: " + t); + error("Jansi 2 support not available", t); } out.println(); @@ -86,9 +102,9 @@ public static void diag(PrintStream out) { out.println("================="); try { TerminalProvider provider = TerminalProvider.load("jni"); - testProvider(out, provider); + testProvider(provider); } catch (Throwable t) { - out.println("JNI support not available: " + t); + error("JNI support not available", t); } out.println(); @@ -97,26 +113,31 @@ public static void diag(PrintStream out) { out.println("================="); try { TerminalProvider provider = TerminalProvider.load("exec"); - testProvider(out, provider); + testProvider(provider); } catch (Throwable t) { - out.println("Exec support not available: " + t); + error("Exec support not available", t); + } + + if (!verbose) { + out.println(); + out.println("Run with --verbose argument to print stack traces"); } } - private static void testProvider(PrintStream out, TerminalProvider provider) { + private void testProvider(TerminalProvider provider) { try { out.println("StdIn stream = " + provider.isSystemStream(SystemStream.Input)); out.println("StdOut stream = " + provider.isSystemStream(SystemStream.Output)); out.println("StdErr stream = " + provider.isSystemStream(SystemStream.Error)); - } catch (Throwable t2) { - out.println("Unable to check stream: " + t2); + } catch (Throwable t) { + error("Unable to check stream", t); } try { out.println("StdIn stream name = " + provider.systemStreamName(SystemStream.Input)); out.println("StdOut stream name = " + provider.systemStreamName(SystemStream.Output)); out.println("StdErr stream name = " + provider.systemStreamName(SystemStream.Error)); - } catch (Throwable t2) { - out.println("Unable to check stream names: " + t2); + } catch (Throwable t) { + error("Unable to check stream names", t); } try (Terminal terminal = provider.sysTerminal( "diag", @@ -132,9 +153,14 @@ private static void testProvider(PrintStream out, TerminalProvider provider) { Attributes attr = terminal.enterRawMode(); try { out.println("Terminal size: " + terminal.getSize()); - ForkJoinTask t = - new ForkJoinPool(1).submit(() -> terminal.reader().read(1)); - int r = t.get(1000, TimeUnit.MILLISECONDS); + ForkJoinPool forkJoinPool = new ForkJoinPool(1); + try { + ForkJoinTask t = + forkJoinPool.submit(() -> terminal.reader().read(1)); + t.get(1000, TimeUnit.MILLISECONDS); + } finally { + forkJoinPool.shutdown(); + } StringBuilder sb = new StringBuilder(); sb.append("The terminal seems to work: "); sb.append("terminal ").append(terminal.getClass().getName()); @@ -146,22 +172,25 @@ private static void testProvider(PrintStream out, TerminalProvider provider) { .getName()); } out.println(sb); - } catch (Throwable t3) { - out.println("Unable to read from terminal: " + t3); - t3.printStackTrace(); + } catch (Throwable t2) { + error("Unable to read from terminal", t2); } finally { terminal.setAttributes(attr); } } else { out.println("Not supported by provider"); } - } catch (Throwable t2) { - out.println("Unable to open terminal: " + t2); - t2.printStackTrace(); + } catch (Throwable t) { + error("Unable to open terminal", t); } } - static S load(Class clazz) { - return ServiceLoader.load(clazz, clazz.getClassLoader()).iterator().next(); + private void error(String message, Throwable cause) { + if (verbose) { + out.println(message); + cause.printStackTrace(out); + } else { + out.println(message + ": " + cause); + } } } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecPty.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecPty.java index c0a35cbd6a21..f21920160d6b 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecPty.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecPty.java @@ -278,7 +278,7 @@ static int doGetInt(String name, String cfg) throws IOException { return Integer.parseInt(matcher.group(1)); } } - throw new IOException("Unable to parse " + name); + return 0; } @Override diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecTerminalProvider.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecTerminalProvider.java index 36ff4a63579c..96be98e851e5 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecTerminalProvider.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecTerminalProvider.java @@ -46,6 +46,9 @@ public String name() { } public Pty current(SystemStream systemStream) throws IOException { + if (!isSystemStream(systemStream)) { + throw new IOException("Not a system stream: " + systemStream); + } return ExecPty.current(this, systemStream); } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Display.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Display.java index 557024a121ed..6a942048a865 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Display.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Display.java @@ -217,7 +217,8 @@ public void update(List newLines, int targetCursorPos, boolean cursorPos++; if (newLength == 0 || newLine.isHidden(0)) { // go to next line column zero - rawPrint(new AttributedString(" \b")); + rawPrint(' '); + terminal.puts(Capability.key_backspace); } else { AttributedString firstChar = newLine.substring(0, 1); // go to next line column one @@ -317,7 +318,8 @@ public void update(List newLines, int targetCursorPos, boolean } else if (atRight) { if (this.wrapAtEol) { if (!fullScreen || (fullScreen && lineIndex < numLines)) { - terminal.writer().write(" \b"); + rawPrint(' '); + terminal.puts(Capability.key_backspace); cursorPos++; } } else { diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/InputStreamReader.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/InputStreamReader.java index 449d6aa69c85..1198da4fe82d 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/InputStreamReader.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/InputStreamReader.java @@ -22,8 +22,7 @@ import java.nio.charset.MalformedInputException; import java.nio.charset.UnmappableCharacterException; -/** - * +/* * NOTE for JLine: the default InputStreamReader that comes from the JRE * usually read more bytes than needed from the input stream, which * is not usable in a character per character model used in the terminal. diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Status.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Status.java index 7348b1ea1c5f..d0ea5ef8962f 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Status.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Status.java @@ -48,7 +48,8 @@ public Status(Terminal terminal) { this.supported = terminal.getStringCapability(Capability.change_scroll_region) != null && terminal.getStringCapability(Capability.save_cursor) != null && terminal.getStringCapability(Capability.restore_cursor) != null - && terminal.getStringCapability(Capability.cursor_address) != null; + && terminal.getStringCapability(Capability.cursor_address) != null + && isValid(terminal.getSize()); if (supported) { display = new MovingCursorDisplay(terminal); resize(); @@ -57,6 +58,10 @@ public Status(Terminal terminal) { } } + private boolean isValid(Size size) { + return size.getRows() > 0 && size.getRows() < 1000 && size.getColumns() > 0 && size.getColumns() < 1000; + } + public void close() { terminal.puts(Capability.save_cursor); terminal.puts(Capability.change_scroll_region, 0, display.rows - 1); @@ -147,6 +152,7 @@ public void update(List lines, boolean flush) { if (newScrollRegion < scrollRegion) { // We need to scroll up to grow the status bar terminal.puts(Capability.save_cursor); + terminal.puts(Capability.cursor_address, scrollRegion, 0); for (int i = newScrollRegion; i < scrollRegion; i++) { terminal.puts(Capability.cursor_down); } diff --git a/src/jdk.internal.le/share/legal/jline.md b/src/jdk.internal.le/share/legal/jline.md index 5b813c0af2fa..17392e93659e 100644 --- a/src/jdk.internal.le/share/legal/jline.md +++ b/src/jdk.internal.le/share/legal/jline.md @@ -1,4 +1,4 @@ -## JLine v3.26.1 +## JLine v3.29.0 ### JLine License

From d2542c4d0d10f6245826cfd80d90f43737aac897 Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Wed, 18 Mar 2026 14:06:46 +0000
Subject: [PATCH 039/223] 8376233: Clean up code in Desktop native peer

Backport-of: c73f05bec95c3ef0d8b6235b67478352db9a48a9
---
 .../macosx/native/libawt_lwawt/awt/CDesktopPeer.m            | 5 ++++-
 .../windows/native/libawt/windows/awt_Desktop.cpp            | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/CDesktopPeer.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/CDesktopPeer.m
index e1841c9398c6..460749c363dd 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CDesktopPeer.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CDesktopPeer.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, 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
@@ -120,6 +120,7 @@
         if (appURI == nil
             || [[urlToOpen absoluteString] containsString:[appURI absoluteString]]
             || [[defaultTerminalApp absoluteString] containsString:[appURI absoluteString]]) {
+            [urlToOpen release];
             return -1;
         }
         // Additionally set forPrinting=TRUE for print
@@ -129,6 +130,7 @@
     } else if (action == sun_lwawt_macosx_CDesktopPeer_EDIT) {
         if (appURI == nil
             || [[urlToOpen absoluteString] containsString:[appURI absoluteString]]) {
+            [urlToOpen release];
             return -1;
         }
         // for EDIT: if (defaultApp = TerminalApp) then set appURI = DefaultTextEditor
@@ -156,6 +158,7 @@
 
     dispatch_semaphore_wait(semaphore, timeout);
 
+    [urlToOpen release];
 JNI_COCOA_EXIT(env);
     return status;
 }
diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp
index ebb43b2f0789..ba69fa75f734 100644
--- a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2026, 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
@@ -92,6 +92,8 @@ JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute
     if (wcscmp(verb_c, L"open") == 0) {
         BOOL isExecutable = SaferiIsExecutableFileType(fileOrUri_c, FALSE);
         if (isExecutable) {
+            JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c);
+            JNU_ReleaseStringPlatformChars(env, verb_j, verb_c);
             return env->NewStringUTF("Unsupported URI content");
         }
     }

From e165c324e8fa0573dfc9ad463252b770625239e0 Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Fri, 20 Mar 2026 06:48:29 +0000
Subject: [PATCH 040/223] 8144124: [macosx] The tabs can't be aligned when we
 pressing the key of 'R','B','L','C' or 'T'.

Backport-of: 15dd96f7a68f634124c73d78659212e7f335230e
---
 test/jdk/ProblemList.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
index f4db1a188af3..7f21bbc6c74e 100644
--- a/test/jdk/ProblemList.txt
+++ b/test/jdk/ProblemList.txt
@@ -803,7 +803,6 @@ jdk/jfr/api/consumer/recordingstream/TestOnEvent.java           8255404 linux-x6
 javax/swing/JFileChooser/6698013/bug6698013.java 8024419 macosx-all
 javax/swing/JColorChooser/8065098/bug8065098.java 8065647 macosx-all
 javax/swing/JTabbedPane/bug4499556.java 8267500 macosx-all
-javax/swing/JTabbedPane/bug4666224.java 8144124  macosx-all
 javax/swing/SwingUtilities/TestTextPosInPrint.java 8227025 windows-all
 
 java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_1.java 7131438,8022539 generic-all

From f26be78a3d5715b9975e52f96775ac71517549cd Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Fri, 20 Mar 2026 06:49:49 +0000
Subject: [PATCH 041/223] 8064922: [macos] Test
 javax/swing/JTabbedPane/4624207/bug4624207.java fails

Backport-of: be18e7ecfd2e89a0abb168e0d9a5b69598e2199f
---
 test/jdk/ProblemList.txt                      |  1 -
 .../swing/JTabbedPane/4624207/bug4624207.java | 67 ++++++++-----------
 2 files changed, 28 insertions(+), 40 deletions(-)

diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
index 7f21bbc6c74e..8f46ccb9c94d 100644
--- a/test/jdk/ProblemList.txt
+++ b/test/jdk/ProblemList.txt
@@ -688,7 +688,6 @@ javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-al
 javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8198003 generic-all
 javax/swing/JFileChooser/8194044/FileSystemRootTest.java 8327236 windows-all
 javax/swing/JPopupMenu/6800513/bug6800513.java 7184956 macosx-all
-javax/swing/JTabbedPane/4624207/bug4624207.java 8064922 macosx-all
 javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java 8160720 generic-all
 javax/swing/JFileChooser/bug6798062.java 8146446 windows-all
 javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-all,linux-all
diff --git a/test/jdk/javax/swing/JTabbedPane/4624207/bug4624207.java b/test/jdk/javax/swing/JTabbedPane/4624207/bug4624207.java
index 10de2ab221ad..4d2fdcf030cd 100644
--- a/test/jdk/javax/swing/JTabbedPane/4624207/bug4624207.java
+++ b/test/jdk/javax/swing/JTabbedPane/4624207/bug4624207.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2025, 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
@@ -25,25 +25,26 @@
  * @test
  * @key headful
  * @bug 4624207
+ * @requires (os.family != "mac")
  * @summary JTabbedPane mnemonics don't work from outside the tabbed pane
- * @author Oleg Mokhovikov
- * @library /test/lib
- * @library ../../regtesthelpers
- * @build Util jdk.test.lib.Platform
  * @run main bug4624207
  */
-import javax.swing.*;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import java.awt.*;
+
+import java.awt.BorderLayout;
+import java.awt.Robot;
 import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;
 import java.awt.event.KeyEvent;
 
-import jdk.test.lib.Platform;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
 
 public class bug4624207 implements ChangeListener, FocusListener {
-
     private static volatile boolean stateChanged = false;
     private static volatile boolean focusGained = false;
     private static JTextField txtField;
@@ -71,51 +72,39 @@ public static void main(String[] args) throws Exception {
             Robot robot = new Robot();
             robot.setAutoDelay(50);
 
-            SwingUtilities.invokeAndWait(new Runnable() {
-
-                public void run() {
-                    createAndShowGUI();
-                }
-            });
-
+            SwingUtilities.invokeAndWait(() -> createAndShowGUI());
             robot.waitForIdle();
-
-            SwingUtilities.invokeAndWait(new Runnable() {
-
-                public void run() {
-                    txtField.requestFocus();
-                }
-            });
-
+            SwingUtilities.invokeAndWait(() -> txtField.requestFocus());
             robot.waitForIdle();
 
             if (!focusGained) {
                 throw new RuntimeException("Couldn't gain focus for text field");
             }
 
-            SwingUtilities.invokeAndWait(new Runnable() {
-
-                public void run() {
-                    tab.addChangeListener((ChangeListener) listener);
-                    txtField.removeFocusListener((FocusListener) listener);
-                }
+            SwingUtilities.invokeAndWait(() -> {
+                tab.addChangeListener((ChangeListener) listener);
+                txtField.removeFocusListener((FocusListener) listener);
             });
 
             robot.waitForIdle();
 
-            if (Platform.isOSX()) {
-                Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_B);
-            } else {
-                Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_B);
-            }
+            robot.keyPress(KeyEvent.VK_ALT);
+            robot.keyPress(KeyEvent.VK_B);
+            robot.keyRelease(KeyEvent.VK_B);
+            robot.keyRelease(KeyEvent.VK_ALT);
 
             robot.waitForIdle();
 
             if (!stateChanged || tab.getSelectedIndex() != 1) {
-                throw new RuntimeException("JTabbedPane mnemonics don't work from outside the tabbed pane");
+                throw new RuntimeException("JTabbedPane mnemonics don't " +
+                        "work from outside the tabbed pane");
             }
         } finally {
-            if (frame != null) SwingUtilities.invokeAndWait(() ->  frame.dispose());
+            SwingUtilities.invokeAndWait(() -> {
+                if (frame != null) {
+                    frame.dispose();
+                }
+            });
         }
     }
 

From da8c9789c33e398596a39ec988788650486b4250 Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Fri, 20 Mar 2026 06:50:23 +0000
Subject: [PATCH 042/223] 8368551: Core dump warning may be confusing

Backport-of: c146805da5708b479bf8dd0180acd06657b72788
---
 src/hotspot/os/linux/os_linux.cpp             |  2 +-
 src/hotspot/os/posix/os_posix.cpp             | 39 ++++++++++++++-----
 .../TestCrashOnOutOfMemoryError.java          |  6 +--
 3 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
index db86de1fbf48..90af9139c25f 100644
--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -5400,7 +5400,7 @@ int os::get_core_path(char* buffer, size_t bufferSize) {
 
     if (core_pattern[0] == '|') {
       written = jio_snprintf(buffer, bufferSize,
-                             "\"%s\" (or dumping to %s/core.%d)",
+                             "\"%s\" (alternatively, falling back to %s/core.%d)",
                              &core_pattern[1], p, current_process_id());
     } else if (pid_pos != nullptr) {
       *pid_pos = '\0';
diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp
index 94084d1239d7..7d139712002c 100644
--- a/src/hotspot/os/posix/os_posix.cpp
+++ b/src/hotspot/os/posix/os_posix.cpp
@@ -106,41 +106,60 @@ size_t os::_os_min_stack_allowed = PTHREAD_STACK_MIN;
 
 // Check core dump limit and report possible place where core can be found
 void os::check_core_dump_prerequisites(char* buffer, size_t bufferSize, bool check_only) {
+  stringStream buf(buffer, bufferSize);
   if (!FLAG_IS_DEFAULT(CreateCoredumpOnCrash) && !CreateCoredumpOnCrash) {
-    jio_snprintf(buffer, bufferSize, "CreateCoredumpOnCrash is disabled from command line");
-    VMError::record_coredump_status(buffer, false);
+    buf.print("CreateCoredumpOnCrash is disabled from command line");
+    VMError::record_coredump_status(buf.freeze(), false);
   } else {
     struct rlimit rlim;
     bool success = true;
     bool warn = true;
     char core_path[PATH_MAX];
     if (get_core_path(core_path, PATH_MAX) <= 0) {
-      jio_snprintf(buffer, bufferSize, "core.%d (may not exist)", current_process_id());
+      // In the warning message, let the user know.
+      if (check_only) {
+        buf.print("the core path couldn't be determined. It commonly defaults to ");
+      }
+      buf.print("core.%d%s", current_process_id(), check_only ? "" : " (may not exist)");
 #ifdef LINUX
     } else if (core_path[0] == '"') { // redirect to user process
-      jio_snprintf(buffer, bufferSize, "Core dumps may be processed with %s", core_path);
+      if (check_only) {
+        buf.print("core dumps may be further processed by the following: ");
+      } else {
+        buf.print("Determined by the following: ");
+      }
+      buf.print("%s", core_path);
 #endif
     } else if (getrlimit(RLIMIT_CORE, &rlim) != 0) {
-      jio_snprintf(buffer, bufferSize, "%s (may not exist)", core_path);
+      if (check_only) {
+        buf.print("the rlimit couldn't be determined. If resource limits permit, the core dump will be located at ");
+      }
+      buf.print("%s%s", core_path, check_only ? "" : " (may not exist)");
     } else {
       switch(rlim.rlim_cur) {
         case RLIM_INFINITY:
-          jio_snprintf(buffer, bufferSize, "%s", core_path);
+          buf.print("%s", core_path);
           warn = false;
           break;
         case 0:
-          jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again");
+          buf.print("%s dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again", check_only ? "core" : "Core");
           success = false;
           break;
         default:
-          jio_snprintf(buffer, bufferSize, "%s (max size " UINT64_FORMAT " k). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", core_path, uint64_t(rlim.rlim_cur) / K);
+          if (check_only) {
+            buf.print("core dumps are constrained ");
+          } else {
+             buf.print( "%s ", core_path);
+          }
+          buf.print( "(max size " UINT64_FORMAT " k). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", uint64_t(rlim.rlim_cur) / K);
           break;
       }
     }
+    const char* result = buf.freeze();
     if (!check_only) {
-      VMError::record_coredump_status(buffer, success);
+      VMError::record_coredump_status(result, success);
     } else if (warn) {
-      warning("CreateCoredumpOnCrash specified, but %s", buffer);
+      warning("CreateCoredumpOnCrash specified, but %s", result);
     }
   }
 }
diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java
index 0be39d22ebec..26d1f726febd 100644
--- a/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java
+++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -72,8 +72,8 @@ public static void main(String[] args) throws Exception {
            #
            # JRE version: OpenJDK Runtime Environment (9.0) (build 1.9.0-internal-debug-cheleswer_2015_10_20_14_32-b00)
            # Java VM: OpenJDK 64-Bit Server VM (1.9.0-internal-debug-cheleswer_2015_10_20_14_32-b00, mixed mode, tiered, compressed oops, serial gc, linux-amd64)
-           # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %P" (or dumping to
-             /home/cheleswer/Desktop/core.6212)
+           # Core dump will be written. Default location: Determined by the following:
+           "/usr/share/apport/apport %p %s %c %P" (alternatively, falling back to /home/cheleswer/Desktop/core.6212)
            #
            # An error report file with more information is saved as:
            # /home/cheleswer/Desktop/hs_err_pid6212.log

From 01323bc3ddd627338b5ccd28a6c53295c762b691 Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Fri, 20 Mar 2026 06:53:08 +0000
Subject: [PATCH 043/223] 8297191: [macos] Printing a page range with starting
 page > 1 results in missing pages

Backport-of: 2161b142f70c99970f5a8d381deea4b289e620d1
---
 .../classes/sun/lwawt/macosx/CPrinterJob.java | 22 +++++--------------
 .../native/libawt_lwawt/awt/CPrinterJob.m     |  6 ++---
 .../native/libawt_lwawt/awt/PrinterView.h     |  6 ++---
 .../native/libawt_lwawt/awt/PrinterView.m     | 11 +++++-----
 .../java/awt/print/PrinterJob/PageRanges.java |  2 +-
 5 files changed, 17 insertions(+), 30 deletions(-)

diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
index 625494efc999..68e36eed5799 100644
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
@@ -306,20 +306,9 @@ public void print(PrintRequestAttributeSet attributes) throws PrinterException {
             validateDestination(destinationAttr);
         }
 
-        /* Get the range of pages we are to print. If the
-         * last page to print is unknown, then we print to
-         * the end of the document. Note that firstPage
-         * and lastPage are 0 based page indices.
-         */
-
+        // Note that firstPage is 0 based page index.
         int firstPage = getFirstPage();
-        int lastPage = getLastPage();
-        if(lastPage == Pageable.UNKNOWN_NUMBER_OF_PAGES) {
-            int totalPages = mDocument.getNumberOfPages();
-            if (totalPages != Pageable.UNKNOWN_NUMBER_OF_PAGES) {
-                lastPage = mDocument.getNumberOfPages() - 1;
-            }
-        }
+        int totalPages = mDocument.getNumberOfPages();
 
         try {
             synchronized (this) {
@@ -351,7 +340,7 @@ public SecondaryLoop run() {
                     try {
                         // Fire off the print rendering loop on the AppKit thread, and don't have
                         //  it wait and block this thread.
-                        if (printLoop(false, firstPage, lastPage)) {
+                        if (printLoop(false, firstPage, totalPages)) {
                             // Start a secondary loop on EDT until printing operation is finished or cancelled
                             printingLoop.enter();
                         }
@@ -365,14 +354,13 @@ public SecondaryLoop run() {
                     onEventThread = false;
 
                     try {
-                        printLoop(true, firstPage, lastPage);
+                        printLoop(true, firstPage, totalPages);
                     } catch (Exception e) {
                         e.printStackTrace();
                     }
                 }
                 if (++loopi < prMembers.length) {
                      firstPage = prMembers[loopi][0]-1;
-                     lastPage = prMembers[loopi][1] -1;
                 }
             }  while (loopi < prMembers.length);
         } finally {
@@ -622,7 +610,7 @@ private long getNSPrintInfo() {
         }
     }
 
-    private native boolean printLoop(boolean waitUntilDone, int firstPage, int lastPage) throws PrinterException;
+    private native boolean printLoop(boolean waitUntilDone, int firstPage, int totalPages) throws PrinterException;
 
     private PageFormat getPageFormat(int pageIndex) {
         // This is called from the native side.
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m
index 9cbd48bf843f..00f30633318a 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m
@@ -638,7 +638,7 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj
  * Signature: ()V
  */
 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CPrinterJob_printLoop
-  (JNIEnv *env, jobject jthis, jboolean blocks, jint firstPage, jint lastPage)
+  (JNIEnv *env, jobject jthis, jboolean blocks, jint firstPage, jint totalPages)
 {
     AWT_ASSERT_NOT_APPKIT_THREAD;
 
@@ -654,14 +654,14 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj
 JNI_COCOA_ENTER(env);
     // Get the first page's PageFormat for setting things up (This introduces
     //  and is a facet of the same problem in Radar 2818593/2708932).
-    jobject page = (*env)->CallObjectMethod(env, jthis, jm_getPageFormat, 0); // AWT_THREADING Safe (!appKit)
+    jobject page = (*env)->CallObjectMethod(env, jthis, jm_getPageFormat, firstPage); // AWT_THREADING Safe (!appKit)
     CHECK_EXCEPTION();
     if (page != NULL) {
         jobject pageFormatArea = (*env)->CallObjectMethod(env, jthis, jm_getPageFormatArea, page); // AWT_THREADING Safe (!appKit)
         CHECK_EXCEPTION();
 
         PrinterView* printerView = [[PrinterView alloc] initWithFrame:JavaToNSRect(env, pageFormatArea) withEnv:env withPrinterJob:jthis];
-        [printerView setFirstPage:firstPage lastPage:lastPage];
+        [printerView setTotalPages:totalPages];
 
         GET_NSPRINTINFO_METHOD_RETURN(NO)
         NSPrintInfo* printInfo = (NSPrintInfo*)jlong_to_ptr((*env)->CallLongMethod(env, jthis, sjm_getNSPrintInfo)); // AWT_THREADING Safe (known object)
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.h
index 43472bee9208..95a8055cdb0c 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.h
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, 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
@@ -32,12 +32,12 @@
     jobject fCurPainter;
     jobject fCurPeekGraphics;
 
-    jint fFirstPage, fLastPage;
+    jint fTotalPages;
 }
 
 - (id)initWithFrame:(NSRect)aRect withEnv:(JNIEnv*)env withPrinterJob:(jobject)printerJob;
 
-- (void)setFirstPage:(jint)firstPage lastPage:(jint)lastPage;
+- (void)setTotalPages:(jint)totalPages;
 
 - (void)releaseReferences:(JNIEnv*)env;
 
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m
index 17feca9fd7e3..e7832c6c8914 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m
@@ -70,9 +70,8 @@ - (void)releaseReferences:(JNIEnv*)env
     }
 }
 
-- (void)setFirstPage:(jint)firstPage lastPage:(jint)lastPage {
-    fFirstPage = firstPage;
-    fLastPage = lastPage;
+- (void)setTotalPages:(jint)totalPages {
+    fTotalPages = totalPages;
 }
 
 - (void)drawRect:(NSRect)aRect
@@ -137,15 +136,15 @@ - (BOOL)knowsPageRange:(NSRangePointer)aRange
         return NO;
     }
 
-    aRange->location = fFirstPage + 1;
+    aRange->location = 1;
 
-    if (fLastPage == java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES)
+    if (fTotalPages == java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES)
     {
         aRange->length = NSIntegerMax;
     }
     else
     {
-        aRange->length = (fLastPage + 1) - fFirstPage;
+        aRange->length = fTotalPages;
     }
 
     return YES;
diff --git a/test/jdk/java/awt/print/PrinterJob/PageRanges.java b/test/jdk/java/awt/print/PrinterJob/PageRanges.java
index accde99ae956..89f4becb22ab 100644
--- a/test/jdk/java/awt/print/PrinterJob/PageRanges.java
+++ b/test/jdk/java/awt/print/PrinterJob/PageRanges.java
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6575331
+ * @bug 6575331 8297191
  * @key printer
  * @summary The specified pages should be printed.
  * @run main/manual=yesno PageRanges

From e7e72844169540ecfa721daf9c5290cd89bd59dc Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Fri, 20 Mar 2026 06:55:14 +0000
Subject: [PATCH 044/223] 8286258: [Accessibility,macOS,VoiceOver] VoiceOver
 reads the spinner value wrong and sometime partially

Backport-of: 8c82b58db960a178566514731e1f8dcbc59b0161
---
 .../awt/a11y/NavigableTextAccessibility.h     |  3 +-
 .../awt/a11y/NavigableTextAccessibility.m     | 27 +++++-
 .../awt/a11y/SpinboxAccessibility.m           | 27 +++++-
 .../CustomSpinnerAccessibilityTest.java       | 86 +++++++++++++++++++
 4 files changed, 139 insertions(+), 4 deletions(-)
 create mode 100644 test/jdk/javax/accessibility/JSpinner/CustomSpinnerAccessibilityTest.java

diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.h
index ebf314c7394c..9a528879a5d4 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.h
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2021, JetBrains s.r.o.. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -29,5 +29,6 @@
 @interface NavigableTextAccessibility : CommonComponentAccessibility 
 
 @property(readonly) BOOL accessibleIsPasswordText;
+@property BOOL announceEditUpdates;
 
 @end
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.m
index 138d502f10fb..8e241e65b963 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2021, JetBrains s.r.o.. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -60,6 +60,22 @@ - (BOOL)accessibleIsPasswordText {
     return [fJavaRole isEqualToString:@"passwordtext"];
 }
 
+- (id)init {
+    self = [super init];
+    if (self) {
+        _announceEditUpdates = YES;
+    }
+    return self;
+}
+
+- (void)suppressEditUpdates {
+    _announceEditUpdates = NO;
+}
+
+- (void)resumeEditUpdates {
+    _announceEditUpdates = YES;
+}
+
 // NSAccessibilityElement protocol methods
 
 - (NSRect)accessibilityFrameForRange:(NSRange)range
@@ -117,6 +133,9 @@ - (NSRange)accessibilityRangeForLine:(NSInteger)line
 
 - (NSString *)accessibilityStringForRange:(NSRange)range
 {
+    if (!_announceEditUpdates) {
+        return @"";
+    }
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     GET_CACCESSIBLETEXT_CLASS_RETURN(nil);
     DECLARE_STATIC_METHOD_RETURN(jm_getStringForRange, sjc_CAccessibleText, "getStringForRange",
@@ -306,6 +325,12 @@ - (id)accessibilityParent
     return [super accessibilityParent];
 }
 
+- (void)postSelectedTextChanged
+{
+    [super postSelectedTextChanged];
+    [self resumeEditUpdates];
+}
+
 /*
 * Other text methods
 - (NSRange)accessibilitySharedCharacterRange;
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.m
index 4dac6bd93f95..0cec7f3eb2c5 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, 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
@@ -24,6 +24,7 @@
  */
 
 #import "SpinboxAccessibility.h"
+#import "ThreadUtilities.h"
 
 #define INCREMENT 0
 #define DECREMENT 1
@@ -44,7 +45,15 @@ - (NSString * _Nullable)accessibilityLabel
 
 - (id _Nullable)accessibilityValue
 {
-    return [super accessibilityValue];
+    id val = [super accessibilityValue];
+    NSArray *clist = [super accessibilityChildren];
+    for (NSUInteger i = 0; i < [clist count]; i++) {
+        id child = [clist objectAtIndex:i];
+        if ([child conformsToProtocol:@protocol(NSAccessibilityNavigableStaticText)]) {
+            val = [child accessibilityValue];
+        }
+    }
+    return val;
 }
 
 - (BOOL)accessibilityPerformIncrement
@@ -68,4 +77,18 @@ - (id)accessibilityParent
     return [super accessibilityParent];
 }
 
+- (void)postValueChanged
+{
+    AWT_ASSERT_APPKIT_THREAD;
+    NSAccessibilityPostNotification(self, NSAccessibilityValueChangedNotification);
+    NSArray *clist = [super accessibilityChildren];
+    for (NSUInteger i = 0; i < [clist count]; i++) {
+        id child = [clist objectAtIndex:i];
+        if ([child conformsToProtocol:@protocol(NSAccessibilityNavigableStaticText)]) {
+            NSAccessibilityPostNotification(child, NSAccessibilityLayoutChangedNotification);
+            [child suppressEditUpdates];
+        }
+    }
+}
+
 @end
diff --git a/test/jdk/javax/accessibility/JSpinner/CustomSpinnerAccessibilityTest.java b/test/jdk/javax/accessibility/JSpinner/CustomSpinnerAccessibilityTest.java
new file mode 100644
index 000000000000..12c98c951104
--- /dev/null
+++ b/test/jdk/javax/accessibility/JSpinner/CustomSpinnerAccessibilityTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2026, 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.awt.GridLayout;
+import java.lang.reflect.InvocationTargetException;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerListModel;
+
+/*
+ * @test
+ * @bug 8286258
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @requires (os.family == "mac")
+ * @summary Checks that JSpinner with custom model announces
+ *          the value every time it is changed
+ * @run main/manual CustomSpinnerAccessibilityTest
+ */
+
+public class CustomSpinnerAccessibilityTest extends JPanel {
+    private static final String INSTRUCTIONS = """
+            1. Turn on VoiceOver
+            2. In the window named "Test UI" click on the text editor inside the
+               spinner component
+            3. Using up and down arrows change current month
+            4. Wait for the VoiceOver to finish speaking
+            5. Repeat steps 3 and 4 couple more times
+
+            If every time value of the spinner is changed VoiceOver
+            announces the new value click "Pass".
+            If instead the value is narrated only partially
+            and the new value is never fully narrated press "Fail".
+            """;
+
+    public CustomSpinnerAccessibilityTest() {
+        super(new GridLayout(0, 2));
+        String[] monthStrings = new java.text.DateFormatSymbols().getMonths();
+        int lastIndex = monthStrings.length - 1;
+        if (monthStrings[lastIndex] == null
+                || monthStrings[lastIndex].length() <= 0) {
+            String[] tmp = new String[lastIndex];
+            System.arraycopy(monthStrings, 0,
+                    tmp, 0, lastIndex);
+            monthStrings = tmp;
+        }
+
+        SpinnerListModel model = new SpinnerListModel(monthStrings);
+        JLabel label = new JLabel("Month: ");
+        add(label);
+        JSpinner spinner = new JSpinner(model);
+        label.setLabelFor(spinner);
+        add(spinner);
+    }
+
+    public static void main(String[] args) throws InterruptedException,
+            InvocationTargetException {
+        PassFailJFrame.builder()
+                .title("Custom Spinner Accessibility Test")
+                .instructions(INSTRUCTIONS)
+                .testUI(CustomSpinnerAccessibilityTest::new)
+                .build()
+                .awaitAndCheck();
+    }
+}

From 461f6f126265d3d7d5c637c3e094fcaea75e5f6f Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Fri, 20 Mar 2026 06:57:27 +0000
Subject: [PATCH 045/223] 8373690: Unexpected Keystore message using
 jdk.crypto.disabledAlgorithms

Backport-of: e92726c352f2d9e9ccb074441d9c09eef781a492
---
 .../share/classes/java/security/KeyStore.java | 16 ++++--
 .../security/KeyStore/DisabledKnownType.java  | 53 +++++++++++++++++++
 2 files changed, 65 insertions(+), 4 deletions(-)
 create mode 100644 test/jdk/java/security/KeyStore/DisabledKnownType.java

diff --git a/src/java.base/share/classes/java/security/KeyStore.java b/src/java.base/share/classes/java/security/KeyStore.java
index 3bbbc3691828..6727d0bc06cf 100644
--- a/src/java.base/share/classes/java/security/KeyStore.java
+++ b/src/java.base/share/classes/java/security/KeyStore.java
@@ -1803,6 +1803,7 @@ private static final KeyStore getInstance(File file, char[] password,
         }
 
         KeyStore keystore = null;
+        String matched = null;
 
         try (DataInputStream dataStream =
             new DataInputStream(
@@ -1826,8 +1827,10 @@ private static final KeyStore getInstance(File file, char[] password,
                                 if (CryptoAlgorithmConstraints.permits(
                                         "KEYSTORE", ksAlgo)) {
                                     keystore = new KeyStore(impl, p, ksAlgo);
-                                    break;
+                                } else {
+                                    matched = ksAlgo;
                                 }
+                                break;
                             }
                         } catch (NoSuchAlgorithmException e) {
                             // ignore
@@ -1857,9 +1860,14 @@ private static final KeyStore getInstance(File file, char[] password,
                 return keystore;
             }
         }
-
-        throw new KeyStoreException("Unrecognized keystore format. "
-                + "Please load it with a specified type");
+        if (matched == null) {
+            throw new KeyStoreException("Unrecognized keystore format. "
+                    + "Please load it with a specified type");
+        } else {
+            throw new KeyStoreException("Keystore format " +
+                    matched +
+                    " disabled by jdk.crypto.disabledAlgorithms property");
+        }
     }
 
     /**
diff --git a/test/jdk/java/security/KeyStore/DisabledKnownType.java b/test/jdk/java/security/KeyStore/DisabledKnownType.java
new file mode 100644
index 000000000000..70b7228f4c2e
--- /dev/null
+++ b/test/jdk/java/security/KeyStore/DisabledKnownType.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2026, 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 8373690
+ * @summary verify that the exception message indicates the keystore type
+ *         when the type is disabled instead of being unrecognized
+ * @run main/othervm -Djdk.crypto.disabledAlgorithms=KeyStore.PKCS12 DisabledKnownType
+ */
+
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+
+public class DisabledKnownType {
+    public static void main(String[] args) throws Exception {
+        String cacertsPath = System.getProperty("java.home") +
+                "/lib/security/cacerts";
+        try {
+            KeyStore ks = KeyStore.getInstance(new java.io.File(cacertsPath),
+                    "changeit".toCharArray());
+            throw new RuntimeException("Expected KeyStoreException not thrown");
+        } catch (KeyStoreException kse) {
+            if (kse.getMessage().contains("PKCS12")) {
+                System.out.println("Passed: expected ex thrown: " + kse);
+            } else {
+                // pass it up
+                throw kse;
+            }
+        }
+    }
+}
+

From 5f6dc173e9e4f51e03dc25d2d6c839cf6d561c0e Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Mon, 23 Mar 2026 19:27:40 +0000
Subject: [PATCH 046/223] 8338554: Fix inconsistencies in
 javadoc/doclet/testLinkOption/TestRedirectLinks.java

Backport-of: 9bb804b14e164982860db6323c7db33214cd0d36
---
 .../testLinkOption/TestRedirectLinks.java     | 111 ++++++------------
 1 file changed, 38 insertions(+), 73 deletions(-)

diff --git a/test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java b/test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java
index 787ac67b915b..9a80ca4d0899 100644
--- a/test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java
+++ b/test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2025, 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
@@ -26,40 +26,36 @@
  * @bug 8190312
  * @key intermittent
  * @summary test redirected URLs for -link
- * @library /tools/lib ../../lib
- * @library /test/lib
+ * @library /tools/lib ../../lib /test/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.javadoc/jdk.javadoc.internal.api
  *          jdk.javadoc/jdk.javadoc.internal.tool
  * @build toolbox.ToolBox toolbox.JavacTask javadoc.tester.*
  * @build jtreg.SkippedException
- * @build jdk.test.lib.Platform
+ * @build jdk.test.lib.Platform jdk.test.lib.net.SimpleSSLContext jdk.test.lib.net.URIBuilder
  * @run main TestRedirectLinks
  */
 
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.UnknownHostException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.security.KeyStore;
 import java.time.Duration;
 import java.time.Instant;
 
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManagerFactory;
 
 import com.sun.net.httpserver.HttpExchange;
 import com.sun.net.httpserver.HttpServer;
@@ -67,6 +63,8 @@
 import com.sun.net.httpserver.HttpsServer;
 
 import javadoc.tester.JavadocTester;
+import jdk.test.lib.net.SimpleSSLContext;
+import jdk.test.lib.net.URIBuilder;
 import toolbox.JavacTask;
 import toolbox.ToolBox;
 
@@ -74,6 +72,9 @@
 import jtreg.SkippedException;
 
 public class TestRedirectLinks extends JavadocTester {
+    // represents the HTTP response body length when the response contains no body
+    private static final int NO_RESPONSE_BODY = -1;
+
     /**
      * The entry point of the test.
      * @param args the array of command line arguments.
@@ -207,17 +208,28 @@ public void testWithServers() throws Exception {
 
         // start web servers
         // use loopback address to avoid any issues if proxy is in use
-        InetAddress localHost = InetAddress.getLoopbackAddress();
+        InetAddress loopback = InetAddress.getLoopbackAddress();
         try {
-            oldServer = HttpServer.create(new InetSocketAddress(localHost, 0), 0);
-            String oldURL = "http:/" + oldServer.getAddress();
+            oldServer = HttpServer.create(new InetSocketAddress(loopback, 0), 0);
+            String oldURL = URIBuilder.newBuilder()
+                    .scheme("http")
+                    .loopback()
+                    .port(oldServer.getAddress().getPort())
+                    .build().toString();
             oldServer.createContext("/", this::handleOldRequest);
             out.println("Starting old server (" + oldServer.getClass().getSimpleName() + ") on " + oldURL);
             oldServer.start();
 
             SSLContext sslContext = new SimpleSSLContext().get();
-            newServer = HttpsServer.create(new InetSocketAddress(localHost, 0), 0);
-            String newURL = "https:/" + newServer.getAddress();
+            if (sslContext == null) {
+                throw new AssertionError("Could not create a SSLContext");
+            }
+            newServer = HttpsServer.create(new InetSocketAddress(loopback, 0), 0);
+            String newURL = URIBuilder.newBuilder()
+                    .scheme("https")
+                    .loopback()
+                    .port(newServer.getAddress().getPort())
+                    .build().toString();
             newServer.setHttpsConfigurator(new HttpsConfigurator(sslContext));
             newServer.createContext("/", this::handleNewRequest);
             out.println("Starting new server (" + newServer.getClass().getSimpleName() + ") on " + newURL);
@@ -241,7 +253,7 @@ public void testWithServers() throws Exception {
                 javadoc("-d", "api",
                         "--module-source-path", src.toString(),
                         "--module-path", libModules.toString(),
-                        "-link", "http:/" + oldServer.getAddress(),
+                        "-link", oldURL,
                         "--module", "mC",
                         "-Xdoclint:none");
 
@@ -282,10 +294,19 @@ private void handleOldRequest(HttpExchange x) throws IOException {
                 + x.getRequestMethod() + " "
                 + x.getRequestURI());
         String newProtocol = (newServer instanceof HttpsServer) ? "https" : "http";
-        String redirectTo = newProtocol + ":/" + newServer.getAddress() + x.getRequestURI();
+        String redirectTo;
+        try {
+            redirectTo = URIBuilder.newBuilder().scheme(newProtocol)
+                    .host(newServer.getAddress().getAddress())
+                    .port(newServer.getAddress().getPort())
+                    .path(x.getRequestURI().getPath())
+                    .build().toString();
+        } catch (URISyntaxException e) {
+            throw new IOException(e);
+        }
         out.println("    redirect to: " + redirectTo);
         x.getResponseHeaders().add("Location", redirectTo);
-        x.sendResponseHeaders(HttpURLConnection.HTTP_MOVED_PERM, 0);
+        x.sendResponseHeaders(HttpURLConnection.HTTP_MOVED_PERM, NO_RESPONSE_BODY);
         x.getResponseBody().close();
     }
 
@@ -306,64 +327,8 @@ private void handleNewRequest(HttpExchange x) throws IOException {
                 responseStream.write(bytes);
             }
         } else {
-            x.sendResponseHeaders(HttpURLConnection.HTTP_NOT_FOUND, 0);
+            x.sendResponseHeaders(HttpURLConnection.HTTP_NOT_FOUND, NO_RESPONSE_BODY);
             x.getResponseBody().close();
         }
     }
-
-    /**
-     * Creates a simple usable SSLContext for an HttpsServer using
-     * a default keystore in the test tree.
-     * 

- * This class is based on - * test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SimpleSSLContext.java - */ - static class SimpleSSLContext { - - private final SSLContext ssl; - - /** - * Loads default keystore. - */ - SimpleSSLContext() throws Exception { - Path p = Path.of(System.getProperty("test.src", ".")).toAbsolutePath(); - while (!Files.exists(p.resolve("TEST.ROOT"))) { - p = p.getParent(); - if (p == null) { - throw new IOException("can't find TEST.ROOT"); - } - } - - System.err.println("Test suite root: " + p); - Path testKeys = p.resolve("../lib/jdk/test/lib/net/testkeys").normalize(); - if (!Files.exists(testKeys)) { - throw new IOException("can't find testkeys"); - } - System.err.println("Test keys: " + testKeys); - - try (InputStream fis = Files.newInputStream(testKeys)) { - ssl = init(fis); - } - } - - private SSLContext init(InputStream i) throws Exception { - char[] passphrase = "passphrase".toCharArray(); - KeyStore ks = KeyStore.getInstance("PKCS12"); - ks.load(i, passphrase); - - KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX"); - kmf.init(ks, passphrase); - - TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX"); - tmf.init(ks); - - SSLContext ssl = SSLContext.getInstance("TLS"); - ssl.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); - return ssl; - } - - SSLContext get() { - return ssl; - } - } } From 4ec838c736441783825b158940dfa4c9429ac95d Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:28:02 +0000 Subject: [PATCH 047/223] 8349533: Refactor validator tests shell files to java Backport-of: c5992ca27b7dddaaaf217b62445fdc48e7eaf240 --- .../sun/security/validator/CertReplace.java | 178 +++++++++++++++++- .../jdk/sun/security/validator/certreplace.sh | 88 --------- test/jdk/sun/security/validator/samedn.sh | 86 --------- 3 files changed, 168 insertions(+), 184 deletions(-) delete mode 100644 test/jdk/sun/security/validator/certreplace.sh delete mode 100644 test/jdk/sun/security/validator/samedn.sh diff --git a/test/jdk/sun/security/validator/CertReplace.java b/test/jdk/sun/security/validator/CertReplace.java index e858cc7657c1..42885b73e96e 100644 --- a/test/jdk/sun/security/validator/CertReplace.java +++ b/test/jdk/sun/security/validator/CertReplace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, 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 @@ -21,29 +21,186 @@ * questions. */ -/* - * This test is called by certreplace.sh - */ - import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.security.KeyStore; +import java.security.PrivateKey; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; -import java.util.Arrays; import java.util.ArrayList; import java.util.List; + +import jdk.test.lib.SecurityTools; +import jdk.test.lib.security.CertUtils; +import jdk.test.lib.security.KeyStoreUtils; import sun.security.validator.Validator; +/* + * @test id=certreplace + * @bug 6948803 + * @summary CertPath validation regression caused by SHA1 replacement root and MD2 disable feature + * @library /test/lib + * @modules java.base/sun.security.validator + * + * @run main CertReplace certreplace.jks certreplace.certs + */ + +/* + * @test id=samedn + * @bug 6958869 + * @summary Regression: PKIXValidator fails when multiple trust anchors have same dn + * @library /test/lib + * @modules java.base/sun.security.validator + * + * @run main CertReplace samedn.jks samedn1.certs + * @run main CertReplace samedn.jks samedn2.certs + */ + public class CertReplace { + private static final String SAMEDN_JKS = "samedn.jks"; + private static final String CERTREPLACE_JKS = "certreplace.jks"; + private static final String PASSWORD = "changeit"; + private static final char[] PASSWORD_CHAR_ARR = PASSWORD.toCharArray(); + + /** + * This method creates certs for the Cert Replace test + * + * @throws Exception + */ + private static void certReplace() throws Exception { + + final String ktBaseParameters = "-storepass " + PASSWORD + " " + + "-keypass " + PASSWORD + " " + + "-keystore " + CERTREPLACE_JKS + " " + + "-keyalg rsa "; + + final Path keystoreFilePath = Paths.get(CERTREPLACE_JKS); + Files.deleteIfExists(keystoreFilePath); + + // 1. Generate 3 aliases in a keystore: ca, int, user + SecurityTools.keytool(ktBaseParameters + + "-genkeypair -alias ca -dname CN=CA -keyalg rsa -sigalg md2withrsa -ext bc"); + SecurityTools.keytool(ktBaseParameters + + "-genkeypair -alias int -dname CN=Int -keyalg rsa"); + SecurityTools.keytool(ktBaseParameters + + "-genkeypair -alias user -dname CN=User -keyalg rsa"); + + final KeyStore keyStore = KeyStoreUtils.loadKeyStore(CERTREPLACE_JKS, PASSWORD); + + // 2. Signing: ca -> int -> user + + SecurityTools.keytool(ktBaseParameters + + "-certreq -alias int -file int.req"); + SecurityTools.keytool(ktBaseParameters + + "-gencert -rfc -alias ca -ext bc -infile int.req " + + "-outfile int.cert"); + + //putting the certificate in the keystore + try (final FileInputStream certInputStream = new FileInputStream("int.cert")) { + final Certificate[] certs = new Certificate[]{ + CertUtils.getCertFromStream( + certInputStream + ) + }; + + final PrivateKey privateKey = (PrivateKey) keyStore.getKey("int", PASSWORD_CHAR_ARR); + keyStore.setKeyEntry("int", privateKey, PASSWORD_CHAR_ARR, certs); + keyStore.store(new FileOutputStream(CERTREPLACE_JKS), PASSWORD_CHAR_ARR); + } + + SecurityTools.keytool(ktBaseParameters + + "-certreq -alias user -file user.req"); + SecurityTools.keytool(ktBaseParameters + + "-gencert -rfc -alias int " + + "-infile user.req " + + "-outfile certreplace.certs"); // this will create certreplace.certs which is later appended + + // 3. Create the certchain file + final Path certPath = Paths.get("certreplace.certs"); + + Files.write(certPath, Files.readAllBytes(Path.of("int.cert")), StandardOpenOption.APPEND); + + final String outputCa = SecurityTools.keytool(ktBaseParameters + + "-export -rfc -alias ca").getOutput(); + Files.write(certPath, outputCa.getBytes(), StandardOpenOption.APPEND); + + // 4. Upgrade ca from MD2withRSA to SHA256withRSA, remove other aliases and make this keystore the cacerts file + keyStore.deleteEntry("int"); + keyStore.deleteEntry("user"); + keyStore.store(new FileOutputStream(CERTREPLACE_JKS), PASSWORD_CHAR_ARR); + + SecurityTools.keytool(ktBaseParameters + + "-selfcert -alias ca"); + } + + /** + * This method creates certs for the Same DN test + * + * @throws Exception + */ + private static void sameDn() throws Exception { + + final String ktBaseParameters = "-storepass " + PASSWORD + " " + + "-keypass " + PASSWORD + " " + + "-keystore " + SAMEDN_JKS + " " + + "-keyalg rsa "; + + final Path keystoreFilePath = Paths.get(SAMEDN_JKS); + Files.deleteIfExists(keystoreFilePath); + + // 1. Generate 3 aliases in a keystore: ca1, ca2, user. The CAs' startdate + // is set to one year ago so that they are expired now + SecurityTools.keytool(ktBaseParameters + + "-genkeypair -alias ca1 -dname CN=CA -keyalg rsa " + + "-sigalg md5withrsa -ext bc -startdate -1y"); + SecurityTools.keytool(ktBaseParameters + + "-genkeypair -alias ca2 -dname CN=CA -keyalg rsa " + + "-sigalg sha1withrsa -ext bc -startdate -1y"); + SecurityTools.keytool(ktBaseParameters + + "-genkeypair -alias user -dname CN=User -keyalg rsa"); + + // 2. Signing: ca -> user. The startdate is set to 1 minute in the past to ensure the certificate + // is valid at the time of validation and to prevent any issues with timing discrepancies + // Automatically saves the certs to the certs files + + SecurityTools.keytool(ktBaseParameters + + "-certreq -alias user -file user.req"); + SecurityTools.keytool(ktBaseParameters + + "-gencert -rfc -alias ca1 " + + "-startdate -1M -infile user.req -outfile samedn1.certs"); + SecurityTools.keytool(ktBaseParameters + + "-gencert -rfc -alias ca2 " + + "-startdate -1M -infile user.req -outfile samedn2.certs"); + + // 3. Remove user for cacerts + final KeyStore keyStore = KeyStoreUtils.loadKeyStore(SAMEDN_JKS, PASSWORD); + keyStore.deleteEntry("user"); + keyStore.store(new FileOutputStream(CERTREPLACE_JKS), PASSWORD_CHAR_ARR); + } + /** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { + if (args[0].equals(CERTREPLACE_JKS)) { + certReplace(); + } else if (args[0].equals(SAMEDN_JKS)) { + sameDn(); + } else { + throw new RuntimeException("Not recognised test " + args[0]); + } + KeyStore ks = KeyStore.getInstance("JKS"); - ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); + try (final FileInputStream certInputStream = new FileInputStream(args[0])) { + ks.load(certInputStream, PASSWORD_CHAR_ARR); + } Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); @@ -57,9 +214,10 @@ public static void main(String[] args) throws Exception { public static X509Certificate[] createPath(String chain) throws Exception { CertificateFactory cf = CertificateFactory.getInstance("X.509"); List list = new ArrayList(); - for (Certificate c: cf.generateCertificates( - new FileInputStream(chain))) { - list.add((X509Certificate)c); + try (final FileInputStream certInputStream = new FileInputStream(chain)) { + for (Certificate c : cf.generateCertificates(certInputStream)) { + list.add((X509Certificate) c); + } } return (X509Certificate[]) list.toArray(new X509Certificate[0]); } diff --git a/test/jdk/sun/security/validator/certreplace.sh b/test/jdk/sun/security/validator/certreplace.sh deleted file mode 100644 index 79c973280927..000000000000 --- a/test/jdk/sun/security/validator/certreplace.sh +++ /dev/null @@ -1,88 +0,0 @@ -# -# Copyright (c) 2010, 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 6948803 -# @summary CertPath validation regression caused by SHA1 replacement root -# and MD2 disable feature -# @modules java.base/sun.security.validator -# - -if [ "${TESTSRC}" = "" ] ; then - TESTSRC="." -fi -if [ "${TESTJAVA}" = "" ] ; then - JAVAC_CMD=`which javac` - TESTJAVA=`dirname $JAVAC_CMD`/.. - COMPILEJAVA="${TESTJAVA}" -fi - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - Windows_* ) - FS="\\" - ;; - * ) - FS="/" - ;; -esac - -KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit \ - -keypass changeit -keystore certreplace.jks -keyalg rsa" -JAVAC=$COMPILEJAVA${FS}bin${FS}javac -JAVA=$TESTJAVA${FS}bin${FS}java - -rm -rf certreplace.jks 2> /dev/null - -# 1. Generate 3 aliases in a keystore: ca, int, user - -$KT -genkeypair -alias ca -dname CN=CA -keyalg rsa -sigalg md2withrsa -ext bc -$KT -genkeypair -alias int -dname CN=Int -keyalg rsa -$KT -genkeypair -alias user -dname CN=User -keyalg rsa - -# 2. Signing: ca -> int -> user - -$KT -certreq -alias int | $KT -gencert -rfc -alias ca -ext bc \ - | $KT -import -alias int -$KT -certreq -alias user | $KT -gencert -rfc -alias int \ - | $KT -import -alias user - -# 3. Create the certchain file - -$KT -export -alias user -rfc > certreplace.certs -$KT -export -rfc -alias int >> certreplace.certs -$KT -export -rfc -alias ca >> certreplace.certs - -# 4. Upgrade ca from MD2withRSA to SHA256withRSA, remove other aliases and -# make this keystore the cacerts file - -$KT -selfcert -alias ca -$KT -delete -alias int -$KT -delete -alias user - -# 5. Build and run test - -EXTRAOPTS="--add-exports java.base/sun.security.validator=ALL-UNNAMED" -$JAVAC ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . ${TESTSRC}${FS}CertReplace.java -$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} ${EXTRAOPTS} CertReplace certreplace.jks certreplace.certs diff --git a/test/jdk/sun/security/validator/samedn.sh b/test/jdk/sun/security/validator/samedn.sh deleted file mode 100644 index 912bbcd40c7c..000000000000 --- a/test/jdk/sun/security/validator/samedn.sh +++ /dev/null @@ -1,86 +0,0 @@ -# -# Copyright (c) 2010, 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 6958869 -# @summary regression: PKIXValidator fails when multiple trust anchors -# have same dn -# @modules java.base/sun.security.validator -# - -if [ "${TESTSRC}" = "" ] ; then - TESTSRC="." -fi -if [ "${TESTJAVA}" = "" ] ; then - JAVAC_CMD=`which javac` - TESTJAVA=`dirname $JAVAC_CMD`/.. - COMPILEJAVA="${TESTJAVA}" -fi - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - Windows_* ) - FS="\\" - ;; - * ) - FS="/" - ;; -esac - -KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit \ - -keypass changeit -keystore samedn.jks -keyalg rsa" -JAVAC=$COMPILEJAVA${FS}bin${FS}javac -JAVA=$TESTJAVA${FS}bin${FS}java - -rm -rf samedn.jks 2> /dev/null - -# 1. Generate 3 aliases in a keystore: ca1, ca2, user. The CAs' startdate -# is set to one year ago so that they are expired now - -$KT -genkeypair -alias ca1 -dname CN=CA -keyalg rsa -sigalg md5withrsa -ext bc -startdate -1y -$KT -genkeypair -alias ca2 -dname CN=CA -keyalg rsa -sigalg sha1withrsa -ext bc -startdate -1y -$KT -genkeypair -alias user -dname CN=User -keyalg rsa - -# 2. Signing: ca -> user. The startdate is set to 1 minute in the past to ensure the certificate -# is valid at the time of validation and to prevent any issues with timing discrepancies - -$KT -certreq -alias user | $KT -gencert -rfc -alias ca1 -startdate -1M > samedn1.certs -$KT -certreq -alias user | $KT -gencert -rfc -alias ca2 -startdate -1M > samedn2.certs - -# 3. Append the ca file - -$KT -export -rfc -alias ca1 >> samedn1.certs -$KT -export -rfc -alias ca2 >> samedn2.certs - -# 4. Remove user for cacerts - -$KT -delete -alias user - -# 5. Build and run test. Make sure the CA certs are ignored for validity check. -# Check both, one of them might be dropped out of map in old codes. - -EXTRAOPTS="--add-exports java.base/sun.security.validator=ALL-UNNAMED" -$JAVAC ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . ${TESTSRC}${FS}CertReplace.java -$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} ${EXTRAOPTS} CertReplace samedn.jks samedn1.certs || exit 1 -$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} ${EXTRAOPTS} CertReplace samedn.jks samedn2.certs || exit 2 From 5feb8ba71dbfc2d7ba4681bbd7740eba80307ff7 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:29:56 +0000 Subject: [PATCH 048/223] 8355443: [java.io] Use @requires tag instead of exiting based on File.separatorChar value Backport-of: 4826a91e7a729999343f450ab7ec4621cc418550 --- .../java/io/FileInputStream/LeadingSlash.java | 21 +++++++++---------- .../jdk/java/io/pathNames/GeneralSolaris.java | 7 ++----- test/jdk/java/io/pathNames/GeneralWin32.java | 7 ++----- .../java/io/pathNames/unix/TrailingSlash.java | 8 ++----- .../java/io/pathNames/win32/DriveOnly.java | 2 +- .../io/pathNames/win32/DriveRelativePath.java | 8 ++----- .../java/io/pathNames/win32/DriveSlash.java | 6 ++---- .../java/io/pathNames/win32/RenameDelete.java | 8 ++----- test/jdk/java/io/pathNames/win32/SJIS.java | 2 +- .../java/io/pathNames/win32/bug6344646.java | 8 ++----- 10 files changed, 26 insertions(+), 51 deletions(-) diff --git a/test/jdk/java/io/FileInputStream/LeadingSlash.java b/test/jdk/java/io/FileInputStream/LeadingSlash.java index 8e8595d7bb29..0ce25581b9e9 100644 --- a/test/jdk/java/io/FileInputStream/LeadingSlash.java +++ b/test/jdk/java/io/FileInputStream/LeadingSlash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -26,22 +26,21 @@ * @bug 4487368 * @summary Test, if FileInputStream can handle * a leading slash in file name. + * @requires (os.family == "windows") */ import java.io.*; public class LeadingSlash { public static void main (String args[]) throws Exception { - if (File.separatorChar == '\\') { // Windows - File file = null; - try { - file = File.createTempFile("bug", "4487368"); - new FileInputStream("\\" + file.getPath()).close(); - new FileOutputStream("\\" + file.getPath()).close(); - } finally { - if (file != null) - file.delete(); - } + File file = null; + try { + file = File.createTempFile("bug", "4487368"); + new FileInputStream("\\" + file.getPath()).close(); + new FileOutputStream("\\" + file.getPath()).close(); + } finally { + if (file != null) + file.delete(); } } } diff --git a/test/jdk/java/io/pathNames/GeneralSolaris.java b/test/jdk/java/io/pathNames/GeneralSolaris.java index 5b3c3d7f7ae4..6aae15b4468d 100644 --- a/test/jdk/java/io/pathNames/GeneralSolaris.java +++ b/test/jdk/java/io/pathNames/GeneralSolaris.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, 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 @@ -24,6 +24,7 @@ /* @test @bug 4035924 4095767 @summary General exhaustive test of solaris pathname handling + @requires (os.family != "windows") @author Mark Reinhold @build General GeneralSolaris @@ -65,10 +66,6 @@ private static void checkPaths() throws Exception { } public static void main(String[] args) throws Exception { - if (File.separatorChar != '/') { - /* This test is only valid on Unix systems */ - return; - } if (args.length > 0) debug = true; initTestData(3); diff --git a/test/jdk/java/io/pathNames/GeneralWin32.java b/test/jdk/java/io/pathNames/GeneralWin32.java index 6ee64fd86f0e..e7594816680a 100644 --- a/test/jdk/java/io/pathNames/GeneralWin32.java +++ b/test/jdk/java/io/pathNames/GeneralWin32.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, 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 @@ -24,6 +24,7 @@ /* @test @bug 4032066 4039597 4046914 4054511 4065189 4109131 4875229 6983520 8009258 @summary General exhaustive test of win32 pathname handling + @requires (os.family == "windows") @author Mark Reinhold @build General GeneralWin32 @@ -162,10 +163,6 @@ private static void checkUncPaths(int depth) throws Exception { public static void main(String[] args) throws Exception { - if (File.separatorChar != '\\') { - /* This test is only valid on win32 systems */ - return; - } if (args.length > 0) debug = true; initTestData(3); diff --git a/test/jdk/java/io/pathNames/unix/TrailingSlash.java b/test/jdk/java/io/pathNames/unix/TrailingSlash.java index b787cd0ef9d0..bfab177b2cfd 100644 --- a/test/jdk/java/io/pathNames/unix/TrailingSlash.java +++ b/test/jdk/java/io/pathNames/unix/TrailingSlash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -24,6 +24,7 @@ /* @test * @bug 4427862 * @summary Ensure that trailing slashes are ignored when opening files + * @requires (os.family != "windows") */ import java.io.*; @@ -107,11 +108,6 @@ static void go(String fn, String fns) throws Exception { } public static void main(String[] args) throws Exception { - if (File.separatorChar != '/') { - // This test is only valid on Unix systems - return; - } - go("xyzzy", "xyzzy"); go("xyzzy", "xyzzy/"); go("xyzzy", "xyzzy//"); diff --git a/test/jdk/java/io/pathNames/win32/DriveOnly.java b/test/jdk/java/io/pathNames/win32/DriveOnly.java index 4281200f0c7d..96aba22a408c 100644 --- a/test/jdk/java/io/pathNames/win32/DriveOnly.java +++ b/test/jdk/java/io/pathNames/win32/DriveOnly.java @@ -24,6 +24,7 @@ /* @test @bug 4096648 @summary Make sure that isDirectory and lastModified work on "x:" + @requires (os.family == "windows") */ import java.io.File; @@ -32,7 +33,6 @@ public class DriveOnly { public static void main(String[] args) throws Exception { - if (File.separatorChar != '\\') return; File f = new File("").getCanonicalFile(); while (f.getParent() != null) f = f.getParentFile(); String p = f.getPath().substring(0, 2); diff --git a/test/jdk/java/io/pathNames/win32/DriveRelativePath.java b/test/jdk/java/io/pathNames/win32/DriveRelativePath.java index 43fa2175e092..3f8e225ab3f5 100644 --- a/test/jdk/java/io/pathNames/win32/DriveRelativePath.java +++ b/test/jdk/java/io/pathNames/win32/DriveRelativePath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -24,6 +24,7 @@ /* @test @bug 4070044 4164823 @summary Check getCanonicalPath's treatment of drive-relative paths (win32) + @requires (os.family == "windows") */ import java.io.*; @@ -37,11 +38,6 @@ static void fail(String s) { public static void main(String[] args) throws IOException { - if (File.separatorChar != '\\') { - /* This test is only valid on win32 systems */ - return; - } - File f = new File("foo"); String c = f.getCanonicalPath(); System.err.println(c); diff --git a/test/jdk/java/io/pathNames/win32/DriveSlash.java b/test/jdk/java/io/pathNames/win32/DriveSlash.java index feb651204d0c..32777ad83d46 100644 --- a/test/jdk/java/io/pathNames/win32/DriveSlash.java +++ b/test/jdk/java/io/pathNames/win32/DriveSlash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, 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 @@ -25,6 +25,7 @@ @bug 4065189 @summary Check that win32 pathnames of the form "C:\\" can be listed by the File.list method + @requires (os.family == "windows") @author Mark Reinhold */ @@ -35,9 +36,6 @@ public class DriveSlash { public static void main(String[] args) throws Exception { - /* This test is only valid on win32 systems */ - if (File.separatorChar != '\\') return; - File f = new File("c:\\"); System.err.println(f.getCanonicalPath()); String[] fs = f.list(); diff --git a/test/jdk/java/io/pathNames/win32/RenameDelete.java b/test/jdk/java/io/pathNames/win32/RenameDelete.java index a6cfffade4bd..4b674ddea919 100644 --- a/test/jdk/java/io/pathNames/win32/RenameDelete.java +++ b/test/jdk/java/io/pathNames/win32/RenameDelete.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, 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 @@ -24,6 +24,7 @@ /* * @test * @bug 4042592 4042593 + @requires (os.family == "windows") * @summary Test operation of rename and delete on win32 */ @@ -40,11 +41,6 @@ public class RenameDelete { public static void main(String[] args) throws Exception { boolean success = false; - if (File.separatorChar != '\\') { - System.err.println("Not a win32 platform -- test inapplicable"); - return; - } - //construct a test file in this location File f1 = new File("."); StringBuffer location = new StringBuffer("\\"); diff --git a/test/jdk/java/io/pathNames/win32/SJIS.java b/test/jdk/java/io/pathNames/win32/SJIS.java index 580f06330a6e..11c69dca8dfa 100644 --- a/test/jdk/java/io/pathNames/win32/SJIS.java +++ b/test/jdk/java/io/pathNames/win32/SJIS.java @@ -25,6 +25,7 @@ @bug 4039597 @summary Check that pathnames containing double-byte characters are not corrupted by win32 path processing + @requires (os.family == "windows") @author Mark Reinhold @library /test/lib */ @@ -52,7 +53,6 @@ public static void main(String[] args) throws Exception { /* This test is only valid on win32 systems that use the SJIS encoding */ - if (File.separatorChar != '\\') return; String enc = System.getProperty("native.encoding"); if ((enc == null) || !enc.equals("MS932")) { throw new SkippedException( diff --git a/test/jdk/java/io/pathNames/win32/bug6344646.java b/test/jdk/java/io/pathNames/win32/bug6344646.java index a89d72fe165b..ecb4bc2bc661 100644 --- a/test/jdk/java/io/pathNames/win32/bug6344646.java +++ b/test/jdk/java/io/pathNames/win32/bug6344646.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -25,6 +25,7 @@ * @bug 6344646 * @summary tests that WinNTFileSystem.hashCode() uses * locale independent case mapping. + * @requires (os.family == "windows") */ import java.io.*; @@ -34,11 +35,6 @@ public class bug6344646 { public static void main(String[] s) { Locale reservedLocale = Locale.getDefault(); try { - /* This test is only valid on win32 systems */ - if (File.separatorChar != '\\') { - return; - } - Locale.setDefault(Locale.of("lt")); File f1 = new File("J\u0301"); File f2 = new File("j\u0301"); From 611e406d81c88bee2d4b9ab23b7edc864a3fd476 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:32:14 +0000 Subject: [PATCH 049/223] 8356695: java/lang/StringBuilder/HugeCapacity.java failing with OOME Backport-of: 0f5c608143413bc0d40fca31e097c7b40c7a6618 --- test/jdk/java/lang/StringBuilder/HugeCapacity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/jdk/java/lang/StringBuilder/HugeCapacity.java b/test/jdk/java/lang/StringBuilder/HugeCapacity.java index a584ce1f07a9..bd6eb51f53bc 100644 --- a/test/jdk/java/lang/StringBuilder/HugeCapacity.java +++ b/test/jdk/java/lang/StringBuilder/HugeCapacity.java @@ -27,8 +27,8 @@ * @summary Capacity should not get close to Integer.MAX_VALUE unless * necessary * @requires (sun.arch.data.model == "64" & os.maxMemory >= 8G) - * @run main/othervm -Xms6G -Xmx6G -XX:+CompactStrings HugeCapacity true - * @run main/othervm -Xms6G -Xmx6G -XX:-CompactStrings HugeCapacity false + * @run main/othervm -Xms8G -Xmx8G -XX:-CompactStrings -Xlog:gc HugeCapacity false + * @run main/othervm -Xms8G -Xmx8G -XX:+CompactStrings -Xlog:gc HugeCapacity true */ public class HugeCapacity { From 910e807e55ea90aefeeed1cb5e58968d241b6a9c Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:34:09 +0000 Subject: [PATCH 050/223] 8357062: Update Public Suffix List to 823beb1 Backport-of: 6162e2c5213c5dd7c1127fd9616b543efa898962 --- .../share/data/publicsuffixlist/VERSION | 4 +- .../publicsuffixlist/public_suffix_list.dat | 4163 +++++++++-------- src/java.base/share/legal/public_suffix.md | 2 +- .../util/RegisteredDomain/ParseNames.java | 4 +- .../security/util/RegisteredDomain/tests.dat | 11 +- 5 files changed, 2121 insertions(+), 2063 deletions(-) diff --git a/src/java.base/share/data/publicsuffixlist/VERSION b/src/java.base/share/data/publicsuffixlist/VERSION index 24f4407cc89a..1e136d312dad 100644 --- a/src/java.base/share/data/publicsuffixlist/VERSION +++ b/src/java.base/share/data/publicsuffixlist/VERSION @@ -1,2 +1,2 @@ -Github: https://raw.githubusercontent.com/publicsuffix/list/1cbd6e71a9b83620b1d0b11e49d3d9ff48c27e22/public_suffix_list.dat -Date: 2024-05-07 +Github: https://raw.githubusercontent.com/publicsuffix/list/823beb1425def931c8b0b170a6bc33b424c3f9b0/public_suffix_list.dat +Date: 2025-05-12 diff --git a/src/java.base/share/data/publicsuffixlist/public_suffix_list.dat b/src/java.base/share/data/publicsuffixlist/public_suffix_list.dat index 34733674ea00..6ebe2dfd632f 100644 --- a/src/java.base/share/data/publicsuffixlist/public_suffix_list.dat +++ b/src/java.base/share/data/publicsuffixlist/public_suffix_list.dat @@ -14,40 +14,48 @@ ac com.ac edu.ac gov.ac -net.ac mil.ac +net.ac org.ac -// ad : https://en.wikipedia.org/wiki/.ad +// ad : https://www.iana.org/domains/root/db/ad.html +// Confirmed by Amadeu Abril i Abril (CORE) 2024-11-17 ad -nom.ad -// ae : https://tdra.gov.ae/en/aeda/ae-policies +// ae : https://www.iana.org/domains/root/db/ae.html ae +ac.ae co.ae +gov.ae +mil.ae net.ae org.ae sch.ae -ac.ae -gov.ae -mil.ae -// aero : see https://www.information.aero/index.php?id=66 +// aero : https://information.aero/registration/policies/dmp aero +// 2LDs +airline.aero +airport.aero +// 2LDs (currently not accepting registration, seemingly never have) +// As of 2024-07, these are marked as reserved for potential 3LD +// registrations (clause 11 "allocated subdomains" in the 2006 TLD +// policy), but the relevant industry partners have not opened them up +// for registration. Current status can be determined from the TLD's +// policy document: 2LDs that are open for registration must list +// their policy in the TLD's policy. Any 2LD without such a policy is +// not open for registrations. accident-investigation.aero accident-prevention.aero aerobatic.aero aeroclub.aero aerodrome.aero agents.aero -aircraft.aero -airline.aero -airport.aero air-surveillance.aero -airtraffic.aero air-traffic-control.aero +aircraft.aero +airtraffic.aero ambulance.aero -amusement.aero association.aero author.aero ballooning.aero @@ -78,6 +86,7 @@ exchange.aero express.aero federation.aero flight.aero +freight.aero fuel.aero gliding.aero government.aero @@ -92,6 +101,7 @@ leasing.aero logistics.aero magazine.aero maintenance.aero +marketplace.aero media.aero microlight.aero modelling.aero @@ -114,6 +124,7 @@ show.aero skydiving.aero software.aero student.aero +taxi.aero trader.aero trading.aero trainer.aero @@ -121,27 +132,27 @@ union.aero workinggroup.aero works.aero -// af : http://www.nic.af/help.jsp +// af : https://www.nic.af/domain-price af -gov.af com.af -org.af -net.af edu.af +gov.af +net.af +org.af // ag : http://www.nic.ag/prices.htm ag +co.ag com.ag -org.ag net.ag -co.ag nom.ag +org.ag // ai : http://nic.com.ai/ ai -off.ai com.ai net.ai +off.ai org.ai // al : http://www.ert.gov.al/ert_alb/faq_det.html?Id=31 @@ -154,6 +165,7 @@ net.al org.al // am : https://www.amnic.net/policy/en/Policy_EN.pdf +// Confirmed by ISOC AM 2024-11-18 am co.am com.am @@ -161,17 +173,20 @@ commune.am net.am org.am -// ao : https://en.wikipedia.org/wiki/.ao -// http://www.dns.ao/REGISTR.DOC +// ao : https://www.iana.org/domains/root/db/ao.html +// https://www.dns.ao/ao/ ao +co.ao ed.ao +edu.ao +gov.ao gv.ao +it.ao og.ao -co.ao +org.ao pb.ao -it.ao -// aq : https://en.wikipedia.org/wiki/.aq +// aq : https://www.iana.org/domains/root/db/aq.html aq // ar : https://nic.ar/es/nic-argentina/normativa @@ -188,51 +203,53 @@ musica.ar mutual.ar net.ar org.ar +seg.ar senasa.ar tur.ar -// arpa : https://en.wikipedia.org/wiki/.arpa +// arpa : https://www.iana.org/domains/root/db/arpa.html // Confirmed by registry 2008-06-18 arpa e164.arpa +home.arpa in-addr.arpa ip6.arpa iris.arpa uri.arpa urn.arpa -// as : https://en.wikipedia.org/wiki/.as +// as : https://www.iana.org/domains/root/db/as.html as gov.as -// asia : https://en.wikipedia.org/wiki/.asia +// asia : https://www.iana.org/domains/root/db/asia.html asia -// at : https://en.wikipedia.org/wiki/.at +// at : https://www.iana.org/domains/root/db/at.html // Confirmed by registry 2008-06-17 at ac.at +sth.ac.at co.at gv.at or.at -sth.ac.at -// au : https://en.wikipedia.org/wiki/.au -// http://www.auda.org.au/ +// au : https://www.iana.org/domains/root/db/au.html +// https://www.auda.org.au/ +// Confirmed by registry 2024-11-17 au // 2LDs +asn.au com.au -net.au -org.au edu.au gov.au -asn.au id.au +net.au +org.au // Historic 2LDs (closed to new registration, but sites still exist) -info.au conf.au oz.au -// CGDNs - http://www.cgdn.org.au/ +// CGDNs : https://www.auda.org.au/au-domain-names/the-different-au-domain-names/state-and-territory-domain-names/ act.au nsw.au nt.au @@ -252,9 +269,9 @@ sa.edu.au tas.edu.au vic.edu.au wa.edu.au -// act.gov.au Bug 984824 - Removed at request of Greg Tankard -// nsw.gov.au Bug 547985 - Removed at request of -// nt.gov.au Bug 940478 - Removed at request of Greg Connors +// act.gov.au - Bug 984824 - Removed at request of Greg Tankard +// nsw.gov.au - Bug 547985 - Removed at request of +// nt.gov.au - Bug 940478 - Removed at request of Greg Connors qld.gov.au sa.gov.au tas.gov.au @@ -264,29 +281,33 @@ wa.gov.au // education.tas.edu.au - Removed at the request of the Department of Education Tasmania schools.nsw.edu.au -// aw : https://en.wikipedia.org/wiki/.aw +// aw : https://www.iana.org/domains/root/db/aw.html aw com.aw -// ax : https://en.wikipedia.org/wiki/.ax +// ax : https://www.iana.org/domains/root/db/ax.html ax -// az : https://en.wikipedia.org/wiki/.az +// az : https://www.iana.org/domains/root/db/az.html +// Confirmed via https://whois.az/?page_id=10 2024-12-11 az +biz.az +co.az com.az -net.az -int.az -gov.az -org.az edu.az +gov.az info.az -pp.az +int.az mil.az name.az +net.az +org.az +pp.az +// No longer available for registration, however domains exist as of 2024-12-11 +// see https://whois.az/?page_id=783 pro.az -biz.az -// ba : http://nic.ba/users_data/files/pravilnik_o_registraciji.pdf +// ba : https://www.iana.org/domains/root/db/ba.html ba com.ba edu.ba @@ -295,7 +316,7 @@ mil.ba net.ba org.ba -// bb : https://en.wikipedia.org/wiki/.bb +// bb : https://www.iana.org/domains/root/db/bb.html bb biz.bb co.bb @@ -308,21 +329,31 @@ org.bb store.bb tv.bb -// bd : https://en.wikipedia.org/wiki/.bd +// bd : https://www.iana.org/domains/root/db/bd.html *.bd -// be : https://en.wikipedia.org/wiki/.be +// be : https://www.iana.org/domains/root/db/be.html // Confirmed by registry 2008-06-08 be ac.be -// bf : https://en.wikipedia.org/wiki/.bf +// bf : https://www.iana.org/domains/root/db/bf.html bf gov.bf -// bg : https://en.wikipedia.org/wiki/.bg +// bg : https://www.iana.org/domains/root/db/bg.html // https://www.register.bg/user/static/rules/en/index.html bg +0.bg +1.bg +2.bg +3.bg +4.bg +5.bg +6.bg +7.bg +8.bg +9.bg a.bg b.bg c.bg @@ -349,26 +380,16 @@ w.bg x.bg y.bg z.bg -0.bg -1.bg -2.bg -3.bg -4.bg -5.bg -6.bg -7.bg -8.bg -9.bg -// bh : https://en.wikipedia.org/wiki/.bh +// bh : https://www.iana.org/domains/root/db/bh.html bh com.bh edu.bh +gov.bh net.bh org.bh -gov.bh -// bi : https://en.wikipedia.org/wiki/.bi +// bi : https://www.iana.org/domains/root/db/bi.html // http://whois.nic.bi/ bi co.bi @@ -377,11 +398,11 @@ edu.bi or.bi org.bi -// biz : https://en.wikipedia.org/wiki/.biz +// biz : https://www.iana.org/domains/root/db/biz.html biz // bj : https://nic.bj/bj-suffixes.txt -// submitted by registry +// Submitted by registry bj africa.bj agro.bj @@ -399,12 +420,12 @@ money.bj net.bj org.bj ote.bj -resto.bj restaurant.bj +resto.bj tourism.bj univ.bj -// bm : http://www.bermudanic.bm/dnr-text.txt +// bm : https://www.bermudanic.bm/domain-registration/index.php bm com.bm edu.bm @@ -420,15 +441,16 @@ gov.bn net.bn org.bn -// bo : https://nic.bo/delegacion2015.php#h-1.10 +// bo : https://nic.bo +// Confirmed by registry 2024-11-19 bo com.bo edu.bo gob.bo int.bo -org.bo -net.bo mil.bo +net.bo +org.bo tv.bo web.bo // Social Domains @@ -454,9 +476,9 @@ natural.bo nombre.bo noticias.bo patria.bo +plurinacional.bo politica.bo profesional.bo -plurinacional.bo pueblo.bo revista.bo salud.bo @@ -484,6 +506,7 @@ ato.br b.br barueri.br belem.br +bet.br bhz.br bib.br bio.br @@ -571,6 +594,7 @@ joinville.br jor.br jus.br leg.br +leilao.br lel.br log.br londrina.br @@ -641,12 +665,12 @@ zlg.br // bs : http://www.nic.bs/rules.html bs com.bs -net.bs -org.bs edu.bs gov.bs +net.bs +org.bs -// bt : https://en.wikipedia.org/wiki/.bt +// bt : https://www.iana.org/domains/root/db/bt.html bt com.bt edu.bt @@ -658,14 +682,16 @@ org.bt // Submitted by registry bv -// bw : https://en.wikipedia.org/wiki/.bw -// http://www.gobin.info/domainname/bw.doc -// list of other 2nd level tlds ? +// bw : https://www.iana.org/domains/root/db/bw.html +// https://nic.net.bw/bw-name-structure bw +ac.bw co.bw +gov.bw +net.bw org.bw -// by : https://en.wikipedia.org/wiki/.by +// by : https://www.iana.org/domains/root/db/by.html // http://tld.by/rules_2006_en.html // list of other 2nd level tlds ? by @@ -675,20 +701,20 @@ mil.by // second-level domain, but it's being used as one (see www.google.com.by and // www.yahoo.com.by, for example), so we list it here for safety's sake. com.by - // http://hoster.by/ of.by -// bz : https://en.wikipedia.org/wiki/.bz +// bz : https://www.iana.org/domains/root/db/bz.html // http://www.belizenic.bz/ bz +co.bz com.bz -net.bz -org.bz edu.bz gov.bz +net.bz +org.bz -// ca : https://en.wikipedia.org/wiki/.ca +// ca : https://www.iana.org/domains/root/db/ca.html ca // ca geographical names ab.ca @@ -709,46 +735,43 @@ yk.ca // see also: http://registry.gc.ca/en/SubdomainFAQ gc.ca -// cat : https://en.wikipedia.org/wiki/.cat +// cat : https://www.iana.org/domains/root/db/cat.html cat -// cc : https://en.wikipedia.org/wiki/.cc +// cc : https://www.iana.org/domains/root/db/cc.html cc -// cd : https://en.wikipedia.org/wiki/.cd -// see also: https://www.nic.cd/domain/insertDomain_2.jsp?act=1 +// cd : https://www.iana.org/domains/root/db/cd.html +// https://www.nic.cd cd gov.cd -// cf : https://en.wikipedia.org/wiki/.cf +// cf : https://www.iana.org/domains/root/db/cf.html cf -// cg : https://en.wikipedia.org/wiki/.cg +// cg : https://www.iana.org/domains/root/db/cg.html cg -// ch : https://en.wikipedia.org/wiki/.ch +// ch : https://www.iana.org/domains/root/db/ch.html ch -// ci : https://en.wikipedia.org/wiki/.ci -// http://www.nic.ci/index.php?page=charte +// ci : https://www.iana.org/domains/root/db/ci.html ci -org.ci -or.ci -com.ci +ac.ci +aéroport.ci +asso.ci co.ci -edu.ci +com.ci ed.ci -ac.ci -net.ci +edu.ci go.ci -asso.ci -aéroport.ci -int.ci -presse.ci -md.ci gouv.ci +int.ci +net.ci +or.ci +org.ci -// ck : https://en.wikipedia.org/wiki/.ck +// ck : https://www.iana.org/domains/root/db/ck.html *.ck !www.ck @@ -760,26 +783,26 @@ gob.cl gov.cl mil.cl -// cm : https://en.wikipedia.org/wiki/.cm plus bug 981927 +// cm : https://www.iana.org/domains/root/db/cm.html plus bug 981927 cm co.cm com.cm gov.cm net.cm -// cn : https://en.wikipedia.org/wiki/.cn +// cn : https://www.iana.org/domains/root/db/cn.html // Submitted by registry cn ac.cn com.cn edu.cn gov.cn +mil.cn net.cn org.cn -mil.cn 公司.cn -网络.cn 網絡.cn +网络.cn // cn geographic names ah.cn bj.cn @@ -787,18 +810,20 @@ cq.cn fj.cn gd.cn gs.cn -gz.cn gx.cn +gz.cn ha.cn hb.cn he.cn hi.cn +hk.cn hl.cn hn.cn jl.cn js.cn jx.cn ln.cn +mo.cn nm.cn nx.cn qh.cn @@ -808,38 +833,31 @@ sh.cn sn.cn sx.cn tj.cn +tw.cn xj.cn xz.cn yn.cn zj.cn -hk.cn -mo.cn -tw.cn -// co : https://en.wikipedia.org/wiki/.co -// Submitted by registry +// co : https://www.iana.org/domains/root/db/co.html +// https://www.cointernet.com.co/como-funciona-un-dominio-restringido +// Confirmed by registry 2024-11-18 co -arts.co com.co edu.co -firm.co gov.co -info.co -int.co mil.co net.co nom.co org.co -rec.co -web.co -// com : https://en.wikipedia.org/wiki/.com +// com : https://www.iana.org/domains/root/db/com.html com -// coop : https://en.wikipedia.org/wiki/.coop +// coop : https://www.iana.org/domains/root/db/coop.html coop -// cr : http://www.nic.cr/niccr_publico/showRegistroDominiosScreen.do +// cr : https://nic.cr/capitulo-1-registro-de-un-nombre-de-dominio/ cr ac.cr co.cr @@ -849,40 +867,45 @@ go.cr or.cr sa.cr -// cu : https://en.wikipedia.org/wiki/.cu +// cu : https://www.iana.org/domains/root/db/cu.html cu com.cu edu.cu -org.cu -net.cu -gov.cu +gob.cu inf.cu +nat.cu +net.cu +org.cu -// cv : https://en.wikipedia.org/wiki/.cv -// cv : http://www.dns.cv/tldcv_portal/do?com=DS;5446457100;111;+PAGE(4000018)+K-CAT-CODIGO(RDOM)+RCNT(100); <- registration rules +// cv : https://www.iana.org/domains/root/db/cv.html +// https://ola.cv/domain-extensions-under-cv/ +// Confirmed by registry 2024-11-26 cv com.cv edu.cv +id.cv int.cv +net.cv nome.cv org.cv +publ.cv -// cw : http://www.una.cw/cw_registry/ -// Confirmed by registry 2013-03-26 +// cw : https://www.uoc.cw/cw-registry +// Confirmed by registry 2024-11-19 cw com.cw edu.cw net.cw org.cw -// cx : https://en.wikipedia.org/wiki/.cx +// cx : https://www.iana.org/domains/root/db/cx.html // list of other 2nd level tlds ? cx gov.cx // cy : http://www.nic.cy/ -// Submitted by registry Panayiotou Fotia -// namespace policies URL https://www.nic.cy/portal//sites/default/files/symfonia_gia_eggrafi.pdf +// Submitted by Panayiotou Fotia +// https://nic.cy/wp-content/uploads/2024/01/Create-Request-for-domain-name-registration-1.pdf cy ac.cy biz.cy @@ -897,30 +920,33 @@ press.cy pro.cy tm.cy -// cz : https://en.wikipedia.org/wiki/.cz +// cz : https://www.iana.org/domains/root/db/cz.html cz -// de : https://en.wikipedia.org/wiki/.de +// de : https://www.iana.org/domains/root/db/de.html // Confirmed by registry (with technical // reservations) 2008-07-01 de -// dj : https://en.wikipedia.org/wiki/.dj +// dj : https://www.iana.org/domains/root/db/dj.html dj -// dk : https://en.wikipedia.org/wiki/.dk +// dk : https://www.iana.org/domains/root/db/dk.html // Confirmed by registry 2008-06-17 dk -// dm : https://en.wikipedia.org/wiki/.dm +// dm : https://www.iana.org/domains/root/db/dm.html +// https://nic.dm/policies/pdf/DMRulesandGuidelines2024v1.pdf +// Confirmed by registry 2024-11-19 dm +co.dm com.dm -net.dm -org.dm edu.dm gov.dm +net.dm +org.dm -// do : https://en.wikipedia.org/wiki/.do +// do : https://www.iana.org/domains/root/db/do.html do art.do com.do @@ -940,88 +966,93 @@ asso.dz com.dz edu.dz gov.dz -org.dz net.dz +org.dz pol.dz soc.dz tm.dz -// ec : http://www.nic.ec/reg/paso1.asp +// ec : https://www.nic.ec/ // Submitted by registry ec com.ec -info.ec -net.ec +edu.ec fin.ec +gob.ec +gov.ec +info.ec k12.ec med.ec -pro.ec -org.ec -edu.ec -gov.ec -gob.ec mil.ec +net.ec +org.ec +pro.ec -// edu : https://en.wikipedia.org/wiki/.edu +// edu : https://www.iana.org/domains/root/db/edu.html edu -// ee : http://www.eenet.ee/EENet/dom_reeglid.html#lisa_B +// ee : https://www.internet.ee/domains/general-domains-and-procedure-for-registration-of-sub-domains-under-general-domains ee +aip.ee +com.ee edu.ee +fie.ee gov.ee -riik.ee lib.ee med.ee -com.ee -pri.ee -aip.ee org.ee -fie.ee +pri.ee +riik.ee -// eg : https://en.wikipedia.org/wiki/.eg +// eg : https://www.iana.org/domains/root/db/eg.html +// https://domain.eg/en/domain-rules/subdomain-names-types/ eg +ac.eg com.eg edu.eg eun.eg gov.eg +info.eg +me.eg mil.eg name.eg net.eg org.eg sci.eg +sport.eg +tv.eg -// er : https://en.wikipedia.org/wiki/.er +// er : https://www.iana.org/domains/root/db/er.html *.er -// es : https://www.nic.es/site_ingles/ingles/dominios/index.html +// es : https://www.dominios.es/en es com.es +edu.es +gob.es nom.es org.es -gob.es -edu.es -// et : https://en.wikipedia.org/wiki/.et +// et : https://www.iana.org/domains/root/db/et.html et +biz.et com.et -gov.et -org.et edu.et -biz.et -name.et +gov.et info.et +name.et net.et +org.et -// eu : https://en.wikipedia.org/wiki/.eu +// eu : https://www.iana.org/domains/root/db/eu.html eu -// fi : https://en.wikipedia.org/wiki/.fi +// fi : https://www.iana.org/domains/root/db/fi.html fi -// aland.fi : https://en.wikipedia.org/wiki/.ax +// aland.fi : https://www.iana.org/domains/root/db/ax.html // This domain is being phased out in favor of .ax. As there are still many // domains under aland.fi, we still keep it on the list until aland.fi is // completely removed. -// TODO: Check for updates (expected to be phased out around Q1/2009) aland.fi // fj : http://domains.fj/ @@ -1038,17 +1069,17 @@ net.fj org.fj pro.fj -// fk : https://en.wikipedia.org/wiki/.fk +// fk : https://www.iana.org/domains/root/db/fk.html *.fk -// fm : https://en.wikipedia.org/wiki/.fm +// fm : https://www.iana.org/domains/root/db/fm.html +fm com.fm edu.fm net.fm org.fm -fm -// fo : https://en.wikipedia.org/wiki/.fo +// fo : https://www.iana.org/domains/root/db/fo.html fo // fr : https://www.afnic.fr/ https://www.afnic.fr/wp-media/uploads/2022/12/afnic-naming-policy-2023-01-01.pdf @@ -1065,59 +1096,60 @@ cci.fr greta.fr huissier-justice.fr -// ga : https://en.wikipedia.org/wiki/.ga +// ga : https://www.iana.org/domains/root/db/ga.html ga // gb : This registry is effectively dormant // Submitted by registry gb -// gd : https://en.wikipedia.org/wiki/.gd +// gd : https://www.iana.org/domains/root/db/gd.html +gd edu.gd gov.gd -gd -// ge : http://www.nic.net.ge/policy_en.pdf +// ge : https://nic.ge/en/administrator/the-ge-domain-regulations +// Confirmed by registry 2024-11-20 ge com.ge edu.ge gov.ge -org.ge -mil.ge net.ge +org.ge pvt.ge +school.ge -// gf : https://en.wikipedia.org/wiki/.gf +// gf : https://www.iana.org/domains/root/db/gf.html gf -// gg : http://www.channelisles.net/register-domains/ +// gg : https://www.channelisles.net/register-1/register-direct // Confirmed by registry 2013-11-28 gg co.gg net.gg org.gg -// gh : https://en.wikipedia.org/wiki/.gh -// see also: http://www.nic.gh/reg_now.php +// gh : https://www.iana.org/domains/root/db/gh.html +// https://www.nic.gh/ // Although domains directly at second level are not possible at the moment, // they have been possible for some time and may come back. gh com.gh edu.gh gov.gh -org.gh mil.gh +org.gh // gi : http://www.nic.gi/rules.html gi com.gi -ltd.gi +edu.gi gov.gi +ltd.gi mod.gi -edu.gi org.gi -// gl : https://en.wikipedia.org/wiki/.gl +// gl : https://www.iana.org/domains/root/db/gl.html // http://nic.gl gl co.gl @@ -1136,34 +1168,34 @@ ac.gn com.gn edu.gn gov.gn -org.gn net.gn +org.gn -// gov : https://en.wikipedia.org/wiki/.gov +// gov : https://www.iana.org/domains/root/db/gov.html gov // gp : http://www.nic.gp/index.php?lang=en gp +asso.gp com.gp -net.gp -mobi.gp edu.gp +mobi.gp +net.gp org.gp -asso.gp -// gq : https://en.wikipedia.org/wiki/.gq +// gq : https://www.iana.org/domains/root/db/gq.html gq -// gr : https://grweb.ics.forth.gr/english/1617-B-2005.html +// gr : https://www.iana.org/domains/root/db/gr.html // Submitted by registry gr com.gr edu.gr +gov.gr net.gr org.gr -gov.gr -// gs : https://en.wikipedia.org/wiki/.gs +// gs : https://www.iana.org/domains/root/db/gs.html gs // gt : https://www.gt/sitio/registration_policy.php?lang=en @@ -1189,11 +1221,11 @@ net.gu org.gu web.gu -// gw : https://en.wikipedia.org/wiki/.gw +// gw : https://www.iana.org/domains/root/db/gw.html // gw : https://nic.gw/regras/ gw -// gy : https://en.wikipedia.org/wiki/.gy +// gy : https://www.iana.org/domains/root/db/gy.html // http://registry.gy/ gy co.gy @@ -1212,97 +1244,97 @@ gov.hk idv.hk net.hk org.hk +个人.hk +個人.hk 公司.hk -教育.hk -敎育.hk 政府.hk -個人.hk -个人.hk +敎育.hk +教育.hk 箇人.hk +組織.hk +組织.hk +網絡.hk 網络.hk -网络.hk 组織.hk -網絡.hk -网絡.hk 组织.hk -組織.hk -組织.hk +网絡.hk +网络.hk -// hm : https://en.wikipedia.org/wiki/.hm +// hm : https://www.iana.org/domains/root/db/hm.html hm -// hn : http://www.nic.hn/politicas/ps02,,05.html +// hn : https://www.iana.org/domains/root/db/hn.html hn com.hn edu.hn -org.hn -net.hn -mil.hn gob.hn +mil.hn +net.hn +org.hn // hr : http://www.dns.hr/documents/pdf/HRTLD-regulations.pdf hr -iz.hr +com.hr from.hr +iz.hr name.hr -com.hr // ht : http://www.nic.ht/info/charte.cfm ht +adult.ht +art.ht +asso.ht com.ht -shop.ht +coop.ht +edu.ht firm.ht +gouv.ht info.ht -adult.ht +med.ht net.ht -pro.ht org.ht -med.ht -art.ht -coop.ht +perso.ht pol.ht -asso.ht -edu.ht +pro.ht rel.ht -gouv.ht -perso.ht +shop.ht -// hu : http://www.domain.hu/domain/English/sld.html +// hu : https://www.iana.org/domains/root/db/hu.html // Confirmed by registry 2008-06-12 hu -co.hu -info.hu -org.hu -priv.hu -sport.hu -tm.hu 2000.hu agrar.hu bolt.hu casino.hu city.hu +co.hu erotica.hu erotika.hu film.hu forum.hu games.hu hotel.hu +info.hu ingatlan.hu jogasz.hu konyvelo.hu lakas.hu media.hu news.hu +org.hu +priv.hu reklam.hu sex.hu shop.hu +sport.hu suli.hu szex.hu +tm.hu tozsde.hu utazas.hu video.hu -// id : https://pandi.id/en/domain/registration-requirements/ +// id : https://www.iana.org/domains/root/db/id.html id ac.id biz.id @@ -1317,13 +1349,13 @@ ponpes.id sch.id web.id -// ie : https://en.wikipedia.org/wiki/.ie +// ie : https://www.iana.org/domains/root/db/ie.html ie gov.ie -// il : http://www.isoc.org.il/domains/ -// see also: https://en.isoc.org.il/il-cctld/registration-rules -// ISOC-IL (operated by .il Registry) +// il : http://www.isoc.org.il/domains/ +// see also: https://en.isoc.org.il/il-cctld/registration-rules +// ISOC-IL (operated by .il Registry) il ac.il co.il @@ -1349,15 +1381,15 @@ org.il im ac.im co.im -com.im ltd.co.im +plc.co.im +com.im net.im org.im -plc.co.im tt.im tv.im -// in : https://en.wikipedia.org/wiki/.in +// in : https://www.iana.org/domains/root/db/in.html // see also: https://registry.in/policies // Please note, that nic.in is not an official eTLD, but used by most // government institutions. @@ -1404,27 +1436,33 @@ uk.in up.in us.in -// info : https://en.wikipedia.org/wiki/.info +// info : https://www.iana.org/domains/root/db/info.html info -// int : https://en.wikipedia.org/wiki/.int +// int : https://www.iana.org/domains/root/db/int.html // Confirmed by registry 2008-06-18 int eu.int // io : http://www.nic.io/rules.htm -// list of other 2nd level tlds ? io +co.io com.io +edu.io +gov.io +mil.io +net.io +nom.io +org.io // iq : http://www.cmc.iq/english/iq/iqregister1.htm iq -gov.iq +com.iq edu.iq +gov.iq mil.iq -com.iq -org.iq net.iq +org.iq // ir : http://www.nic.ir/Terms_and_Conditions_ir,_Appendix_1_Domain_Rules // Also see http://www.nic.ir/Internationalized_Domain_Names @@ -1443,22 +1481,16 @@ sch.ir ايران.ir // is : http://www.isnic.is/domain/rules.php -// Confirmed by registry 2008-12-06 +// Confirmed by registry 2024-11-17 is -net.is -com.is -edu.is -gov.is -org.is -int.is - -// it : https://en.wikipedia.org/wiki/.it + +// it : https://www.iana.org/domains/root/db/it.html +// https://www.nic.it/ it -gov.it edu.it -// Reserved geo-names (regions and provinces): -// https://www.nic.it/sites/default/files/archivio/docs/Regulation_assignation_v7.1.pdf -// Regions +gov.it +// Regions (3.3.1) +// https://www.nic.it/en/manage-your-it/forms-and-docs -> "Assignment and Management of domain names" abr.it abruzzo.it aosta-valley.it @@ -1517,6 +1549,7 @@ trentin-sudtirol.it trentin-südtirol.it trentin-sued-tirol.it trentin-suedtirol.it +trentino.it trentino-a-adige.it trentino-aadige.it trentino-alto-adige.it @@ -1529,7 +1562,6 @@ trentino-sudtirol.it trentino-südtirol.it trentino-sued-tirol.it trentino-suedtirol.it -trentino.it trentinoa-adige.it trentinoaadige.it trentinoalto-adige.it @@ -1573,7 +1605,7 @@ vao.it vda.it ven.it veneto.it -// Provinces +// Provinces (3.3.2) ag.it agrigento.it al.it @@ -1601,10 +1633,10 @@ at.it av.it avellino.it ba.it +balsan.it balsan-sudtirol.it balsan-südtirol.it balsan-suedtirol.it -balsan.it bari.it barletta-trani-andria.it barlettatraniandria.it @@ -1618,21 +1650,21 @@ bl.it bn.it bo.it bologna.it -bolzano-altoadige.it bolzano.it +bolzano-altoadige.it +bozen.it bozen-sudtirol.it bozen-südtirol.it bozen-suedtirol.it -bozen.it br.it brescia.it brindisi.it bs.it bt.it +bulsan.it bulsan-sudtirol.it bulsan-südtirol.it bulsan-suedtirol.it -bulsan.it bz.it ca.it cagliari.it @@ -1734,9 +1766,9 @@ milano.it mn.it mo.it modena.it +monza.it monza-brianza.it monza-e-della-brianza.it -monza.it monzabrianza.it monzaebrianza.it monzaedellabrianza.it @@ -1815,8 +1847,8 @@ sondrio.it sp.it sr.it ss.it -suedtirol.it südtirol.it +suedtirol.it sv.it ta.it taranto.it @@ -1865,7 +1897,7 @@ vs.it vt.it vv.it -// je : http://www.channelisles.net/register-domains/ +// je : https://www.iana.org/domains/root/db/je.html // Confirmed by registry 2013-11-28 je co.je @@ -1875,23 +1907,30 @@ org.je // jm : http://www.com.jm/register.html *.jm -// jo : http://www.dns.jo/Registration_policy.aspx +// jo : https://www.dns.jo/JoFamily.aspx +// Confirmed by registry 2024-11-17 jo +agri.jo +ai.jo com.jo -org.jo -net.jo edu.jo -sch.jo +eng.jo +fm.jo gov.jo mil.jo -name.jo +net.jo +org.jo +per.jo +phd.jo +sch.jo +tv.jo -// jobs : https://en.wikipedia.org/wiki/.jobs +// jobs : https://www.iana.org/domains/root/db/jobs.html jobs -// jp : https://en.wikipedia.org/wiki/.jp +// jp : https://www.iana.org/domains/root/db/jp.html // http://jprs.co.jp/en/jpdomain.html -// Submitted by registry +// Confirmed by registry 2024-11-22 jp // jp organizational type names ac.jp @@ -1951,26 +1990,14 @@ wakayama.jp yamagata.jp yamaguchi.jp yamanashi.jp -栃木.jp -愛知.jp -愛媛.jp +三重.jp +京都.jp +佐賀.jp 兵庫.jp -熊本.jp -茨城.jp 北海道.jp 千葉.jp 和歌山.jp -長崎.jp -長野.jp -新潟.jp -青森.jp -静岡.jp -東京.jp -石川.jp 埼玉.jp -三重.jp -京都.jp -佐賀.jp 大分.jp 大阪.jp 奈良.jp @@ -1980,39 +2007,54 @@ yamanashi.jp 山口.jp 山形.jp 山梨.jp -岩手.jp 岐阜.jp 岡山.jp +岩手.jp 島根.jp 広島.jp 徳島.jp +愛媛.jp +愛知.jp +新潟.jp +東京.jp +栃木.jp 沖縄.jp 滋賀.jp +熊本.jp +石川.jp 神奈川.jp 福井.jp 福岡.jp 福島.jp 秋田.jp 群馬.jp +茨城.jp +長崎.jp +長野.jp +青森.jp +静岡.jp 香川.jp 高知.jp 鳥取.jp 鹿児島.jp // jp geographic type names // http://jprs.jp/doc/rule/saisoku-1.html +// 2024-11-22: JPRS confirmed that jp geographic type names no longer accept new registrations. +// Once all existing registrations expire (marking full discontinuation), these suffixes +// will be removed from the PSL. *.kawasaki.jp -*.kitakyushu.jp -*.kobe.jp -*.nagoya.jp -*.sapporo.jp -*.sendai.jp -*.yokohama.jp !city.kawasaki.jp +*.kitakyushu.jp !city.kitakyushu.jp +*.kobe.jp !city.kobe.jp +*.nagoya.jp !city.nagoya.jp +*.sapporo.jp !city.sapporo.jp +*.sendai.jp !city.sendai.jp +*.yokohama.jp !city.yokohama.jp // 4th level registration aisai.aichi.jp @@ -3703,56 +3745,56 @@ sc.ke // kg : http://www.domain.kg/dmn_n.html kg -org.kg -net.kg com.kg edu.kg gov.kg mil.kg +net.kg +org.kg // kh : http://www.mptc.gov.kh/dns_registration.htm *.kh -// ki : http://www.ki/dns/index.html +// ki : https://www.iana.org/domains/root/db/ki.html ki -edu.ki biz.ki -net.ki -org.ki +com.ki +edu.ki gov.ki info.ki -com.ki +net.ki +org.ki -// km : https://en.wikipedia.org/wiki/.km +// km : https://www.iana.org/domains/root/db/km.html // http://www.domaine.km/documents/charte.doc km -org.km -nom.km +ass.km +com.km +edu.km gov.km +mil.km +nom.km +org.km prd.km tm.km -edu.km -mil.km -ass.km -com.km // These are only mentioned as proposed suggestions at domaine.km, but -// https://en.wikipedia.org/wiki/.km says they're available for registration: -coop.km +// https://www.iana.org/domains/root/db/km.html says they're available for registration: asso.km -presse.km +coop.km +gouv.km medecin.km notaires.km pharmaciens.km +presse.km veterinaire.km -gouv.km -// kn : https://en.wikipedia.org/wiki/.kn +// kn : https://www.iana.org/domains/root/db/kn.html // http://www.dot.kn/domainRules.html kn -net.kn -org.kn edu.kn gov.kn +net.kn +org.kn // kp : http://www.kcce.kp/en_index.php kp @@ -3763,15 +3805,19 @@ org.kp rep.kp tra.kp -// kr : https://en.wikipedia.org/wiki/.kr -// see also: http://domain.nida.or.kr/eng/registration.jsp +// kr : https://www.iana.org/domains/root/db/kr.html +// see also: https://krnic.kisa.or.kr/jsp/infoboard/law/domBylawsReg.jsp kr ac.kr +ai.kr co.kr es.kr go.kr hs.kr +io.kr +it.kr kg.kr +me.kr mil.kr ms.kr ne.kr @@ -3816,29 +3862,29 @@ edu.ky net.ky org.ky -// kz : https://en.wikipedia.org/wiki/.kz +// kz : https://www.iana.org/domains/root/db/kz.html // see also: http://www.nic.kz/rules/index.jsp kz -org.kz +com.kz edu.kz -net.kz gov.kz mil.kz -com.kz +net.kz +org.kz -// la : https://en.wikipedia.org/wiki/.la +// la : https://www.iana.org/domains/root/db/la.html // Submitted by registry la -int.la -net.la -info.la +com.la edu.la gov.la -per.la -com.la +info.la +int.la +net.la org.la +per.la -// lb : https://en.wikipedia.org/wiki/.lb +// lb : https://www.iana.org/domains/root/db/lb.html // Submitted by registry lb com.lb @@ -3847,36 +3893,36 @@ gov.lb net.lb org.lb -// lc : https://en.wikipedia.org/wiki/.lc +// lc : https://www.iana.org/domains/root/db/lc.html // see also: http://www.nic.lc/rules.htm lc -com.lc -net.lc co.lc -org.lc +com.lc edu.lc gov.lc +net.lc +org.lc -// li : https://en.wikipedia.org/wiki/.li +// li : https://www.iana.org/domains/root/db/li.html li -// lk : https://www.nic.lk/index.php/domain-registration/lk-domain-naming-structure +// lk : https://www.iana.org/domains/root/db/lk.html lk -gov.lk -sch.lk -net.lk -int.lk +ac.lk +assn.lk com.lk -org.lk edu.lk +gov.lk +grp.lk +hotel.lk +int.lk +ltd.lk +net.lk ngo.lk +org.lk +sch.lk soc.lk web.lk -ltd.lk -assn.lk -grp.lk -hotel.lk -ac.lk // lr : http://psg.com/dns/lr/lr.txt // Submitted by registry @@ -3884,8 +3930,8 @@ lr com.lr edu.lr gov.lr -org.lr net.lr +org.lr // ls : http://www.nic.ls/ // Confirmed by registry @@ -3900,7 +3946,7 @@ net.ls org.ls sc.ls -// lt : https://en.wikipedia.org/wiki/.lt +// lt : https://www.iana.org/domains/root/db/lt.html lt // gov.lt : http://www.gov.lt/index_en.php gov.lt @@ -3908,131 +3954,136 @@ gov.lt // lu : http://www.dns.lu/en/ lu -// lv : http://www.nic.lv/DNS/En/generic.php +// lv : https://www.iana.org/domains/root/db/lv.html lv +asn.lv com.lv +conf.lv edu.lv gov.lv -org.lv -mil.lv id.lv +mil.lv net.lv -asn.lv -conf.lv +org.lv // ly : http://www.nic.ly/regulations.php ly com.ly -net.ly -gov.ly -plc.ly edu.ly -sch.ly +gov.ly +id.ly med.ly +net.ly org.ly -id.ly +plc.ly +sch.ly -// ma : https://en.wikipedia.org/wiki/.ma +// ma : https://www.iana.org/domains/root/db/ma.html // http://www.anrt.ma/fr/admin/download/upload/file_fr782.pdf ma +ac.ma co.ma -net.ma gov.ma +net.ma org.ma -ac.ma press.ma // mc : http://www.nic.mc/ mc -tm.mc asso.mc +tm.mc -// md : https://en.wikipedia.org/wiki/.md +// md : https://www.iana.org/domains/root/db/md.html md -// me : https://en.wikipedia.org/wiki/.me +// me : https://www.iana.org/domains/root/db/me.html me +ac.me co.me -net.me -org.me edu.me -ac.me gov.me its.me +net.me +org.me priv.me -// mg : http://nic.mg/nicmg/?page_id=39 +// mg : https://nic.mg mg -org.mg -nom.mg -gov.mg -prd.mg -tm.mg +co.mg +com.mg edu.mg +gov.mg mil.mg -com.mg -co.mg +nom.mg +org.mg +prd.mg -// mh : https://en.wikipedia.org/wiki/.mh +// mh : https://www.iana.org/domains/root/db/mh.html mh -// mil : https://en.wikipedia.org/wiki/.mil +// mil : https://www.iana.org/domains/root/db/mil.html mil -// mk : https://en.wikipedia.org/wiki/.mk +// mk : https://www.iana.org/domains/root/db/mk.html // see also: http://dns.marnet.net.mk/postapka.php mk com.mk -org.mk -net.mk edu.mk gov.mk inf.mk name.mk +net.mk +org.mk -// ml : http://www.gobin.info/domainname/ml-template.doc -// see also: https://en.wikipedia.org/wiki/.ml +// ml : https://www.iana.org/domains/root/db/ml.html +// Confirmed by Boubacar NDIAYE 2024-12-31 ml +ac.ml +art.ml +asso.ml com.ml edu.ml gouv.ml gov.ml +info.ml +inst.ml net.ml org.ml +pr.ml presse.ml -// mm : https://en.wikipedia.org/wiki/.mm +// mm : https://www.iana.org/domains/root/db/mm.html *.mm -// mn : https://en.wikipedia.org/wiki/.mn +// mn : https://www.iana.org/domains/root/db/mn.html mn -gov.mn edu.mn +gov.mn org.mn // mo : http://www.monic.net.mo/ mo com.mo -net.mo -org.mo edu.mo gov.mo +net.mo +org.mo -// mobi : https://en.wikipedia.org/wiki/.mobi +// mobi : https://www.iana.org/domains/root/db/mobi.html mobi // mp : http://www.dot.mp/ // Confirmed by registry 2008-06-17 mp -// mq : https://en.wikipedia.org/wiki/.mq +// mq : https://www.iana.org/domains/root/db/mq.html mq -// mr : https://en.wikipedia.org/wiki/.mr +// mr : https://www.iana.org/domains/root/db/mr.html mr gov.mr -// ms : http://www.nic.ms/pdf/MS_Domain_Name_Rules.pdf +// ms : https://www.iana.org/domains/root/db/ms.html ms com.ms edu.ms @@ -4048,20 +4099,20 @@ edu.mt net.mt org.mt -// mu : https://en.wikipedia.org/wiki/.mu +// mu : https://www.iana.org/domains/root/db/mu.html mu -com.mu -net.mu -org.mu -gov.mu ac.mu co.mu +com.mu +gov.mu +net.mu or.mu +org.mu // museum : https://welcome.museum/wp-content/uploads/2018/05/20180525-Registration-Policy-MUSEUM-EN_VF-2.pdf https://welcome.museum/buy-your-dot-museum-2/ museum -// mv : https://en.wikipedia.org/wiki/.mv +// mv : https://www.iana.org/domains/root/db/mv.html // "mv" included because, contra Wikipedia, google.mv exists. mv aero.mv @@ -4089,7 +4140,6 @@ coop.mw edu.mw gov.mw int.mw -museum.mw net.mw org.mw @@ -4097,10 +4147,10 @@ org.mw // Submitted by registry mx com.mx -org.mx -gob.mx edu.mx +gob.mx net.mx +org.mx // my : http://www.mynic.my/ // Available strings: https://mynic.my/resources/domains/buying-a-domain/ @@ -4127,27 +4177,16 @@ net.mz org.mz // na : http://www.na-nic.com.na/ -// http://www.info.na/domain/ na -info.na -pro.na -name.na -school.na -or.na -dr.na -us.na -mx.na -ca.na -in.na -cc.na -tv.na -ws.na -mobi.na +alt.na co.na com.na +gov.na +net.na org.na -// name : has 2nd-level tlds, but there's no list of them +// name : http://www.nic.name/ +// Regarding 2LDs: https://github.com/publicsuffix/list/issues/2306 name // nc : http://www.cctld.nc/ @@ -4155,24 +4194,24 @@ nc asso.nc nom.nc -// ne : https://en.wikipedia.org/wiki/.ne +// ne : https://www.iana.org/domains/root/db/ne.html ne -// net : https://en.wikipedia.org/wiki/.net +// net : https://www.iana.org/domains/root/db/net.html net -// nf : https://en.wikipedia.org/wiki/.nf +// nf : https://www.iana.org/domains/root/db/nf.html nf -com.nf -net.nf -per.nf -rec.nf -web.nf arts.nf +com.nf firm.nf info.nf +net.nf other.nf +per.nf +rec.nf store.nf +web.nf // ng : http://www.nira.org.ng/index.php/join-us/register-ng-domain/189-nira-slds ng @@ -4204,9 +4243,8 @@ nom.ni org.ni web.ni -// nl : https://en.wikipedia.org/wiki/.nl -// https://www.sidn.nl/ -// ccTLD for the Netherlands +// nl : https://www.iana.org/domains/root/db/nl.html +// https://www.sidn.nl/ nl // no : https://www.norid.no/en/om-domenenavn/regelverk-for-no/ @@ -4217,18 +4255,18 @@ nl no // Norid category second level domains : https://www.norid.no/en/om-domenenavn/regelverk-for-no/vedlegg-c/ fhs.no -vgs.no -fylkesbibl.no folkebibl.no -museum.no +fylkesbibl.no idrett.no +museum.no priv.no +vgs.no // Norid category second-level domains managed by parties other than Norid : https://www.norid.no/en/om-domenenavn/regelverk-for-no/vedlegg-d/ -mil.no -stat.no dep.no -kommune.no herad.no +kommune.no +mil.no +stat.no // Norid geographical second level domains : https://www.norid.no/en/om-domenenavn/regelverk-for-no/vedlegg-b/ // counties aa.no @@ -4280,10 +4318,10 @@ akrehamn.no algard.no ålgård.no arna.no -brumunddal.no -bryne.no bronnoysund.no brønnøysund.no +brumunddal.no +bryne.no drobak.no drøbak.no egersund.no @@ -4327,27 +4365,32 @@ tananger.no tranby.no vossevangen.no // communities +aarborte.no +aejrie.no afjord.no åfjord.no agdenes.no +nes.akershus.no +aknoluokta.no +ákŋoluokta.no al.no ål.no +alaheadju.no +álaheadju.no alesund.no ålesund.no alstahaug.no alta.no áltá.no -alaheadju.no -álaheadju.no alvdal.no amli.no åmli.no amot.no åmot.no +andasuolo.no andebu.no andoy.no andøy.no -andasuolo.no ardal.no årdal.no aremark.no @@ -4357,9 +4400,9 @@ aseral.no åseral.no asker.no askim.no -askvoll.no askoy.no askøy.no +askvoll.no asnes.no åsnes.no audnedaln.no @@ -4372,27 +4415,37 @@ austevoll.no austrheim.no averoy.no averøy.no -balestrand.no -ballangen.no +badaddja.no +bådåddjå.no +bærum.no +bahcavuotna.no +báhcavuotna.no +bahccavuotna.no +báhccavuotna.no +baidar.no +báidár.no +bajddar.no +bájddar.no balat.no bálát.no +balestrand.no +ballangen.no balsfjord.no -bahccavuotna.no -báhccavuotna.no bamble.no bardu.no +barum.no +batsfjord.no +båtsfjord.no +bearalvahki.no +bearalváhki.no beardu.no beiarn.no -bajddar.no -bájddar.no -baidar.no -báidár.no berg.no bergen.no berlevag.no berlevåg.no -bearalvahki.no -bearalváhki.no +bievat.no +bievát.no bindal.no birkenes.no bjarkoy.no @@ -4401,36 +4454,32 @@ bjerkreim.no bjugn.no bodo.no bodø.no -badaddja.no -bådåddjå.no -budejju.no bokn.no +bomlo.no +bømlo.no bremanger.no bronnoy.no brønnøy.no +budejju.no +nes.buskerud.no bygland.no bykle.no -barum.no -bærum.no -bo.telemark.no -bø.telemark.no -bo.nordland.no -bø.nordland.no -bievat.no -bievát.no -bomlo.no -bømlo.no -batsfjord.no -båtsfjord.no -bahcavuotna.no -báhcavuotna.no +cahcesuolo.no +čáhcesuolo.no +davvenjarga.no +davvenjárga.no +davvesiida.no +deatnu.no +dielddanuorri.no +divtasvuodna.no +divttasvuotna.no +donna.no +dønna.no dovre.no drammen.no drangedal.no dyroy.no dyrøy.no -donna.no -dønna.no eid.no eidfjord.no eidsberg.no @@ -4442,14 +4491,12 @@ enebakk.no engerdal.no etne.no etnedal.no -evenes.no evenassi.no evenášši.no +evenes.no evje-og-hornnes.no farsund.no fauske.no -fuossko.no -fuoisku.no fedje.no fet.no finnoy.no @@ -4457,33 +4504,40 @@ finnøy.no fitjar.no fjaler.no fjell.no +fla.no +flå.no flakstad.no flatanger.no flekkefjord.no flesberg.no flora.no -fla.no -flå.no folldal.no +forde.no +førde.no forsand.no fosnes.no +fræna.no +frana.no frei.no frogn.no froland.no frosta.no -frana.no -fræna.no froya.no frøya.no +fuoisku.no +fuossko.no fusa.no fyresdal.no -forde.no -førde.no +gaivuotna.no +gáivuotna.no +galsa.no +gálsá.no gamvik.no gangaviika.no gáŋgaviika.no gaular.no gausdal.no +giehtavuoatna.no gildeskal.no gildeskål.no giske.no @@ -4501,38 +4555,37 @@ granvin.no gratangen.no grimstad.no grong.no -kraanghke.no -kråanghke.no grue.no gulen.no +guovdageaidnu.no +ha.no +hå.no +habmer.no +hábmer.no hadsel.no +hægebostad.no +hagebostad.no halden.no halsa.no hamar.no hamaroy.no -habmer.no -hábmer.no -hapmir.no -hápmir.no -hammerfest.no hammarfeasta.no hámmárfeasta.no +hammerfest.no +hapmir.no +hápmir.no haram.no hareid.no harstad.no hasvik.no -aknoluokta.no -ákŋoluokta.no hattfjelldal.no -aarborte.no haugesund.no +os.hedmark.no +valer.hedmark.no +våler.hedmark.no hemne.no hemnes.no hemsedal.no -heroy.more-og-romsdal.no -herøy.møre-og-romsdal.no -heroy.nordland.no -herøy.nordland.no hitra.no hjartdal.no hjelmeland.no @@ -4544,96 +4597,95 @@ hole.no holmestrand.no holtalen.no holtålen.no +os.hordaland.no hornindal.no horten.no -hurdal.no -hurum.no -hvaler.no -hyllestad.no -hagebostad.no -hægebostad.no hoyanger.no høyanger.no hoylandet.no høylandet.no -ha.no -hå.no +hurdal.no +hurum.no +hvaler.no +hyllestad.no ibestad.no inderoy.no inderøy.no iveland.no +ivgu.no jevnaker.no -jondal.no jolster.no jølster.no -karasjok.no +jondal.no +kafjord.no +kåfjord.no karasjohka.no kárášjohka.no +karasjok.no karlsoy.no -galsa.no -gálsá.no karmoy.no karmøy.no kautokeino.no -guovdageaidnu.no -klepp.no klabu.no klæbu.no +klepp.no kongsberg.no kongsvinger.no +kraanghke.no +kråanghke.no kragero.no kragerø.no kristiansand.no kristiansund.no krodsherad.no krødsherad.no +kvæfjord.no +kvænangen.no +kvafjord.no kvalsund.no -rahkkeravju.no -ráhkkerávju.no kvam.no +kvanangen.no kvinesdal.no kvinnherad.no kviteseid.no kvitsoy.no kvitsøy.no -kvafjord.no -kvæfjord.no -giehtavuoatna.no -kvanangen.no -kvænangen.no -navuotna.no -návuotna.no -kafjord.no -kåfjord.no -gaivuotna.no -gáivuotna.no +laakesvuemie.no +lærdal.no +lahppi.no +láhppi.no +lardal.no larvik.no -lavangen.no lavagis.no -loabat.no -loabát.no +lavangen.no +leangaviika.no +leaŋgaviika.no lebesby.no -davvesiida.no leikanger.no leirfjord.no leka.no leksvik.no lenvik.no -leangaviika.no -leaŋgaviika.no +lerdal.no lesja.no levanger.no lier.no lierne.no lillehammer.no lillesand.no -lindesnes.no lindas.no lindås.no +lindesnes.no +loabat.no +loabát.no +lodingen.no +lødingen.no lom.no loppa.no -lahppi.no -láhppi.no +lorenskog.no +lørenskog.no +loten.no +løten.no lund.no lunner.no luroy.no @@ -4641,25 +4693,19 @@ lurøy.no luster.no lyngdal.no lyngen.no -ivgu.no -lardal.no -lerdal.no -lærdal.no -lodingen.no -lødingen.no -lorenskog.no -lørenskog.no -loten.no -løten.no +malatvuopmi.no +málatvuopmi.no +malselv.no +målselv.no malvik.no -masoy.no -måsøy.no -muosat.no -muosát.no mandal.no marker.no marnardal.no masfjorden.no +masoy.no +måsøy.no +matta-varjjat.no +mátta-várjjat.no meland.no meldal.no melhus.no @@ -4667,39 +4713,39 @@ meloy.no meløy.no meraker.no meråker.no -moareke.no -moåreke.no midsund.no midtre-gauldal.no +moareke.no +moåreke.no modalen.no modum.no molde.no +heroy.more-og-romsdal.no +sande.more-og-romsdal.no +herøy.møre-og-romsdal.no +sande.møre-og-romsdal.no moskenes.no moss.no mosvik.no -malselv.no -målselv.no -malatvuopmi.no -málatvuopmi.no +muosat.no +muosát.no +naamesjevuemie.no +nååmesjevuemie.no +nærøy.no namdalseid.no -aejrie.no namsos.no namsskogan.no -naamesjevuemie.no -nååmesjevuemie.no -laakesvuemie.no nannestad.no -narvik.no +naroy.no narviika.no +narvik.no naustdal.no +navuotna.no +návuotna.no nedre-eiker.no -nes.akershus.no -nes.buskerud.no nesna.no nesodden.no nesseby.no -unjarga.no -unjárga.no nesset.no nissedal.no nittedal.no @@ -4708,21 +4754,20 @@ nord-fron.no nord-odal.no norddal.no nordkapp.no -davvenjarga.no -davvenjárga.no +bo.nordland.no +bø.nordland.no +heroy.nordland.no +herøy.nordland.no nordre-land.no nordreisa.no -raisa.no -ráisa.no nore-og-uvdal.no notodden.no -naroy.no -nærøy.no notteroy.no nøtterøy.no odda.no oksnes.no øksnes.no +omasvuotna.no oppdal.no oppegard.no oppegård.no @@ -4733,11 +4778,11 @@ orskog.no ørskog.no orsta.no ørsta.no -os.hedmark.no -os.hordaland.no osen.no osteroy.no osterøy.no +valer.ostfold.no +våler.østfold.no ostre-toten.no østre-toten.no overhalla.no @@ -4753,12 +4798,19 @@ porsanger.no porsangu.no porsáŋgu.no porsgrunn.no +rade.no +råde.no radoy.no radøy.no -rakkestad.no -rana.no -ruovat.no -randaberg.no +rælingen.no +rahkkeravju.no +ráhkkerávju.no +raisa.no +ráisa.no +rakkestad.no +ralingen.no +rana.no +randaberg.no rauma.no rendalen.no rennebu.no @@ -4768,16 +4820,14 @@ rindal.no ringebu.no ringerike.no ringsaker.no -rissa.no risor.no risør.no +rissa.no roan.no -rollag.no -rygge.no -ralingen.no -rælingen.no rodoy.no rødøy.no +rollag.no +romsa.no romskog.no rømskog.no roros.no @@ -4788,18 +4838,14 @@ royken.no røyken.no royrvik.no røyrvik.no -rade.no -råde.no +ruovat.no +rygge.no salangen.no -siellak.no -saltdal.no salat.no -sálát.no sálat.no +sálát.no +saltdal.no samnanger.no -sande.more-og-romsdal.no -sande.møre-og-romsdal.no -sande.vestfold.no sandefjord.no sandnes.no sandoy.no @@ -4811,39 +4857,60 @@ sel.no selbu.no selje.no seljord.no +siellak.no sigdal.no siljan.no sirdal.no +skanit.no +skánit.no +skanland.no +skånland.no skaun.no skedsmo.no ski.no skien.no -skiptvet.no -skjervoy.no -skjervøy.no skierva.no skiervá.no +skiptvet.no skjak.no skjåk.no +skjervoy.no +skjervøy.no skodje.no -skanland.no -skånland.no -skanit.no -skánit.no smola.no smøla.no -snillfjord.no +snaase.no +snåase.no snasa.no snåsa.no +snillfjord.no snoasa.no -snaase.no -snåase.no sogndal.no +sogne.no +søgne.no sokndal.no sola.no solund.no +somna.no +sømna.no +sondre-land.no +søndre-land.no songdalen.no +sor-aurdal.no +sør-aurdal.no +sor-fron.no +sør-fron.no +sor-odal.no +sør-odal.no +sor-varanger.no +sør-varanger.no +sorfold.no +sørfold.no +sorreisa.no +sørreisa.no sortland.no +sorum.no +sørum.no spydeberg.no stange.no stavanger.no @@ -4856,7 +4923,6 @@ stor-elvdal.no stord.no stordal.no storfjord.no -omasvuotna.no strand.no stranda.no stryn.no @@ -4868,72 +4934,55 @@ surnadal.no sveio.no svelvik.no sykkylven.no -sogne.no -søgne.no -somna.no -sømna.no -sondre-land.no -søndre-land.no -sor-aurdal.no -sør-aurdal.no -sor-fron.no -sør-fron.no -sor-odal.no -sør-odal.no -sor-varanger.no -sør-varanger.no -matta-varjjat.no -mátta-várjjat.no -sorfold.no -sørfold.no -sorreisa.no -sørreisa.no -sorum.no -sørum.no tana.no -deatnu.no +bo.telemark.no +bø.telemark.no time.no tingvoll.no tinn.no tjeldsund.no -dielddanuorri.no tjome.no tjøme.no tokke.no tolga.no +tonsberg.no +tønsberg.no torsken.no +træna.no +trana.no tranoy.no tranøy.no +troandin.no +trogstad.no +trøgstad.no +tromsa.no tromso.no tromsø.no -tromsa.no -romsa.no trondheim.no -troandin.no trysil.no -trana.no -træna.no -trogstad.no -trøgstad.no tvedestrand.no tydal.no tynset.no tysfjord.no -divtasvuodna.no -divttasvuotna.no tysnes.no -tysvar.no tysvær.no -tonsberg.no -tønsberg.no +tysvar.no ullensaker.no ullensvang.no ulvik.no +unjarga.no +unjárga.no utsira.no +vaapste.no vadso.no vadsø.no -cahcesuolo.no -čáhcesuolo.no +værøy.no +vaga.no +vågå.no +vagan.no +vågan.no +vagsoy.no +vågsøy.no vaksdal.no valle.no vang.no @@ -4942,8 +4991,8 @@ vardo.no vardø.no varggat.no várggát.no +varoy.no vefsn.no -vaapste.no vega.no vegarshei.no vegårshei.no @@ -4951,6 +5000,7 @@ vennesla.no verdal.no verran.no vestby.no +sande.vestfold.no vestnes.no vestre-slidre.no vestre-toten.no @@ -4960,21 +5010,9 @@ vevelstad.no vik.no vikna.no vindafjord.no +voagat.no volda.no voss.no -varoy.no -værøy.no -vagan.no -vågan.no -voagat.no -vagsoy.no -vågsøy.no -vaga.no -vågå.no -valer.ostfold.no -våler.østfold.no -valer.hedmark.no -våler.hedmark.no // np : http://www.mos.com.np/register.html *.np @@ -4983,17 +5021,17 @@ våler.hedmark.no // Submitted by registry nr biz.nr -info.nr -gov.nr +com.nr edu.nr -org.nr +gov.nr +info.nr net.nr -com.nr +org.nr -// nu : https://en.wikipedia.org/wiki/.nu +// nu : https://www.iana.org/domains/root/db/nu.html nu -// nz : https://en.wikipedia.org/wiki/.nz +// nz : https://www.iana.org/domains/root/db/nz.html // Submitted by registry nz ac.nz @@ -5006,14 +5044,14 @@ health.nz iwi.nz kiwi.nz maori.nz -mil.nz māori.nz +mil.nz net.nz org.nz parliament.nz school.nz -// om : https://en.wikipedia.org/wiki/.om +// om : https://www.iana.org/domains/root/db/om.html om co.om com.om @@ -5028,82 +5066,84 @@ pro.om // onion : https://tools.ietf.org/html/rfc7686 onion -// org : https://en.wikipedia.org/wiki/.org +// org : https://www.iana.org/domains/root/db/org.html org // pa : http://www.nic.pa/ // Some additional second level "domains" resolve directly as hostnames, such as // pannet.pa, so we add a rule for "pa". pa +abo.pa ac.pa -gob.pa com.pa -org.pa -sld.pa edu.pa -net.pa +gob.pa ing.pa -abo.pa med.pa +net.pa nom.pa +org.pa +sld.pa // pe : https://www.nic.pe/InformeFinalComision.pdf pe +com.pe edu.pe gob.pe -nom.pe mil.pe -org.pe -com.pe net.pe +nom.pe +org.pe // pf : http://www.gobin.info/domainname/formulaire-pf.pdf pf com.pf -org.pf edu.pf +org.pf -// pg : https://en.wikipedia.org/wiki/.pg +// pg : https://www.iana.org/domains/root/db/pg.html *.pg -// ph : http://www.domains.ph/FAQ2.asp +// ph : https://www.iana.org/domains/root/db/ph.html // Submitted by registry ph com.ph -net.ph -org.ph -gov.ph edu.ph -ngo.ph -mil.ph +gov.ph i.ph +mil.ph +net.ph +ngo.ph +org.ph -// pk : http://pk5.pknic.net.pk/pk5/msgNamepk.PK +// pk : https://pk5.pknic.net.pk/pk5/msgNamepk.PK +// Contact Email: staff@pknic.net.pk pk +ac.pk +biz.pk com.pk -net.pk edu.pk -org.pk fam.pk -biz.pk -web.pk -gov.pk +gkp.pk gob.pk +gog.pk gok.pk -gon.pk gop.pk gos.pk -info.pk +gov.pk +net.pk +org.pk +web.pk -// pl http://www.dns.pl/english/index.html -// Submitted by registry +// pl : https://www.dns.pl/en/ +// Confirmed by registry 2024-11-18 pl com.pl net.pl org.pl -// pl functional domains (http://www.dns.pl/english/index.html) -aid.pl +// pl functional domains : https://www.dns.pl/en/list_of_functional_domain_names agro.pl +aid.pl atm.pl auto.pl biz.pl @@ -5112,8 +5152,8 @@ gmina.pl gsm.pl info.pl mail.pl -miasta.pl media.pl +miasta.pl mil.pl nieruchomosci.pl nom.pl @@ -5132,7 +5172,8 @@ tm.pl tourism.pl travel.pl turystyka.pl -// Government domains +// Government domains : https://www.dns.pl/informacje_o_rejestracji_domen_gov_pl +// In accordance with the .gov.pl Domain Name Regulations : https://www.dns.pl/regulamin_gov_pl gov.pl ap.gov.pl griw.gov.pl @@ -5189,7 +5230,7 @@ wuoz.gov.pl wzmiuw.gov.pl zp.gov.pl zpisdn.gov.pl -// pl regional domains (http://www.dns.pl/english/index.html) +// pl regional domains : https://www.dns.pl/en/list_of_regional_domain_names augustow.pl babia-gora.pl bedzin.pl @@ -5216,11 +5257,11 @@ jaworzno.pl jelenia-gora.pl jgora.pl kalisz.pl -kazimierz-dolny.pl karpacz.pl kartuzy.pl kaszuby.pl katowice.pl +kazimierz-dolny.pl kepno.pl ketrzyn.pl klodzko.pl @@ -5263,8 +5304,8 @@ pisz.pl podhale.pl podlasie.pl polkowice.pl -pomorze.pl pomorskie.pl +pomorze.pl prochowice.pl pruszkow.pl przeworsk.pl @@ -5275,11 +5316,11 @@ rybnik.pl rzeszow.pl sanok.pl sejny.pl +skoczow.pl slask.pl slupsk.pl sosnowiec.pl stalowa-wola.pl -skoczow.pl starachowice.pl stargard.pl suwalki.pl @@ -5313,33 +5354,33 @@ zgorzelec.pl // pm : https://www.afnic.fr/wp-media/uploads/2022/12/afnic-naming-policy-2023-01-01.pdf pm -// pn : http://www.government.pn/PnRegistry/policies.htm +// pn : https://www.iana.org/domains/root/db/pn.html pn -gov.pn co.pn -org.pn edu.pn +gov.pn net.pn +org.pn -// post : https://en.wikipedia.org/wiki/.post +// post : https://www.iana.org/domains/root/db/post.html post // pr : http://www.nic.pr/index.asp?f=1 pr +biz.pr com.pr -net.pr -org.pr -gov.pr edu.pr -isla.pr -pro.pr -biz.pr +gov.pr info.pr +isla.pr name.pr -// these aren't mentioned on nic.pr, but on https://en.wikipedia.org/wiki/.pr +net.pr +org.pr +pro.pr +// these aren't mentioned on nic.pr, but on https://www.iana.org/domains/root/db/pr.html +ac.pr est.pr prof.pr -ac.pr // pro : http://registry.pro/get-pro pro @@ -5355,38 +5396,34 @@ law.pro med.pro recht.pro -// ps : https://en.wikipedia.org/wiki/.ps +// ps : https://www.iana.org/domains/root/db/ps.html // http://www.nic.ps/registration/policy.html#reg ps +com.ps edu.ps gov.ps -sec.ps -plo.ps -com.ps -org.ps net.ps +org.ps +plo.ps +sec.ps // pt : https://www.dns.pt/en/domain/pt-terms-and-conditions-registration-rules/ pt -net.pt -gov.pt -org.pt +com.pt edu.pt +gov.pt int.pt -publ.pt -com.pt +net.pt nome.pt +org.pt +publ.pt -// pw : https://en.wikipedia.org/wiki/.pw +// pw : https://www.iana.org/domains/root/db/pw.html +// Confirmed by registry in private correspondence with @dnsguru 2024-12-09 pw -co.pw -ne.pw -or.pw -ed.pw -go.pw -belau.pw - -// py : http://www.nic.py/pautas.html#seccion_9 +gov.pw + +// py : https://www.iana.org/domains/root/db/py.html // Submitted by registry py com.py @@ -5409,10 +5446,11 @@ org.qa sch.qa // re : https://www.afnic.fr/wp-media/uploads/2022/12/afnic-naming-policy-2023-01-01.pdf +// Confirmed by registry 2024-11-18 re +// Closed for registration on 2013-03-15 but domains are still maintained asso.re com.re -nom.re // ro : http://www.rotld.ro/ ro @@ -5441,7 +5479,7 @@ org.rs // Submitted by George Georgievsky ru -// rw : https://www.ricta.org.rw/sites/default/files/resources/registry_registrar_contract_0.pdf +// rw : https://www.iana.org/domains/root/db/rw.html rw ac.rw co.rw @@ -5454,12 +5492,12 @@ org.rw // sa : http://www.nic.net.sa/ sa com.sa -net.sa -org.sa +edu.sa gov.sa med.sa +net.sa +org.sa pub.sa -edu.sa sch.sa // sb : http://www.sbnic.net.sb/ @@ -5474,25 +5512,26 @@ org.sb // sc : http://www.nic.sc/ sc com.sc +edu.sc gov.sc net.sc org.sc -edu.sc -// sd : http://www.isoc.sd/sudanic.isoc.sd/billing_pricing.htm +// sd : https://www.iana.org/domains/root/db/sd.html // Submitted by registry sd com.sd -net.sd -org.sd edu.sd -med.sd -tv.sd gov.sd info.sd - -// se : https://en.wikipedia.org/wiki/.se -// Submitted by registry +med.sd +net.sd +org.sd +tv.sd + +// se : https://www.iana.org/domains/root/db/se.html +// https://data.internetstiftelsen.se/barred_domains_list.txt -> Second level domains & Sub-domains +// Confirmed by Registry Services 2024-11-20 se a.se ac.se @@ -5534,47 +5573,46 @@ x.se y.se z.se -// sg : http://www.nic.net.sg/page/registration-policies-procedures-and-guidelines +// sg : https://www.sgnic.sg/domain-registration/sg-categories-rules +// Confirmed by registry 2024-11-19 sg com.sg +edu.sg +gov.sg net.sg org.sg -gov.sg -edu.sg -per.sg // sh : http://nic.sh/rules.htm sh com.sh -net.sh gov.sh -org.sh mil.sh +net.sh +org.sh -// si : https://en.wikipedia.org/wiki/.si +// si : https://www.iana.org/domains/root/db/si.html si // sj : No registrations at this time. // Submitted by registry sj -// sk : https://en.wikipedia.org/wiki/.sk -// list of 2nd level domains ? +// sk : https://www.iana.org/domains/root/db/sk.html sk // sl : http://www.nic.sl // Submitted by registry sl com.sl -net.sl edu.sl gov.sl +net.sl org.sl -// sm : https://en.wikipedia.org/wiki/.sm +// sm : https://www.iana.org/domains/root/db/sm.html sm -// sn : https://en.wikipedia.org/wiki/.sn +// sn : https://www.iana.org/domains/root/db/sn.html sn art.sn com.sn @@ -5593,13 +5631,14 @@ me.so net.so org.so -// sr : https://en.wikipedia.org/wiki/.sr +// sr : https://www.iana.org/domains/root/db/sr.html sr // ss : https://registry.nic.ss/ // Submitted by registry ss biz.ss +co.ss com.ss edu.ss gov.ss @@ -5622,10 +5661,10 @@ principe.st saotome.st store.st -// su : https://en.wikipedia.org/wiki/.su +// su : https://www.iana.org/domains/root/db/su.html su -// sv : http://www.svnet.org.sv/niveldos.pdf +// sv : https://www.iana.org/domains/root/db/sv.html sv com.sv edu.sv @@ -5633,46 +5672,45 @@ gob.sv org.sv red.sv -// sx : https://en.wikipedia.org/wiki/.sx +// sx : https://www.iana.org/domains/root/db/sx.html // Submitted by registry sx gov.sx -// sy : https://en.wikipedia.org/wiki/.sy -// see also: http://www.gobin.info/domainname/sy.doc +// sy : https://www.iana.org/domains/root/db/sy.html sy +com.sy edu.sy gov.sy -net.sy mil.sy -com.sy +net.sy org.sy -// sz : https://en.wikipedia.org/wiki/.sz +// sz : https://www.iana.org/domains/root/db/sz.html // http://www.sispa.org.sz/ sz -co.sz ac.sz +co.sz org.sz -// tc : https://en.wikipedia.org/wiki/.tc +// tc : https://www.iana.org/domains/root/db/tc.html tc -// td : https://en.wikipedia.org/wiki/.td +// td : https://www.iana.org/domains/root/db/td.html td -// tel: https://en.wikipedia.org/wiki/.tel +// tel : https://www.iana.org/domains/root/db/tel.html // http://www.telnic.org/ tel // tf : https://www.afnic.fr/wp-media/uploads/2022/12/afnic-naming-policy-2023-01-01.pdf tf -// tg : https://en.wikipedia.org/wiki/.tg +// tg : https://www.iana.org/domains/root/db/tg.html // http://www.nic.tg/ tg -// th : https://en.wikipedia.org/wiki/.th +// th : https://www.iana.org/domains/root/db/th.html // Submitted by registry th ac.th @@ -5701,23 +5739,24 @@ org.tj test.tj web.tj -// tk : https://en.wikipedia.org/wiki/.tk +// tk : https://www.iana.org/domains/root/db/tk.html tk -// tl : https://en.wikipedia.org/wiki/.tl +// tl : https://www.iana.org/domains/root/db/tl.html tl gov.tl -// tm : http://www.nic.tm/local.html +// tm : https://www.nic.tm/local.html +// Confirmed by registry 2024-11-19 tm -com.tm co.tm -org.tm -net.tm -nom.tm +com.tm +edu.tm gov.tm mil.tm -edu.tm +net.tm +nom.tm +org.tm // tn : http://www.registre.tn/fr/ // https://whois.ati.tn/ @@ -5736,15 +5775,15 @@ org.tn perso.tn tourism.tn -// to : https://en.wikipedia.org/wiki/.to +// to : https://www.iana.org/domains/root/db/to.html // Submitted by registry to com.to +edu.to gov.to +mil.to net.to org.to -edu.to -mil.to // tr : https://nic.tr/ // https://nic.tr/forms/eng/policies.pdf @@ -5760,9 +5799,9 @@ edu.tr gen.tr gov.tr info.tr -mil.tr k12.tr kep.tr +mil.tr name.tr net.tr org.tr @@ -5776,46 +5815,40 @@ nc.tr // Used by government agencies of Northern Cyprus gov.nc.tr -// tt : http://www.nic.tt/ +// tt : https://www.nic.tt/ +// Confirmed by registry 2024-11-19 tt +biz.tt co.tt com.tt -org.tt -net.tt -biz.tt +edu.tt +gov.tt info.tt -pro.tt -int.tt -coop.tt -jobs.tt -mobi.tt -travel.tt -museum.tt -aero.tt +mil.tt name.tt -gov.tt -edu.tt +net.tt +org.tt +pro.tt -// tv : https://en.wikipedia.org/wiki/.tv +// tv : https://www.iana.org/domains/root/db/tv.html // Not listing any 2LDs as reserved since none seem to exist in practice, // Wikipedia notwithstanding. tv -// tw : https://en.wikipedia.org/wiki/.tw +// tw : https://www.iana.org/domains/root/db/tw.html +// https://twnic.tw/dnservice_catag.php +// Confirmed by registry 2024-11-26 tw +club.tw +com.tw +ebiz.tw edu.tw +game.tw gov.tw +idv.tw mil.tw -com.tw net.tw org.tw -idv.tw -game.tw -ebiz.tw -club.tw -網路.tw -組織.tw -商業.tw // tz : http://www.tznic.or.tz/index.php/domains // Submitted by registry @@ -5920,17 +5953,23 @@ zp.ua zt.ua // ug : https://www.registry.co.ug/ +// https://www.registry.co.ug, https://whois.co.ug +// Confirmed by registry 2025-01-20 ug -co.ug -or.ug ac.ug -sc.ug +co.ug +com.ug +edu.ug go.ug +gov.ug +mil.ug ne.ug -com.ug +or.ug org.ug +sc.ug +us.ug -// uk : https://en.wikipedia.org/wiki/.uk +// uk : https://www.iana.org/domains/root/db/uk.html // Submitted by registry uk ac.uk @@ -5945,14 +5984,13 @@ plc.uk police.uk *.sch.uk -// us : https://en.wikipedia.org/wiki/.us +// us : https://www.iana.org/domains/root/db/us.html +// Confirmed via the .us zone file by William Harrison 2024-12-10 us dni.us -fed.us isa.us -kids.us nsn.us -// us geographic names +// Geographic Names ak.us al.us ar.us @@ -6001,9 +6039,9 @@ sd.us tn.us tx.us ut.us +va.us vi.us vt.us -va.us wa.us wi.us wv.us @@ -6026,7 +6064,7 @@ k12.dc.us k12.fl.us k12.ga.us k12.gu.us -// k12.hi.us Bug 614565 - Hawaii has a state-wide DOE login +// k12.hi.us - Bug 614565 - Hawaii has a state-wide DOE login k12.ia.us k12.id.us k12.il.us @@ -6043,7 +6081,7 @@ k12.mo.us k12.ms.us k12.mt.us k12.nc.us -// k12.nd.us Bug 1028347 - Removed at request of Travis Rosso +// k12.nd.us - Bug 1028347 - Removed at request of Travis Rosso k12.ne.us k12.nh.us k12.nj.us @@ -6055,28 +6093,36 @@ k12.ok.us k12.or.us k12.pa.us k12.pr.us -// k12.ri.us Removed at request of Kim Cournoyer +// k12.ri.us - Removed at request of Kim Cournoyer k12.sc.us -// k12.sd.us Bug 934131 - Removed at request of James Booze +// k12.sd.us - Bug 934131 - Removed at request of James Booze k12.tn.us k12.tx.us k12.ut.us +k12.va.us k12.vi.us k12.vt.us -k12.va.us k12.wa.us k12.wi.us -// k12.wv.us Bug 947705 - Removed at request of Verne Britton -k12.wy.us +// k12.wv.us - Bug 947705 - Removed at request of Verne Britton cc.ak.us +lib.ak.us cc.al.us +lib.al.us cc.ar.us +lib.ar.us cc.as.us +lib.as.us cc.az.us +lib.az.us cc.ca.us +lib.ca.us cc.co.us +lib.co.us cc.ct.us +lib.ct.us cc.dc.us +lib.dc.us cc.de.us cc.fl.us cc.ga.us @@ -6116,23 +6162,15 @@ cc.sd.us cc.tn.us cc.tx.us cc.ut.us +cc.va.us cc.vi.us cc.vt.us -cc.va.us cc.wa.us cc.wi.us cc.wv.us cc.wy.us -lib.ak.us -lib.al.us -lib.ar.us -lib.as.us -lib.az.us -lib.ca.us -lib.co.us -lib.ct.us -lib.dc.us -// lib.de.us Issue #243 - Moved to Private section at request of Ed Moore +k12.wy.us +// lib.de.us - Issue #243 - Moved to Private section at request of Ed Moore lib.fl.us lib.ga.us lib.gu.us @@ -6171,23 +6209,23 @@ lib.sd.us lib.tn.us lib.tx.us lib.ut.us +lib.va.us lib.vi.us lib.vt.us -lib.va.us lib.wa.us lib.wi.us -// lib.wv.us Bug 941670 - Removed at request of Larry W Arnold +// lib.wv.us - Bug 941670 - Removed at request of Larry W Arnold lib.wy.us // k12.ma.us contains school districts in Massachusetts. The 4LDs are -// managed independently except for private (PVT), charter (CHTR) and -// parochial (PAROCH) schools. Those are delegated directly to the -// 5LD operators. -pvt.k12.ma.us +// managed independently except for private (PVT), charter (CHTR) and +// parochial (PAROCH) schools. Those are delegated directly to the +// 5LD operators. chtr.k12.ma.us paroch.k12.ma.us +pvt.k12.ma.us // Merit Network, Inc. maintains the registry for =~ /(k12|cc|lib).mi.us/ and the following -// see also: http://domreg.merit.edu -// see also: whois -h whois.domreg.merit.edu help +// see also: https://domreg.merit.edu : domreg@merit.edu +// see also: whois -h whois.domreg.merit.edu help ann-arbor.mi.us cog.mi.us dst.mi.us @@ -6213,18 +6251,18 @@ com.uz net.uz org.uz -// va : https://en.wikipedia.org/wiki/.va +// va : https://www.iana.org/domains/root/db/va.html va -// vc : https://en.wikipedia.org/wiki/.vc +// vc : https://www.iana.org/domains/root/db/vc.html // Submitted by registry vc com.vc -net.vc -org.vc +edu.vc gov.vc mil.vc -edu.vc +net.vc +org.vc // ve : https://registro.nic.ve/ // Submitted by registry nic@nic.ve and nicve@conatel.gob.ve @@ -6235,6 +6273,7 @@ co.ve com.ve e12.ve edu.ve +emprende.ve firm.ve gob.ve gov.ve @@ -6250,13 +6289,12 @@ store.ve tec.ve web.ve -// vg : https://en.wikipedia.org/wiki/.vg +// vg : https://www.iana.org/domains/root/db/vg.html +// Confirmed by registry 2025-01-10 vg +edu.vg -// vi : http://www.nic.vi/newdomainform.htm -// http://www.nic.vi/Domain_Rules/body_domain_rules.html indicates some other -// TLDs are "reserved", such as edu.vi and gov.vi, but doesn't actually say they -// are available for registration (which they do not seem to be). +// vi : https://www.iana.org/domains/root/db/vi.html vi co.vi com.vi @@ -6348,7 +6386,7 @@ vinhlong.vn vinhphuc.vn yenbai.vn -// vu : https://en.wikipedia.org/wiki/.vu +// vu : https://www.iana.org/domains/root/db/vu.html // http://www.vunic.vu/ vu com.vu @@ -6359,14 +6397,14 @@ org.vu // wf : https://www.afnic.fr/wp-media/uploads/2022/12/afnic-naming-policy-2023-01-01.pdf wf -// ws : https://en.wikipedia.org/wiki/.ws +// ws : https://www.iana.org/domains/root/db/ws.html // http://samoanic.ws/index.dhtml ws com.ws +edu.ws +gov.ws net.ws org.ws -gov.ws -edu.ws // yt : https://www.afnic.fr/wp-media/uploads/2022/12/afnic-naming-policy-2023-01-01.pdf yt @@ -6401,12 +6439,12 @@ yt // xn--fiqs8s ("Zhongguo/China", Chinese, Simplified) : CN // CNNIC -// http://cnnic.cn/html/Dir/2005/10/11/3218.htm +// https://www.cnnic.cn/11/192/index.html 中国 // xn--fiqz9s ("Zhongguo/China", Chinese, Traditional) : CN // CNNIC -// http://cnnic.cn/html/Dir/2005/10/11/3218.htm +// https://www.cnnic.com.cn/AU/MediaC/Announcement/201609/t20160905_54470.htm 中國 // xn--lgbbat1ad8j ("Algeria/Al Jazair", Arabic) : DZ @@ -6439,12 +6477,12 @@ yt // Submitted by registry // https://www.hkirc.hk/content.jsp?id=30#!/34 香港 +個人.香港 公司.香港 -教育.香港 政府.香港 -個人.香港 -網絡.香港 +教育.香港 組織.香港 +網絡.香港 // xn--2scrj9c ("Bharat", Kannada) : IN // India @@ -6575,12 +6613,12 @@ yt // xn--90a3ac ("srb", Cyrillic) : RS // https://www.rnids.rs/en/domains/national-domains срб -пр.срб -орг.срб +ак.срб обр.срб од.срб +орг.срб +пр.срб упр.срб -ак.срб // xn--p1ai ("rf", Russian-Cyrillic) : RU // https://cctld.ru/files/pdf/docs/en/rules_ru-rf.pdf @@ -6595,7 +6633,7 @@ yt // http://www.nic.net.sa/ السعودية -// xn--mgberp4a5d4a87g ("AlSaudiah", Arabic, variant) : SA +// xn--mgberp4a5d4a87g ("AlSaudiah", Arabic, variant): SA السعودیة // xn--mgbqly7c0a67fbc ("AlSaudiah", Arabic, variant) : SA @@ -6623,11 +6661,11 @@ yt // xn--o3cw4h ("Thai", Thai) : TH // http://www.thnic.co.th ไทย -ศึกษา.ไทย -ธุรกิจ.ไทย -รัฐบาล.ไทย ทหาร.ไทย +ธุรกิจ.ไทย เน็ต.ไทย +รัฐบาล.ไทย +ศึกษา.ไทย องค์กร.ไทย // xn--pgbs0dh ("Tunisia", Arabic) : TN @@ -6635,7 +6673,7 @@ yt تونس // xn--kpry57d ("Taiwan", Chinese, Traditional) : TW -// http://www.twnic.net/english/dn/dn_07a.htm +// https://twnic.tw/dnservice_catag.php 台灣 // xn--kprw13d ("Taiwan", Chinese, Simplified) : TW @@ -6659,11 +6697,11 @@ ye com.ye edu.ye gov.ye -net.ye mil.ye +net.ye org.ye -// za : https://www.zadna.org.za/content/page/domain-information/ +// za : https://www.iana.org/domains/root/db/za.html ac.za agric.za alt.za @@ -6707,10 +6745,9 @@ gov.zw mil.zw org.zw - // newGTLDs -// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2024-05-04T15:12:50Z +// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2025-04-30T15:19:32Z // This list is auto-generated, don't edit it manually. // aaa : American Automobile Association, Inc. // https://www.iana.org/domains/root/db/aaa.html @@ -6940,7 +6977,7 @@ art // https://www.iana.org/domains/root/db/arte.html arte -// asda : Wal-Mart Stores, Inc. +// asda : Asda Stores Limited // https://www.iana.org/domains/root/db/asda.html asda @@ -7092,10 +7129,6 @@ beauty // https://www.iana.org/domains/root/db/beer.html beer -// bentley : Bentley Motors Limited -// https://www.iana.org/domains/root/db/bentley.html -bentley - // berlin : dotBERLIN GmbH & Co. KG // https://www.iana.org/domains/root/db/berlin.html berlin @@ -7656,10 +7689,6 @@ cymru // https://www.iana.org/domains/root/db/cyou.html cyou -// dabur : Dabur India Limited -// https://www.iana.org/domains/root/db/dabur.html -dabur - // dad : Charleston Road Registry Inc. // https://www.iana.org/domains/root/db/dad.html dad @@ -8112,7 +8141,7 @@ forex // https://www.iana.org/domains/root/db/forsale.html forsale -// forum : Fegistry, LLC +// forum : Waterford Limited // https://www.iana.org/domains/root/db/forum.html forum @@ -8152,7 +8181,7 @@ ftr // https://www.iana.org/domains/root/db/fujitsu.html fujitsu -// fun : Radix Technologies Inc. +// fun : Radix Technologies Inc SEZC // https://www.iana.org/domains/root/db/fun.html fun @@ -8392,11 +8421,11 @@ haus // https://www.iana.org/domains/root/db/hbo.html hbo -// hdfc : HOUSING DEVELOPMENT FINANCE CORPORATION LIMITED +// hdfc : HDFC BANK LIMITED // https://www.iana.org/domains/root/db/hdfc.html hdfc -// hdfcbank : HDFC Bank Limited +// hdfcbank : HDFC BANK LIMITED // https://www.iana.org/domains/root/db/hdfcbank.html hdfcbank @@ -8484,7 +8513,7 @@ horse // https://www.iana.org/domains/root/db/hospital.html hospital -// host : Radix Technologies Inc. +// host : Radix Technologies Inc SEZC // https://www.iana.org/domains/root/db/host.html host @@ -8724,10 +8753,6 @@ kddi // https://www.iana.org/domains/root/db/kerryhotels.html kerryhotels -// kerrylogistics : Kerry Trading Co. Limited -// https://www.iana.org/domains/root/db/kerrylogistics.html -kerrylogistics - // kerryproperties : Kerry Trading Co. Limited // https://www.iana.org/domains/root/db/kerryproperties.html kerryproperties @@ -8808,10 +8833,6 @@ lamborghini // https://www.iana.org/domains/root/db/lamer.html lamer -// lancaster : LANCASTER -// https://www.iana.org/domains/root/db/lancaster.html -lancaster - // land : Binky Moon, LLC // https://www.iana.org/domains/root/db/land.html land @@ -8924,10 +8945,6 @@ lincoln // https://www.iana.org/domains/root/db/link.html link -// lipsy : Lipsy Ltd -// https://www.iana.org/domains/root/db/lipsy.html -lipsy - // live : Dog Beach, LLC // https://www.iana.org/domains/root/db/live.html live @@ -8976,7 +8993,7 @@ lotte // https://www.iana.org/domains/root/db/lotto.html lotto -// love : Merchant Law Group LLP +// love : Waterford Limited // https://www.iana.org/domains/root/db/love.html love @@ -9024,7 +9041,7 @@ maison // https://www.iana.org/domains/root/db/makeup.html makeup -// man : MAN SE +// man : MAN Truck & Bus SE // https://www.iana.org/domains/root/db/man.html man @@ -9060,7 +9077,7 @@ marriott // https://www.iana.org/domains/root/db/marshalls.html marshalls -// mattel : Mattel Sites, Inc. +// mattel : Mattel IT Services, Inc. // https://www.iana.org/domains/root/db/mattel.html mattel @@ -9104,6 +9121,10 @@ men // https://www.iana.org/domains/root/db/menu.html menu +// merck : Merck Registry Holdings, Inc. +// https://www.iana.org/domains/root/db/merck.html +merck + // merckmsd : MSD Registry Holdings, Inc. // https://www.iana.org/domains/root/db/merckmsd.html merckmsd @@ -9228,10 +9249,6 @@ nab // https://www.iana.org/domains/root/db/nagoya.html nagoya -// natura : NATURA COSMÉTICOS S.A. -// https://www.iana.org/domains/root/db/natura.html -natura - // navy : Dog Beach, LLC // https://www.iana.org/domains/root/db/navy.html navy @@ -9320,7 +9337,7 @@ nissay // https://www.iana.org/domains/root/db/nokia.html nokia -// norton : NortonLifeLock Inc. +// norton : Gen Digital Inc. // https://www.iana.org/domains/root/db/norton.html norton @@ -9328,7 +9345,7 @@ norton // https://www.iana.org/domains/root/db/now.html now -// nowruz : Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. +// nowruz // https://www.iana.org/domains/root/db/nowruz.html nowruz @@ -9396,7 +9413,7 @@ ong // https://www.iana.org/domains/root/db/onl.html onl -// online : Radix Technologies Inc. +// online : Radix Technologies Inc SEZC // https://www.iana.org/domains/root/db/online.html online @@ -9452,7 +9469,7 @@ panasonic // https://www.iana.org/domains/root/db/paris.html paris -// pars : Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. +// pars // https://www.iana.org/domains/root/db/pars.html pars @@ -9520,7 +9537,7 @@ physio // https://www.iana.org/domains/root/db/pics.html pics -// pictet : Pictet Europe S.A. +// pictet : Banque Pictet & Cie SA // https://www.iana.org/domains/root/db/pictet.html pictet @@ -9600,7 +9617,7 @@ pramerica // https://www.iana.org/domains/root/db/praxi.html praxi -// press : Radix Technologies Inc. +// press : Radix Technologies Inc SEZC // https://www.iana.org/domains/root/db/press.html press @@ -9688,7 +9705,7 @@ realestate // https://www.iana.org/domains/root/db/realtor.html realtor -// realty : Internet Naming Company LLC +// realty : Waterford Limited // https://www.iana.org/domains/root/db/realty.html realty @@ -10004,15 +10021,11 @@ shangrila // https://www.iana.org/domains/root/db/sharp.html sharp -// shaw : Shaw Cablesystems G.P. -// https://www.iana.org/domains/root/db/shaw.html -shaw - // shell : Shell Information Technology International Inc // https://www.iana.org/domains/root/db/shell.html shell -// shia : Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. +// shia // https://www.iana.org/domains/root/db/shia.html shia @@ -10052,7 +10065,7 @@ sina // https://www.iana.org/domains/root/db/singles.html singles -// site : Radix Technologies Inc. +// site : Radix Technologies Inc SEZC // https://www.iana.org/domains/root/db/site.html site @@ -10064,7 +10077,7 @@ ski // https://www.iana.org/domains/root/db/skin.html skin -// sky : Sky International AG +// sky : Sky UK Limited // https://www.iana.org/domains/root/db/sky.html sky @@ -10132,7 +10145,7 @@ soy // https://www.iana.org/domains/root/db/spa.html spa -// space : Radix Technologies Inc. +// space : Radix Technologies Inc SEZC // https://www.iana.org/domains/root/db/space.html space @@ -10184,7 +10197,7 @@ stockholm // https://www.iana.org/domains/root/db/storage.html storage -// store : Radix Technologies Inc. +// store : Radix Technologies Inc SEZC // https://www.iana.org/domains/root/db/store.html store @@ -10288,7 +10301,7 @@ tax // https://www.iana.org/domains/root/db/taxi.html taxi -// tci : Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. +// tci // https://www.iana.org/domains/root/db/tci.html tci @@ -10300,7 +10313,7 @@ tdk // https://www.iana.org/domains/root/db/team.html team -// tech : Radix Technologies Inc. +// tech : Radix Technologies Inc SEZC // https://www.iana.org/domains/root/db/tech.html tech @@ -10484,7 +10497,7 @@ unicom // https://www.iana.org/domains/root/db/university.html university -// uno : Radix Technologies Inc. +// uno : Radix Technologies Inc SEZC // https://www.iana.org/domains/root/db/uno.html uno @@ -10500,7 +10513,7 @@ ups // https://www.iana.org/domains/root/db/vacations.html vacations -// vana : Internet Naming Company LLC +// vana : D3 Registry LLC // https://www.iana.org/domains/root/db/vana.html vana @@ -10648,7 +10661,7 @@ webcam // https://www.iana.org/domains/root/db/weber.html weber -// website : Radix Technologies Inc. +// website : Radix Technologies Inc SEZC // https://www.iana.org/domains/root/db/website.html website @@ -10772,7 +10785,7 @@ xin // https://www.iana.org/domains/root/db/xn--3bst00m.html 集团 -// xn--3ds443g : TLD REGISTRY LIMITED OY +// xn--3ds443g : Beijing TLD Registry Technology Limited // https://www.iana.org/domains/root/db/xn--3ds443g.html 在线 @@ -10996,7 +11009,7 @@ xin // https://www.iana.org/domains/root/db/xn--mgbi4ecexp.html كاثوليك -// xn--mgbt3dhd : Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. +// xn--mgbt3dhd // https://www.iana.org/domains/root/db/xn--mgbt3dhd.html همراه @@ -11128,7 +11141,7 @@ yahoo // https://www.iana.org/domains/root/db/yamaxun.html yamaxun -// yandex : Yandex Europe B.V. +// yandex : YANDEX, LLC // https://www.iana.org/domains/root/db/yandex.html yandex @@ -11180,12 +11193,29 @@ zone // https://www.iana.org/domains/root/db/zuerich.html zuerich - // ===END ICANN DOMAINS=== + // ===BEGIN PRIVATE DOMAINS=== + // (Note: these are in alphabetical order by company name) -// 12CHARS: https://12chars.com +// .KRD : https://nic.krd +co.krd +edu.krd + +// .pl domains (grandfathered) +art.pl +gliwice.pl +krakow.pl +poznan.pl +wroc.pl +zakopane.pl + +// .US +// Submitted by Ed Moore +lib.de.us + +// 12CHARS : https://12chars.com // Submitted by Kenny Niehage 12chars.dev 12chars.it @@ -11197,31 +11227,19 @@ cc.ua inf.ua ltd.ua -// 611coin : https://611project.org/ +// 611 blockchain domain name system : https://611project.net/ 611.to -// AAA workspace : https://aaa.vodka -// Submitted by Kirill Rezraf -aaa.vodka - // A2 Hosting // Submitted by Tyler Hall a2hosted.com cpserver.com -// Aaron Marais' Gitlab pages: https://lab.aaronleem.co.za -// Submitted by Aaron Marais -graphox.us - -// accesso Technology Group, plc. : https://accesso.com/ -// Submitted by accesso Team -*.devcdnaccesso.com - // Acorn Labs : https://acorn.io // Submitted by Craig Jellick *.on-acorn.io -// ActiveTrail: https://www.activetrail.biz/ +// ActiveTrail : https://www.activetrail.biz/ // Submitted by Ofer Kalaora activetrail.biz @@ -11229,6 +11247,13 @@ activetrail.biz // Submitted by Mark Terrel adaptable.app +// addr.tools : https://addr.tools/ +// Submitted by Brian Shea +myaddr.dev +myaddr.io +dyn.addr.tools +myaddr.tools + // Adobe : https://www.adobe.com/ // Submitted by Ian Boston and Lars Trieloff adobeaemcloud.com @@ -11245,6 +11270,10 @@ hlx3.page adobeio-static.net adobeioruntime.net +// Africa.com Web Solutions Ltd : https://registry.africa.com +// Submitted by Gavin Brown +africa.com + // Agnat sp. z o.o. : https://domena.pl // Submitted by Przemyslaw Plewa beep.pl @@ -11255,8 +11284,9 @@ airkitapps.com airkitapps-au.com airkitapps.eu -// Aiven: https://aiven.io/ -// Submitted by Etienne Stalmans +// Aiven : https://aiven.io/ +// Submitted by Aiven Security Team +aiven.app aivencloud.com // Akamai : https://www.akamai.com/ @@ -11286,11 +11316,15 @@ barsy.ca *.compute.estate *.alces.network +// Alibaba Cloud API Gateway +// Submitted by Alibaba Cloud Security +alibabacloudcs.com + // all-inkl.com : https://all-inkl.com // Submitted by Werner Kaltofen kasserver.com -// Altervista: https://www.altervista.org +// Altervista : https://www.altervista.org // Submitted by Carlo Cannas altervista.org @@ -11308,7 +11342,7 @@ myamaze.net // Amazon API Gateway // Submitted by AWS Security -// Reference: 9e37648f-a66c-4655-9ab1-5981f8737197 +// Reference: 6a4f5a95-8c7d-4077-a7af-9cf1abec0a53 execute-api.cn-north-1.amazonaws.com.cn execute-api.cn-northwest-1.amazonaws.com.cn execute-api.af-south-1.amazonaws.com @@ -11322,6 +11356,7 @@ execute-api.ap-southeast-1.amazonaws.com execute-api.ap-southeast-2.amazonaws.com execute-api.ap-southeast-3.amazonaws.com execute-api.ap-southeast-4.amazonaws.com +execute-api.ap-southeast-5.amazonaws.com execute-api.ca-central-1.amazonaws.com execute-api.ca-west-1.amazonaws.com execute-api.eu-central-1.amazonaws.com @@ -11350,8 +11385,9 @@ cloudfront.net // Amazon Cognito // Submitted by AWS Security -// Reference: 09588633-91fe-49d8-b4e7-ec36496d11f3 +// Reference: eb4652f0-20f0-43f5-b323-e6cc6ae02ad7 auth.af-south-1.amazoncognito.com +auth.ap-east-1.amazoncognito.com auth.ap-northeast-1.amazoncognito.com auth.ap-northeast-2.amazoncognito.com auth.ap-northeast-3.amazoncognito.com @@ -11361,7 +11397,9 @@ auth.ap-southeast-1.amazoncognito.com auth.ap-southeast-2.amazoncognito.com auth.ap-southeast-3.amazoncognito.com auth.ap-southeast-4.amazoncognito.com +auth.ap-southeast-5.amazoncognito.com auth.ca-central-1.amazoncognito.com +auth.ca-west-1.amazoncognito.com auth.eu-central-1.amazoncognito.com auth.eu-central-2.amazoncognito.com auth.eu-north-1.amazoncognito.com @@ -11378,6 +11416,7 @@ auth.us-east-1.amazoncognito.com auth-fips.us-east-1.amazoncognito.com auth.us-east-2.amazoncognito.com auth-fips.us-east-2.amazoncognito.com +auth-fips.us-gov-east-1.amazoncognito.com auth-fips.us-gov-west-1.amazoncognito.com auth.us-west-1.amazoncognito.com auth-fips.us-west-1.amazoncognito.com @@ -11387,9 +11426,9 @@ auth-fips.us-west-2.amazoncognito.com // Amazon EC2 // Submitted by Luke Wells // Reference: 4c38fa71-58ac-4768-99e5-689c1767e537 +*.compute.amazonaws.com.cn *.compute.amazonaws.com *.compute-1.amazonaws.com -*.compute.amazonaws.com.cn us-east-1.amazonaws.com // Amazon EMR @@ -11497,23 +11536,32 @@ emrstudio-prod.us-west-2.amazonaws.com // Amazon Managed Workflows for Apache Airflow // Submitted by AWS Security -// Reference: 87f24ece-a77e-40e8-bb4a-f6b74fe9f975 +// Reference: f5ea5d0a-ec6a-4f23-ac1c-553fbff13f5c *.cn-north-1.airflow.amazonaws.com.cn *.cn-northwest-1.airflow.amazonaws.com.cn *.af-south-1.airflow.amazonaws.com *.ap-east-1.airflow.amazonaws.com *.ap-northeast-1.airflow.amazonaws.com *.ap-northeast-2.airflow.amazonaws.com +*.ap-northeast-3.airflow.amazonaws.com *.ap-south-1.airflow.amazonaws.com +*.ap-south-2.airflow.amazonaws.com *.ap-southeast-1.airflow.amazonaws.com *.ap-southeast-2.airflow.amazonaws.com +*.ap-southeast-3.airflow.amazonaws.com +*.ap-southeast-4.airflow.amazonaws.com *.ca-central-1.airflow.amazonaws.com +*.ca-west-1.airflow.amazonaws.com *.eu-central-1.airflow.amazonaws.com +*.eu-central-2.airflow.amazonaws.com *.eu-north-1.airflow.amazonaws.com *.eu-south-1.airflow.amazonaws.com +*.eu-south-2.airflow.amazonaws.com *.eu-west-1.airflow.amazonaws.com *.eu-west-2.airflow.amazonaws.com *.eu-west-3.airflow.amazonaws.com +*.il-central-1.airflow.amazonaws.com +*.me-central-1.airflow.amazonaws.com *.me-south-1.airflow.amazonaws.com *.sa-east-1.airflow.amazonaws.com *.us-east-1.airflow.amazonaws.com @@ -11523,7 +11571,7 @@ emrstudio-prod.us-west-2.amazonaws.com // Amazon S3 // Submitted by AWS Security -// Reference: cd5c8b3a-67b7-4b40-9236-c87ce81a3d10 +// Reference: ada5c9df-55e1-4195-a1ce-732d6c81e357 s3.dualstack.cn-north-1.amazonaws.com.cn s3-accesspoint.dualstack.cn-north-1.amazonaws.com.cn s3-website.dualstack.cn-north-1.amazonaws.com.cn @@ -11581,6 +11629,7 @@ s3-object-lambda.ap-south-1.amazonaws.com s3-website.ap-south-1.amazonaws.com s3.dualstack.ap-south-2.amazonaws.com s3-accesspoint.dualstack.ap-south-2.amazonaws.com +s3-website.dualstack.ap-south-2.amazonaws.com s3.ap-south-2.amazonaws.com s3-accesspoint.ap-south-2.amazonaws.com s3-object-lambda.ap-south-2.amazonaws.com @@ -11601,16 +11650,26 @@ s3-object-lambda.ap-southeast-2.amazonaws.com s3-website.ap-southeast-2.amazonaws.com s3.dualstack.ap-southeast-3.amazonaws.com s3-accesspoint.dualstack.ap-southeast-3.amazonaws.com +s3-website.dualstack.ap-southeast-3.amazonaws.com s3.ap-southeast-3.amazonaws.com s3-accesspoint.ap-southeast-3.amazonaws.com s3-object-lambda.ap-southeast-3.amazonaws.com s3-website.ap-southeast-3.amazonaws.com s3.dualstack.ap-southeast-4.amazonaws.com s3-accesspoint.dualstack.ap-southeast-4.amazonaws.com +s3-website.dualstack.ap-southeast-4.amazonaws.com s3.ap-southeast-4.amazonaws.com s3-accesspoint.ap-southeast-4.amazonaws.com s3-object-lambda.ap-southeast-4.amazonaws.com s3-website.ap-southeast-4.amazonaws.com +s3.dualstack.ap-southeast-5.amazonaws.com +s3-accesspoint.dualstack.ap-southeast-5.amazonaws.com +s3-website.dualstack.ap-southeast-5.amazonaws.com +s3.ap-southeast-5.amazonaws.com +s3-accesspoint.ap-southeast-5.amazonaws.com +s3-deprecated.ap-southeast-5.amazonaws.com +s3-object-lambda.ap-southeast-5.amazonaws.com +s3-website.ap-southeast-5.amazonaws.com s3.dualstack.ca-central-1.amazonaws.com s3-accesspoint.dualstack.ca-central-1.amazonaws.com s3-accesspoint-fips.dualstack.ca-central-1.amazonaws.com @@ -11631,6 +11690,7 @@ s3.ca-west-1.amazonaws.com s3-accesspoint.ca-west-1.amazonaws.com s3-accesspoint-fips.ca-west-1.amazonaws.com s3-fips.ca-west-1.amazonaws.com +s3-object-lambda.ca-west-1.amazonaws.com s3-website.ca-west-1.amazonaws.com s3.dualstack.eu-central-1.amazonaws.com s3-accesspoint.dualstack.eu-central-1.amazonaws.com @@ -11641,6 +11701,7 @@ s3-object-lambda.eu-central-1.amazonaws.com s3-website.eu-central-1.amazonaws.com s3.dualstack.eu-central-2.amazonaws.com s3-accesspoint.dualstack.eu-central-2.amazonaws.com +s3-website.dualstack.eu-central-2.amazonaws.com s3.eu-central-2.amazonaws.com s3-accesspoint.eu-central-2.amazonaws.com s3-object-lambda.eu-central-2.amazonaws.com @@ -11660,6 +11721,7 @@ s3-object-lambda.eu-south-1.amazonaws.com s3-website.eu-south-1.amazonaws.com s3.dualstack.eu-south-2.amazonaws.com s3-accesspoint.dualstack.eu-south-2.amazonaws.com +s3-website.dualstack.eu-south-2.amazonaws.com s3.eu-south-2.amazonaws.com s3-accesspoint.eu-south-2.amazonaws.com s3-object-lambda.eu-south-2.amazonaws.com @@ -11687,12 +11749,14 @@ s3-object-lambda.eu-west-3.amazonaws.com s3-website.eu-west-3.amazonaws.com s3.dualstack.il-central-1.amazonaws.com s3-accesspoint.dualstack.il-central-1.amazonaws.com +s3-website.dualstack.il-central-1.amazonaws.com s3.il-central-1.amazonaws.com s3-accesspoint.il-central-1.amazonaws.com s3-object-lambda.il-central-1.amazonaws.com s3-website.il-central-1.amazonaws.com s3.dualstack.me-central-1.amazonaws.com s3-accesspoint.dualstack.me-central-1.amazonaws.com +s3-website.dualstack.me-central-1.amazonaws.com s3.me-central-1.amazonaws.com s3-accesspoint.me-central-1.amazonaws.com s3-object-lambda.me-central-1.amazonaws.com @@ -11761,6 +11825,7 @@ s3.dualstack.us-east-2.amazonaws.com s3-accesspoint.dualstack.us-east-2.amazonaws.com s3-accesspoint-fips.dualstack.us-east-2.amazonaws.com s3-fips.dualstack.us-east-2.amazonaws.com +s3-website.dualstack.us-east-2.amazonaws.com s3.us-east-2.amazonaws.com s3-accesspoint.us-east-2.amazonaws.com s3-accesspoint-fips.us-east-2.amazonaws.com @@ -11875,7 +11940,7 @@ notebook.cn-northwest-1.sagemaker.com.cn // Amazon SageMaker Studio // Submitted by AWS Security -// Reference: 69c723d9-6e1a-4bff-a203-48eecd203183 +// Reference: 475f237e-ab88-4041-9f41-7cfccdf66aeb studio.af-south-1.sagemaker.aws studio.ap-east-1.sagemaker.aws studio.ap-northeast-1.sagemaker.aws @@ -11887,6 +11952,7 @@ studio.ap-southeast-2.sagemaker.aws studio.ap-southeast-3.sagemaker.aws studio.ca-central-1.sagemaker.aws studio.eu-central-1.sagemaker.aws +studio.eu-central-2.sagemaker.aws studio.eu-north-1.sagemaker.aws studio.eu-south-1.sagemaker.aws studio.eu-south-2.sagemaker.aws @@ -11908,6 +11974,11 @@ studio.us-west-2.sagemaker.aws studio.cn-north-1.sagemaker.com.cn studio.cn-northwest-1.sagemaker.com.cn +// Amazon SageMaker with MLflow +// Submited by: AWS Security +// Reference: c19f92b3-a82a-452d-8189-831b572eea7e +*.experiments.sagemaker.aws + // Analytics on AWS // Submitted by AWS Security // Reference: 955f9f40-a495-4e73-ae85-67b77ac9cadd @@ -11924,8 +11995,8 @@ analytics-gateway.us-west-2.amazonaws.com // AWS Amplify // Submitted by AWS Security -// Reference: 5ecce854-c033-4fc4-a755-1a9916d9a9bb -*.amplifyapp.com +// Reference: c35bed18-6f4f-424f-9298-5756f2f7d72b +amplifyapp.com // AWS App Runner // Submitted by AWS Security @@ -12054,6 +12125,19 @@ awsglobalaccelerator.com // Reference: 83385945-225f-416e-9aa0-ad0632bfdcee *.private.repost.aws +// AWS Transfer Family web apps +// Submitted by AWS Security +// Reference: 67e9cfe6-ac57-49c7-b197-6652711c8e8d +transfer-webapp.ap-northeast-1.on.aws +transfer-webapp.ap-southeast-1.on.aws +transfer-webapp.ap-southeast-2.on.aws +transfer-webapp.eu-central-1.on.aws +transfer-webapp.eu-north-1.on.aws +transfer-webapp.eu-west-1.on.aws +transfer-webapp.us-east-1.on.aws +transfer-webapp.us-east-2.on.aws +transfer-webapp.us-west-2.on.aws + // eero // Submitted by Yue Kang // Reference: 264afe70-f62c-4c02-8ab9-b5281ed24461 @@ -12062,16 +12146,11 @@ eero-stage.online // concludes Amazon -// Amune : https://amune.org/ -// Submitted by Team Amune -t3l3p0rt.net -tele.amune.org - // Apigee : https://apigee.com/ // Submitted by Apigee Security Team apigee.io -// Apis Networks: https://apisnetworks.com +// Apis Networks : https://apisnetworks.com // Submitted by Matt Saladna panel.dev @@ -12088,6 +12167,11 @@ appspaceusercontent.com // Submitted by Alexander Hochbaum appudo.net +// Appwrite : https://appwrite.io +// Submitted by Steven Nguyen +appwrite.global +*.appwrite.run + // Aptible : https://www.aptible.com/ // Submitted by Thomas Orozco on-aptible.com @@ -12096,6 +12180,10 @@ on-aptible.com // Submitted by Aki Ueno f5.si +// ArvanCloud EdgeCompute +// Submitted by ArvanCloud CDN +arvanedge.ir + // ASEINet : https://www.aseinet.com/ // Submitted by Asei SEKIGUCHI user.aseinet.ne.jp @@ -12125,10 +12213,6 @@ cdn.prod.atlassian-dev.net // Submitted by Lukas Reschke translated.page -// Autocode : https://autocode.com -// Submitted by Jacob Lee -autocode.dev - // AVM : https://avm.de // Submitted by Andreas Weise myfritz.link @@ -12143,7 +12227,7 @@ onavstack.net *.awdev.ca *.advisor.ws -// AZ.pl sp. z.o.o: https://az.pl +// AZ.pl sp. z.o.o : https://az.pl // Submitted by Krzysztof Wolski ecommerce-shop.pl @@ -12151,25 +12235,10 @@ ecommerce-shop.pl // Submitted by Olivier Benz b-data.io -// backplane : https://www.backplane.io -// Submitted by Anthony Voutas -backplaneapp.io - // Balena : https://www.balena.io // Submitted by Petros Angelatos balena-devices.com -// University of Banja Luka : https://unibl.org -// Domains for Republic of Srpska administrative entity. -// Submitted by Marko Ivanovic -rs.ba - -// Banzai Cloud -// Submitted by Janos Matyas -*.banzai.cloud -app.banzaicloud.io -*.backyards.banzaicloud.io - // BASE, Inc. : https://binc.jp // Submitted by Yuya NAGASAWA base.ec @@ -12195,14 +12264,6 @@ beagleboard.io // Submitted by Hazel Cora pages.gay -// BetaInABox -// Submitted by Adrian -betainabox.com - -// University of Bielsko-Biala regional domain: http://dns.bielsko.pl/ -// Submitted by Marcin -bielsko.pl - // BinaryLane : http://www.binarylane.com // Submitted by Nathan O'Sullivan bnr.la @@ -12219,6 +12280,10 @@ blackbaudcdn.net // Submitted by Luke Bratch of.je +// Block, Inc. : https://block.xyz +// Submitted by Jonathan Boice +square.site + // Blue Bite, LLC : https://bluebite.com // Submitted by Joshua Weiss bluebite.io @@ -12246,6 +12311,9 @@ square7.net // Brave : https://brave.com // Submitted by Andrea Brancaleoni +brave.app +*.s.brave.app +brave.io *.s.brave.io // Brendly : https://brendly.rs @@ -12257,6 +12325,16 @@ shop.brendly.rs // Submitted by Dave Tharp browsersafetymark.io +// BRS Media : https://brsmedia.com/ +// Submitted by Gavin Brown +radio.am +radio.fm + +// Bubble : https://bubble.io/ +// Submitted by Merlin Zhao +cdn.bubble.io +bubbleapps.io + // Bytemark Hosting : https://www.bytemark.co.uk // Submitted by Paul Cammish uk0.bigv.io @@ -12267,10 +12345,6 @@ vm.bytemark.co.uk // Submitted by Antonio Lain cafjs.com -// callidomus : https://www.callidomus.com/ -// Submitted by Marcus Popp -mycd.eu - // Canva Pty Ltd : https://canva.com/ // Submitted by Joel Aquilina canva-apps.cn @@ -12286,102 +12360,99 @@ carrd.co crd.co ju.mp -// CentralNic : http://www.centralnic.com/names/domains +// CDDO : https://www.gov.uk/guidance/get-an-api-domain-on-govuk +// Submitted by Jamie Tanna +api.gov.uk + +// CDN77.com : http://www.cdn77.com +// Submitted by Jan Krpes +cdn77-storage.com +rsc.contentproxy9.cz +r.cdn77.net +cdn77-ssl.net +c.cdn77.org +rsc.cdn77.org +ssl.origin.cdn77-secure.org + +// CentralNic : https://teaminternet.com/ // Submitted by registry -ae.org +za.bz br.com cn.com -com.de -com.se de.com eu.com -gb.net -hu.net -jp.net jpn.com mex.com ru.com sa.com -se.net uk.com -uk.net us.com -za.bz za.com +com.de +gb.net +hu.net +jp.net +se.net +uk.net +ae.org +com.se -// No longer operated by CentralNic, these entries should be adopted and/or removed by current operators -// Submitted by Gavin Brown -ar.com -hu.com -kr.com -no.com -qc.com -uy.com - -// Africa.com Web Solutions Ltd : https://registry.africa.com -// Submitted by Gavin Brown -africa.com +// Cityhost LLC : https://cityhost.ua +// Submitted by Maksym Rivtin +cx.ua -// iDOT Services Limited : http://www.domain.gr.com -// Submitted by Gavin Brown -gr.com +// Civilized Discourse Construction Kit, Inc. : https://www.discourse.org/ +// Submitted by Rishabh Nambiar & Michael Brown +discourse.group +discourse.team -// Radix FZC : http://domains.in.net -// Submitted by Gavin Brown -in.net -web.in +// Clerk : https://www.clerk.dev +// Submitted by Colin Sidoti +clerk.app +clerkstage.app +*.lcl.dev +*.lclstage.dev +*.stg.dev +*.stgstage.dev -// US REGISTRY LLC : http://us.org -// Submitted by Gavin Brown -us.org - -// co.com Registry, LLC : https://registry.co.com -// Submitted by Gavin Brown -co.com - -// Roar Domains LLC : https://roar.basketball/ -// Submitted by Gavin Brown -aus.basketball -nz.basketball - -// BRS Media : https://brsmedia.com/ -// Submitted by Gavin Brown -radio.am -radio.fm - -// c.la : http://www.c.la/ -c.la - -// certmgr.org : https://certmgr.org -// Submitted by B. Blechschmidt -certmgr.org - -// Cityhost LLC : https://cityhost.ua -// Submitted by Maksym Rivtin -cx.ua - -// Civilized Discourse Construction Kit, Inc. : https://www.discourse.org/ -// Submitted by Rishabh Nambiar & Michael Brown -discourse.group -discourse.team - -// Clever Cloud : https://www.clever-cloud.com/ -// Submitted by Quentin Adam -cleverapps.io - -// Clerk : https://www.clerk.dev -// Submitted by Colin Sidoti -clerk.app -clerkstage.app -*.lcl.dev -*.lclstage.dev -*.stg.dev -*.stgstage.dev +// Clever Cloud : https://www.clever-cloud.com/ +// Submitted by Quentin Adam +cleverapps.cc +*.services.clever-cloud.com +cleverapps.io +cleverapps.tech // ClickRising : https://clickrising.com/ // Submitted by Umut Gumeli clickrising.net +// Cloud DNS Ltd : http://www.cloudns.net +// Submitted by Aleksander Hristov & Boyan Peychev +cloudns.asia +cloudns.be +cloud-ip.biz +cloudns.biz +cloudns.cc +cloudns.ch +cloudns.cl +cloudns.club +dnsabr.com +ip-ddns.com +cloudns.cx +cloudns.eu +cloudns.in +cloudns.info +ddns-ip.net +dns-cloud.net +dns-dynamic.net +cloudns.nz +cloudns.org +ip-dynamic.org +cloudns.ph +cloudns.pro +cloudns.pw +cloudns.us + // Cloud66 : https://www.cloud66.com/ // Submitted by Khash Sajadi c66.me @@ -12396,10 +12467,9 @@ cloudaccess.host freesite.host cloudaccess.net -// cloudControl : https://www.cloudcontrol.com/ -// Submitted by Tobias Wilken -cloudcontrolled.com -cloudcontrolapp.com +// Cloudbees, Inc. : https://www.cloudbees.com/ +// Submitted by Mohideen Shajith +cloudbeesusercontent.io // Cloudera, Inc. : https://www.cloudera.com/ // Submitted by Kedarnath Waikar @@ -12413,64 +12483,38 @@ trycloudflare.com pages.dev r2.dev workers.dev +cloudflare.net +cdn.cloudflare.net +cdn.cloudflareanycast.net +cdn.cloudflarecn.net +cdn.cloudflareglobal.net // cloudscale.ch AG : https://www.cloudscale.ch/ // Submitted by Gaudenz Steinlin cust.cloudscale.ch objects.lpg.cloudscale.ch objects.rma.cloudscale.ch +lpg.objectstorage.ch +rma.objectstorage.ch // Clovyr : https://clovyr.io // Submitted by Patrick Nielsen wnext.app -// co.ca : http://registry.co.ca/ -co.ca +// CNPY : https://cnpy.gdn +// Submitted by Angelo Gladding +cnpy.gdn // Co & Co : https://co-co.nl/ // Submitted by Govert Versluis *.otap.co -// i-registry s.r.o. : http://www.i-registry.cz/ -// Submitted by Martin Semrad -co.cz - -// CDN77.com : http://www.cdn77.com -// Submitted by Jan Krpes -cdn77-storage.com -rsc.contentproxy9.cz -cdn77-ssl.net -r.cdn77.net -ssl.origin.cdn77-secure.org -c.cdn77.org -rsc.cdn77.org - -// Cloud DNS Ltd : http://www.cloudns.net -// Submitted by Aleksander Hristov & Boyan Peychev -cloudns.asia -cloudns.be -cloudns.biz -cloudns.cc -cloudns.ch -cloudns.cl -cloudns.club -dnsabr.com -cloudns.cx -cloudns.eu -cloudns.in -cloudns.info -dns-cloud.net -dns-dynamic.net -cloudns.nz -cloudns.org -cloudns.ph -cloudns.pro -cloudns.pw -cloudns.us +// co.ca : http://registry.co.ca/ +co.ca -// CNPY : https://cnpy.gdn -// Submitted by Angelo Gladding -cnpy.gdn +// co.com Registry, LLC : https://registry.co.com +// Submitted by Gavin Brown +co.com // Codeberg e. V. : https://codeberg.org // Submitted by Moritz Marquardt @@ -12485,13 +12529,23 @@ preview.csb.app co.nl co.no +// Cognition AI, Inc. : https://cognition.ai +// Submitted by Philip Papurt +*.devinapps.com + // Combell.com : https://www.combell.com // Submitted by Thomas Wouters webhosting.be hosting-cluster.nl +// Contentful GmbH : https://www.contentful.com +// Submitted by Contentful Developer Experience Team +ctfcloud.net + // Convex : https://convex.dev/ // Submitted by James Cowling +convex.app +convex.cloud convex.site // Coordination Center for TLD RU and XN--P1AI : https://cctld.ru/en/domains/domens_ru/reserved/ @@ -12501,13 +12555,12 @@ edu.ru gov.ru int.ru mil.ru -test.ru // COSIMO GmbH : http://www.cosimo.de // Submitted by Rene Marticke dyn.cosidns.de -dynamisches-dns.de dnsupdater.de +dynamisches-dns.de internet-dns.de l-o-g-i-n.de dynamic-dns.info @@ -12515,9 +12568,9 @@ feste-ip.net knx-server.net static-access.net -// cPanel L.L.C. : https://www.cpanel.net/ -// Submitted by Dustin Scherer -*.cprapid.com +// Craft Docs Ltd : https://www.craft.do/ +// Submitted by Zsombor Fuszenecker +craft.me // Craynic, s.r.o. : http://www.craynic.com/ // Submitted by Ales Krajnik @@ -12531,54 +12584,15 @@ on.crisp.email // Submitted by Andrew Cady *.cryptonomic.net -// Cupcake : https://cupcake.io/ -// Submitted by Jonathan Rudenberg -cupcake.is - -// Curv UG : https://curv-labs.de/ -// Submitted by Marvin Wiesner -curv.dev - -// Customer OCI - Oracle Dyn https://cloud.oracle.com/home https://dyn.com/dns/ -// Submitted by Gregory Drake -// Note: This is intended to also include customer-oci.com due to wildcards implicitly including the current label -*.customer-oci.com -*.oci.customer-oci.com -*.ocp.customer-oci.com -*.ocs.customer-oci.com - -// Cyclic Software : https://www.cyclic.sh -// Submitted by Kam Lasater -cyclic.app -cyclic.cloud -cyclic-app.com -cyclic.co.in +// cyber_Folks S.A. : https://cyberfolks.pl +// Submitted by Bartlomiej Kida +cfolks.pl // cyon GmbH : https://www.cyon.ch/ // Submitted by Dominic Luechinger cyon.link cyon.site -// Danger Science Group: https://dangerscience.com/ -// Submitted by Skylar MacDonald -fnwk.site -folionetwork.site -platform0.app - -// Daplie, Inc : https://daplie.com -// Submitted by AJ ONeal -daplie.me -localhost.daplie.me - -// Datto, Inc. : https://www.datto.com/ -// Submitted by Philipp Heckel -dattolocal.com -dattorelay.com -dattoweb.com -mydatto.com -dattolocal.net -mydatto.net - // Dansk.net : http://www.dansk.net/ // Submitted by Anani Voule biz.dk @@ -12591,11 +12605,6 @@ store.dk // Submitted by Abel Boldu / DAppNode Team dyndns.dappnode.io -// dapps.earth : https://dapps.earth/ -// Submitted by Daniil Burdakov -*.dapps.earth -*.bzz.dapps.earth - // Dark, Inc. : https://darklang.com // Submitted by Paul Biggar builtwithdark.com @@ -12610,39 +12619,78 @@ instance.datadetect.com // Submitted by Richard Li edgestack.me -// DDNS5 : https://ddns5.com -// Submitted by Cameron Elliott -ddns5.com +// Datto, Inc. : https://www.datto.com/ +// Submitted by Philipp Heckel +dattolocal.com +dattorelay.com +dattoweb.com +mydatto.com +dattolocal.net +mydatto.net + +// ddnss.de : https://www.ddnss.de/ +// Submitted by Robert Niedziela +ddnss.de +dyn.ddnss.de +dyndns.ddnss.de +dyn-ip24.de +dyndns1.de +home-webserver.de +dyn.home-webserver.de +myhome-server.de +ddnss.org // Debian : https://www.debian.org/ // Submitted by Peter Palfrader / Debian Sysadmin Team debian.net +// Definima : http://www.definima.com/ +// Submitted by Maxence Bitterli +definima.io +definima.net + // Deno Land Inc : https://deno.com/ // Submitted by Luca Casonato deno.dev deno-staging.dev +deno.net // deSEC : https://desec.io/ // Submitted by Peter Thomassen dedyn.io -// Deta: https://www.deta.sh/ +// Deta : https://www.deta.sh/ // Submitted by Aavash Shrestha deta.app deta.dev -// Diher Solutions : https://diher.solutions -// Submitted by Didi Hermawan -*.rss.my.id -*.diher.solutions +// dhosting.pl Sp. z o.o. : https://dhosting.pl/ +// Submitted by Michal Kokoszkiewicz +dfirma.pl +dkonto.pl +you2.pl + +// DigitalOcean App Platform : https://www.digitalocean.com/products/app-platform/ +// Submitted by Braxton Huggins +ondigitalocean.app + +// DigitalOcean Spaces : https://www.digitalocean.com/products/spaces/ +// Submitted by Robin H. Johnson +*.digitaloceanspaces.com + +// DigitalPlat : https://www.digitalplat.org/ +// Submitted by Edward Hsing +qzz.io +us.kg +xx.kg +dpdns.org // Discord Inc : https://discord.com // Submitted by Sahn Lam discordsays.com discordsez.com -// DNS Africa Ltd https://dns.business +// DNS Africa Ltd : https://dns.business // Submitted by Calvin Browne jozi.biz @@ -12667,32 +12715,44 @@ shoparena.pl // Submitted by Andrew Farmer dreamhosters.com +// Dreamyoungs, Inc. : https://durumis.com +// Submitted by Infra Team +durumis.com + // Drobo : http://www.drobo.com/ // Submitted by Ricardo Padilha mydrobo.com -// Drud Holdings, LLC. : https://www.drud.com/ -// Submitted by Kevin Bridges -drud.io -drud.us - // DuckDNS : http://www.duckdns.org/ // Submitted by Richard Harper duckdns.org -// Bip : https://bip.sh -// Submitted by Joel Kennedy -bip.sh - -// bitbridge.net : Submitted by Craig Welch, abeliidev@gmail.com -bitbridge.net - // dy.fi : http://dy.fi/ // Submitted by Heikki Hannikainen dy.fi tunk.org // DynDNS.com : http://www.dyndns.com/services/dns/dyndns/ +dyndns.biz +for-better.biz +for-more.biz +for-some.biz +for-the.biz +selfip.biz +webhop.biz +ftpaccess.cc +game-server.cc +myphotos.cc +scrapping.cc +blogdns.com +cechire.com +dnsalias.com +dnsdojo.com +doesntexist.com +dontexist.com +doomdns.com +dyn-o-saur.com +dynalias.com dyndns-at-home.com dyndns-at-work.com dyndns-blog.com @@ -12707,64 +12767,14 @@ dyndns-server.com dyndns-web.com dyndns-wiki.com dyndns-work.com -dyndns.biz -dyndns.info -dyndns.org -dyndns.tv -at-band-camp.net -ath.cx -barrel-of-knowledge.info -barrell-of-knowledge.info -better-than.tv -blogdns.com -blogdns.net -blogdns.org -blogsite.org -boldlygoingnowhere.org -broke-it.net -buyshouses.net -cechire.com -dnsalias.com -dnsalias.net -dnsalias.org -dnsdojo.com -dnsdojo.net -dnsdojo.org -does-it.net -doesntexist.com -doesntexist.org -dontexist.com -dontexist.net -dontexist.org -doomdns.com -doomdns.org -dvrdns.org -dyn-o-saur.com -dynalias.com -dynalias.net -dynalias.org -dynathome.net -dyndns.ws -endofinternet.net -endofinternet.org -endoftheinternet.org est-a-la-maison.com est-a-la-masion.com est-le-patron.com est-mon-blogueur.com -for-better.biz -for-more.biz -for-our.info -for-some.biz -for-the.biz -forgot.her.name -forgot.his.name from-ak.com from-al.com from-ar.com -from-az.net from-ca.com -from-co.net from-ct.com from-dc.com from-de.com @@ -12777,10 +12787,8 @@ from-il.com from-in.com from-ks.com from-ky.com -from-la.net from-ma.com from-md.com -from-me.org from-mi.com from-mn.com from-mo.com @@ -12793,7 +12801,6 @@ from-nh.com from-nj.com from-nm.com from-nv.com -from-ny.net from-oh.com from-ok.com from-or.com @@ -12811,45 +12818,18 @@ from-wa.com from-wi.com from-wv.com from-wy.com -ftpaccess.cc -fuettertdasnetz.de -game-host.org -game-server.cc getmyip.com -gets-it.net -go.dyndns.org gotdns.com -gotdns.org -groks-the.info -groks-this.info -ham-radio-op.net -here-for-more.info hobby-site.com -hobby-site.org -home.dyndns.org -homedns.org -homeftp.net -homeftp.org -homeip.net homelinux.com -homelinux.net -homelinux.org homeunix.com -homeunix.net -homeunix.org iamallama.com -in-the-band.net is-a-anarchist.com is-a-blogger.com is-a-bookkeeper.com -is-a-bruinsfan.org is-a-bulls-fan.com -is-a-candidate.org is-a-caterer.com -is-a-celticsfan.org is-a-chef.com -is-a-chef.net -is-a-chef.org is-a-conservative.com is-a-cpa.com is-a-cubicle-slave.com @@ -12858,31 +12838,25 @@ is-a-designer.com is-a-doctor.com is-a-financialadvisor.com is-a-geek.com -is-a-geek.net -is-a-geek.org is-a-green.com is-a-guru.com is-a-hard-worker.com is-a-hunter.com -is-a-knight.org is-a-landscaper.com is-a-lawyer.com is-a-liberal.com is-a-libertarian.com -is-a-linux-user.org is-a-llama.com is-a-musician.com is-a-nascarfan.com is-a-nurse.com is-a-painter.com -is-a-patsfan.org is-a-personaltrainer.com is-a-photographer.com is-a-player.com is-a-republican.com is-a-rockstar.com is-a-socialist.com -is-a-soxfan.org is-a-student.com is-a-teacher.com is-a-techie.com @@ -12894,117 +12868,150 @@ is-an-anarchist.com is-an-artist.com is-an-engineer.com is-an-entertainer.com -is-by.us is-certified.com -is-found.org is-gone.com is-into-anime.com is-into-cars.com is-into-cartoons.com is-into-games.com is-leet.com -is-lost.org is-not-certified.com -is-saved.org is-slick.com is-uberleet.com -is-very-bad.org -is-very-evil.org -is-very-good.org -is-very-nice.org -is-very-sweet.org is-with-theband.com isa-geek.com -isa-geek.net -isa-geek.org isa-hockeynut.com issmarterthanyou.com +likes-pie.com +likescandy.com +neat-url.com +saves-the-whales.com +selfip.com +sells-for-less.com +sells-for-u.com +servebbs.com +simple-url.com +space-to-rent.com +teaches-yoga.com +writesthisblog.com +ath.cx +fuettertdasnetz.de isteingeek.de istmein.de -kicks-ass.net -kicks-ass.org -knowsitall.info -land-4-sale.us lebtimnetz.de leitungsen.de -likes-pie.com -likescandy.com +traeumtgerade.de +barrel-of-knowledge.info +barrell-of-knowledge.info +dyndns.info +for-our.info +groks-the.info +groks-this.info +here-for-more.info +knowsitall.info +selfip.info +webhop.info +forgot.her.name +forgot.his.name +at-band-camp.net +blogdns.net +broke-it.net +buyshouses.net +dnsalias.net +dnsdojo.net +does-it.net +dontexist.net +dynalias.net +dynathome.net +endofinternet.net +from-az.net +from-co.net +from-la.net +from-ny.net +gets-it.net +ham-radio-op.net +homeftp.net +homeip.net +homelinux.net +homeunix.net +in-the-band.net +is-a-chef.net +is-a-geek.net +isa-geek.net +kicks-ass.net +office-on-the.net +podzone.net +scrapper-site.net +selfip.net +sells-it.net +servebbs.net +serveftp.net +thruhere.net +webhop.net merseine.nu mine.nu +shacknet.nu +blogdns.org +blogsite.org +boldlygoingnowhere.org +dnsalias.org +dnsdojo.org +doesntexist.org +dontexist.org +doomdns.org +dvrdns.org +dynalias.org +dyndns.org +go.dyndns.org +home.dyndns.org +endofinternet.org +endoftheinternet.org +from-me.org +game-host.org +gotdns.org +hobby-site.org +homedns.org +homeftp.org +homelinux.org +homeunix.org +is-a-bruinsfan.org +is-a-candidate.org +is-a-celticsfan.org +is-a-chef.org +is-a-geek.org +is-a-knight.org +is-a-linux-user.org +is-a-patsfan.org +is-a-soxfan.org +is-found.org +is-lost.org +is-saved.org +is-very-bad.org +is-very-evil.org +is-very-good.org +is-very-nice.org +is-very-sweet.org +isa-geek.org +kicks-ass.org misconfused.org -mypets.ws -myphotos.cc -neat-url.com -office-on-the.net -on-the-web.tv -podzone.net podzone.org readmyblog.org -saves-the-whales.com -scrapper-site.net -scrapping.cc -selfip.biz -selfip.com -selfip.info -selfip.net selfip.org -sells-for-less.com -sells-for-u.com -sells-it.net sellsyourhome.org -servebbs.com -servebbs.net servebbs.org -serveftp.net serveftp.org servegame.org -shacknet.nu -simple-url.com -space-to-rent.com stuff-4-sale.org -stuff-4-sale.us -teaches-yoga.com -thruhere.net -traeumtgerade.de -webhop.biz -webhop.info -webhop.net webhop.org +better-than.tv +dyndns.tv +on-the-web.tv worse-than.tv -writesthisblog.com - -// ddnss.de : https://www.ddnss.de/ -// Submitted by Robert Niedziela -ddnss.de -dyn.ddnss.de -dyndns.ddnss.de -dyndns1.de -dyn-ip24.de -home-webserver.de -dyn.home-webserver.de -myhome-server.de -ddnss.org - -// Definima : http://www.definima.com/ -// Submitted by Maxence Bitterli -definima.net -definima.io - -// DigitalOcean App Platform : https://www.digitalocean.com/products/app-platform/ -// Submitted by Braxton Huggins -ondigitalocean.app - -// DigitalOcean Spaces : https://www.digitalocean.com/products/spaces/ -// Submitted by Robin H. Johnson -*.digitaloceanspaces.com - -// DigitalPlat : https://www.digitalplat.org/ -// Submitted by Edward Hsing -us.kg - -// dnstrace.pro : https://dnstrace.pro/ -// Submitted by Chris Partridge -bci.dnstrace.pro +is-by.us +land-4-sale.us +stuff-4-sale.us +dyndns.ws +mypets.ws // Dynu.com : https://www.dynu.com/ // Submitted by Sue Ye @@ -13024,7 +13031,6 @@ freeddns.org mywire.org webredirect.org myddns.rocks -blogsite.xyz // dynv6 : https://dynv6.com // Submitted by Dominik Menke @@ -13043,6 +13049,14 @@ easypanel.host // Submitted by *.ewp.live +// eDirect Corp. : https://hosting.url.com.tw/ +// Submitted by C.S. chang +twmail.cc +twmail.net +twmail.org +mymailer.com.tw +url.tw + // Electromagnetic Field : https://www.emfcamp.org // Submitted by at.emf.camp @@ -13060,26 +13074,22 @@ elementor.cool // Submitted by Emmanuel Raviart en-root.fr -// Enalean SAS: https://www.enalean.com -// Submitted by Thomas Cottier +// Enalean SAS : https://www.enalean.com +// Submitted by Enalean Security Team mytuleap.com tuleap-partners.com -// Encoretivity AB: https://encore.dev -// Submitted by André Eriksson +// Encoretivity AB : https://encore.cloud +// Submitted by André Eriksson encr.app encoreapi.com - -// ECG Robotics, Inc: https://ecgrobotics.org -// Submitted by -onred.one -staging.onred.one +lp.dev // encoway GmbH : https://www.encoway.de // Submitted by Marcel Daus eu.encoway.cloud -// EU.org https://eu.org/ +// EU.org : https://eu.org/ // Submitted by Pierre Beyssac eu.org al.eu.org @@ -13115,7 +13125,6 @@ kr.eu.org lt.eu.org lu.eu.org lv.eu.org -mc.eu.org me.eu.org mk.eu.org mt.eu.org @@ -13125,10 +13134,8 @@ ng.eu.org nl.eu.org no.eu.org nz.eu.org -paris.eu.org pl.eu.org pt.eu.org -q-a.eu.org ro.eu.org ru.eu.org se.eu.org @@ -13153,13 +13160,15 @@ us-2.evennode.com us-3.evennode.com us-4.evennode.com -// eDirect Corp. : https://hosting.url.com.tw/ -// Submitted by C.S. chang -twmail.cc -twmail.net -twmail.org -mymailer.com.tw -url.tw +// Evervault : https://evervault.com +// Submitted by Hannah Neary +relay.evervault.app +relay.evervault.dev + +// Expo : https://expo.dev/ +// Submitted by James Ide +expo.app +staging.expo.app // Fabrica Technologies, Inc. : https://www.fabrica.dev/ // Submitted by Eric Jiang @@ -13251,8 +13260,6 @@ u.channelsdvr.net edgecompute.app fastly-edge.com fastly-terrarium.com -fastlylb.net -map.fastlylb.net freetls.fastly.net map.fastly.net a.prod.fastly.net @@ -13260,6 +13267,8 @@ global.prod.fastly.net a.ssl.fastly.net b.ssl.fastly.net global.ssl.fastly.net +fastlylb.net +map.fastlylb.net // Fastmail : https://www.fastmail.com/ // Submitted by Marc Bradshaw @@ -13273,74 +13282,68 @@ myfast.host fastvps.site myfast.space +// FearWorks Media Ltd. : https://fearworksmedia.co.uk +// Submitted by Keith Fairley +conn.uk +copro.uk +hosp.uk + // Fedora : https://fedoraproject.org/ -// submitted by Patrick Uiterwijk +// Submitted by Patrick Uiterwijk fedorainfracloud.org fedorapeople.org cloud.fedoraproject.org app.os.fedoraproject.org app.os.stg.fedoraproject.org -// FearWorks Media Ltd. : https://fearworksmedia.co.uk -// submitted by Keith Fairley -conn.uk -copro.uk -hosp.uk - // Fermax : https://fermax.com/ -// submitted by Koen Van Isterdael +// Submitted by Koen Van Isterdael mydobiss.com // FH Muenster : https://www.fh-muenster.de // Submitted by Robin Naundorf fh-muenster.io +// Figma : https://www.figma.com +// Submitted by Nick Frost +figma.site +preview.site + // Filegear Inc. : https://www.filegear.com // Submitted by Jason Zhu filegear.me -filegear-au.me -filegear-de.me -filegear-gb.me -filegear-ie.me -filegear-jp.me -filegear-sg.me // Firebase, Inc. // Submitted by Chris Raynor firebaseapp.com -// Firewebkit : https://www.firewebkit.com -// Submitted by Majid Qureshi -fireweb.app - -// FLAP : https://www.flap.cloud -// Submitted by Louis Chemineau -flap.id - // FlashDrive : https://flashdrive.io // Submitted by Eric Chan -onflashdrive.app fldrv.com +// Fleek Labs Inc : https://fleek.xyz +// Submitted by Parsa Ghadimi +on-fleek.app + // FlutterFlow : https://flutterflow.io // Submitted by Anton Emelyanov flutterflow.app -// fly.io: https://fly.io +// fly.io : https://fly.io // Submitted by Kurt Mackey fly.dev -edgeapp.net shw.io - -// Flynn : https://flynn.io -// Submitted by Jonathan Rudenberg -flynnhosting.net +edgeapp.net // Forgerock : https://www.forgerock.com // Submitted by Roderick Parr forgeblocks.com id.forgerock.io +// FoundryLabs, Inc : https://e2b.dev/ +// Submitted by Jiri Sveceny +e2b.app + // Framer : https://www.framer.com // Submitted by Koen Rouwhorst framer.ai @@ -13351,17 +13354,9 @@ framer.photos framer.website framer.wiki -// Frusky MEDIA&PR : https://www.frusky.de -// Submitted by Victor Pupynin -*.frusky.de - -// RavPage : https://www.ravpage.co.il -// Submitted by Roni Horowitz -ravpage.co.il - -// Frederik Braun https://frederik-braun.com +// Frederik Braun : https://frederik-braun.com // Submitted by Frederik Braun -0e.vc +*.0e.vc // Freebox : http://www.freebox.fr // Submitted by Romain Fliedel @@ -13380,11 +13375,15 @@ freedesktop.org // Submitted by Cadence freemyip.com +// Frusky MEDIA&PR : https://www.frusky.de +// Submitted by Victor Pupynin +*.frusky.de + // FunkFeuer - Verein zur Förderung freier Netze : https://www.funkfeuer.at // Submitted by Daniel A. Maierhofer wien.funkfeuer.at -// Future Versatile Group. :https://www.fvg-on.net/ +// Future Versatile Group. : https://www.fvg-on.net/ // T.Kabu daemon.asia dix.asia @@ -13419,6 +13418,8 @@ aliases121.com // GDS : https://www.gov.uk/service-manual/technology/managing-domain-names // Submitted by Stephen Ford +campaign.gov.uk +service.gov.uk independent-commission.uk independent-inquest.uk independent-inquiry.uk @@ -13426,12 +13427,6 @@ independent-panel.uk independent-review.uk public-inquiry.uk royal-commission.uk -campaign.gov.uk -service.gov.uk - -// CDDO : https://www.gov.uk/guidance/get-an-api-domain-on-govuk -// Submitted by Jamie Tanna -api.gov.uk // Gehirn Inc. : https://www.gehirn.co.jp/ // Submitted by Kohei YOSHIDA @@ -13442,16 +13437,9 @@ usercontent.jp // Submitted by Tom Klein gentapps.com gentlentapis.com -lab.ms cdn-edges.net -// Getlocalcert: https://www.getlocalcert.net -// Submitted by Robert Alexander -localcert.net -localhostcert.net -corpnet.work - -// GignoSystemJapan: http://gsj.bz +// GignoSystemJapan : http://gsj.bz // Submitted by GignoSystemJapan gsj.bz @@ -13461,11 +13449,11 @@ githubusercontent.com githubpreview.dev github.io -// GitLab, Inc. +// GitLab, Inc. : https://about.gitlab.com/ // Submitted by Alex Hanselka gitlab.io -// Gitplac.si - https://gitplac.si +// Gitplac.si : https://gitplac.si // Submitted by Aljaž Starc gitapp.si gitpage.si @@ -13597,35 +13585,23 @@ heteml.net // Submitted by Rohan Durrant graphic.design -// GOV.UK Platform as a Service : https://www.cloud.service.gov.uk/ -// Submitted by Tom Whitwell -cloudapps.digital -london.cloudapps.digital - -// GOV.UK Pay : https://www.payments.service.gov.uk/ -// Submitted by Richard Baker -pymnt.uk - -// GlobeHosting, Inc. -// Submitted by Zoltan Egresi -ro.im - // GoIP DNS Services : http://www.goip.de // Submitted by Christian Poulter goip.de // Google, Inc. -// Submitted by Eduardo Vela +// Submitted by Shannon McCabe +*.hosted.app *.run.app web.app *.0emm.com appspot.com *.r.appspot.com +blogspot.com codespot.com googleapis.com googlecode.com pagespeedmobilizer.com -publishproxy.com withgoogle.com withyoutube.com *.gateway.dev @@ -13633,114 +13609,40 @@ cloud.goog translate.goog *.usercontent.goog cloudfunctions.net -blogspot.ae -blogspot.al -blogspot.am -blogspot.ba -blogspot.be -blogspot.bg -blogspot.bj -blogspot.ca -blogspot.cf -blogspot.ch -blogspot.cl -blogspot.co.at -blogspot.co.id -blogspot.co.il -blogspot.co.ke -blogspot.co.nz -blogspot.co.uk -blogspot.co.za -blogspot.com -blogspot.com.ar -blogspot.com.au -blogspot.com.br -blogspot.com.by -blogspot.com.co -blogspot.com.cy -blogspot.com.ee -blogspot.com.eg -blogspot.com.es -blogspot.com.mt -blogspot.com.ng -blogspot.com.tr -blogspot.com.uy -blogspot.cv -blogspot.cz -blogspot.de -blogspot.dk -blogspot.fi -blogspot.fr -blogspot.gr -blogspot.hk -blogspot.hr -blogspot.hu -blogspot.ie -blogspot.in -blogspot.is -blogspot.it -blogspot.jp -blogspot.kr -blogspot.li -blogspot.lt -blogspot.lu -blogspot.md -blogspot.mk -blogspot.mr -blogspot.mx -blogspot.my -blogspot.nl -blogspot.no -blogspot.pe -blogspot.pt -blogspot.qa -blogspot.re -blogspot.ro -blogspot.rs -blogspot.ru -blogspot.se -blogspot.sg -blogspot.si -blogspot.sk -blogspot.sn -blogspot.td -blogspot.tw -blogspot.ug -blogspot.vn // Goupile : https://goupile.fr // Submitted by Niels Martignene goupile.fr -// Government of the Netherlands: https://www.government.nl +// GOV.UK Pay : https://www.payments.service.gov.uk/ +// Submitted by Richard Baker +pymnt.uk + +// GOV.UK Platform as a Service : https://www.cloud.service.gov.uk/ +// Submitted by Tom Whitwell +cloudapps.digital +london.cloudapps.digital + +// Government of the Netherlands : https://www.government.nl // Submitted by gov.nl +// Grafana Labs : https://grafana.com/ +// Submitted by Platform Engineering +grafana-dev.net + // GrayJay Web Solutions Inc. : https://grayjaysports.ca // Submitted by Matt Yamkowy grayjayleagues.com -// Group 53, LLC : https://www.group53.com -// Submitted by Tyler Todd -awsmppl.com - // GünstigBestellen : https://günstigbestellen.de // Submitted by Furkan Akkoc günstigbestellen.de günstigliefern.de -// Hakaran group: http://hakaran.cz -// Submitted by Arseniy Sokolov -fin.ci -free.hr -caa.li -ua.rs -conf.se - -// Handshake : https://handshake.org -// Submitted by Mike Damm -hs.zone -hs.run +// Häkkinen.fi : https://www.häkkinen.fi/ +// Submitted by Eero Häkkinen +häkkinen.fi // Hashbang : https://hashbang.sh hashbang.sh @@ -13750,9 +13652,23 @@ hashbang.sh hasura.app hasura-app.io -// Heilbronn University of Applied Sciences - Faculty Informatics (GitLab Pages): https://www.hs-heilbronn.de -// Submitted by Richard Zowalla +// Hatena Co., Ltd. : https://hatena.co.jp +// Submitted by Masato Nakamura +hatenablog.com +hatenadiary.com +hateblo.jp +hatenablog.jp +hatenadiary.jp +hatenadiary.org + +// Heilbronn University of Applied Sciences - Faculty Informatics (GitLab Pages) : https://www.hs-heilbronn.de +// Submitted by Richard Zowalla pages.it.hs-heilbronn.de +pages-research.it.hs-heilbronn.de + +// HeiyuSpace : https://lazycat.cloud +// Submitted by Xia Bin +heiyu.space // Helio Networks : https://heliohost.org // Submitted by Ben Frede @@ -13764,9 +13680,13 @@ heliohost.us hepforge.org // Heroku : https://www.heroku.com/ -// Submitted by Tom Maher +// Submitted by Shumon Huque herokuapp.com -herokussl.com + +// Heyflow : https://www.heyflow.com +// Submitted by Mirko Nitschke +heyflow.page +heyflow.site // Hibernating Rhinos // Submitted by Oren Eini @@ -13775,7 +13695,7 @@ ravendb.community development.run ravendb.run -// home.pl S.A.: https://home.pl +// home.pl S.A. : https://home.pl // Submitted by Krzysztof Wolski homesklep.pl @@ -13785,58 +13705,66 @@ homesklep.pl *.id.pub *.kin.pub -// Hong Kong Productivity Council: https://www.hkpc.org/ -// Submitted by SECaaS Team -secaas.hk - // Hoplix : https://www.hoplix.com // Submitted by Danilo De Franco hoplix.shop - // HOSTBIP REGISTRY : https://www.hostbip.com/ // Submitted by Atanunu Igbunuroghene orx.biz biz.gl +biz.ng +co.biz.ng +dl.biz.ng +go.biz.ng +lg.biz.ng +on.biz.ng col.ng firm.ng gen.ng ltd.ng ngo.ng -edu.scot -sch.so +plc.ng -// HostFly : https://www.ie.ua -// Submitted by Bohdan Dub -ie.ua - -// HostyHosting (hostyhosting.com) +// HostyHosting : https://hostyhosting.com hostyhosting.io -// Häkkinen.fi -// Submitted by Eero Häkkinen -häkkinen.fi +// Hugging Face : https://huggingface.co +// Submitted by Eliott Coyac +hf.space +static.hf.space + +// Hypernode B.V. : https://www.hypernode.com/ +// Submitted by Cipriano Groenendal +hypernode.io + +// I-O DATA DEVICE, INC. : http://www.iodata.com/ +// Submitted by Yuji Minagawa +iobb.net + +// i-registry s.r.o. : http://www.i-registry.cz/ +// Submitted by Martin Semrad +co.cz // Ici la Lune : http://www.icilalune.com/ // Submitted by Simon Morvan *.moonscale.io moonscale.net +// iDOT Services Limited : http://www.domain.gr.com +// Submitted by Gavin Brown +gr.com + // iki.fi // Submitted by Hannu Aronsson iki.fi -// iliad italia: https://www.iliad.it +// iliad italia : https://www.iliad.it // Submitted by Marios Makassikis ibxos.it iliadboxos.it -// Impertrix Solutions : -// Submitted by Zhixiang Zhao -impertrixcdn.com -impertrix.com - -// Incsub, LLC: https://incsub.com/ +// Incsub, LLC : https://incsub.com/ // Submitted by Aaron Edwards smushcdn.com wphostedmail.com @@ -13851,12 +13779,16 @@ in-berlin.de in-brb.de in-butter.de in-dsl.de -in-dsl.net -in-dsl.org in-vpn.de +in-dsl.net in-vpn.net +in-dsl.org in-vpn.org +// Inferno Communications : https://inferno.co.uk +// Submitted by Connor McFarlane +oninferno.net + // info.at : http://www.info.at/ biz.at info.at @@ -13899,26 +13831,54 @@ to.leg.br // Submitted by Wolfgang Schwarz pixolino.com -// Internet-Pro, LLP: https://netangels.ru/ +// Internet-Pro, LLP : https://netangels.ru/ // Submitted by Vasiliy Sheredeko na4u.ru +// Inventor Services : https://inventor.gg/ +// Submitted by Inventor Team +botdash.app +botdash.dev +botdash.gg +botdash.net +botda.sh +botdash.xyz + +// IONOS SE : https://www.ionos.com/ +// IONOS Group SE : https://www.ionos-group.com/ +// Submitted by Henrik Willert +apps-1and1.com +live-website.com +apps-1and1.net +websitebuilder.online +app-ionos.space + // iopsys software solutions AB : https://iopsys.eu/ // Submitted by Roman Azarenko iopsys.se +// IPFS Project : https://ipfs.tech/ +// Submitted by Interplanetary Shipyard +*.inbrowser.dev +*.dweb.link +*.inbrowser.link + // IPiFony Systems, Inc. : https://www.ipifony.com/ // Submitted by Matthew Hardeman ipifony.net -// is-a.dev : https://www.is-a.dev -// Submitted by William Harrison -is-a.dev - // ir.md : https://nic.ir.md // Submitted by Ali Soizi ir.md +// is-a-good.dev : https://is-a-good.dev +// Submitted by William Harrison +is-a-good.dev + +// is-a.dev : https://is-a.dev +// Submitted by William Harrison +is-a.dev + // IServ GmbH : https://iserv.de // Submitted by Mario Hoberg iservschule.de @@ -13928,15 +13888,10 @@ schulserver.de test-iserv.de iserv.dev -// I-O DATA DEVICE, INC. : http://www.iodata.com/ -// Submitted by Yuji Minagawa -iobb.net - // Jelastic, Inc. : https://jelastic.com/ // Submitted by Ihor Kolodyuk mel.cloudlets.com.au cloud.interhostsolutions.be -mycloud.by alp1.ae.flow.ch appengine.flow.ch es-1.axarnet.cloud @@ -13958,7 +13913,6 @@ us.reclaim.cloud ch.trendhosting.cloud de.trendhosting.cloud jele.club -amscompute.com dopaas.com paas.hosted-by-previder.com rag-cloud.hosteur.com @@ -13966,10 +13920,8 @@ rag-cloud-ch.hosteur.com jcloud.ik-server.com jcloud-ver-jpc.ik-server.com demo.jelastic.com -kilatiron.com paas.massivegrid.com jed.wafaicloud.com -lon.wafaicloud.com ryd.wafaicloud.com j.scaleforce.com.cy jelastic.dogado.eu @@ -13981,18 +13933,14 @@ mircloud.host paas.beebyte.io sekd1.beebyteapp.io jele.io -cloud-fr1.unispace.io jc.neen.it -cloud.jelastic.open.tim.it jcloud.kz -upaas.kazteleport.kz cloudjiffy.net fra1-de.cloudjiffy.net west1-us.cloudjiffy.net jls-sto1.elastx.net jls-sto2.elastx.net jls-sto3.elastx.net -faststacks.net fr-1.paas.massivegrid.net lon-1.paas.massivegrid.net lon-2.paas.massivegrid.net @@ -14002,11 +13950,9 @@ sg-1.paas.massivegrid.net jelastic.saveincloud.net nordeste-idc.saveincloud.net j.scaleforce.net -jelastic.tsukaeru.net sdscloud.pl unicloud.pl mircloud.ru -jelastic.regruhosting.ru enscaled.sg jele.site jelastic.team @@ -14029,13 +13975,13 @@ jotelulu.cloud // JouwWeb B.V. : https://www.jouwweb.nl // Submitted by Camilo Sperberg -jouwweb.site webadorsite.com +jouwweb.site // Joyent : https://www.joyent.com/ // Submitted by Brian Bennett -*.triton.zone *.cns.joyent.com +*.triton.zone // JS.ORG : http://dns.js.org // Submitted by Stefan Keim @@ -14046,14 +13992,15 @@ js.org kaas.gg khplay.nl -// Kakao : https://www.kakaocorp.com/ -// Submitted by JaeYoong Lee -ktistory.com - // Kapsi : https://kapsi.fi // Submitted by Tomi Juntunen kapsi.fi +// Katholieke Universiteit Leuven : https://www.kuleuven.be +// Submitted by Abuse KU Leuven +ezproxy.kuleuven.be +kuleuven.cloud + // Keyweb AG : https://www.keyweb.de // Submitted by Martin Dannehl keymachine.de @@ -14067,27 +14014,22 @@ uni5.net // Submitted by Roy Keene knightpoint.systems -// KoobinEvent, SL: https://www.koobin.com +// KoobinEvent, SL : https://www.koobin.com // Submitted by Iván Oliva koobin.events +// Krellian Ltd. : https://krellian.com +// Submitted by Ben Francis +webthings.io +krellian.net + // KUROKU LTD : https://kuroku.ltd/ // Submitted by DisposaBoy oya.to -// Katholieke Universiteit Leuven: https://www.kuleuven.be -// Submitted by Abuse KU Leuven -kuleuven.cloud -ezproxy.kuleuven.be - -// .KRD : http://nic.krd/data/krd/Registration%20Policy.pdf -co.krd -edu.krd - -// Krellian Ltd. : https://krellian.com -// Submitted by Ben Francis -krellian.net -webthings.io +// Laravel Holdings, Inc. : https://laravel.com +// Submitted by André Valentin +laravel.cloud // LCube - Professional hosting e.K. : https://www.lcube-webhosting.de // Submitted by Lars Laehn @@ -14101,9 +14043,14 @@ leadpages.co lpages.co lpusercontent.com -// Lelux.fi : https://lelux.fi/ -// Submitted by Lelux Admin -lelux.site +// Liara : https://liara.ir +// Submitted by Amirhossein Badinloo +liara.run +iran.liara.run + +// libp2p project : https://libp2p.io +// Submitted by Interplanetary Shipyard +libp2p.direct // Libre IT Ltd : https://libre.nz // Submitted by Tomas Maggio @@ -14119,10 +14066,10 @@ co.network co.place co.technology -// linkyard ldt: https://www.linkyard.ch/ +// linkyard ldt : https://www.linkyard.ch/ // Submitted by Mario Siegenthaler -linkyard.cloud linkyard-cloud.ch +linkyard.cloud // Linode : https://linode.com // Submitted by @@ -14135,13 +14082,32 @@ ip.linodeusercontent.com // Submitted by Victor Velchev we.bs +// Listen53 : https://www.l53.net +// Submitted by Gerry Keh +filegear-sg.me +ggff.net + // Localcert : https://localcert.dev // Submitted by Lann Martin *.user.localcert.dev -// localzone.xyz -// Submitted by Kenny Niehage -localzone.xyz +// LocalCert : https://localcert.net +// Submitted by William Harrison +localcert.net + +// Localtonet : https://localtonet.com/ +// Submitted by Burak Isleyici +localtonet.com +*.localto.net + +// Lodz University of Technology LODMAN regional domains : https://www.man.lodz.pl/dns +// Submitted by Piotr Wilk +lodz.pl +pabianice.pl +plock.pl +sieradz.pl +skierniewice.pl +zgierz.pl // Log'in Line : https://www.loginline.com/ // Submitted by Rémi Mach @@ -14151,13 +14117,18 @@ loginline.io loginline.services loginline.site +// Lõhmus Family, The : https://lohmus.me/ +// Submitted by Heiki Lõhmus +lohmus.me + // Lokalized : https://lokalized.nl // Submitted by Noah Taheij servers.run -// Lõhmus Family, The -// Submitted by Heiki Lõhmus -lohmus.me +// Lovable : https://lovable.dev +// Submitted by Fabian Hedin +lovable.app +lovableproject.com // LubMAN UMCS Sp. z o.o : https://lubman.pl/ // Submitted by Ireneusz Maliszewski @@ -14177,18 +14148,19 @@ lugs.org.uk // Lukanet Ltd : https://lukanet.com // Submitted by Anton Avramov barsy.bg -barsy.co.uk -barsyonline.co.uk +barsy.club barsycenter.com barsyonline.com -barsy.club barsy.de +barsy.dev barsy.eu +barsy.gr barsy.in barsy.info barsy.io barsy.me barsy.menu +barsyonline.menu barsy.mobi barsy.net barsy.online @@ -14196,42 +14168,51 @@ barsy.org barsy.pro barsy.pub barsy.ro +barsy.rs barsy.shop +barsyonline.shop barsy.site +barsy.store barsy.support barsy.uk +barsy.co.uk +barsyonline.co.uk + +// Luyani Inc. : https://luyani.com/ +// Submitted by Umut Gumeli +luyani.app +luyani.net // Magento Commerce // Submitted by Damien Tournoud *.magentosite.cloud -// May First - People Link : https://mayfirst.org/ -// Submitted by Jamie McClelland -mayfirst.info -mayfirst.org - // Mail.Ru Group : https://hb.cldmail.ru // Submitted by Ilya Zaretskiy hb.cldmail.ru -// Mail Transfer Platform : https://www.neupeer.com -// Submitted by Li Hui -cn.vu +// MathWorks : https://www.mathworks.com/ +// Submitted by Emily Reed +matlab.cloud +modelscape.com +mwcloudnonprod.com +polyspace.com + +// May First - People Link : https://mayfirst.org/ +// Submitted by Jamie McClelland +mayfirst.info +mayfirst.org -// Maze Play: https://www.mazeplay.com +// Maze Play : https://www.mazeplay.com // Submitted by Adam Humpherys mazeplay.com -// mcpe.me : https://mcpe.me -// Submitted by Noa Heyl -mcpe.me - // McHost : https://mchost.ru // Submitted by Evgeniy Subbotin mcdir.me mcdir.ru -mcpre.ru vps.mcdir.ru +mcpre.ru // Mediatech : https://mediatech.by // Submitted by Evgeniy Kozhuhovskiy @@ -14242,6 +14223,10 @@ mediatech.dev // Submitted by Michael Olson hra.health +// MedusaJS, Inc : https://medusajs.com/ +// Submitted by Stevche Radevski +medusajs.app + // Memset hosting : https://www.memset.com // Submitted by Tom Whitwell miniserver.com @@ -14257,12 +14242,9 @@ atmeta.com apps.fbsbx.com // MetaCentrum, CESNET z.s.p.o. : https://www.metacentrum.cz/en/ -// Submitted by Zdeněk Šustr +// Submitted by Zdeněk Šustr and Radim Janča *.cloud.metacentrum.cz custom.metacentrum.cz - -// MetaCentrum, CESNET z.s.p.o. : https://www.metacentrum.cz/en/ -// Submitted by Radim Janča flt.cloud.muni.cz usr.cloud.muni.cz @@ -14280,10 +14262,9 @@ co.pl // Microsoft Azure : https://home.azure *.azurecontainer.io azure-api.net +azure-mobile.net azureedge.net azurefd.net -azurewebsites.net -azure-mobile.net azurestaticapps.net 1.azurestaticapps.net 2.azurestaticapps.net @@ -14297,31 +14278,36 @@ eastasia.azurestaticapps.net eastus2.azurestaticapps.net westeurope.azurestaticapps.net westus2.azurestaticapps.net +azurewebsites.net cloudapp.net trafficmanager.net blob.core.windows.net servicebus.windows.net +// MikroTik : https://mikrotik.com +// Submitted by MikroTik SysAdmin Team +routingthecloud.com +sn.mynetname.net +routingthecloud.net +routingthecloud.org + // minion.systems : http://minion.systems // Submitted by Robert Böttinger csx.cc -// Mintere : https://mintere.com/ -// Submitted by Ben Aubin -mintere.site - -// MobileEducation, LLC : https://joinforte.com -// Submitted by Grayson Martin -forte.id +// Mittwald CM Service GmbH & Co. KG : https://mittwald.de +// Submitted by Marco Rieger +mydbserver.com +webspaceconfig.de +mittwald.info +mittwaldserver.info +typo3server.info +project.space // MODX Systems LLC : https://modx.com // Submitted by Elizabeth Southwell modx.dev -// Mozilla Corporation : https://mozilla.com -// Submitted by Ben Francis -mozilla-iot.org - // Mozilla Foundation : https://mozilla.org/ // Submitted by glob bmoattachments.org @@ -14335,8 +14321,8 @@ pp.ru // Mythic Beasts : https://www.mythic-beasts.com // Submitted by Paul Cammish hostedpi.com -customer.mythic-beasts.com caracal.mythic-beasts.com +customer.mythic-beasts.com fentiger.mythic-beasts.com lynx.mythic-beasts.com ocelot.mythic-beasts.com @@ -14355,6 +14341,15 @@ ui.nabu.casa // Net at Work Gmbh : https://www.netatwork.de // Submitted by Jan Jaeschke cloud.nospamproxy.com +o365.cloud.nospamproxy.com + +// Net libre : https://www.netlib.re +// Submitted by Philippe PITTOLI +netlib.re + +// Netfy Domains : https://netfy.domains +// Submitted by Suranga Ranasinghe +netfy.app // Netlify : https://www.netlify.com // Submitted by Jessica Parsons @@ -14364,6 +14359,14 @@ netlify.app // Submitted by Trung Tran 4u.com +// NFSN, Inc. : https://www.NearlyFreeSpeech.NET/ +// Submitted by Jeff Wheelhouse +nfshost.com + +// NFT.Storage : https://nft.storage/ +// Submitted by Vasco Santos or +ipfs.nftstorage.link + // NGO.US Registry : https://nic.ngo.us // Submitted by Alstra Solutions Ltd. Networking Team ngo.us @@ -14385,7 +14388,7 @@ us.ngrok.io ngrok.pizza ngrok.pro -// Nicolaus Copernicus University in Torun - MSK TORMAN (https://www.man.torun.pl) +// Nicolaus Copernicus University in Torun - MSK TORMAN : https://www.man.torun.pl torun.pl // Nimbus Hosting Ltd. : https://www.nimbushosting.co.uk/ @@ -14393,13 +14396,97 @@ torun.pl nh-serv.co.uk nimsite.uk -// NFSN, Inc. : https://www.NearlyFreeSpeech.NET/ -// Submitted by Jeff Wheelhouse -nfshost.com +// No-IP.com : https://noip.com/ +// Submitted by Deven Reza +mmafan.biz +myftp.biz +no-ip.biz +no-ip.ca +fantasyleague.cc +gotdns.ch +3utilities.com +blogsyte.com +ciscofreak.com +damnserver.com +ddnsking.com +ditchyourip.com +dnsiskinky.com +dynns.com +geekgalaxy.com +health-carereform.com +homesecuritymac.com +homesecuritypc.com +myactivedirectory.com +mysecuritycamera.com +myvnc.com +net-freaks.com +onthewifi.com +point2this.com +quicksytes.com +securitytactics.com +servebeer.com +servecounterstrike.com +serveexchange.com +serveftp.com +servegame.com +servehalflife.com +servehttp.com +servehumour.com +serveirc.com +servemp3.com +servep2p.com +servepics.com +servequake.com +servesarcasm.com +stufftoread.com +unusualperson.com +workisboring.com +dvrcam.info +ilovecollege.info +no-ip.info +brasilia.me +ddns.me +dnsfor.me +hopto.me +loginto.me +noip.me +webhop.me +bounceme.net +ddns.net +eating-organic.net +mydissent.net +myeffect.net +mymediapc.net +mypsx.net +mysecuritycamera.net +nhlfan.net +no-ip.net +pgafan.net +privatizehealthinsurance.net +redirectme.net +serveblog.net +serveminecraft.net +sytes.net +cable-modem.org +collegefan.org +couchpotatofries.org +hopto.org +mlbfan.org +myftp.org +mysecuritycamera.org +nflfan.org +no-ip.org +read-books.org +ufcfan.org +zapto.org +no-ip.co.uk +golffan.us +noip.us +pointto.us -// NFT.Storage : https://nft.storage/ -// Submitted by Vasco Santos or -ipfs.nftstorage.link +// NodeArt : https://nodeart.io +// Submitted by Konstantin Nosov +stage.nodeart.io // Noop : https://noop.app // Submitted by Nathaniel Schweinberg @@ -14418,18 +14505,16 @@ noop.app // Submitted by Laurent Pellegrino noticeable.news +// Notion Labs, Inc : https://www.notion.so/ +// Submitted by Jess Yao +notion.site + // Now-DNS : https://now-dns.com // Submitted by Steve Russell dnsking.ch mypi.co -n4t.co -001www.com -ddnslive.com myiphost.com forumz.info -16-b.it -32-b.it -64-b.it soundcast.me tcp4.me dnsup.net @@ -14440,130 +14525,32 @@ vpndns.net dynserv.org now-dns.org x443.pw -now-dns.top ntdll.top freeddns.us -crafting.xyz -zapto.xyz // nsupdate.info : https://www.nsupdate.info/ // Submitted by Thomas Waldmann nsupdate.info nerdpol.ovh -// No-IP.com : https://noip.com/ -// Submitted by Deven Reza -blogsyte.com -brasilia.me -cable-modem.org -ciscofreak.com -collegefan.org -couchpotatofries.org -damnserver.com -ddns.me -ditchyourip.com -dnsfor.me -dnsiskinky.com -dvrcam.info -dynns.com -eating-organic.net -fantasyleague.cc -geekgalaxy.com -golffan.us -health-carereform.com -homesecuritymac.com -homesecuritypc.com -hopto.me -ilovecollege.info -loginto.me -mlbfan.org -mmafan.biz -myactivedirectory.com -mydissent.net -myeffect.net -mymediapc.net -mypsx.net -mysecuritycamera.com -mysecuritycamera.net -mysecuritycamera.org -net-freaks.com -nflfan.org -nhlfan.net -no-ip.ca -no-ip.co.uk -no-ip.net -noip.us -onthewifi.com -pgafan.net -point2this.com -pointto.us -privatizehealthinsurance.net -quicksytes.com -read-books.org -securitytactics.com -serveexchange.com -servehumour.com -servep2p.com -servesarcasm.com -stufftoread.com -ufcfan.org -unusualperson.com -workisboring.com -3utilities.com -bounceme.net -ddns.net -ddnsking.com -gotdns.ch -hopto.org -myftp.biz -myftp.org -myvnc.com -no-ip.biz -no-ip.info -no-ip.org -noip.me -redirectme.net -servebeer.com -serveblog.net -servecounterstrike.com -serveftp.com -servegame.com -servehalflife.com -servehttp.com -serveirc.com -serveminecraft.net -servemp3.com -servepics.com -servequake.com -sytes.net -webhop.me -zapto.org - -// NodeArt : https://nodeart.io -// Submitted by Konstantin Nosov -stage.nodeart.io - -// Nucleos Inc. : https://nucleos.com -// Submitted by Piotr Zduniak -pcloud.host - -// NYC.mn : http://www.information.nyc.mn -// Submitted by Matthew Brown +// NYC.mn : https://dot.nyc.mn/ +// Submitted by NYC.mn Subdomain Service nyc.mn // O3O.Foundation : https://o3o.foundation/ -// Submitted by the prvcy.page Registry Team +// Submitted by the prvcy.page Registry Team prvcy.page +// Obl.ong : https://obl.ong +// Submitted by Reese Armstrong +obl.ong + // Observable, Inc. : https://observablehq.com // Submitted by Mike Bostock +observablehq.cloud static.observableusercontent.com -// Octopodal Solutions, LLC. : https://ulterius.io/ -// Submitted by Andrew Sampson -cya.gg - -// OMG.LOL : +// OMG.LOL : https://omg.lol // Submitted by Adam Newbold omg.lol @@ -14571,38 +14558,39 @@ omg.lol // Submitted by Cole Estep cloudycluster.net -// OmniWe Limited: https://omniwe.com +// OmniWe Limited : https://omniwe.com // Submitted by Vicary Archangel omniwe.site -// One.com: https://www.one.com/ +// One.com : https://www.one.com/ // Submitted by Jacob Bunk Nielsen -123hjemmeside.dk -123hjemmeside.no -123homepage.it -123kotisivu.fi -123minsida.se -123miweb.es -123paginaweb.pt -123siteweb.fr 123webseite.at -123webseite.de 123website.be +simplesite.com.br 123website.ch +simplesite.com +123webseite.de +123hjemmeside.dk +123miweb.es +123kotisivu.fi +123siteweb.fr +simplesite.gr +123homepage.it 123website.lu 123website.nl +123hjemmeside.no service.one -simplesite.com -simplesite.com.br -simplesite.gr simplesite.pl +123paginaweb.pt +123minsida.se -// One Fold Media : http://www.onefoldmedia.com/ -// Submitted by Eddie Jones -nid.io +// ONID : https://get.onid.ca +// Submitted by ONID Engineering Team +onid.ca // Open Domains : https://open-domains.net // Submitted by William Harrison +is-a-fullstack.dev is-cool.dev is-not-a.dev localplayer.dev @@ -14616,7 +14604,13 @@ opensocial.site // Submitted by Sven Marnach opencraft.hosting -// OpenResearch GmbH: https://openresearch.com/ +// OpenHost : https://registry.openhost.uk +// Submitted by OpenHost Registry Team +16-b.it +32-b.it +64-b.it + +// OpenResearch GmbH : https://openresearch.com/ // Submitted by Philipp Schmid orsites.com @@ -14624,17 +14618,28 @@ orsites.com // Submitted by Yngve Pettersen operaunite.com +// Oracle Dyn : https://cloud.oracle.com/home https://dyn.com/dns/ +// Submitted by Gregory Drake +// Note: This is intended to also include customer-oci.com due to wildcards implicitly including the current label +*.customer-oci.com +*.oci.customer-oci.com +*.ocp.customer-oci.com +*.ocs.customer-oci.com +*.oraclecloudapps.com +*.oraclegovcloudapps.com +*.oraclegovcloudapps.uk + // Orange : https://www.orange.com // Submitted by Alexandre Linte tech.orange // OsSav Technology Ltd. : https://ossav.com/ -// TLD Nic: http://nic.can.re - TLD Whois Server: whois.can.re // Submitted by OsSav Technology Ltd. +// https://nic.can.re can.re -// Oursky Limited : https://authgear.com/, https://skygear.io/ -// Submitted by Authgear Team , Skygear Developer +// Oursky Limited : https://authgear.com/ +// Submitted by Authgear Team & Skygear Developer authgear-staging.com authgearapps.com skygearapp.com @@ -14643,12 +14648,12 @@ skygearapp.com // Submitted by Duarte Santos outsystemscloud.com -// OVHcloud: https://ovhcloud.com +// OVHcloud : https://ovhcloud.com // Submitted by Vincent Cassé -*.webpaas.ovh.net *.hosting.ovh.net +*.webpaas.ovh.net -// OwnProvider GmbH: http://www.ownprovider.com +// OwnProvider GmbH : http://www.ownprovider.com // Submitted by Jan Moennich ownprovider.com own.pm @@ -14669,38 +14674,31 @@ oy.lc // Submitted by Derek Myers pgfog.com -// Pagefront : https://www.pagefronthq.com/ -// Submitted by Jason Kriss -pagefrontapp.com - // PageXL : https://pagexl.com // Submitted by Yann Guichard pagexl.com +// Pantheon Systems, Inc. : https://pantheon.io/ +// Submitted by Gary Dylina +gotpantheon.com +pantheonsite.io + // Paywhirl, Inc : https://paywhirl.com/ // Submitted by Daniel Netzer *.paywhirl.com -// pcarrier.ca Software Inc: https://pcarrier.ca/ +// pcarrier.ca Software Inc : https://pcarrier.ca/ // Submitted by Pierre Carrier *.xmit.co xmit.dev +madethis.site srv.us gh.srv.us gl.srv.us -// .pl domains (grandfathered) -art.pl -gliwice.pl -krakow.pl -poznan.pl -wroc.pl -zakopane.pl - -// Pantheon Systems, Inc. : https://pantheon.io/ -// Submitted by Gary Dylina -pantheonsite.io -gotpantheon.com +// PE Ulyanov Kirill Sergeevich : https://airy.host +// Submitted by Kirill Ulyanov +lk3.ru // Peplink | Pepwave : http://peplink.com/ // Submitted by Steve Leung @@ -14710,10 +14708,6 @@ mypep.link // Submitted by Kenneth Van Alstyne perspecta.cloud -// PE Ulyanov Kirill Sergeevich : https://airy.host -// Submitted by Kirill Ulyanov -lk3.ru - // Planet-Work : https://www.planet-work.com/ // Submitted by Frédéric VANNIÈRE on-web.fr @@ -14728,26 +14722,15 @@ us.platform.sh *.platformsh.site *.tst.site -// Platter: https://platter.dev +// Platter : https://platter.dev // Submitted by Patrick Flor -platter-app.com platter-app.dev platterp.us -// Plesk : https://www.plesk.com/ -// Submitted by Anton Akhtyamov -pdns.page -plesk.page -pleskns.com - // Pley AB : https://www.pley.com/ // Submitted by Henning Pohl pley.games -// Port53 : https://port53.io/ -// Submitted by Maximilian Schieder -dyn53.io - // Porter : https://porter.run/ // Submitted by Rudraksh MK onporter.run @@ -14763,8 +14746,8 @@ pstmn.io mock.pstmn.io httpbin.org -//prequalifyme.today : https://prequalifyme.today -//Submitted by DeepakTiwari deepak@ivylead.io +// prequalifyme.today : https://prequalifyme.today +// Submitted by DeepakTiwari deepak@ivylead.io prequalifyme.today // prgmr.com : https://prgmr.com/ @@ -14775,64 +14758,37 @@ xen.prgmr.com // Submitted by registry priv.at -// Protocol Labs : https://protocol.ai/ -// Submitted by Michael Burns -*.dweb.link +// PROJECT ELIV : https://eliv.kr/ +// Submitted by PROJECT ELIV Domain Team +c01.kr +eliv-dns.kr +mmv.kr +vki.kr + +// project-study : https://project-study.com +// Submitted by yumenewa +dev.project-study.com // Protonet GmbH : http://protonet.io // Submitted by Martin Meier protonet.io -// Publication Presse Communication SARL : https://ppcom.fr -// Submitted by Yaacov Akiba Slama -chirurgiens-dentistes-en-france.fr -byen.site - -// pubtls.org: https://www.pubtls.org -// Submitted by Kor Nielsen -pubtls.org - -// PythonAnywhere LLP: https://www.pythonanywhere.com -// Submitted by Giles Thomas -pythonanywhere.com -eu.pythonanywhere.com - -// QOTO, Org. -// Submitted by Jeffrey Phillips Freeman -qoto.io - -// Qualifio : https://qualifio.com/ -// Submitted by Xavier De Cock -qualifioapp.com - -// Quality Unit: https://qualityunit.com -// Submitted by Vasyl Tsalko -ladesk.com - -// QuickBackend: https://www.quickbackend.com -// Submitted by Dani Biro -qbuser.com - -// Rad Web Hosting: https://radwebhosting.com -// Submitted by Scott Claeys -cloudsite.builders -myradweb.net -servername.us - -// Redgate Software: https://red-gate.com -// Submitted by Andrew Farries -instances.spawn.cc - -// Redstar Consultants : https://www.redstarconsultants.com/ -// Submitted by Jons Slemmer -instantcloud.cn +// Publication Presse Communication SARL : https://ppcom.fr +// Submitted by Yaacov Akiba Slama +chirurgiens-dentistes-en-france.fr +byen.site -// Russian Academy of Sciences -// Submitted by Tech Support -ras.ru +// pubtls.org : https://www.pubtls.org +// Submitted by Kor Nielsen +pubtls.org + +// PythonAnywhere LLP : https://www.pythonanywhere.com +// Submitted by Giles Thomas +pythonanywhere.com +eu.pythonanywhere.com // QA2 -// Submitted by Daniel Dent (https://www.danieldent.com/) +// Submitted by Daniel Dent : https://www.danieldent.com/ qa2.com // QCX @@ -14849,6 +14805,22 @@ mycloudnas.com mynascloud.com myqnapcloud.com +// QOTO, Org. +// Submitted by Jeffrey Phillips Freeman +qoto.io + +// Qualifio : https://qualifio.com/ +// Submitted by Xavier De Cock +qualifioapp.com + +// Quality Unit : https://qualityunit.com +// Submitted by Vasyl Tsalko +ladesk.com + +// QuickBackend : https://www.quickbackend.com +// Submitted by Dani Biro +qbuser.com + // Quip : https://quip.com // Submitted by Patrick Linehan *.quipelements.com @@ -14863,28 +14835,49 @@ vaporcloud.io rackmaze.com rackmaze.net -// Rakuten Games, Inc : https://dev.viberplay.io -// Submitted by Joshua Zhang -g.vbrplsbx.io +// Rad Web Hosting : https://radwebhosting.com +// Submitted by Scott Claeys +cloudsite.builders +myradweb.net +servername.us + +// Radix FZC : http://domains.in.net +// Submitted by Gavin Brown +web.in +in.net + +// Raidboxes GmbH : https://raidboxes.de +// Submitted by Auke Tembrink +myrdbx.io +site.rb-hosting.io // Rancher Labs, Inc : https://rancher.com // Submitted by Vincent Fiduccia -*.on-k3s.io *.on-rancher.cloud +*.on-k3s.io *.on-rio.io +// RavPage : https://www.ravpage.co.il +// Submitted by Roni Horowitz +ravpage.co.il + // Read The Docs, Inc : https://www.readthedocs.org // Submitted by David Fischer +readthedocs-hosted.com readthedocs.io // Red Hat, Inc. OpenShift : https://openshift.redhat.com/ // Submitted by Tim Kramer rhcloud.com +// Redgate Software : https://red-gate.com +// Submitted by Andrew Farries +instances.spawn.cc + // Render : https://render.com // Submitted by Anurag Goel -app.render.com onrender.com +app.render.com // Repl.it : https://repl.it // Submitted by Lincoln Bergeson @@ -14932,11 +14925,6 @@ devices.resinstaging.io // Submitted by Chris Kastorff hzc.io -// Revitalised Limited : http://www.revitalised.co.uk -// Submitted by Jack Price -wellbeingzone.eu -wellbeingzone.co.uk - // Rico Developments Limited : https://adimo.co // Submitted by Colin Brown adimo.co.uk @@ -14945,6 +14933,16 @@ adimo.co.uk // Submitted by Micah Anderson itcouldbewor.se +// Roar Domains LLC : https://roar.basketball/ +// Submitted by Gavin Brown +aus.basketball +nz.basketball + +// ROBOT PAYMENT INC. : https://www.robotpayment.co.jp/ +// Submitted by Kentaro Takamori +subsc-pay.com +subsc-pay.net + // Rochester Institute of Technology : http://www.rit.edu/ // Submitted by Jennifer Herting git-pages.rit.edu @@ -14953,7 +14951,13 @@ git-pages.rit.edu // Submitted by Neil Hanlon rocky.page -// Rusnames Limited: http://rusnames.ru/ +// Ruhr University Bochum : https://www.ruhr-uni-bochum.de/ +// Submitted by Andreas Jobs +rub.de +ruhr-uni-bochum.de +io.noc.ruhr-uni-bochum.de + +// Rusnames Limited : http://rusnames.ru/ // Submitted by Sergey Zotov биз.рус ком.рус @@ -14966,6 +14970,14 @@ rocky.page спб.рус я.рус +// Russian Academy of Sciences +// Submitted by Tech Support +ras.ru + +// Sakura Frp : https://www.natfrp.com +// Submitted by Bobo Liu +nyat.app + // SAKURA Internet Inc. : https://www.sakura.ad.jp/ // Submitted by Internet Service Department 180r.com @@ -15016,12 +15028,20 @@ x0.to from.tv sakura.tv -// Salesforce.com, Inc. https://salesforce.com/ -// Submitted by Michael Biven and Aaron Romeo +// Salesforce.com, Inc. : https://salesforce.com/ +// Submitted by Salesforce Public Suffix List Team *.builder.code.com *.dev-builder.code.com *.stg-builder.code.com *.001.test.code-builder-stg.platform.salesforce.com +*.d.crm.dev +*.w.crm.dev +*.wa.crm.dev +*.wb.crm.dev +*.wc.crm.dev +*.wd.crm.dev +*.we.crm.dev +*.wf.crm.dev // Sandstorm Development Group, Inc. : https://sandcats.io/ // Submitted by Asheesh Laroia @@ -15029,8 +15049,8 @@ sandcats.io // SBE network solutions GmbH : https://www.sbe.de/ // Submitted by Norman Meilick -logoip.de logoip.com +logoip.de // Scaleway : https://www.scaleway.com/ // Submitted by Rémy Léone @@ -15067,7 +15087,7 @@ dedibox.fr // Submitted by Hanno Böck schokokeks.net -// Scottish Government: https://www.gov.scot +// Scottish Government : https://www.gov.scot // Submitted by Martin Ellis gov.scot service.gov.scot @@ -15101,17 +15121,17 @@ seidat.net // Submitted by Yuriy Romadin sellfy.store +// Sendmsg : https://www.sendmsg.co.il +// Submitted by Assaf Stern +minisite.ms + // Senseering GmbH : https://www.senseering.de // Submitted by Felix Mönckemeyer senseering.net -// Sendmsg: https://www.sendmsg.co.il -// Submitted by Assaf Stern -minisite.ms - -// Service Magnet : https://myservicemagnet.com -// Submitted by Dave Sanders -magnet.page +// Servebolt AS : https://servebolt.com +// Submitted by Daniel Kjeserud +servebolt.cloud // Service Online LLC : http://drs.ua/ // Submitted by Serhii Bulakh @@ -15119,19 +15139,14 @@ biz.ua co.ua pp.ua +// Shanghai Accounting Society : https://www.sasf.org.cn +// Submitted by Information Administration +as.sh.cn + // Sheezy.Art : https://sheezy.art // Submitted by Nyoom sheezy.games -// Shift Crypto AG : https://shiftcrypto.ch -// Submitted by alex -shiftcrypto.dev -shiftcrypto.io - -// ShiftEdit : https://shiftedit.net/ -// Submitted by Adam Jimenez -shiftedit.io - // Shopblocks : http://www.shopblocks.com/ // Submitted by Alex Bowers myshopblocks.com @@ -15146,6 +15161,7 @@ shopitsite.com // shopware AG : https://shopware.com // Submitted by Jens Küper +shopware.shop shopware.store // Siemens Mobility GmbH @@ -15164,13 +15180,11 @@ vipsinaapp.com // Submitted by Skylar Challand siteleaf.net -// Skyhat : http://www.skyhat.io -// Submitted by Shante Adam -bounty-full.com -alpha.bounty-full.com -beta.bounty-full.com +// Small Technology Foundation : https://small-tech.org +// Submitted by Aral Balkan +small-web.org -// Smallregistry by Promopixel SARL: https://www.smallregistry.net +// Smallregistry by Promopixel SARL : https://www.smallregistry.net // Former AFNIC's SLDs // Submitted by Jérôme Lipowicz aeroport.fr @@ -15184,10 +15198,6 @@ pharmacien.fr port.fr veterinaire.fr -// Small Technology Foundation : https://small-tech.org -// Submitted by Aral Balkan -small-web.org - // Smoove.io : https://www.smoove.io/ // Submitted by Dan Kozak vp4.me @@ -15203,65 +15213,28 @@ streamlitapp.com // Submitted by Ian Streeter try-snowplow.com -// SourceHut : https://sourcehut.org -// Submitted by Drew DeVault -srht.site - -// StackBlitz : https://stackblitz.com -// Submitted by Dominic Elm -w-corp-staticblitz.com -w-credentialless-staticblitz.com -w-staticblitz.com - -// Stackhero : https://www.stackhero.io -// Submitted by Adrien Gillon -stackhero-network.com - -// STACKIT : https://www.stackit.de/en/ -// Submitted by STACKIT-DNS Team (Simon Stier) -runs.onstackit.cloud -stackit.gg -stackit.rocks -stackit.run -stackit.zone - -// Staclar : https://staclar.com -// Submitted by Q Misell -musician.io -// Submitted by Matthias Merkel -novecore.site - -// staticland : https://static.land -// Submitted by Seth Vincent -static.land -dev.static.land -sites.static.land - -// Storebase : https://www.storebase.io -// Submitted by Tony Schirmer -storebase.store - -// Strategic System Consulting (eApps Hosting): https://www.eapps.com/ -// Submitted by Alex Oancea -vps-host.net -atl.jelastic.vps-host.net -njs.jelastic.vps-host.net -ric.jelastic.vps-host.net +// Software Consulting Michal Zalewski : https://www.mafelo.com +// Submitted by Michal Zalewski +mafelo.net // Sony Interactive Entertainment LLC : https://sie.com/ // Submitted by David Coles playstation-cloud.com +// SourceHut : https://sourcehut.org +// Submitted by Drew DeVault +srht.site + // SourceLair PC : https://www.sourcelair.com // Submitted by Antonis Kalipetis apps.lair.io *.stolos.io -// SpaceKit : https://www.spacekit.io/ -// Submitted by Reza Akhavan -spacekit.io +// SparrowHost : https://sparrowhost.in/ +// Submitted by Anant Pandey +ind.mom -// SpeedPartner GmbH: https://www.speedpartner.de/ +// SpeedPartner GmbH : https://www.speedpartner.de/ // Submitted by Stefan Neufeind customer.speedpartner.de @@ -15287,6 +15260,30 @@ myspreadshop.pl myspreadshop.se myspreadshop.co.uk +// StackBlitz : https://stackblitz.com +// Submitted by Dominic Elm +w-corp-staticblitz.com +w-credentialless-staticblitz.com +w-staticblitz.com + +// Stackhero : https://www.stackhero.io +// Submitted by Adrien Gillon +stackhero-network.com + +// STACKIT GmbH & Co. KG : https://www.stackit.de/en/ +// Submitted by STACKIT-DNS Team (Simon Stier) +runs.onstackit.cloud +stackit.gg +stackit.rocks +stackit.run +stackit.zone + +// Staclar : https://staclar.com +// Submitted by Q Misell +// Submitted by Matthias Merkel +musician.io +novecore.site + // Standard Library : https://stdlib.com // Submitted by Jacob Lee api.stdlib.com @@ -15304,6 +15301,15 @@ researched.cx tests.cx surveys.so +// Storacha Network : https://storacha.network +// Submitted by Alan Shaw +ipfs.storacha.link +ipfs.w3s.link + +// Storebase : https://www.storebase.io +// Submitted by Tony Schirmer +storebase.store + // Storipress : https://storipress.com // Submitted by Benno Liu storipress.app @@ -15312,22 +15318,34 @@ storipress.app // Submitted by Philip Hutchins storj.farm +// Strapi : https://strapi.io/ +// Submitted by Florent Baldino +strapiapp.com +media.strapiapp.com + +// Strategic System Consulting (eApps Hosting) : https://www.eapps.com/ +// Submitted by Alex Oancea +vps-host.net +atl.jelastic.vps-host.net +njs.jelastic.vps-host.net +ric.jelastic.vps-host.net + // Streak : https://streak.com // Submitted by Blake Kadatz streak-link.com streaklinks.com streakusercontent.com -// Studenten Net Twente : http://www.snt.utwente.nl/ -// Submitted by Silke Hofstra -utwente.io - // Student-Run Computing Facility : https://www.srcf.net/ // Submitted by Edwin Balani soc.srcf.net user.srcf.net -// Sub 6 Limited: http://www.sub6.com +// Studenten Net Twente : http://www.snt.utwente.nl/ +// Submitted by Silke Hofstra +utwente.io + +// Sub 6 Limited : http://www.sub6.com // Submitted by Dan Miller temp-dns.com @@ -15336,12 +15354,6 @@ temp-dns.com supabase.co supabase.in supabase.net -su.paba.se - -// Symfony, SAS : https://symfony.com/ -// Submitted by Fabien Potencier -*.s5y.io -*.sensiosite.cloud // Syncloud : https://syncloud.org // Submitted by Boris Rybalkin @@ -15363,33 +15375,41 @@ dsmynas.net familyds.net dsmynas.org familyds.org -vpnplus.to direct.quickconnect.to +vpnplus.to // Tabit Technologies Ltd. : https://tabit.cloud/ // Submitted by Oren Agiv -tabitorder.co.il -mytabit.co.il mytabit.com +mytabit.co.il +tabitorder.co.il // TAIFUN Software AG : http://taifun-software.de // Submitted by Bjoern Henke taifun-dns.de // Tailscale Inc. : https://www.tailscale.com -// Submitted by David Anderson -beta.tailscale.net +// Submitted by David Anderson ts.net *.c.ts.net -// TASK geographical domains (www.task.gda.pl/uslugi/dns) +// TASK geographical domains : https://task.gda.pl/en/services/for-entrepreneurs/ gda.pl gdansk.pl gdynia.pl med.pl sopot.pl -// team.blue https://team.blue +// Tave Creative Corp : https://tave.com/ +// Submitted by Adrian Ziemkowski +taveusercontent.com + +// tawk.to, Inc : https://www.tawk.to +// Submitted by tawk.to developer team +p.tawk.email +p.tawkto.email + +// team.blue : https://team.blue // Submitted by Cedric Dubois site.tb-hosting.com @@ -15411,11 +15431,11 @@ telebit.io reservd.com thingdustdata.com cust.dev.thingdust.io +reservd.dev.thingdust.io cust.disrec.thingdust.io +reservd.disrec.thingdust.io cust.prod.thingdust.io cust.testing.thingdust.io -reservd.dev.thingdust.io -reservd.disrec.thingdust.io reservd.testing.thingdust.io // ticket i/O GmbH : https://ticket.io @@ -15429,13 +15449,12 @@ azimuth.network tlon.network // Tor Project, Inc. : https://torproject.org -// Submitted by Antoine Beaupré torproject.net pages.torproject.net // TownNews.com : http://www.townnews.com // Submitted by Dustin Ward -bloxcms.com townnews-staging.com // TrafficPlex GmbH : https://www.trafficplex.de/ @@ -15461,14 +15480,11 @@ webspace.rocks lima.zone // TransIP : https://www.transip.nl -// Submitted by Rory Breuk +// Submitted by Rory Breuk and Cedric Dubois *.transurl.be *.transurl.eu -*.transurl.nl - -// TransIP: https://www.transip.nl -// Submitted by Cedric Dubois site.transip.me +*.transurl.nl // TuxFamily : http://tuxfamily.org // Submitted by TuxFamily administrators @@ -15477,8 +15493,6 @@ tuxfamily.org // TwoDNS : https://www.twodns.de/ // Submitted by TwoDNS-Support dd-dns.de -diskstation.eu -diskstation.org dray-dns.de draydns.de dyn-vpn.de @@ -15489,26 +15503,28 @@ my-wan.de syno-ds.de synology-diskstation.de synology-ds.de +diskstation.eu +diskstation.org // Typedream : https://typedream.com // Submitted by Putri Karunia typedream.app // Typeform : https://www.typeform.com -// Submitted by Sergi Ferriz +// Submitted by Typeform pro.typeform.com // Uberspace : https://uberspace.de // Submitted by Moritz Werner -uber.space *.uberspace.de +uber.space // UDR Limited : http://www.udr.hk.com // Submitted by registry hk.com -hk.org -ltd.hk inc.hk +ltd.hk +hk.org // UK Intis Telecom LTD : https://it.com // Submitted by ITComdomains @@ -15518,6 +15534,15 @@ it.com // Submitted by Simon Højberg unison-services.cloud +// United Gameserver GmbH : https://united-gameserver.de +// Submitted by Stefan Schwarz +virtual-user.de +virtualuser.de + +// United States Writing Corporation : https://uswriting.co +// Submitted by Andrew Sampson +obj.ag + // UNIVERSAL DOMAIN REGISTRY : https://www.udr.org.yt/ // see also: whois -h whois.udr.org.yt help // Submitted by Atanunu Igbunuroghene @@ -15527,50 +15552,57 @@ biz.wf sch.wf org.yt -// United Gameserver GmbH : https://united-gameserver.de -// Submitted by Stefan Schwarz -virtualuser.de -virtual-user.de +// University of Banja Luka : https://unibl.org +// Domains for Republic of Srpska administrative entity. +// Submitted by Marko Ivanovic +rs.ba -// Upli : https://upli.io -// Submitted by Lenny Bakkalian -upli.io +// University of Bielsko-Biala regional domain : http://dns.bielsko.pl/ +// Submitted by Marcin +bielsko.pl // urown.net : https://urown.net // Submitted by Hostmaster urown.cloud dnsupdate.info -// .US -// Submitted by Ed Moore -lib.de.us +// US REGISTRY LLC : http://us.org +// Submitted by Gavin Brown +us.org -// VeryPositive SIA : http://very.lv -// Submitted by Danko Aleksejevs -2038.io +// V.UA Domain Administrator : https://domain.v.ua/ +// Submitted by Serhii Rostilo +v.ua + +// Val Town, Inc : https://val.town/ +// Submitted by Tom MacWright +val.run +web.val.run // Vercel, Inc : https://vercel.com/ -// Submitted by Connor Davis +// Submitted by Max Leiter vercel.app +v0.build vercel.dev +vusercontent.net now.sh -// Viprinet Europe GmbH : http://www.viprinet.com -// Submitted by Simon Kissel -router.management +// VeryPositive SIA : http://very.lv +// Submitted by Danko Aleksejevs +2038.io // Virtual-Info : https://www.virtual-info.info/ // Submitted by Adnan RIHAN v-info.info -// Voorloper.com: https://voorloper.com +// Viva Republica, Inc. : https://toss.im/ +// Submitted by Deus Team +deus-canvas.com + +// Voorloper.com : https://voorloper.com // Submitted by Nathan van Bakel voorloper.cloud -// V.UA Domain Administrator : https://domain.v.ua/ -// Submitted by Serhii Rostilo -v.ua - // Vultr Objects : https://www.vultr.com/products/object-storage/ // Submitted by Niels Maumenee *.vultrobjects.com @@ -15584,46 +15616,72 @@ wafflecell.com webflow.io webflowtest.io -// WebHare bv: https://www.webhare.com/ +// WebHare bv : https://www.webhare.com/ // Submitted by Arnold Hendriks *.webhare.dev -// WebHotelier Technologies Ltd: https://www.webhotelier.net/ +// WebHotelier Technologies Ltd : https://www.webhotelier.net/ // Submitted by Apostolos Tsakpinis -reserve-online.net -reserve-online.com bookonline.app hotelwithflight.com +reserve-online.com +reserve-online.net + +// WebPros International, LLC : https://webpros.com/ +// Submitted by Nicolas Rochelemagne +cprapid.com +pleskns.com +wp2.host +pdns.page +plesk.page +cpanel.site +wpsquared.site -// WebWaddle Ltd: https://webwaddle.com/ +// WebWaddle Ltd : https://webwaddle.com/ // Submitted by Merlin Glander *.wadl.top -// WeDeploy by Liferay, Inc. : https://www.wedeploy.com -// Submitted by Henrique Vicente -wedeploy.io -wedeploy.me -wedeploy.sh - // Western Digital Technologies, Inc : https://www.wdc.com // Submitted by Jung Jin remotewd.com +// Whatbox Inc. : https://whatbox.ca/ +// Submitted by Anthony Ryan +box.ca + // WIARD Enterprises : https://wiardweb.com // Submitted by Kidd Hustle pages.wiardweb.com // Wikimedia Labs : https://wikitech.wikimedia.org // Submitted by Arturo Borrero Gonzalez -wmflabs.org toolforge.org wmcloud.org +wmflabs.org + +// William Harrison : https://wharrison.com.au +// Submitted by William Harrison +wdh.app +hrsn.dev + +// Windsurf : https://windsurf.com +// Submitted by Douglas Chen +windsurf.app +windsurf.build // WISP : https://wisp.gg // Submitted by Stepan Fedotov panel.gg daemon.panel.gg +// Wix.com, Inc. : https://www.wix.com +// Submitted by Shahar Talmi / Alon Kochba +wixsite.com +wixstudio.com +editorx.io +wixstudio.io +wix.run + // Wizard Zines : https://wizardzines.com // Submitted by Julia Evans messwithdns.com @@ -15649,14 +15707,7 @@ weeklylottery.org.uk wpenginepowered.com js.wpenginepowered.com -// Wix.com, Inc. : https://www.wix.com -// Submitted by Shahar Talmi -wixsite.com -editorx.io -wixstudio.io -wix.run - -// XenonCloud GbR: https://xenoncloud.net +// XenonCloud GbR : https://xenoncloud.net // Submitted by Julian Uphoff half.host @@ -15672,7 +15723,7 @@ cistron.nl demon.nl xs4all.space -// Yandex.Cloud LLC: https://cloud.yandex.com +// Yandex.Cloud LLC : https://cloud.yandex.com // Submitted by Alexander Lodin yandexcloud.net storage.yandexcloud.net @@ -15686,16 +15737,6 @@ official.academy // Submitted by Stefano Rivera yolasite.com -// Yombo : https://yombo.net -// Submitted by Mitch Schwenk -ybo.faith -yombo.me -homelink.one -ybo.party -ybo.review -ybo.science -ybo.trade - // Yunohost : https://yunohost.org // Submitted by Valentin Grimaud ynh.fr @@ -15711,6 +15752,14 @@ za.org // Submitted by Julian Alker zap.cloud +// Zeabur : https://zeabur.com/ +// Submitted by Zeabur Team +zeabur.app + +// Zerops : https://zerops.io/ +// Submitted by Zerops Team +*.zerops.app + // Zine EOOD : https://zine.bg/ // Submitted by Martin Angelov bss.design @@ -15721,4 +15770,8 @@ basicserver.io virtualserver.io enterprisecloud.nu +// Zone.ID: https://zone.id +// Submitted by Gx1.org +zone.id + // ===END PRIVATE DOMAINS=== diff --git a/src/java.base/share/legal/public_suffix.md b/src/java.base/share/legal/public_suffix.md index 02481558af65..26ab8a69a23f 100644 --- a/src/java.base/share/legal/public_suffix.md +++ b/src/java.base/share/legal/public_suffix.md @@ -11,7 +11,7 @@ If you do not wish to use the Public Suffix List, you may remove the The Source Code of this file is available under the Mozilla Public License, v. 2.0 and is located at -https://raw.githubusercontent.com/publicsuffix/list/1cbd6e71a9b83620b1d0b11e49d3d9ff48c27e22/public_suffix_list.dat. +https://raw.githubusercontent.com/publicsuffix/list/823beb1425def931c8b0b170a6bc33b424c3f9b0/public_suffix_list.dat. If a copy of the MPL was not distributed with this file, you can obtain one at https://mozilla.org/MPL/2.0/. diff --git a/test/jdk/sun/security/util/RegisteredDomain/ParseNames.java b/test/jdk/sun/security/util/RegisteredDomain/ParseNames.java index 904f672ba401..f3811511e530 100644 --- a/test/jdk/sun/security/util/RegisteredDomain/ParseNames.java +++ b/test/jdk/sun/security/util/RegisteredDomain/ParseNames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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,7 +23,7 @@ /* * @test - * @bug 8228969 8244087 8255266 8302182 8331864 + * @bug 8228969 8244087 8255266 8302182 8331864 8357062 * @modules java.base/sun.security.util * @summary unit test for RegisteredDomain */ diff --git a/test/jdk/sun/security/util/RegisteredDomain/tests.dat b/test/jdk/sun/security/util/RegisteredDomain/tests.dat index 7fe95c979ea8..7d395c62a742 100644 --- a/test/jdk/sun/security/util/RegisteredDomain/tests.dat +++ b/test/jdk/sun/security/util/RegisteredDomain/tests.dat @@ -72,9 +72,9 @@ w.foo.公司.cn 公司.cn foo.公司.cn www.foo.com com foo.com z.www.foo.com com foo.com com com null -ar.com ar.com null -site.ar.com ar.com site.ar.com -w.site.ar.com ar.com site.ar.com +us.com us.com null +site.us.com us.com site.us.com +w.site.us.com us.com site.us.com # fj (no longer *.fj) foo.gov.fj gov.fj foo.gov.fj @@ -109,6 +109,10 @@ p.w.foo.kawasaki.jp foo.kawasaki.jp w.foo.kawasaki.jp city.kawasaki.jp kawasaki.jp city.kawasaki.jp w.city.kawasaki.jp kawasaki.jp city.kawasaki.jp +# kr +ai.kr ai.kr null +foo.ai.kr ai.kr foo.ai.kr + # kw www.example.kw kw example.kw www.example.com.kw com.kw example.com.kw @@ -151,6 +155,7 @@ w.s.k12.oh.us k12.oh.us s.k12.oh.us s.k12.oh.us k12.oh.us s.k12.oh.us s.pvt.k12.ma.us pvt.k12.ma.us s.pvt.k12.ma.us w.s.pvt.k12.ma.us pvt.k12.ma.us s.pvt.k12.ma.us +kids.us us kids.us # vn site.com.vn com.vn site.com.vn From f17c3151097d0df44943defc3e5b1bd9e48250c0 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:36:43 +0000 Subject: [PATCH 051/223] 8363949: Incorrect jtreg header in MonitorWithDeadObjectTest.java Backport-of: c4fbfa21030c9a0e8a3e0eed1b0a0988eba08ddb --- .../jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/hotspot/jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java b/test/hotspot/jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java index 31aeaccf07a4..7f9b44a4a76b 100644 --- a/test/hotspot/jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java +++ b/test/hotspot/jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java @@ -32,20 +32,20 @@ */ /* - * @requires os.family != "windows" & os.family != "aix" * @test id=DetachThread + * @requires os.family != "windows" & os.family != "aix" * @run main/othervm/native MonitorWithDeadObjectTest 0 */ /* - * @requires os.family != "windows" & os.family != "aix" * @test id=DumpThreadsBeforeDetach + * @requires os.family != "windows" & os.family != "aix" * @run main/othervm/native MonitorWithDeadObjectTest 1 */ /* - * @requires os.family != "windows" & os.family != "aix" * @test id=DumpThreadsAfterDetach + * @requires os.family != "windows" & os.family != "aix" * @run main/othervm/native MonitorWithDeadObjectTest 2 */ From 7ee16740cc05d983bf4c24957dd2dc6e2fdb9009 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:39:37 +0000 Subject: [PATCH 052/223] 8369683: Exclude runtime/Monitor/MonitorWithDeadObjectTest.java#DumpThreadsBeforeDetach on Alpine Linux debug Backport-of: 17c13e53aff16b294c7c0286ccb6ea3054b1de91 --- .../jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java b/test/hotspot/jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java index 7f9b44a4a76b..b1e6d0aa8c7d 100644 --- a/test/hotspot/jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java +++ b/test/hotspot/jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java @@ -39,7 +39,8 @@ /* * @test id=DumpThreadsBeforeDetach - * @requires os.family != "windows" & os.family != "aix" + * @comment Temporarily exclude on Musl-C debug until JDK-8366133 is fixed. + * @requires os.family != "windows" & os.family != "aix" & (!vm.musl | !vm.debug) * @run main/othervm/native MonitorWithDeadObjectTest 1 */ From c02e8a1a36b03bab1d49f02b69a93045a687e4f5 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:41:15 +0000 Subject: [PATCH 053/223] 8364315: Remove unused xml files from test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles Backport-of: b8acbc3ed8675ad4cc4b9dea69ee1e87c2a2ca45 --- .../javax/xml/transform/xmlfiles/lexical.xml | 24 ------------------- .../xml/transform/xmlfiles/out/doctypeGF.out | 21 ---------------- .../javax/xml/transform/xmlfiles/publish2.xml | 23 ------------------ .../org/xml/sax/xmlfiles/out/DTDHandlerGF.out | 2 -- 4 files changed, 70 deletions(-) delete mode 100644 test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/lexical.xml delete mode 100644 test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/doctypeGF.out delete mode 100644 test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/publish2.xml delete mode 100644 test/jaxp/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/DTDHandlerGF.out diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/lexical.xml b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/lexical.xml deleted file mode 100644 index e7ea712cdd96..000000000000 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/lexical.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - Publishers of the Music of New York Women Composers - The Publishers <![CDATA[<?xml>]]> - - - ACA - info@composers.com - http://www.composers.com/ -

- 170 West 74th St. - NY - NY - 10023 -
- 212-362-8900 - 212-874-8605 - - &familytree; - - - diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/doctypeGF.out b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/doctypeGF.out deleted file mode 100644 index d4a9d98475f3..000000000000 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/doctypeGF.out +++ /dev/null @@ -1,21 +0,0 @@ - - - - Publishers of the Music of New York Women Composers - The Publishers - - ACA - info@composers.com - http://www.composers.com/ -
- 170 West 74th St. - NY - NY - 10023 -
- 212-362-8900 - 212-874-8605 - - -
-
diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/publish2.xml b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/publish2.xml deleted file mode 100644 index 789983f79f31..000000000000 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/publish2.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - Publishers of the Music of New York Women Composers - The Publishers - - ACA - info@composers.com - http://www.composers.com/ -
- 170 West 74th St. - NY - NY - 10023 -
- 212-362-8900 - 212-874-8605 - - &familytree; -
-
- diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/DTDHandlerGF.out b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/DTDHandlerGF.out deleted file mode 100644 index f4b4241dd397..000000000000 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/DTDHandlerGF.out +++ /dev/null @@ -1,2 +0,0 @@ -In unparsedEntityDecl... name:logo publicId:null systemId:http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/images/tool.gif notationName:gif -In notationDecl... name:gif publicId:null systemId:http://sardinia/ From 7d92135217c6d6e6b778bcc4bc3b2747db4400cd Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:43:39 +0000 Subject: [PATCH 054/223] 8298823: [macos] java/awt/Mouse/EnterExitEvents/DragWindowTest.java continues to fail with "No MouseReleased event on label!" Reviewed-by: mbaesken Backport-of: fa6e884105ac247b3b83a5a2329f9c18888bd7d0 --- .../Mouse/EnterExitEvents/DragWindowTest.java | 113 +++++++----------- 1 file changed, 45 insertions(+), 68 deletions(-) diff --git a/test/jdk/java/awt/Mouse/EnterExitEvents/DragWindowTest.java b/test/jdk/java/awt/Mouse/EnterExitEvents/DragWindowTest.java index 4f789668c4a5..2a77f294298d 100644 --- a/test/jdk/java/awt/Mouse/EnterExitEvents/DragWindowTest.java +++ b/test/jdk/java/awt/Mouse/EnterExitEvents/DragWindowTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -26,11 +26,8 @@ * @key headful * @bug 7154048 * @summary Window created under a mouse does not receive mouse enter event. - * Mouse Entered/Exited events are wrongly generated during dragging the window - * from one component to another - * @library ../../regtesthelpers - * @build Util - * @author alexandr.scherbatiy area=awt.event + * Mouse Entered/Exited events are wrongly generated during dragging the + * window from one component to another * @run main DragWindowTest */ @@ -50,76 +47,67 @@ import javax.swing.JPanel; import javax.swing.SwingUtilities; -import java.util.concurrent.Callable; - -import test.java.awt.regtesthelpers.Util; - public class DragWindowTest { - private static volatile int dragWindowMouseEnteredCount = 0; - private static volatile int dragWindowMouseReleasedCount = 0; private static volatile int buttonMouseEnteredCount = 0; private static volatile int labelMouseReleasedCount = 0; + + private static volatile Point pointToClick; + private static volatile Point pointToDrag; + private static MyDragWindow dragWindow; private static JLabel label; private static JButton button; + private static JFrame frame; public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + robot.setAutoDelay(100); - Robot robot = new Robot(); - robot.setAutoDelay(100); - - SwingUtilities.invokeAndWait(new Runnable() { + SwingUtilities.invokeAndWait(DragWindowTest::createAndShowGUI); - @Override - public void run() { - createAndShowGUI(); - } - }); + robot.delay(250); + robot.waitForIdle(); - robot.delay(250); - robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + pointToClick = getCenterPoint(label); + pointToDrag = getCenterPoint(button); + }); - Point pointToClick = Util.invokeOnEDT(new Callable() { + robot.mouseMove(pointToClick.x, pointToClick.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.delay(250); - @Override - public Point call() throws Exception { - return getCenterPoint(label); + if (dragWindowMouseEnteredCount != 1) { + throw new RuntimeException("No MouseEntered event on Drag Window!"); } - }); + // Reset entered count to check if mouse entered starting from here + buttonMouseEnteredCount = 0; + robot.mouseMove(pointToDrag.x, pointToDrag.y); + robot.waitForIdle(); + robot.delay(250); - robot.mouseMove(pointToClick.x, pointToClick.y); - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.waitForIdle(); - - if (dragWindowMouseEnteredCount != 1) { - throw new RuntimeException("No MouseEntered event on Drag Window!"); - } - - Point pointToDrag = Util.invokeOnEDT(new Callable() { - - @Override - public Point call() throws Exception { - button.addMouseListener(new ButtonMouseListener()); - return getCenterPoint(button); + if (buttonMouseEnteredCount != 0) { + throw new RuntimeException("Extra MouseEntered event on button!"); } - }); - - robot.mouseMove(pointToDrag.x, pointToDrag.y); - robot.waitForIdle(); - - if (buttonMouseEnteredCount != 0) { - throw new RuntimeException("Extra MouseEntered event on button!"); - } - robot.mouseRelease(InputEvent.BUTTON1_MASK); - robot.waitForIdle(); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.delay(250); - if (labelMouseReleasedCount != 1) { - throw new RuntimeException("No MouseReleased event on label!"); + if (labelMouseReleasedCount != 1) { + throw new RuntimeException("No MouseReleased event on label!"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); } - } private static Point getCenterPoint(Component comp) { @@ -129,8 +117,7 @@ private static Point getCenterPoint(Component comp) { } private static void createAndShowGUI() { - - JFrame frame = new JFrame("Main Frame"); + frame = new JFrame("DragWindowTest"); frame.setSize(300, 200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -142,6 +129,7 @@ private static void createAndShowGUI() { button = new JButton("Button"); Panel panel = new Panel(new BorderLayout()); + button.addMouseListener(new ButtonMouseListener()); panel.add(label, BorderLayout.NORTH); panel.add(button, BorderLayout.CENTER); @@ -149,7 +137,6 @@ private static void createAndShowGUI() { frame.getContentPane().add(panel); frame.setLocationRelativeTo(null); frame.setVisible(true); - } private static Point getAbsoluteLocation(MouseEvent e) { @@ -157,7 +144,6 @@ private static Point getAbsoluteLocation(MouseEvent e) { } static class MyDragWindow extends Window { - static int d = 30; public MyDragWindow(Window parent, Point location) { @@ -176,8 +162,6 @@ void dragTo(Point point) { } static class LabelMouseListener extends MouseAdapter { - - Point origin; Window parent; public LabelMouseListener(Window parent) { @@ -210,20 +194,13 @@ public void mouseDragged(MouseEvent e) { } static class DragWindowMouseListener extends MouseAdapter { - @Override public void mouseEntered(MouseEvent e) { dragWindowMouseEnteredCount++; } - - @Override - public void mouseReleased(MouseEvent e) { - dragWindowMouseReleasedCount++; - } } static class ButtonMouseListener extends MouseAdapter { - @Override public void mouseEntered(MouseEvent e) { buttonMouseEnteredCount++; From 7ba43a08cbe8fe3551e00973dbe8e6c5bcb7a2a6 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:45:59 +0000 Subject: [PATCH 055/223] 8359978: Test javax/net/ssl/SSLSocket/Tls13PacketSize.java failed again with java.net.SocketException: An established connection was aborted by the software in your host machine Backport-of: 3cbcda5ff3d86d65554a470571c5d72047e8d7f6 --- test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java b/test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java index 0e34f4865ab8..16e009ed5895 100644 --- a/test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java +++ b/test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java @@ -107,5 +107,10 @@ protected void runClientApplication(SSLSocket socket) throws Exception { throw new Exception( "Server record plaintext exceeds 2^14 octets: " + extra); } + + int drained = 1; + while (drained < appData.length) { + drained += sslIS.read(appData, drained, appData.length - drained); + } } } From 6f855dd82b9481a635956b0b3bc3aa71d4d4a116 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:47:58 +0000 Subject: [PATCH 056/223] 8361606: ConsumeNextMnemonicKeyTypedTest.java fails on Windows: character typed with VK_A: a 8321303: Intermittent open/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java failure on Linux Backport-of: 07ea907e4fc8aa8fda01d8fe64c599f9d944eef9 --- .../classes/javax/swing/plaf/basic/BasicPopupMenuUI.java | 3 ++- test/jdk/ProblemList.txt | 1 - .../ConsumeNextMnemonicKeyTypedTest.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java index f9de13876bd8..5e00bc9723be 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -379,6 +379,7 @@ public void menuKeyPressed(MenuKeyEvent e) { } else if (item.isEnabled()) { // we have a menu item manager.clearSelectedPath(); + sun.awt.SunToolkit.consumeNextKeyTyped(e); item.doClick(); } e.consume(); diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 8f46ccb9c94d..c73f0486bf19 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -492,7 +492,6 @@ java/awt/Graphics2D/CopyAreaOOB.java 8343106 macosx-aarch64 java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java 8257529 windows-x64 java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeForModalDialogTest/ConsumeForModalDialogTest.java 8302787 windows-all java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedTest.java 8302787 windows-all -java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java 8321303 linux-all java/awt/Window/GetScreenLocation/GetScreenLocationTest.java 8225787 linux-x64 java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java 8266243 macosx-aarch64 diff --git a/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java b/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java index 5b2dc2844f17..60c05fb05a67 100644 --- a/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java +++ b/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -24,7 +24,7 @@ /* @test @key headful - @bug 6346690 + @bug 6346690 8361606 8321303 @summary Tests that key_typed is consumed after mnemonic key_pressed is handled for a menu item. @library /test/lib @build jdk.test.lib.Platform From cd5f755de8c1d134cf8e68b81ebc56e956771845 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:50:35 +0000 Subject: [PATCH 057/223] 8370732: Use WhiteBox.getWhiteBox().fullGC() to provoking gc for nsk/jvmti tests Backport-of: 54fe50210efe9ae6fad225b815cfdeb16c868115 --- .../AttachOnDemand/attach020/TEST.properties | 24 ------------------- .../attach020/TestDescription.java | 8 ++++--- .../attach020/attach020Target.java | 6 ++--- .../AttachOnDemand/attach021/TEST.properties | 24 ------------------- .../attach021/TestDescription.java | 6 +++-- .../attach021/attach021Target.java | 6 ++--- .../AttachOnDemand/attach022/TEST.properties | 24 ------------------- .../attach022/TestDescription.java | 6 +++-- .../attach022/attach022Target.java | 6 ++--- .../GarbageCollectionFinish/gcfinish001.java | 5 ++-- .../gcfinish001/TEST.properties | 24 ------------------- .../gcfinish001/TestDescription.java | 5 +++- .../GarbageCollectionStart/gcstart001.java | 11 +++------ .../gcstart001/TEST.properties | 24 ------------------- .../gcstart001/TestDescription.java | 5 +++- .../GarbageCollectionStart/gcstart002.java | 11 +++------ .../gcstart002/TEST.properties | 24 ------------------- .../gcstart002/TestDescription.java | 5 +++- .../scenarios/allocation/AP12/ap12t001.java | 10 ++++---- .../allocation/AP12/ap12t001/TEST.properties | 24 ------------------- .../AP12/ap12t001/TestDescription.java | 5 +++- .../jvmti/scenarios/events/EM02/em02t002.java | 5 ++-- .../events/EM02/em02t002/TEST.properties | 24 ------------------- .../events/EM02/em02t002/TestDescription.java | 5 +++- .../jvmti/scenarios/events/EM02/em02t006.java | 5 ++-- .../events/EM02/em02t006/TEST.properties | 24 ------------------- .../events/EM02/em02t006/TestDescription.java | 5 +++- 27 files changed, 65 insertions(+), 266 deletions(-) delete mode 100644 test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/TEST.properties delete mode 100644 test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/TEST.properties diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TEST.properties deleted file mode 100644 index 8b51b2a91156..000000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TEST.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2018, 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. -# - -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java index a729aa4d28f6..09d54318b602 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -37,7 +37,7 @@ * Test scenario: * - during initialization (from function Agent_OnAttach) agent starts auxiliary thread waiting on * raw monitor and enables GarbageCollectionStart and GarbageCollectionFinish events - * - target application provokes garbage collection (calls System.gc()) + * - target application provokes garbage collection (calls WhiteBox.getWhiteBox().fullGC()) * - agent receives event GarbageCollectionStart * - agent receives event GarbageCollectionFinish event and notifies waiting auxiliary thread * - notified auxiliary thread notifies target application that agent finished its work @@ -48,11 +48,13 @@ * /test/lib * @build nsk.share.aod.AODTestRunner * nsk.jvmti.AttachOnDemand.attach020.attach020Target + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * @run main/othervm/native * nsk.share.aod.AODTestRunner * -jdk ${test.jdk} * -target nsk.jvmti.AttachOnDemand.attach020.attach020Target - * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts}" + * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI" * -na attach020Agent00 */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java index a20cf935bae2..3a52a539b82b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -22,14 +22,14 @@ */ package nsk.jvmti.AttachOnDemand.attach020; -import nsk.share.ClassUnloader; import nsk.share.aod.TargetApplicationWaitingAgents; +import jdk.test.whitebox.WhiteBox; public class attach020Target extends TargetApplicationWaitingAgents { protected void targetApplicationActions() { log.display("Provoking garbage collection"); - ClassUnloader.eatMemory(); + WhiteBox.getWhiteBox().fullGC(); } public static void main(String[] args) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TEST.properties deleted file mode 100644 index 8b51b2a91156..000000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TEST.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2018, 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. -# - -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java index 5cf7b39729b6..3d8dc2f4e854 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -44,11 +44,13 @@ * /test/lib * @build nsk.share.aod.AODTestRunner * nsk.jvmti.AttachOnDemand.attach021.attach021Target + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * @run main/othervm/native * nsk.share.aod.AODTestRunner * -jdk ${test.jdk} * -target nsk.jvmti.AttachOnDemand.attach021.attach021Target - * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts}" + * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI" * -na attach021Agent00 */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java index d287616af69c..adb2c1941896 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -22,8 +22,8 @@ */ package nsk.jvmti.AttachOnDemand.attach021; -import nsk.share.ClassUnloader; import nsk.share.aod.TargetApplicationWaitingAgents; +import jdk.test.whitebox.WhiteBox; public class attach021Target extends TargetApplicationWaitingAgents { @@ -51,7 +51,7 @@ protected void targetApplicationActions() throws Throwable { try { if (createTaggedObject()) { log.display("Provoking GC"); - ClassUnloader.eatMemory(); + WhiteBox.getWhiteBox().fullGC(); } } finally { shutdownAgent(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TEST.properties deleted file mode 100644 index 8b51b2a91156..000000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TEST.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2018, 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. -# - -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java index 49b47585749f..5875f7a0f50e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -47,11 +47,13 @@ * /test/lib * @build nsk.share.aod.AODTestRunner * nsk.jvmti.AttachOnDemand.attach022.attach022Target + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * @run main/othervm/native * nsk.share.aod.AODTestRunner * -jdk ${test.jdk} * -target nsk.jvmti.AttachOnDemand.attach022.attach022Target - * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts}" + * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI" * -na attach022Agent00 */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java index eb80c0c2a4c7..3324855e622b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -22,8 +22,8 @@ */ package nsk.jvmti.AttachOnDemand.attach022; -import nsk.share.ClassUnloader; import nsk.share.aod.TargetApplicationWaitingAgents; +import jdk.test.whitebox.WhiteBox; class ClassForAllocationEventsTest { @@ -47,7 +47,7 @@ protected void targetApplicationActions() throws Throwable { } log.display("Provoking GC"); - ClassUnloader.eatMemory(); + WhiteBox.getWhiteBox().fullGC(); } finally { if (!shutdownAgent(TEST_ALLOCATION_NUMBER)) { setStatusFailed("Error happened during agent work, see error messages for details"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java index 433ee607d7c4..3e25000a2fbf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -27,6 +27,7 @@ import java.math.*; import nsk.share.*; +import jdk.test.whitebox.WhiteBox; /** * This test exercises the JVMTI event GarbageCollectionFinish. @@ -63,7 +64,7 @@ public static int run(String argv[], PrintStream out) { private int runThis(String argv[], PrintStream out) { try { for (int i=0; iGarbageCollectionStart. @@ -63,13 +64,7 @@ public static int run(String argv[], PrintStream out) { } private int runThis(String argv[], PrintStream out) { - try { - for (int i=0; iGarbageCollectionStart. @@ -61,13 +62,7 @@ public static int run(String argv[], PrintStream out) { } private int runThis(String argv[], PrintStream out) { - try { - for (int i=0; i Date: Mon, 23 Mar 2026 19:52:36 +0000 Subject: [PATCH 058/223] 8361106: [TEST] com/sun/net/httpserver/Test9.java fails with java.nio.file.FileSystemException Backport-of: 576f9694b092f2a11a6a4e5a82c2b0e12203bd9c --- test/jdk/com/sun/net/httpserver/Test9.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/test/jdk/com/sun/net/httpserver/Test9.java b/test/jdk/com/sun/net/httpserver/Test9.java index 6f7b1d4f5bc3..6051de965960 100644 --- a/test/jdk/com/sun/net/httpserver/Test9.java +++ b/test/jdk/com/sun/net/httpserver/Test9.java @@ -59,7 +59,7 @@ public class Test9 extends Test { HttpServer.class.getPackageName() + '-' + Test9.class.getSimpleName() + '-'; static SSLContext ctx; - static boolean error = false; + static volatile boolean error = false; public static void main (String[] args) throws Exception { HttpServer s1 = null; @@ -67,6 +67,8 @@ public static void main (String[] args) throws Exception { ExecutorService executor=null; Path smallFilePath = createTempFileOfSize(TEMP_FILE_PREFIX, null, 23); Path largeFilePath = createTempFileOfSize(TEMP_FILE_PREFIX, null, 2730088); + smallFilePath.toFile().deleteOnExit(); + largeFilePath.toFile().deleteOnExit(); try { System.out.print ("Test9: "); InetAddress loopback = InetAddress.getLoopbackAddress(); @@ -122,20 +124,16 @@ public static void main (String[] args) throws Exception { s2.stop(0); if (executor != null) executor.shutdown (); - Files.delete(smallFilePath); - Files.delete(largeFilePath); } } - static int foo = 1; - static ClientThread test (boolean fixedLen, String protocol, int port, Path filePath) throws Exception { ClientThread t = new ClientThread (fixedLen, protocol, port, filePath); t.start(); return t; } - static Object fileLock = new Object(); + static final Object fileLock = new Object(); static class ClientThread extends Thread { @@ -203,9 +201,8 @@ public boolean verify (String s, SSLSession s1) { error = true; } assertFileContentsEqual(filePath, temp.toPath()); - temp.delete(); } catch (Exception e) { - e.printStackTrace(); + System.err.println("Error occurred: " + e); error = true; } } From 748db97bcd039205d4be7308b0b91ae21bf2aab0 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:55:25 +0000 Subject: [PATCH 059/223] 8371364: Refactor javax/swing/JFileChooser/FileSizeCheck.java to use Util.findComponent() Backport-of: 9bc23608fb5719c3e977b5839efed5bc3f64a268 --- .../swing/JFileChooser/FileSizeCheck.java | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/test/jdk/javax/swing/JFileChooser/FileSizeCheck.java b/test/jdk/javax/swing/JFileChooser/FileSizeCheck.java index 056ce38a0989..6d92032e0d13 100644 --- a/test/jdk/javax/swing/JFileChooser/FileSizeCheck.java +++ b/test/jdk/javax/swing/JFileChooser/FileSizeCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -34,7 +34,6 @@ import java.util.Arrays; import java.util.Locale; import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Predicate; import javax.swing.AbstractButton; import javax.swing.JFileChooser; @@ -52,6 +51,8 @@ * @requires (os.family == "linux") * @summary Verifies if the size of an empty file is shown as 0.0 KB * as well as checks the displayed file sizes are rounded up + * @library /javax/swing/regtesthelpers + * @build Util * @run main FileSizeCheck */ public class FileSizeCheck { @@ -228,31 +229,15 @@ private static void clickDetails() { } private static AbstractButton findDetailsButton(final Container container) { - Component result = findComponent(container, + Component result = Util.findComponent(container, c -> c instanceof JToggleButton button && "Details".equals(button.getToolTipText())); return (AbstractButton) result; } private static JTable findTable(final Container container) { - Component result = findComponent(container, - c -> c instanceof JTable); + Component result = Util.findComponent(container, + c -> c instanceof JTable); return (JTable) result; } - - private static Component findComponent(final Container container, - final Predicate predicate) { - for (Component child : container.getComponents()) { - if (predicate.test(child)) { - return child; - } - if (child instanceof Container cont && cont.getComponentCount() > 0) { - Component result = findComponent(cont, predicate); - if (result != null) { - return result; - } - } - } - return null; - } } From f2e810aa59f42c04be2fd0bd7200f7f17c76738b Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:57:42 +0000 Subject: [PATCH 060/223] 8371365: Update javax/swing/JFileChooser/bug4759934.java to use Util.findComponent() Backport-of: 78db38f14044d434eabb61ff8293d62eff3c497c --- .../jdk/javax/swing/JFileChooser/bug4759934.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/jdk/javax/swing/JFileChooser/bug4759934.java b/test/jdk/javax/swing/JFileChooser/bug4759934.java index 08ccdebfb2be..c7f340ccdd0b 100644 --- a/test/jdk/javax/swing/JFileChooser/bug4759934.java +++ b/test/jdk/javax/swing/JFileChooser/bug4759934.java @@ -31,10 +31,11 @@ * @run main bug4759934 */ +import java.awt.Component; +import java.awt.Container; import java.awt.Dialog; import java.awt.Point; import java.awt.Robot; -import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import javax.swing.JButton; import javax.swing.JDialog; @@ -72,8 +73,10 @@ public static void main(String[] args) throws Exception { robot.mouseRelease(MouseEvent.BUTTON1_DOWN_MASK); robot.delay(500); - robot.keyPress(KeyEvent.VK_ESCAPE); - robot.keyRelease(KeyEvent.VK_ESCAPE); + SwingUtilities.invokeAndWait(() -> { + JButton cancelBtn = findCancelButton(jfc); + cancelBtn.doClick(); + }); robot.delay(500); SwingUtilities.invokeAndWait(() -> { @@ -121,4 +124,11 @@ private static void createDialog() { dlg.setLocation(fr.getX() + fr.getWidth() + 10, fr.getY()); dlg.setVisible(true); } + + private static JButton findCancelButton(final Container container) { + Component result = Util.findComponent(container, + c -> c instanceof JButton button + && "Cancel".equals(button.getText())); + return (JButton) result; + } } From c8e9caf25ab1bbe8cbe6bfc6998411e1b5bd9750 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 19:59:49 +0000 Subject: [PATCH 061/223] 8371366: java/net/httpclient/whitebox/RawChannelTestDriver.java fails intermittently in jtreg timeout Backport-of: 8a7af77e991511e144914abc129a9d4d40c0b76b --- .../whitebox/RawChannelTestDriver.java | 9 +- .../jdk/internal/net/http/RawChannelTest.java | 82 +++++++++++++++---- 2 files changed, 75 insertions(+), 16 deletions(-) diff --git a/test/jdk/java/net/httpclient/whitebox/RawChannelTestDriver.java b/test/jdk/java/net/httpclient/whitebox/RawChannelTestDriver.java index 77b1c3db8a53..6ca6fe47b59c 100644 --- a/test/jdk/java/net/httpclient/whitebox/RawChannelTestDriver.java +++ b/test/jdk/java/net/httpclient/whitebox/RawChannelTestDriver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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 @@ -25,7 +25,12 @@ * @test * @bug 8151299 8164704 * @modules java.net.http/jdk.internal.net.http - * @run testng java.net.http/jdk.internal.net.http.RawChannelTest + * @run testng/othervm java.net.http/jdk.internal.net.http.RawChannelTest */ +// use +// @run testng/othervm -Dseed=6434511950803022575 +// java.net.http/jdk.internal.net.http.RawChannelTest +// to reproduce a failure with a particular seed (e.g. 6434511950803022575) +// if this test is observed failing with that seed //-Djdk.internal.httpclient.websocket.debug=true diff --git a/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/RawChannelTest.java b/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/RawChannelTest.java index 6619eff008a0..01aafd916dd4 100644 --- a/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/RawChannelTest.java +++ b/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/RawChannelTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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,6 +23,7 @@ package jdk.internal.net.http; +import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -43,8 +44,9 @@ import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import java.util.concurrent.atomic.AtomicReference; + import jdk.internal.net.http.websocket.RawChannel; -import jdk.internal.net.http.websocket.WebSocketRequest; import org.testng.annotations.Test; import static java.net.http.HttpResponse.BodyHandlers.discarding; import static java.util.concurrent.TimeUnit.SECONDS; @@ -57,6 +59,20 @@ */ public class RawChannelTest { + // can't use jdk.test.lib when injected in java.net.httpclient + // Seed can be specified on the @run line with -Dseed= + private static class RandomFactory { + private static long getSeed() { + long seed = Long.getLong("seed", new Random().nextLong()); + System.out.println("Seed from RandomFactory = "+seed+"L"); + return seed; + } + public static Random getRandom() { + return new Random(getSeed()); + } + } + + private static final Random RANDOM = RandomFactory.getRandom(); private final AtomicLong clientWritten = new AtomicLong(); private final AtomicLong serverWritten = new AtomicLong(); private final AtomicLong clientRead = new AtomicLong(); @@ -90,7 +106,8 @@ public void test() throws Exception { server.setReuseAddress(false); server.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); int port = server.getLocalPort(); - new TestServer(server).start(); + TestServer testServer = new TestServer(server); + testServer.start(); final RawChannel chan = channelOf(port); print("RawChannel is %s", String.valueOf(chan)); @@ -129,6 +146,7 @@ public void handle() { } catch (IOException e) { outputCompleted.completeExceptionally(e); e.printStackTrace(); + closeChannel(chan); } return; } @@ -145,6 +163,9 @@ public void handle() { chan.registerEvent(this); writeStall.countDown(); // signal send buffer is full } catch (IOException e) { + print("OP_WRITE failed: " + e); + outputCompleted.completeExceptionally(e); + closeChannel(chan); throw new UncheckedIOException(e); } } @@ -168,6 +189,7 @@ public void handle() { read = chan.read(); } catch (IOException e) { inputCompleted.completeExceptionally(e); + closeChannel(chan); e.printStackTrace(); } if (read == null) { @@ -179,7 +201,10 @@ public void handle() { try { chan.registerEvent(this); } catch (IOException e) { - e.printStackTrace(); + print("OP_READ failed to register event: " + e); + inputCompleted.completeExceptionally(e); + closeChannel(chan); + throw new UncheckedIOException(e); } readStall.countDown(); break; @@ -191,21 +216,33 @@ public void handle() { print("OP_READ read %s bytes (%s total)", total, clientRead.get()); } }); + CompletableFuture.allOf(outputCompleted,inputCompleted) .whenComplete((r,t) -> { - try { - print("closing channel"); - chan.close(); - } catch (IOException x) { - x.printStackTrace(); - } + closeChannel(chan); }); exit.await(); // All done, we need to compare results: assertEquals(clientRead.get(), serverWritten.get()); assertEquals(serverRead.get(), clientWritten.get()); + Throwable serverError = testServer.failed.get(); + if (serverError != null) { + throw new AssertionError("TestServer failed: " + + serverError, serverError); + } } } + private static void closeChannel(RawChannel chan) { + print("closing channel"); + try { + chan.close(); + } catch (IOException x) { + print("Failed to close channel: " + x); + x.printStackTrace(); + } + } + + private static RawChannel channelOf(int port) throws Exception { URI uri = URI.create("http://localhost:" + port + "/"); print("raw channel to %s", uri.toString()); @@ -238,11 +275,24 @@ private static RawChannel channelOf(int port) throws Exception { private class TestServer extends Thread { // Powered by Slowpokes private final ServerSocket server; + private final AtomicReference failed = new AtomicReference<>(); TestServer(ServerSocket server) throws IOException { this.server = server; } + private void fail(Closeable s, String actor, Throwable t) { + failed.compareAndSet(null, t); + print("Server %s got exception: %s", actor, t); + t.printStackTrace(); + try { + s.close(); + } catch (Exception x) { + print("Server %s failed to close socket: %s", actor, t); + } + + } + @Override public void run() { try (Socket s = server.accept()) { @@ -253,21 +303,23 @@ public void run() { Thread reader = new Thread(() -> { try { + print("Server reader started"); long n = readSlowly(is); print("Server read %s bytes", n); s.shutdownInput(); } catch (Exception e) { - e.printStackTrace(); + fail(s, "reader", e); } }); Thread writer = new Thread(() -> { try { + print("Server writer started"); long n = writeSlowly(os); print("Server written %s bytes", n); s.shutdownOutput(); } catch (Exception e) { - e.printStackTrace(); + fail(s, "writer", e); } }); @@ -277,7 +329,7 @@ public void run() { reader.join(); writer.join(); } catch (Exception e) { - e.printStackTrace(); + fail(server,"acceptor", e); } finally { exit.countDown(); } @@ -366,6 +418,8 @@ private static void print(String format, Object... args) { } private static byte[] byteArrayOfSize(int bound) { - return new byte[new Random().nextInt(1 + bound)]; + // bound must be > 1; No need to check it, + // nextInt will throw IllegalArgumentException if needed + return new byte[RANDOM.nextInt(1, bound + 1)]; } } From 2da03ea83694260e676e2648b37e1c162f1183c2 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 20:02:45 +0000 Subject: [PATCH 062/223] 8371349: Update NSS library to 3.117 Backport-of: cebb03ef24fad8705156f12cecd2da6351cd1ef6 --- test/jdk/sun/security/pkcs11/PKCS11Test.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jdk/sun/security/pkcs11/PKCS11Test.java b/test/jdk/sun/security/pkcs11/PKCS11Test.java index 717d3823136c..f72a2e07b0d6 100644 --- a/test/jdk/sun/security/pkcs11/PKCS11Test.java +++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java @@ -82,7 +82,7 @@ public abstract class PKCS11Test { // Version of the NSS artifact. This coincides with the version of // the NSS version - private static final String NSS_BUNDLE_VERSION = "3.111"; + private static final String NSS_BUNDLE_VERSION = "3.117"; private static final String NSSLIB = "jpg.tests.jdk.nsslib"; static Version nss_version = null; From f71e15ec9054c8e696ec922a1723ca4cf2f68edd Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 20:03:09 +0000 Subject: [PATCH 063/223] 8293484: AArch64: TestUseSHA512IntrinsicsOptionOnSupportedCPU.java fails on CPU with SHA512 feature support Backport-of: 696821670e11fee003906806f081038032ac4985 --- .../jtreg/compiler/intrinsics/sha/cli/DigestOptionsBase.java | 4 ++-- .../sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/DigestOptionsBase.java b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/DigestOptionsBase.java index 2d4d43538687..22b3bba854ca 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/DigestOptionsBase.java +++ b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/DigestOptionsBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -120,7 +120,7 @@ public static BooleanSupplier getPredicateForOption(String optionName) { case DigestOptionsBase.USE_SHA256_INTRINSICS_OPTION: return IntrinsicPredicates.SHA256_INSTRUCTION_AVAILABLE; case DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION: - return IntrinsicPredicates.SHA512_INSTRUCTION_AVAILABLE; + return IntrinsicPredicates.isSHA512IntrinsicAvailable(); case DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION: return IntrinsicPredicates.SHA3_INSTRUCTION_AVAILABLE; default: diff --git a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java index e349c22e3832..7913a25d9398 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java +++ b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -25,7 +25,6 @@ * @test * @bug 8035968 * @summary Verify UseSHA512Intrinsics option processing on supported CPU. - * @requires os.arch!="x86" & os.arch!="i386" * @library /test/lib / * @requires vm.flagless * From bfc0dddbd83c8525f255c3527258f715d2e490a6 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 20:05:15 +0000 Subject: [PATCH 064/223] 8372120: Add missing sound keyword to MIDI tests Backport-of: 902aa4dcd297fef34cb302e468b030c48665ec84 --- .../javax/sound/midi/MidiDeviceConnectors/TestAllDevices.java | 1 + test/jdk/javax/sound/midi/SysexMessage/SendRawSysexMessage.java | 1 + .../sound/midi/spi/MidiDeviceProvider/ExpectedNPEOnNull.java | 1 + test/jdk/javax/sound/midi/spi/MidiDeviceProvider/FakeInfo.java | 1 + .../javax/sound/midi/spi/MidiDeviceProvider/UnsupportedInfo.java | 1 + 5 files changed, 5 insertions(+) diff --git a/test/jdk/javax/sound/midi/MidiDeviceConnectors/TestAllDevices.java b/test/jdk/javax/sound/midi/MidiDeviceConnectors/TestAllDevices.java index 27290738a0cc..afac39b83fbf 100644 --- a/test/jdk/javax/sound/midi/MidiDeviceConnectors/TestAllDevices.java +++ b/test/jdk/javax/sound/midi/MidiDeviceConnectors/TestAllDevices.java @@ -24,6 +24,7 @@ /** * @test * @bug 4933700 + * @key sound * @summary Tests that default devices return MidiDeviceTransmitter/Receiver and returned objects return correct MidiDevice * @compile TestAllDevices.java * @run main TestAllDevices diff --git a/test/jdk/javax/sound/midi/SysexMessage/SendRawSysexMessage.java b/test/jdk/javax/sound/midi/SysexMessage/SendRawSysexMessage.java index 2a33d28b3f53..e258b4cb53ad 100644 --- a/test/jdk/javax/sound/midi/SysexMessage/SendRawSysexMessage.java +++ b/test/jdk/javax/sound/midi/SysexMessage/SendRawSysexMessage.java @@ -35,6 +35,7 @@ /** * @test * @bug 8237495 8301310 + * @key sound * @summary fail with memory errors when asked to send a sysex message starting * with 0xF7 */ diff --git a/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/ExpectedNPEOnNull.java b/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/ExpectedNPEOnNull.java index efb57eeeae2d..05ba16cded56 100644 --- a/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/ExpectedNPEOnNull.java +++ b/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/ExpectedNPEOnNull.java @@ -32,6 +32,7 @@ /** * @test * @bug 8143909 + * @key sound * @author Sergey Bylokhov */ public final class ExpectedNPEOnNull { diff --git a/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/FakeInfo.java b/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/FakeInfo.java index 8eabb992bca9..71d27c4943c0 100644 --- a/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/FakeInfo.java +++ b/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/FakeInfo.java @@ -35,6 +35,7 @@ /** * @test * @bug 8059743 + * @key sound * @summary MidiDeviceProvider shouldn't returns incorrect results in case of * some unknown MidiDevice.Info * @author Sergey Bylokhov diff --git a/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/UnsupportedInfo.java b/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/UnsupportedInfo.java index 685a5e8af629..5d37759fbad7 100644 --- a/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/UnsupportedInfo.java +++ b/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/UnsupportedInfo.java @@ -30,6 +30,7 @@ /** * @test * @bug 8058115 + * @key sound * @summary MidiDeviceProvider shouldn't returns incorrect results in case of * unsupported MidiDevice.Info * @author Sergey Bylokhov From 0da179550f8ed1bfafe3742c03e576d23cabe5a1 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 20:08:04 +0000 Subject: [PATCH 065/223] 8371383: Test sun/security/tools/jarsigner/DefaultOptions.java failed due to CertificateNotYetValidException Backport-of: 0972ba681cdc81b77e9b4353db8ee835216d242e --- test/jdk/sun/security/tools/jarsigner/DefaultOptions.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/jdk/sun/security/tools/jarsigner/DefaultOptions.java b/test/jdk/sun/security/tools/jarsigner/DefaultOptions.java index 72756de6f8bd..fe8adfb89624 100644 --- a/test/jdk/sun/security/tools/jarsigner/DefaultOptions.java +++ b/test/jdk/sun/security/tools/jarsigner/DefaultOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -62,7 +62,10 @@ public static void main(String[] args) throws Throwable { keytool("-genkeypair -dname CN=CA -alias ca -keyalg rsa -ext bc:c") .shouldHaveExitValue(0); keytool("-alias a -certreq -file a.req"); - keytool("-alias ca -gencert -infile a.req -outfile a.cert"); + + // The start date is set to -1M to prevent the certificate not yet + // valid during fast enough execution. + keytool("-alias ca -gencert -infile a.req -outfile a.cert -startdate -1M"); keytool("-alias a -import -file a.cert").shouldHaveExitValue(0); Files.write(Path.of("js.conf"), List.of( From ef64500063d1992a57669aeb6f356494350c290d Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 20:10:39 +0000 Subject: [PATCH 066/223] 8370942: test/jdk/java/security/Provider/NewInstance.java and /test/jdk/java/security/cert/CertStore/NoLDAP.java may skip without notifying Backport-of: e13dfd3ec39b0550eede83aa766deaad105995fc --- .../java/security/Provider/NewInstance.java | 29 ++++++++++++++----- .../java/security/cert/CertStore/NoLDAP.java | 11 ++++--- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/test/jdk/java/security/Provider/NewInstance.java b/test/jdk/java/security/Provider/NewInstance.java index ad69f468925c..547b9111682b 100644 --- a/test/jdk/java/security/Provider/NewInstance.java +++ b/test/jdk/java/security/Provider/NewInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -26,21 +26,34 @@ * @bug 8039853 * @summary Provider.Service.newInstance() does not work with current JDK JGSS Mechanisms + * @library /test/lib */ -import java.security.*; -import java.util.*; + +import jtreg.SkippedException; + +import java.security.InvalidAlgorithmParameterException; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.security.Security; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; public class NewInstance { public static void main(String[] args) throws Exception { - for (Provider p : Security.getProviders()) { + + System.out.println("Removing SunPCSC provider from the list (A smartcard might not be installed)."); + final List providers = Arrays.stream(Security.getProviders()) + .filter(provider -> !provider.getName().equals("SunPCSC")) + .collect(Collectors.toList()); + + for (Provider p : providers) { System.out.println("---------"); System.out.println(p.getName() + ":" + p.getInfo()); - if (p.getName().equals("SunPCSC")) { - System.out.println("A smartcard might not be installed. Skip test."); - continue; - } Set set = p.getServices(); Iterator i = set.iterator(); diff --git a/test/jdk/java/security/cert/CertStore/NoLDAP.java b/test/jdk/java/security/cert/CertStore/NoLDAP.java index 868411e63c45..812a978931d9 100644 --- a/test/jdk/java/security/cert/CertStore/NoLDAP.java +++ b/test/jdk/java/security/cert/CertStore/NoLDAP.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, 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 @@ -25,20 +25,23 @@ * @bug 8004502 * @summary Sanity check that NoSuchAlgorithmException is thrown when requesting * a CertStore of type "LDAP" and LDAP is not available. + * @library /test/lib */ import java.security.NoSuchAlgorithmException; import java.security.cert.CertStore; import java.security.cert.LDAPCertStoreParameters; +import jtreg.SkippedException; public class NoLDAP { public static void main(String[] args) throws Exception { try { Class.forName("javax.naming.ldap.LdapName"); - System.out.println("LDAP is present, test skipped"); - return; - } catch (ClassNotFoundException ignore) { } + throw new SkippedException("LDAP is present"); + } catch (ClassNotFoundException ignore) { + System.err.println("Expected: class not found exception " + ignore.getMessage()); + } try { CertStore.getInstance("LDAP", new LDAPCertStoreParameters()); From f9d202c558371a2cb8f37c1ca859cadd21ac0065 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 20:12:56 +0000 Subject: [PATCH 067/223] 8334928: Test sun/security/ssl/SSLSocketImpl/ReuseAddr.java failed: java.net.BindException: Address already in use Backport-of: cdf5fbed9bd8366e4ee9ab9cb538db88d7bcc7c0 --- test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java | 2 ++ test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java b/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java index 0891523ac11f..51706cec9270 100644 --- a/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java +++ b/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java @@ -190,6 +190,7 @@ protected void doServerSide() throws Exception { try { sslServerSocket.setSoTimeout(30000); sslSocket = (SSLSocket)sslServerSocket.accept(); + System.out.println("Connection established on port : " +serverPort); } catch (SocketTimeoutException ste) { // Ignore the test case if no connection within 30 seconds. System.out.println( @@ -228,6 +229,7 @@ protected void doServerSide() throws Exception { } } finally { sslSocket.close(); + System.out.println("Connection closed on port : " +serverPort); } } diff --git a/test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java b/test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java index f7e677bbbd05..68761f10c599 100644 --- a/test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -38,7 +38,7 @@ public class ReuseAddr extends SSLSocketTemplate { - private static final int MAX_ATTEMPTS = 3; + private static final int MAX_ATTEMPTS = 15; @Override protected void doServerSide() throws Exception { @@ -65,6 +65,7 @@ public static void main(String[] args) throws Exception { System.err.println(msg); throw new AssertionError("Failed to reuse address: " + msg, x); } else { + Thread.sleep(100*i); System.out.println("Retrying..."); } } From 43af76d7a330f22aa4bad19242c8e31d14689388 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 20:15:40 +0000 Subject: [PATCH 068/223] 8373807: test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java getURI() uses "localhost" Backport-of: f3a48560b5e3a280f6f76031eb3d475ff9ee49f4 --- .../net/httpclient/websocket/DummyWebSocketServer.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java b/test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java index 176634d69077..5df14bff9d28 100644 --- a/test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java +++ b/test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java @@ -265,7 +265,14 @@ URI getURI() { if (!started.get()) { throw new IllegalStateException("Not yet started"); } - return URI.create("ws://localhost:" + address.getPort()); + String ip = address.getAddress().isAnyLocalAddress() + ? InetAddress.getLoopbackAddress().getHostAddress() + : address.getAddress().getHostAddress(); + if (ip.indexOf(':') >= 0) { + ip = String.format("[%s]", ip); + } + + return URI.create("ws://" + ip + ":" + address.getPort()); } private boolean readRequest(SocketChannel channel, StringBuilder request) From b7b0aad2e95929f75b955531767b5180f7359a9e Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 23 Mar 2026 20:18:03 +0000 Subject: [PATCH 069/223] 8373869: Refactor java/net/httpclient/ThrowingPushPromises*.java tests to use JUnit5 Backport-of: 47a8fafa0d118a68d54029bfa53451e5dd6240aa --- .../AbstractThrowingPushPromises.java | 140 +++++++++--------- ...rowingPushPromisesAsInputStreamCustom.java | 10 +- .../ThrowingPushPromisesAsInputStreamIO.java | 10 +- .../ThrowingPushPromisesAsLinesCustom.java | 10 +- .../ThrowingPushPromisesAsLinesIO.java | 10 +- .../ThrowingPushPromisesAsStringCustom.java | 10 +- .../ThrowingPushPromisesAsStringIO.java | 10 +- .../ThrowingPushPromisesSanity.java | 10 +- 8 files changed, 111 insertions(+), 99 deletions(-) diff --git a/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java b/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java index b5230d48d104..50200c86b430 100644 --- a/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java +++ b/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java @@ -35,18 +35,10 @@ * ReferenceTracker AbstractThrowingPushPromises * jdk.httpclient.test.lib.common.HttpServerAdapters * - * @run testng/othervm -Djdk.internal.httpclient.debug=true + * @run junit/othervm -Djdk.internal.httpclient.debug=true */ import jdk.test.lib.net.SimpleSSLContext; -import org.testng.ITestContext; -import org.testng.ITestResult; -import org.testng.SkipException; -import org.testng.annotations.AfterTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; import javax.net.ssl.SSLContext; import java.io.BufferedReader; @@ -95,18 +87,29 @@ import static java.lang.String.format; import static java.net.http.HttpClient.Version.HTTP_2; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - +import org.junit.jupiter.api.AfterAll; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.junit.jupiter.api.extension.TestWatcher; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public abstract class AbstractThrowingPushPromises implements HttpServerAdapters { - SSLContext sslContext; - HttpTestServer http2TestServer; // HTTP/2 ( h2c ) - HttpTestServer https2TestServer; // HTTP/2 ( h2 ) - String http2URI_fixed; - String http2URI_chunk; - String https2URI_fixed; - String https2URI_chunk; + static SSLContext sslContext; + static HttpTestServer http2TestServer; // HTTP/2 ( h2c ) + static HttpTestServer https2TestServer; // HTTP/2 ( h2 ) + static String http2URI_fixed; + static String http2URI_chunk; + static String https2URI_fixed; + static String https2URI_chunk; static final int ITERATION_COUNT = 1; // a shared executor helps reduce the amount of threads created by the test @@ -124,8 +127,34 @@ public static String now() { return String.format("[%d s, %d ms, %d ns] ", secs, mill, nan); } - final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; - private volatile HttpClient sharedClient; + static final class TestStopper implements TestWatcher, BeforeEachCallback { + final AtomicReference failed = new AtomicReference<>(); + TestStopper() { } + @Override + public void testFailed(ExtensionContext context, Throwable cause) { + if (stopAfterFirstFailure()) { + String msg = "Aborting due to: " + cause; + failed.compareAndSet(null, msg); + FAILURES.putIfAbsent(context.getDisplayName(), cause); + System.out.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n", + now(), context.getDisplayName(), cause); + System.err.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n", + now(), context.getDisplayName(), cause); + } + } + + @Override + public void beforeEach(ExtensionContext context) { + String msg = failed.get(); + Assumptions.assumeTrue(msg == null, msg); + } + } + + @RegisterExtension + static final TestStopper stopper = new TestStopper(); + + static final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; + private static volatile HttpClient sharedClient; static class TestExecutor implements Executor { final AtomicLong tasks = new AtomicLong(); @@ -151,34 +180,13 @@ public void execute(Runnable command) { } } - protected boolean stopAfterFirstFailure() { + protected static boolean stopAfterFirstFailure() { return Boolean.getBoolean("jdk.internal.httpclient.debug"); } - final AtomicReference skiptests = new AtomicReference<>(); - void checkSkip() { - var skip = skiptests.get(); - if (skip != null) throw skip; - } - static String name(ITestResult result) { - var params = result.getParameters(); - return result.getName() - + (params == null ? "()" : Arrays.toString(result.getParameters())); - } - @BeforeMethod - void beforeMethod(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - if (skiptests.get() == null) { - SkipException skip = new SkipException("some tests failed"); - skip.setStackTrace(new StackTraceElement[0]); - skiptests.compareAndSet(null, skip); - } - } - } - - @AfterClass - static final void printFailedTests(ITestContext context) { + @AfterAll + static final void printFailedTests() { out.println("\n========================="); try { // Exceptions should already have been added to FAILURES @@ -203,7 +211,7 @@ static final void printFailedTests(ITestContext context) { } } - private String[] uris() { + private static String[] uris() { return new String[] { http2URI_fixed, http2URI_chunk, @@ -212,8 +220,7 @@ private String[] uris() { }; } - @DataProvider(name = "sanity") - public Object[][] sanity() { + public static Object[][] sanity() { String[] uris = uris(); Object[][] result = new Object[uris.length * 2][]; @@ -242,7 +249,7 @@ public void accept(Where where) { } } - private Object[][] variants(List throwers) { + private static Object[][] variants(List throwers) { String[] uris = uris(); // reduce traces by always using the same client if // stopAfterFirstFailure is requested. @@ -262,25 +269,17 @@ private Object[][] variants(List throwers) { return result; } - @DataProvider(name = "ioVariants") - public Object[][] ioVariants(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - return new Object[0][]; - } + public static Object[][] ioVariants() { return variants(List.of( new UncheckedIOExceptionThrower())); } - @DataProvider(name = "customVariants") - public Object[][] customVariants(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - return new Object[0][]; - } + public static Object[][] customVariants() { return variants(List.of( new UncheckedCustomExceptionThrower())); } - private HttpClient makeNewClient() { + private static HttpClient makeNewClient() { clientCount.incrementAndGet(); return TRACKER.track(HttpClient.newBuilder() .proxy(HttpClient.Builder.NO_PROXY) @@ -289,11 +288,11 @@ private HttpClient makeNewClient() { .build()); } - HttpClient newHttpClient(boolean share) { + static HttpClient newHttpClient(boolean share) { if (!share) return makeNewClient(); HttpClient shared = sharedClient; if (shared != null) return shared; - synchronized (this) { + synchronized (AbstractThrowingPushPromises.class) { shared = sharedClient; if (shared == null) { shared = sharedClient = makeNewClient(); @@ -331,13 +330,13 @@ public void applyPushPromise(HttpRequest initiatingRequest, HttpResponse> response = client.sendAsync(req, BodyHandlers.ofLines(), pushHandler).get(); String body = response.body().collect(Collectors.joining("|")); - assertEquals(URI.create(body).getPath(), URI.create(uri).getPath()); + assertEquals(URI.create(uri).getPath(), URI.create(body).getPath()); for (HttpRequest promised : pushPromises.keySet()) { out.printf("%s Received promise: %s%n\tresponse: %s%n", now(), promised, pushPromises.get(promised).get()); String promisedBody = pushPromises.get(promised).get().body() .collect(Collectors.joining("|")); - assertEquals(promisedBody, promised.uri().toASCIIString()); + assertEquals(promised.uri().toASCIIString(), promisedBody); } assertEquals(3, pushPromises.size()); if (!sameClient) { @@ -402,7 +401,6 @@ private void testThrowing(String name, String uri, boolean sameClient, Finisher finisher, Thrower thrower) throws Exception { - checkSkip(); out.printf("%n%s%s%n", now(), name); try { testThrowing(uri, sameClient, handlers, finisher, thrower); @@ -577,9 +575,9 @@ private final List check(Where w, URI reqURI, default: expectedCount = 3; } - assertEquals(promises.size(), expectedCount, + assertEquals(expectedCount, promises.size(), "bad promise count for " + reqURI + " with " + w); - assertEquals(result, List.of(reqURI.toASCIIString())); + assertEquals(List.of(reqURI.toASCIIString()), result); return result; } @@ -732,8 +730,8 @@ public CompletionStage getBody() { } - @BeforeTest - public void setup() throws Exception { + @BeforeAll + public static void setup() throws Exception { sslContext = new SimpleSSLContext().get(); if (sslContext == null) throw new AssertionError("Unexpected null sslContext"); @@ -759,8 +757,8 @@ public void setup() throws Exception { https2TestServer.start(); } - @AfterTest - public void teardown() throws Exception { + @AfterAll + public static void teardown() throws Exception { String sharedClientName = sharedClient == null ? null : sharedClient.toString(); sharedClient = null; diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java index 0b66a8e913ec..797507ac7ada 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsInputStreamCustom * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsInputStreamCustom + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsInputStreamCustom */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesAsInputStreamCustom extends AbstractThrowingPushPromises { - @Test(dataProvider = "customVariants") + @ParameterizedTest + @MethodSource("customVariants") public void testThrowingAsInputStream(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsInputStreamImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java index 89cf1162bc34..309f60c0f22f 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsInputStreamIO * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsInputStreamIO + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsInputStreamIO */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesAsInputStreamIO extends AbstractThrowingPushPromises { - @Test(dataProvider = "ioVariants") + @ParameterizedTest + @MethodSource("ioVariants") public void testThrowingAsInputStream(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsInputStreamImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java index d1fb7d342587..77c87151e194 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsLinesCustom * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsLinesCustom + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsLinesCustom */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesAsLinesCustom extends AbstractThrowingPushPromises { - @Test(dataProvider = "customVariants") + @ParameterizedTest + @MethodSource("customVariants") public void testThrowingAsLines(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsLinesImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java index 88afaf3dbd55..69deeec533a9 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsLinesIO * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsLinesIO + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsLinesIO */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesAsLinesIO extends AbstractThrowingPushPromises { - @Test(dataProvider = "ioVariants") + @ParameterizedTest + @MethodSource("ioVariants") public void testThrowingAsLines(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsLinesImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java index c40af0ab0b06..de38cf4f7826 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsStringCustom * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsStringCustom + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsStringCustom */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesAsStringCustom extends AbstractThrowingPushPromises { - @Test(dataProvider = "customVariants") + @ParameterizedTest + @MethodSource("customVariants") public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsStringImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java index 6485e82af8f5..ec4d682d73ff 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsStringIO * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsStringIO + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsStringIO */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesAsStringIO extends AbstractThrowingPushPromises { - @Test(dataProvider = "ioVariants") + @ParameterizedTest + @MethodSource("ioVariants") public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsStringImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java index 7fdb6dcb19db..92f2ab3726dd 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesSanity * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesSanity + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesSanity */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesSanity extends AbstractThrowingPushPromises { - @Test(dataProvider = "sanity") + @ParameterizedTest + @MethodSource("sanity") public void testSanity(String uri, boolean sameClient) throws Exception { super.testSanityImpl(uri, sameClient); From 9098bb323a400e5e79156fcfe5f82dde6f206ace Mon Sep 17 00:00:00 2001 From: Richard Reingruber Date: Tue, 24 Mar 2026 08:49:04 +0000 Subject: [PATCH 070/223] 8374769: PPC: MASM::pop_cont_fastpath() should reset _cont_fastpath if SP == _cont_fastpath Reviewed-by: goetz, mdoerr Backport-of: 5664d9148401934cd26308dc4493f4a5656e89bd --- src/hotspot/cpu/ppc/macroAssembler_ppc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp index adc40748fe7c..7e847e651844 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp @@ -4440,7 +4440,7 @@ void MacroAssembler::push_cont_fastpath() { Label done; ld_ptr(R0, JavaThread::cont_fastpath_offset(), R16_thread); cmpld(CCR0, R1_SP, R0); - ble(CCR0, done); + ble(CCR0, done); // if (SP <= _cont_fastpath) goto done; st_ptr(R1_SP, JavaThread::cont_fastpath_offset(), R16_thread); bind(done); } @@ -4449,7 +4449,7 @@ void MacroAssembler::pop_cont_fastpath() { Label done; ld_ptr(R0, JavaThread::cont_fastpath_offset(), R16_thread); cmpld(CCR0, R1_SP, R0); - ble(CCR0, done); + blt(CCR0, done); // if (SP < _cont_fastpath) goto done; li(R0, 0); st_ptr(R0, JavaThread::cont_fastpath_offset(), R16_thread); bind(done); From 8b1959589f0a40d170a84a533aa029b5e47d1c20 Mon Sep 17 00:00:00 2001 From: Fei Yang Date: Tue, 24 Mar 2026 09:02:38 +0000 Subject: [PATCH 071/223] 8379464: Enable missing stack walking test via jtreg requires for RISC-V Backport-of: 58bf76adfd93303bdd78862ae3677b514754d34d --- .../jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java b/test/hotspot/jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java index 7d7deffdb6e3..7f25f20e8943 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java @@ -33,7 +33,7 @@ * @test StackWalkNativeToJava * @bug 8316309 * @summary Check that walking the stack works fine when going from C++ frame to Java frame. - * @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" + * @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64" * @requires os.family != "windows" * @requires vm.flagless * @library /test/lib From b318d5cabba4f832084e16b09bce42d38f36e124 Mon Sep 17 00:00:00 2001 From: Fei Yang Date: Tue, 24 Mar 2026 09:03:04 +0000 Subject: [PATCH 072/223] 8378810: Enable missing FFM test via jtreg requires for RISC-V Backport-of: 8009a714ba81af8b6a7b422f510ae5d6509a73a7 --- .../jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java b/test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java index cea16a375951..107ebbb3901a 100644 --- a/test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java +++ b/test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java @@ -28,7 +28,8 @@ * @summary guarantee(loc != NULL) failed: missing saved register with native invoke * * @requires vm.flavor == "server" - * @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "ppc64" | os.arch == "ppc64le" + * @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | + os.arch == "aarch64" | os.arch == "ppc64" | os.arch == "ppc64le" | os.arch == "riscv64" * @requires vm.gc.Shenandoah * * @run main/native/othervm --enable-native-access=ALL-UNNAMED -XX:+UnlockDiagnosticVMOptions From f3742e77816436f812ccb67f77120311d3da449e Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Tue, 24 Mar 2026 13:15:42 +0000 Subject: [PATCH 073/223] 8380011: Path-to-gcroots search should not trigger stack overflows Backport-of: 347aae6428358e79a9463b04654f3eaf83450595 --- .../jfr/leakprofiler/chains/dfsClosure.cpp | 23 +++- .../jfr/leakprofiler/chains/dfsClosure.hpp | 3 + test/jdk/TEST.groups | 1 + .../jdk/jfr/event/oldobject/OldObjects.java | 14 ++- .../oldobject/TestDFSWithSmallStack.java | 101 ++++++++++++++++++ 5 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 test/jdk/jdk/jfr/event/oldobject/TestDFSWithSmallStack.java diff --git a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp index 4ba2e3329f81..d2d3fec79e38 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp @@ -35,6 +35,7 @@ #include "memory/resourceArea.hpp" #include "oops/access.inline.hpp" #include "oops/oop.inline.hpp" +#include "runtime/os.hpp" #include "utilities/align.hpp" UnifiedOopRef DFSClosure::_reference_stack[max_dfs_depth]; @@ -68,9 +69,27 @@ void DFSClosure::find_leaks_from_root_set(EdgeStore* edge_store, rs.process(); } +static address calculate_headroom_limit() { + static constexpr size_t required_headroom = K * 64; + const Thread* const t = Thread::current_or_null(); + return t->stack_end() + required_headroom; +} + DFSClosure::DFSClosure(EdgeStore* edge_store, JFRBitSet* mark_bits, const Edge* start_edge) :_edge_store(edge_store), _mark_bits(mark_bits), _start_edge(start_edge), - _max_depth(max_dfs_depth), _depth(0), _ignore_root_set(false) { + _max_depth(max_dfs_depth), _depth(0), _ignore_root_set(false), + _headroom_limit(calculate_headroom_limit()) { +} + +bool DFSClosure::have_headroom() const { + const address sp = (address) os::current_stack_pointer(); +#ifdef ASSERT + const Thread* const t = Thread::current_or_null(); + assert(t->is_VM_thread(), "invariant"); + assert(t->is_in_full_stack(_headroom_limit), "invariant"); + assert(t->is_in_full_stack(sp), "invariant"); +#endif + return sp > _headroom_limit; } void DFSClosure::closure_impl(UnifiedOopRef reference, const oop pointee) { @@ -98,7 +117,7 @@ void DFSClosure::closure_impl(UnifiedOopRef reference, const oop pointee) { } } assert(_max_depth >= 1, "invariant"); - if (_depth < _max_depth - 1) { + if (_depth < _max_depth - 1 && have_headroom()) { _depth++; pointee->oop_iterate(this); assert(_depth > 0, "invariant"); diff --git a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp index be0cd2a5d7eb..a22b5137380f 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp @@ -46,12 +46,15 @@ class DFSClosure : public BasicOopIterateClosure { size_t _max_depth; size_t _depth; bool _ignore_root_set; + const address _headroom_limit; DFSClosure(EdgeStore* edge_store, JFRBitSet* mark_bits, const Edge* start_edge); void add_chain(); void closure_impl(UnifiedOopRef reference, const oop pointee); + bool have_headroom() const; + public: virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS_EXCEPT_REFERENT; } diff --git a/test/jdk/TEST.groups b/test/jdk/TEST.groups index 7720d4e8c007..dae237be3ed3 100644 --- a/test/jdk/TEST.groups +++ b/test/jdk/TEST.groups @@ -553,6 +553,7 @@ jdk_jfr_sanity = \ jdk/jfr/event/gc/collection/TestGCWithFasttime.java \ jdk/jfr/event/gc/configuration/TestGCConfigurationEvent.java \ jdk/jfr/event/metadata/TestDefaultConfigurations.java \ + jdk/jfr/event/oldobject/TestDFSWithSmallStack.java \ jdk/jfr/startupargs/TestDumpOnExit.java \ jdk/jfr/api/consumer/recordingstream/TestBasics.java diff --git a/test/jdk/jdk/jfr/event/oldobject/OldObjects.java b/test/jdk/jdk/jfr/event/oldobject/OldObjects.java index ba90bb10a9ee..bb0ca27836ea 100644 --- a/test/jdk/jdk/jfr/event/oldobject/OldObjects.java +++ b/test/jdk/jdk/jfr/event/oldobject/OldObjects.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, 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 @@ -276,4 +276,16 @@ public static void validateReferenceChainLimit(RecordedEvent e, int maxLength) { throw new RuntimeException("Reference chain max length not respected. Found a chain of length " + length); } } + + public static int countChains(List events) throws IOException { + int found = 0; + for (RecordedEvent e : events) { + RecordedObject ro = e.getValue("object"); + if (ro.getValue("referrer") != null) { + found++; + } + } + System.out.println("Found chains: " + found); + return found; + } } diff --git a/test/jdk/jdk/jfr/event/oldobject/TestDFSWithSmallStack.java b/test/jdk/jdk/jfr/event/oldobject/TestDFSWithSmallStack.java new file mode 100644 index 000000000000..d25a6cd5f67e --- /dev/null +++ b/test/jdk/jdk/jfr/event/oldobject/TestDFSWithSmallStack.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2026, IBM Corp. + * 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. + */ +package jdk.jfr.event.oldobject; + +import java.util.LinkedList; +import java.util.List; + +import jdk.jfr.Recording; +import jdk.jfr.consumer.RecordedEvent; +import jdk.jfr.internal.test.WhiteBox; +import jdk.test.lib.jfr.EventNames; +import jdk.test.lib.jfr.Events; + +/** + * @test id=dfsonly + * @summary Tests that DFS works with a small stack + * @library /test/lib /test/jdk + * @requires vm.hasJFR + * @modules jdk.jfr/jdk.jfr.internal.test + * @run main/othervm -Xmx2g -XX:VMThreadStackSize=512 jdk.jfr.event.oldobject.TestDFSWithSmallStack dfsonly + */ + +/** + * @test id=bfsdfs + * @summary Tests that DFS works with a small stack + * @library /test/lib /test/jdk + * @requires vm.hasJFR + * @modules jdk.jfr/jdk.jfr.internal.test + * @run main/othervm -Xmx2g -XX:VMThreadStackSize=512 jdk.jfr.event.oldobject.TestDFSWithSmallStack bfsdfs + */ +public class TestDFSWithSmallStack { + + // Tests depth first search with a small stack. + + // An non-zero exit code, together with a missing hs-err file or possibly a missing jfr file, + // indicates a native stack overflow happened and is a fail condition for this test. + + // We build up an array of linked lists, each containing enough entries for DFS search to + // max out max_dfs_depth (but not greatly surpass it). + + private static final int TOTAL_OBJECTS = 10_000_000; + private static final int OBJECTS_PER_LIST = 5_000; + public static LinkedList[] leak; + + public static void main(String... args) throws Exception { + + switch (args[0]) { + case "dfsonly" -> WhiteBox.setSkipBFS(true); + case "bfsdfs" -> {} /* ignored */ + default -> throw new RuntimeException("Invalid argument"); + } + + WhiteBox.setWriteAllObjectSamples(true); + int count = 10; + + while (count > 0) { + try (Recording r = new Recording()) { + r.enable(EventNames.OldObjectSample).with("cutoff", "infinity"); + r.start(); + leak = new LinkedList[TOTAL_OBJECTS / OBJECTS_PER_LIST]; + for (int i = 0; i < leak.length; i++) { + leak[i] = new LinkedList(); + for (int j = 0; j < OBJECTS_PER_LIST; j++) { + leak[i].add(new Object()); + } + } + System.gc(); + r.stop(); + List events = Events.fromRecording(r); + Events.hasEvents(events); + if (OldObjects.countChains(events) >= 30) { + return; + } + System.out.println("Not enough chains found, retrying."); + } + count--; + leak = null; + } + } +} From 6365e1adea81642cf544bbc9837d4865a53333f3 Mon Sep 17 00:00:00 2001 From: Arno Zeller Date: Tue, 24 Mar 2026 19:14:38 +0000 Subject: [PATCH 074/223] 8380428: ProblemList containers/docker/TestJcmdWithSideCar.java on linux-all Reviewed-by: mbaesken Backport-of: f5fbb6a237f022b485dbc79b6ec819df65535ffe --- test/hotspot/jtreg/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 9866a885956d..ad537efa2714 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -131,6 +131,7 @@ applications/jcstress/copy.java 8229852 linux-all containers/docker/TestJcmd.java 8278102 linux-all containers/docker/TestMemoryAwareness.java 8303470 linux-all +containers/docker/TestJcmdWithSideCar.java 8341518 linux-all ############################################################################# From 56e436e41afa8bce69e7256694ecb222865d503a Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 26 Mar 2026 19:38:23 +0000 Subject: [PATCH 075/223] 8339638: Update vmTestbase/nsk/jvmti/*Field*Watch tests to use virtual thread factory Backport-of: 9785e19f3f87306cabc26a862d35b89d41cfef93 --- .../ClearFieldAccessWatch/clrfldw001.java | 8 ++- .../clrfmodw001.java | 8 ++- .../jvmti/SetFieldAccessWatch/setfldw001.java | 8 ++- .../setfmodw001.java | 8 ++- .../test/lib/thread/TestThreadFactory.java | 55 +++++++++++++++++++ 5 files changed, 75 insertions(+), 12 deletions(-) create mode 100644 test/lib/jdk/test/lib/thread/TestThreadFactory.java diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001.java index 5724f0ea9f4c..ffdc26b7cb14 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, 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 @@ -23,6 +23,8 @@ package nsk.jvmti.ClearFieldAccessWatch; +import jdk.test.lib.thread.TestThreadFactory; + import java.io.PrintStream; public class clrfldw001 { @@ -58,7 +60,7 @@ public static void main(String[] args) { public static int run(String argv[], PrintStream ref) { clrfldw001 t = new clrfldw001(); clrfldw001a t_a = new clrfldw001a(); - clrfldw001b t_b = new clrfldw001b(); + Thread t_b = TestThreadFactory.newThread(new clrfldw001b()); for (int i = 0; i < 5; i++) { setWatch(i); } @@ -91,7 +93,7 @@ class clrfldw001a { int fld = 2; } -class clrfldw001b extends Thread { +class clrfldw001b implements Runnable { float fld4 = 6.0f; public void run() { clrfldw001.clearWatch(4); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001.java index 9861f755f8fd..7e1163d91029 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, 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 @@ -23,6 +23,8 @@ package nsk.jvmti.ClearFieldModificationWatch; +import jdk.test.lib.thread.TestThreadFactory; + import java.io.PrintStream; public class clrfmodw001 { @@ -58,7 +60,7 @@ public static void main(String[] args) { public static int run(String argv[], PrintStream ref) { clrfmodw001 t = new clrfmodw001(); clrfmodw001a t_a = new clrfmodw001a(); - clrfmodw001b t_b = new clrfmodw001b(); + Thread t_b = TestThreadFactory.newThread(new clrfmodw001b()); for (int i = 0; i < 5; i++) { setWatch(i); } @@ -91,7 +93,7 @@ class clrfmodw001a { int fld = 2; } -class clrfmodw001b extends Thread { +class clrfmodw001b implements Runnable { float fld4; public void run() { clrfmodw001.clearWatch(4); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001.java index 03951bf97697..fd64c4d33235 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, 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 @@ -23,6 +23,8 @@ package nsk.jvmti.SetFieldAccessWatch; +import jdk.test.lib.thread.TestThreadFactory; + import java.io.PrintStream; public class setfldw001 { @@ -62,7 +64,7 @@ public static void main(String[] args) { public static int run(String argv[], PrintStream ref) { setfldw001 t = new setfldw001(); setfldw001a t_a = new setfldw001a(); - setfldw001b t_b = new setfldw001b(); + Thread t_b = TestThreadFactory.newThread(new setfldw001b()); t_b.start(); synchronized (lock) { fld = fld1 + 1; @@ -111,7 +113,7 @@ class setfldw001a { int fld = 2; } -class setfldw001b extends Thread { +class setfldw001b implements Runnable { float fld4 = 6.0f; public void run() { synchronized (setfldw001.lock) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001.java index a545a41f2fdf..b79120e404c2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, 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 @@ -23,6 +23,8 @@ package nsk.jvmti.SetFieldModificationWatch; +import jdk.test.lib.thread.TestThreadFactory; + import java.io.PrintStream; public class setfmodw001 { @@ -62,7 +64,7 @@ public static void main(String[] args) { public static int run(String argv[], PrintStream ref) { setfmodw001 t = new setfmodw001(); setfmodw001a t_a = new setfmodw001a(); - setfmodw001b t_b = new setfmodw001b(); + Thread t_b = TestThreadFactory.newThread(new setfmodw001b()); t_b.start(); synchronized (lock) { fld1 = fld1 + 1; @@ -111,7 +113,7 @@ class setfmodw001a { int fld = 2; } -class setfmodw001b extends Thread { +class setfmodw001b implements Runnable { float fld4; public void run() { synchronized (setfmodw001.lock) { diff --git a/test/lib/jdk/test/lib/thread/TestThreadFactory.java b/test/lib/jdk/test/lib/thread/TestThreadFactory.java new file mode 100644 index 000000000000..ac5a6b749092 --- /dev/null +++ b/test/lib/jdk/test/lib/thread/TestThreadFactory.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2021, 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. + */ + +package jdk.test.lib.thread; + +import java.util.concurrent.ThreadFactory; + +/* + This factory is used to start new threads in tests. + It supports creation of virtual threads when jtreg test.thread.factory plugin is enabled. +*/ + +public class TestThreadFactory { + + private static ThreadFactory threadFactory = "Virtual".equals(System.getProperty("test.thread.factory")) + ? virtualThreadFactory() : platformThreadFactory(); + + public static Thread newThread(Runnable task) { + return threadFactory.newThread(task); + } + + public static Thread newThread(Runnable task, String name) { + Thread t = threadFactory.newThread(task); + t.setName(name); + return t; + } + + private static ThreadFactory platformThreadFactory() { + return Thread.ofPlatform().factory(); + } + + private static ThreadFactory virtualThreadFactory() { + return Thread.ofVirtual().factory(); + } +} From 90a44860e11600083ed60c140c134abd355ff81c Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 26 Mar 2026 19:41:08 +0000 Subject: [PATCH 076/223] 8349959: Test CR6740048.java passes unexpectedly missing CR6740048.xsd Backport-of: 5cbd9d1fe19b6d9516233cd1ed8d3ba340b7a1e6 --- .../javax/xml/jaxp/unittest/validation/CR6740048.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/CR6740048.java b/test/jaxp/javax/xml/jaxp/unittest/validation/CR6740048.java index 6ecbba3014d8..58e78f97fabd 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/CR6740048.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/CR6740048.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -62,11 +62,9 @@ public final void testReusingDocumentBuilder() { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); docBuilderFactory.setNamespaceAware(true); - if (xsd != null) { - docBuilderFactory.setValidating(true); - docBuilderFactory.setAttribute(SCHEMA_LANGUAGE_URL, XML_SCHEMA_URL); - docBuilderFactory.setAttribute(SCHEMA_SOURCE_URL, xsd); - } + docBuilderFactory.setValidating(true); + docBuilderFactory.setAttribute(SCHEMA_LANGUAGE_URL, XML_SCHEMA_URL); + docBuilderFactory.setAttribute(SCHEMA_SOURCE_URL, xsd); final DocumentBuilder documentBuilder = docBuilderFactory.newDocumentBuilder(); documentBuilder.setErrorHandler(new ErrorHandler() { From f0d4b0f968dee5df7b611287af559c9a111f33be Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 26 Mar 2026 19:43:16 +0000 Subject: [PATCH 077/223] 8353124: java/lang/Thread/virtual/stress/Skynet.java#Z times out on macosx-x64-debug Reviewed-by: phh Backport-of: 7cb6e5eb3e004ad974a0c49e83014844f9f7cabb --- test/jdk/java/lang/Thread/virtual/stress/Skynet.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/jdk/java/lang/Thread/virtual/stress/Skynet.java b/test/jdk/java/lang/Thread/virtual/stress/Skynet.java index ee45fc827b00..d4678ce39d0a 100644 --- a/test/jdk/java/lang/Thread/virtual/stress/Skynet.java +++ b/test/jdk/java/lang/Thread/virtual/stress/Skynet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -26,14 +26,14 @@ * @summary Stress test virtual threads with a variation of the Skynet 1M benchmark * @requires vm.continuations * @requires !vm.debug | vm.gc != "Z" - * @run main/othervm/timeout=300 -Xmx1500m Skynet + * @run main/othervm/timeout=400 -Xmx1500m Skynet */ /* * @test id=ZSinglegen * @requires vm.debug == true & vm.continuations * @requires vm.gc.ZSinglegen - * @run main/othervm/timeout=300 -XX:+UnlockDiagnosticVMOptions + * @run main/othervm/timeout=400 -XX:+UnlockDiagnosticVMOptions * -XX:+UseZGC -XX:-ZGenerational * -XX:+ZVerifyOops -XX:ZCollectionInterval=0.01 -Xmx1500m Skynet */ @@ -42,7 +42,7 @@ * @test id=ZGenerational * @requires vm.debug == true & vm.continuations * @requires vm.gc.ZGenerational - * @run main/othervm/timeout=300 -XX:+UnlockDiagnosticVMOptions + * @run main/othervm/timeout=400 -XX:+UnlockDiagnosticVMOptions * -XX:+UseZGC -XX:+ZGenerational * -XX:+ZVerifyOops -XX:ZCollectionInterval=0.01 -Xmx1500m Skynet */ From d3c360b095b372ef272d00d527c66aa90e2e4f04 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 26 Mar 2026 19:46:02 +0000 Subject: [PATCH 078/223] 8364756: JFR: Improve slow tests Reviewed-by: phh Backport-of: 87d734012e3130501bfd37b23cee7f5e0a3a476f --- .../api/consumer/streaming/TestFilledChunks.java | 2 ++ .../consumer/streaming/TestStartMultiChunk.java | 4 ++-- test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java | 6 ++++-- .../jdk/jfr/jmx/streaming/TestRemoteDump.java | 16 ++++++++++------ test/jdk/jdk/jfr/jvm/TestWaste.java | 2 +- .../TestMultipleStartupRecordings.java | 8 -------- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java index 18bfa57a4b18..903df39628c4 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java @@ -26,6 +26,7 @@ import java.util.Random; import jdk.jfr.Event; +import jdk.jfr.StackTrace; import jdk.jfr.consumer.RecordingStream; /** @@ -38,6 +39,7 @@ */ public class TestFilledChunks { + @StackTrace(false) static class FillEvent extends Event { String message; int value; diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java index baae06b8ec71..c9265d21023b 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java @@ -44,7 +44,7 @@ */ public class TestStartMultiChunk { - @Period("10 s") + @Period("2 s") @Name("Zebra") static class ZebraEvent extends Event { } @@ -65,7 +65,7 @@ public static void main(String... args) throws Exception { CountDownLatch dogLatch = new CountDownLatch(1); CountDownLatch catLatch = new CountDownLatch(1); CountDownLatch mouseLatch = new CountDownLatch(1); - CountDownLatch zebraLatch = new CountDownLatch(3); + CountDownLatch zebraLatch = new CountDownLatch(2); FlightRecorder.addPeriodicEvent(ZebraEvent.class, () -> { ZebraEvent ze = new ZebraEvent(); diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java b/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java index 7bf389c75ad8..69f36b2ec2a3 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -33,6 +33,7 @@ import javax.management.MBeanServerConnection; import jdk.jfr.Event; +import jdk.jfr.StackTrace; import jdk.management.jfr.RemoteRecordingStream; /** @@ -45,6 +46,7 @@ */ public class TestMaxSize { + @StackTrace(false) static class Monkey extends Event { } @@ -92,7 +94,7 @@ private static void emitEvents(int count) throws InterruptedException { m.commit(); } System.out.println("Emitted " + count + " events"); - Thread.sleep(1000); + Thread.sleep(100); } private static int fileCount(Path dir) throws IOException { diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java b/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java index 51e0c815dc0b..7a2b52b9deb7 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java @@ -97,7 +97,7 @@ private static void testClosed() throws Exception { } } - private static List recordWithPolicy(String filename, Consumer policy) throws Exception { + private static List recordWithPolicy(String filename, boolean awaitEvents, Consumer policy) throws Exception { CountDownLatch latch1 = new CountDownLatch(1); CountDownLatch latch2 = new CountDownLatch(2); CountDownLatch latch3 = new CountDownLatch(3); @@ -111,14 +111,18 @@ private static List recordWithPolicy(String filename, Consumer recordWithPolicy(String filename, Consumer { + var events = recordWithPolicy("max-size.jfr", false, rs -> { // keeps all events for the dump rs.setMaxSize(100_000_000); }); @@ -140,7 +144,7 @@ private static void testSetMaxSize() throws Exception { } private static void testSetMaxAge() throws Exception { - var events = recordWithPolicy("max-age.jfr", rs -> { + var events = recordWithPolicy("max-age.jfr", false, rs -> { // keeps all events for the dump rs.setMaxAge(Duration.ofDays(1)); }); @@ -151,7 +155,7 @@ private static void testSetMaxAge() throws Exception { } private static void testSetNoPolicy() throws Exception { - var events = recordWithPolicy("no-policy.jfr", rs -> { + var events = recordWithPolicy("no-policy.jfr", true, rs -> { // use default policy, remove after consumption }); // Since latch3 have been triggered at least two events/chunks diff --git a/test/jdk/jdk/jfr/jvm/TestWaste.java b/test/jdk/jdk/jfr/jvm/TestWaste.java index 0cc1010765eb..c460fe90a1d5 100644 --- a/test/jdk/jdk/jfr/jvm/TestWaste.java +++ b/test/jdk/jdk/jfr/jvm/TestWaste.java @@ -61,7 +61,7 @@ public static void main(String... args) throws Exception { try (Recording r = new Recording(c)) { // Old objects that are cleared out should not create waste r.enable("jdk.OldObjectSample") - .with("cutoff", "infinity") + .with("cutoff", "2 s") .withStackTrace(); // No stack trace waste from allocation sample r.enable("jdk.ObjectAllocationSample") diff --git a/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java b/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java index 24be874a87f6..391a456962c4 100644 --- a/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java +++ b/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java @@ -74,13 +74,6 @@ private static void launchTernary(String options1, String options2, String optio test(pb, "Started recording 1", "Started recording 2", "Started recording 3"); } - private static void testDefault() throws Exception { - System.out.println("testDefault"); - launchUnary(null); - launchBinary(null, null); - launchTernary(null, null, null); - } - private static void testColonDelimited() throws Exception { launchBinary(":name=myrecording1,filename=myrecording1.jfr", ":filename=myrecording2.jfr,name=myrecording2"); } @@ -99,7 +92,6 @@ private static void testWithFlightRecorderOptions() throws Exception { } public static void main(String[] args) throws Exception { - testDefault(); testColonDelimited(); testMixed(); testWithFlightRecorderOptions(); From 01a70bcb6dc59a1094c4199c7cf23de27c171f10 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 26 Mar 2026 19:54:58 +0000 Subject: [PATCH 079/223] 8362428: Update IANA Language Subtag Registry to Version 2025-08-25 Backport-of: fa6ca0bbd14436cd3778a7a3383183cd73688123 --- .../data/lsrdata/language-subtag-registry.txt | 61 +++++++++++++++++-- .../Locale/LanguageSubtagRegistryTest.java | 4 +- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/src/java.base/share/data/lsrdata/language-subtag-registry.txt b/src/java.base/share/data/lsrdata/language-subtag-registry.txt index 64c40f28162c..82618f9b40eb 100644 --- a/src/java.base/share/data/lsrdata/language-subtag-registry.txt +++ b/src/java.base/share/data/lsrdata/language-subtag-registry.txt @@ -1,4 +1,4 @@ -File-Date: 2025-05-15 +File-Date: 2025-08-25 %% Type: language Subtag: aa @@ -3102,6 +3102,7 @@ Added: 2009-07-29 Type: language Subtag: asb Description: Assiniboine +Description: Nakoda Assiniboine Added: 2009-07-29 %% Type: language @@ -3269,6 +3270,7 @@ Added: 2009-07-29 Type: language Subtag: atj Description: Atikamekw +Description: Nehirowimowin Added: 2009-07-29 %% Type: language @@ -7981,6 +7983,7 @@ Added: 2009-07-29 Type: language Subtag: clc Description: Chilcotin +Description: Tsilhqot’in Added: 2009-07-29 %% Type: language @@ -8021,6 +8024,7 @@ Added: 2009-07-29 %% Type: language Subtag: clm +Description: Klallam Description: Clallam Added: 2009-07-29 %% @@ -13509,7 +13513,7 @@ Added: 2009-07-29 %% Type: language Subtag: haa -Description: Han +Description: Hän Added: 2009-07-29 %% Type: language @@ -19022,6 +19026,7 @@ Added: 2009-07-29 %% Type: language Subtag: kwk +Description: Kwak'wala Description: Kwakiutl Added: 2009-07-29 %% @@ -22262,7 +22267,7 @@ Added: 2009-07-29 %% Type: language Subtag: mhn -Description: Mócheno +Description: Mòcheno Added: 2009-07-29 %% Type: language @@ -31655,6 +31660,7 @@ Added: 2009-07-29 Type: language Subtag: sec Description: Sechelt +Description: She shashishalhem Added: 2009-07-29 %% Type: language @@ -32003,6 +32009,7 @@ Added: 2009-07-29 Type: language Subtag: shs Description: Shuswap +Description: Secwepemctsín Added: 2009-07-29 %% Type: language @@ -33014,6 +33021,7 @@ Added: 2009-07-29 Type: language Subtag: squ Description: Squamish +Description: Sḵwx̱wú7mesh sníchim Added: 2009-07-29 %% Type: language @@ -34664,6 +34672,8 @@ Added: 2009-07-29 Type: language Subtag: thp Description: Thompson +Description: Nłeʔkepmxcín +Description: Thompson River Salish Added: 2009-07-29 %% Type: language @@ -34684,6 +34694,7 @@ Added: 2009-07-29 Type: language Subtag: tht Description: Tahltan +Description: Tāłtān Added: 2009-07-29 %% Type: language @@ -42419,7 +42430,7 @@ Added: 2009-07-29 %% Type: language Subtag: zmp -Description: Mpuono +Description: Mbuun Added: 2009-07-29 %% Type: language @@ -47639,6 +47650,12 @@ Comments: Denotes conventions established by the Academia Brasileira de Letras in 1943 and generally used in Brazil until 2009 %% Type: variant +Subtag: akhmimic +Description: Akhmimic dialect of Coptic +Added: 2025-07-14 +Prefix: cop +%% +Type: variant Subtag: akuapem Description: Akuapem Twi Added: 2017-06-05 @@ -47814,6 +47831,12 @@ Comments: Black American Sign Language (BASL) or Black Sign Variation (BSV) is a dialect of American Sign Language (ASL) %% Type: variant +Subtag: bohairic +Description: Bohairic dialect of Coptic +Added: 2025-07-14 +Prefix: cop +%% +Type: variant Subtag: bohoric Description: Slovene in Bohorič alphabet Added: 2012-06-27 @@ -47898,6 +47921,12 @@ Comments: Represents the standard written form of Ladin in Fascia which unified the three subvarieties Cazet, Brach and Moenat %% Type: variant +Subtag: fayyumic +Description: Fayyumic dialect of Coptic +Added: 2025-07-14 +Prefix: cop +%% +Type: variant Subtag: fodom Description: Fodom standard of Ladin Added: 2024-03-04 @@ -48167,6 +48196,12 @@ Comments: Russian orthography as established by the 1917/1918 orthographic reforms %% Type: variant +Subtag: lycopol +Description: Lycopolitan alias Subakhmimic dialect of Coptic +Added: 2025-07-14 +Prefix: cop +%% +Type: variant Subtag: mdcegyp Description: Ancient Egyptian hieroglyphs encoded in Manuel de Codage Added: 2025-02-06 @@ -48180,6 +48215,12 @@ Added: 2025-02-06 Prefix: egy %% Type: variant +Subtag: mesokem +Description: Mesokemic alias Oxyrhynchite dialect of Coptic +Added: 2025-07-14 +Prefix: cop +%% +Type: variant Subtag: metelko Description: Slovene in Metelko alphabet Added: 2012-06-27 @@ -48367,6 +48408,12 @@ Prefix: rm Comments: Supraregional Romansh written standard %% Type: variant +Subtag: sahidic +Description: Sahidic dialect of Coptic +Added: 2025-07-14 +Prefix: cop +%% +Type: variant Subtag: saigon Description: The Sài Gòn variant of Vietnamese Added: 2025-03-10 @@ -48555,6 +48602,12 @@ Comments: The subtag represents the old orthography of the Latvian language used during c. 1600s–1920s. %% Type: variant +Subtag: viennese +Description: The Viennese dialect of German +Added: 2025-06-22 +Prefix: de +%% +Type: variant Subtag: vivaraup Description: Vivaro-Alpine Added: 2018-04-22 diff --git a/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java b/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java index 12f5a96d3fb5..07cc7a412b6a 100644 --- a/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java +++ b/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java @@ -25,9 +25,9 @@ * @test * @bug 8025703 8040211 8191404 8203872 8222980 8225435 8241082 8242010 8247432 * 8258795 8267038 8287180 8302512 8304761 8306031 8308021 8313702 8318322 - * 8327631 8332424 8334418 8344589 8348328 + * 8327631 8332424 8334418 8344589 8348328 8362428 * @summary Checks the IANA language subtag registry data update - * (LSR Revision: 2025-05-15) with Locale and Locale.LanguageRange + * (LSR Revision: 2025-08-25) with Locale and Locale.LanguageRange * class methods. * @run main LanguageSubtagRegistryTest */ From 8954d057fa0ce0f366c27744d6c6284807ef0a55 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 26 Mar 2026 19:57:23 +0000 Subject: [PATCH 080/223] 8375065: Update LCMS to 2.18 Backport-of: 3871b8899df79fa85619975bd1c7f59792a839d1 --- src/java.desktop/share/legal/lcms.md | 4 +- .../share/native/liblcms/cmsalpha.c | 4 +- .../share/native/liblcms/cmscam02.c | 41 +++++++++-------- .../share/native/liblcms/cmscgats.c | 13 ++++-- .../share/native/liblcms/cmscnvrt.c | 2 +- .../share/native/liblcms/cmserr.c | 2 +- .../share/native/liblcms/cmsgamma.c | 3 +- .../share/native/liblcms/cmsgmt.c | 2 +- .../share/native/liblcms/cmshalf.c | 2 +- .../share/native/liblcms/cmsintrp.c | 10 ++--- .../share/native/liblcms/cmsio0.c | 12 +++-- .../share/native/liblcms/cmsio1.c | 10 ++++- .../share/native/liblcms/cmslut.c | 2 +- .../share/native/liblcms/cmsmd5.c | 2 +- .../share/native/liblcms/cmsmtrx.c | 2 +- .../share/native/liblcms/cmsnamed.c | 16 +++---- .../share/native/liblcms/cmsopt.c | 16 +++++-- .../share/native/liblcms/cmspack.c | 2 +- .../share/native/liblcms/cmspcs.c | 2 +- .../share/native/liblcms/cmsplugin.c | 4 +- .../share/native/liblcms/cmsps2.c | 2 +- .../share/native/liblcms/cmssamp.c | 13 +++--- src/java.desktop/share/native/liblcms/cmssm.c | 2 +- .../share/native/liblcms/cmstypes.c | 40 ++++++++++------- .../share/native/liblcms/cmsvirt.c | 44 ++++++++++++------- .../share/native/liblcms/cmswtpnt.c | 2 +- .../share/native/liblcms/cmsxform.c | 9 +++- src/java.desktop/share/native/liblcms/lcms2.h | 6 +-- .../share/native/liblcms/lcms2_internal.h | 2 +- .../share/native/liblcms/lcms2_plugin.h | 2 +- 30 files changed, 166 insertions(+), 107 deletions(-) diff --git a/src/java.desktop/share/legal/lcms.md b/src/java.desktop/share/legal/lcms.md index 83c47d3acdb4..886415679437 100644 --- a/src/java.desktop/share/legal/lcms.md +++ b/src/java.desktop/share/legal/lcms.md @@ -1,11 +1,11 @@ -## Little Color Management System (LCMS) v2.17 +## Little Color Management System (LCMS) v2.18 ### LCMS License
 
 MIT License
 
-Copyright (C) 1998-2025 Marti Maria Saguer
+Copyright (C) 1998-2026 Marti Maria Saguer
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsalpha.c b/src/java.desktop/share/native/liblcms/cmsalpha.c
index 2e50b65be24c..bcedbde938e8 100644
--- a/src/java.desktop/share/native/liblcms/cmsalpha.c
+++ b/src/java.desktop/share/native/liblcms/cmsalpha.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -406,7 +406,7 @@ int FormatterPos(cmsUInt32Number frm)
 static
 cmsFormatterAlphaFn _cmsGetFormatterAlpha(cmsContext id, cmsUInt32Number in, cmsUInt32Number out)
 {
-static cmsFormatterAlphaFn FormattersAlpha[6][6] = {
+static const cmsFormatterAlphaFn FormattersAlpha[6][6] = {
 
        /* from 8 */  { copy8,       from8to16,   from8to16SE,   from8toHLF,   from8toFLT,    from8toDBL    },
        /* from 16*/  { from16to8,   copy16,      from16to16,    from16toHLF,  from16toFLT,   from16toDBL   },
diff --git a/src/java.desktop/share/native/liblcms/cmscam02.c b/src/java.desktop/share/native/liblcms/cmscam02.c
index 45ef4eef970c..168ef597032a 100644
--- a/src/java.desktop/share/native/liblcms/cmscam02.c
+++ b/src/java.desktop/share/native/liblcms/cmscam02.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -285,27 +285,32 @@ CAM02COLOR InverseCorrelates(CAM02COLOR clr, cmsCIECAM02* pMod)
            (clr.J / 100.0),
            (1.0 / (pMod->c * pMod->z)));
 
-    p1 = e / t;
     p2 = (clr.A / pMod->Nbb) + 0.305;
-    p3 = 21.0 / 20.0;
 
-    hr = clr.h * d2r;
-
-    if (fabs(sin(hr)) >= fabs(cos(hr))) {
-        p4 = p1 / sin(hr);
-        clr.b = (p2 * (2.0 + p3) * (460.0 / 1403.0)) /
-            (p4 + (2.0 + p3) * (220.0 / 1403.0) *
-            (cos(hr) / sin(hr)) - (27.0 / 1403.0) +
-            p3 * (6300.0 / 1403.0));
-        clr.a = clr.b * (cos(hr) / sin(hr));
+    if ( t <= 0.0 ) {     // special case from spec notes, avoid divide by zero
+        clr.a = clr.b = 0.0;
     }
     else {
-        p5 = p1 / cos(hr);
-        clr.a = (p2 * (2.0 + p3) * (460.0 / 1403.0)) /
-            (p5 + (2.0 + p3) * (220.0 / 1403.0) -
-            ((27.0 / 1403.0) - p3 * (6300.0 / 1403.0)) *
-            (sin(hr) / cos(hr)));
-        clr.b = clr.a * (sin(hr) / cos(hr));
+        hr = clr.h * d2r;
+        p1 = e / t;
+        p3 = 21.0 / 20.0;
+
+        if (fabs(sin(hr)) >= fabs(cos(hr))) {
+            p4 = p1 / sin(hr);
+            clr.b = (p2 * (2.0 + p3) * (460.0 / 1403.0)) /
+                (p4 + (2.0 + p3) * (220.0 / 1403.0) *
+                (cos(hr) / sin(hr)) - (27.0 / 1403.0) +
+                p3 * (6300.0 / 1403.0));
+            clr.a = clr.b * (cos(hr) / sin(hr));
+        }
+        else {
+            p5 = p1 / cos(hr);
+            clr.a = (p2 * (2.0 + p3) * (460.0 / 1403.0)) /
+                (p5 + (2.0 + p3) * (220.0 / 1403.0) -
+                ((27.0 / 1403.0) - p3 * (6300.0 / 1403.0)) *
+                (sin(hr) / cos(hr)));
+            clr.b = clr.a * (sin(hr) / cos(hr));
+        }
     }
 
     clr.RGBpa[0] = ((460.0 / 1403.0) * p2) +
diff --git a/src/java.desktop/share/native/liblcms/cmscgats.c b/src/java.desktop/share/native/liblcms/cmscgats.c
index 3e62d064c3f6..e8a75c7355fd 100644
--- a/src/java.desktop/share/native/liblcms/cmscgats.c
+++ b/src/java.desktop/share/native/liblcms/cmscgats.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -295,7 +295,7 @@ typedef struct {
         WRITEMODE as;      // How is supposed to be written
     } PROPERTY;
 
-static PROPERTY PredefinedProperties[] = {
+static const PROPERTY PredefinedProperties[] = {
 
         {"NUMBER_OF_FIELDS", WRITE_UNCOOKED},    // Required - NUMBER OF FIELDS
         {"NUMBER_OF_SETS",   WRITE_UNCOOKED},    // Required - NUMBER OF SETS
@@ -458,7 +458,7 @@ cmsBool StringAppend(string* s, char c)
         new_ptr = (char*) AllocChunk(s->it8, s->max);
         if (new_ptr == NULL) return FALSE;
 
-        if (new_ptr != NULL && s->begin != NULL)
+        if (s->begin != NULL)
             memcpy(new_ptr, s->begin, s->len);
 
         s->begin = new_ptr;
@@ -899,6 +899,11 @@ void InSymbol(cmsIT8* it8)
                     sign = -1;
                     NextCh(it8);
                 }
+                else
+                    if (it8->ch == '+') {
+                        sign = +1;
+                        NextCh(it8);
+                    }
 
                 it8->inum = 0;
                 it8->sy   = SINUM;
@@ -3206,7 +3211,7 @@ cmsBool ParseCube(cmsIT8* cube, cmsStage** Shaper, cmsStage** CLUT, char title[]
 
                 int nodes = lut_size * lut_size * lut_size;
 
-                cmsFloat32Number* lut_table = _cmsMalloc(cube->ContextID, nodes * 3 * sizeof(cmsFloat32Number));
+                cmsFloat32Number* lut_table = (cmsFloat32Number*) _cmsMalloc(cube->ContextID, nodes * 3 * sizeof(cmsFloat32Number));
                 if (lut_table == NULL) return FALSE;
 
                 for (i = 0; i < nodes; i++) {
diff --git a/src/java.desktop/share/native/liblcms/cmscnvrt.c b/src/java.desktop/share/native/liblcms/cmscnvrt.c
index 9f8619cb9dac..c66dbcbebad8 100644
--- a/src/java.desktop/share/native/liblcms/cmscnvrt.c
+++ b/src/java.desktop/share/native/liblcms/cmscnvrt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmserr.c b/src/java.desktop/share/native/liblcms/cmserr.c
index d421c550d32d..877beb9ca6a3 100644
--- a/src/java.desktop/share/native/liblcms/cmserr.c
+++ b/src/java.desktop/share/native/liblcms/cmserr.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsgamma.c b/src/java.desktop/share/native/liblcms/cmsgamma.c
index 773858b0c1f0..bace6ab02e2a 100644
--- a/src/java.desktop/share/native/liblcms/cmsgamma.c
+++ b/src/java.desktop/share/native/liblcms/cmsgamma.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -1187,6 +1187,7 @@ cmsBool smooth2(cmsContext ContextID, cmsFloat32Number w[], cmsFloat32Number y[]
     cmsFloat32Number *c, *d, *e;
     cmsBool st;
 
+    if (m < 4 || lambda < MATRIX_DET_TOLERANCE) return FALSE;
 
     c = (cmsFloat32Number*) _cmsCalloc(ContextID, MAX_NODES_IN_CURVE, sizeof(cmsFloat32Number));
     d = (cmsFloat32Number*) _cmsCalloc(ContextID, MAX_NODES_IN_CURVE, sizeof(cmsFloat32Number));
diff --git a/src/java.desktop/share/native/liblcms/cmsgmt.c b/src/java.desktop/share/native/liblcms/cmsgmt.c
index 03ac70202a50..1b023dcc299f 100644
--- a/src/java.desktop/share/native/liblcms/cmsgmt.c
+++ b/src/java.desktop/share/native/liblcms/cmsgmt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmshalf.c b/src/java.desktop/share/native/liblcms/cmshalf.c
index 7e5f7a3c7e03..e1fb1d554883 100644
--- a/src/java.desktop/share/native/liblcms/cmshalf.c
+++ b/src/java.desktop/share/native/liblcms/cmshalf.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsintrp.c b/src/java.desktop/share/native/liblcms/cmsintrp.c
index 43c47429c3cd..23e59a229a9f 100644
--- a/src/java.desktop/share/native/liblcms/cmsintrp.c
+++ b/src/java.desktop/share/native/liblcms/cmsintrp.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -984,9 +984,9 @@ void Eval4Inputs(CMSREGISTER const cmsUInt16Number Input[],
                                 c1 = c2 = c3 = 0;
                             }
 
-        Rest = c1 * rx + c2 * ry + c3 * rz;
+        Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001;
 
-        Tmp1[OutChan] = (cmsUInt16Number)(c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest)));
+        Tmp1[OutChan] = (cmsUInt16Number)c0 + ((Rest + (Rest >> 16)) >> 16);
     }
 
 
@@ -1048,9 +1048,9 @@ void Eval4Inputs(CMSREGISTER const cmsUInt16Number Input[],
                                 c1 = c2 = c3 = 0;
                             }
 
-        Rest = c1 * rx + c2 * ry + c3 * rz;
+        Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001;
 
-        Tmp2[OutChan] = (cmsUInt16Number) (c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest)));
+        Tmp2[OutChan] = (cmsUInt16Number) c0 + ((Rest + (Rest >> 16)) >> 16);
     }
 
 
diff --git a/src/java.desktop/share/native/liblcms/cmsio0.c b/src/java.desktop/share/native/liblcms/cmsio0.c
index 5258b7939d2b..5a4f09af5bcf 100644
--- a/src/java.desktop/share/native/liblcms/cmsio0.c
+++ b/src/java.desktop/share/native/liblcms/cmsio0.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -685,6 +685,7 @@ void _cmsDeleteTagByPos(_cmsICCPROFILE* Icc, int i)
         // Free previous version
         if (Icc ->TagSaveAsRaw[i]) {
             _cmsFree(Icc ->ContextID, Icc ->TagPtrs[i]);
+            Icc->TagSaveAsRaw[i] = FALSE;
         }
         else {
             cmsTagTypeHandler* TypeHandler = Icc ->TagTypeHandlers[i];
@@ -1605,6 +1606,8 @@ void freeOneTag(_cmsICCPROFILE* Icc, cmsUInt32Number i)
         else
             _cmsFree(Icc->ContextID, Icc->TagPtrs[i]);
     }
+
+    Icc->TagPtrs[i] = NULL;
 }
 
 // Closes a profile freeing any involved resources
@@ -1847,8 +1850,11 @@ cmsBool CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const v
 
     if (!_cmsNewTag(Icc, sig, &i)) goto Error;
 
-    // This is not raw
-    Icc ->TagSaveAsRaw[i] = FALSE;
+    // This cannot be RAW
+    if (Icc->TagSaveAsRaw[i]) {
+        cmsSignalError(Icc->ContextID, cmsERROR_ALREADY_DEFINED, "Tag  '%x' was already saved as RAW", sig);
+        goto Error;
+    }
 
     // This is not a link
     Icc ->TagLinked[i] = (cmsTagSignature) 0;
diff --git a/src/java.desktop/share/native/liblcms/cmsio1.c b/src/java.desktop/share/native/liblcms/cmsio1.c
index 48772c7cbde9..463f1192c2a4 100644
--- a/src/java.desktop/share/native/liblcms/cmsio1.c
+++ b/src/java.desktop/share/native/liblcms/cmsio1.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -1012,7 +1012,13 @@ const cmsMLU* GetInfo(cmsHPROFILE hProfile, cmsInfoType Info)
     switch (Info) {
 
     case cmsInfoDescription:
-        sig = cmsSigProfileDescriptionTag;
+        /**
+        * Add for MacOS, which uses propiertary tags for description
+        */
+        if (cmsIsTag(hProfile, cmsSigProfileDescriptionMLTag))
+            sig = cmsSigProfileDescriptionMLTag;
+        else
+            sig = cmsSigProfileDescriptionTag;
         break;
 
     case cmsInfoManufacturer:
diff --git a/src/java.desktop/share/native/liblcms/cmslut.c b/src/java.desktop/share/native/liblcms/cmslut.c
index 3cf4e8cac5a6..28220eae6673 100644
--- a/src/java.desktop/share/native/liblcms/cmslut.c
+++ b/src/java.desktop/share/native/liblcms/cmslut.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsmd5.c b/src/java.desktop/share/native/liblcms/cmsmd5.c
index d9b9a4e52608..f18300ebace2 100644
--- a/src/java.desktop/share/native/liblcms/cmsmd5.c
+++ b/src/java.desktop/share/native/liblcms/cmsmd5.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsmtrx.c b/src/java.desktop/share/native/liblcms/cmsmtrx.c
index 841da662a107..1db000752e3a 100644
--- a/src/java.desktop/share/native/liblcms/cmsmtrx.c
+++ b/src/java.desktop/share/native/liblcms/cmsmtrx.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsnamed.c b/src/java.desktop/share/native/liblcms/cmsnamed.c
index 451bfe9f34d5..acdaabc3ec26 100644
--- a/src/java.desktop/share/native/liblcms/cmsnamed.c
+++ b/src/java.desktop/share/native/liblcms/cmsnamed.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -303,7 +303,7 @@ cmsUInt32Number encodeUTF8(char* out, const wchar_t* in, cmsUInt32Number max_wch
     cmsUInt32Number size = 0;
     cmsUInt32Number len_w = 0;
 
-    while (*in && len_w < max_wchars)
+    while (len_w < max_wchars && *in)
     {
         if (*in >= 0xd800 && *in <= 0xdbff)
             codepoint = ((*in - 0xd800) << 10) + 0x10000;
@@ -1071,17 +1071,17 @@ cmsSEQ* CMSEXPORT cmsDupProfileSequenceDescription(const cmsSEQ* pseq)
     if (pseq == NULL)
         return NULL;
 
-    NewSeq = (cmsSEQ*) _cmsMalloc(pseq -> ContextID, sizeof(cmsSEQ));
+    NewSeq = (cmsSEQ*)_cmsMallocZero(pseq->ContextID, sizeof(cmsSEQ));
     if (NewSeq == NULL) return NULL;
 
+    NewSeq->ContextID = pseq->ContextID;
 
-    NewSeq -> seq      = (cmsPSEQDESC*) _cmsCalloc(pseq ->ContextID, pseq ->n, sizeof(cmsPSEQDESC));
-    if (NewSeq ->seq == NULL) goto Error;
+    NewSeq->seq = (cmsPSEQDESC*)_cmsCalloc(pseq->ContextID, pseq->n, sizeof(cmsPSEQDESC));
+    if (NewSeq->seq == NULL) goto Error;
 
-    NewSeq -> ContextID = pseq ->ContextID;
-    NewSeq -> n        = pseq ->n;
+    NewSeq->n = pseq->n;
 
-    for (i=0; i < pseq->n; i++) {
+    for (i = 0; i < pseq->n; i++) {
 
         memmove(&NewSeq ->seq[i].attributes, &pseq ->seq[i].attributes, sizeof(cmsUInt64Number));
 
diff --git a/src/java.desktop/share/native/liblcms/cmsopt.c b/src/java.desktop/share/native/liblcms/cmsopt.c
index 767008e68c58..9e71426a3327 100644
--- a/src/java.desktop/share/native/liblcms/cmsopt.c
+++ b/src/java.desktop/share/native/liblcms/cmsopt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -698,11 +698,16 @@ cmsBool OptimizeByResampling(cmsPipeline** Lut, cmsUInt32Number Intent, cmsUInt3
     if (ColorSpace == (cmsColorSpaceSignature)0 ||
         OutputColorSpace == (cmsColorSpaceSignature)0) return FALSE;
 
-    nGridPoints = _cmsReasonableGridpointsByColorspace(ColorSpace, *dwFlags);
-
     // For empty LUTs, 2 points are enough
     if (cmsPipelineStageCount(*Lut) == 0)
         nGridPoints = 2;
+    else
+    {
+        nGridPoints = _cmsReasonableGridpointsByColorspace(ColorSpace, *dwFlags);
+
+        // Lab16 as input cannot be optimized by a CLUT due to centering issues, thanks to Mike Chaney for discovering this.
+        if (!(*dwFlags & cmsFLAGS_FORCE_CLUT) && (ColorSpace == cmsSigLabData) && (T_BYTES(*InputFormat) == 2)) return FALSE;
+    }
 
     Src = *Lut;
 
@@ -813,6 +818,11 @@ cmsBool OptimizeByResampling(cmsPipeline** Lut, cmsUInt32Number Intent, cmsUInt3
             Dest ->OutputChannels,
             DataSetOut);
 
+        if (p16 == NULL) {
+            cmsPipelineFree(Dest);
+            return FALSE;
+        }
+
         _cmsPipelineSetOptimizationParameters(Dest, PrelinEval16, (void*) p16, PrelinOpt16free, Prelin16dup);
     }
 
diff --git a/src/java.desktop/share/native/liblcms/cmspack.c b/src/java.desktop/share/native/liblcms/cmspack.c
index d430e73051de..b740567af3b6 100644
--- a/src/java.desktop/share/native/liblcms/cmspack.c
+++ b/src/java.desktop/share/native/liblcms/cmspack.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmspcs.c b/src/java.desktop/share/native/liblcms/cmspcs.c
index 5f1b1f0d8e6d..8c33057721e9 100644
--- a/src/java.desktop/share/native/liblcms/cmspcs.c
+++ b/src/java.desktop/share/native/liblcms/cmspcs.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsplugin.c b/src/java.desktop/share/native/liblcms/cmsplugin.c
index aaad39f52b04..a943c9f4dd96 100644
--- a/src/java.desktop/share/native/liblcms/cmsplugin.c
+++ b/src/java.desktop/share/native/liblcms/cmsplugin.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -522,7 +522,7 @@ cmsBool CMSEXPORT _cmsIOPrintf(cmsIOHANDLER* io, const char* frm, ...)
     va_start(args, frm);
 
     len = vsnprintf((char*) Buffer, 2047, frm, args);
-    if (len < 0) {
+    if (len < 0 || len >= 2047) {
         va_end(args);
         return FALSE;   // Truncated, which is a fatal error for us
     }
diff --git a/src/java.desktop/share/native/liblcms/cmsps2.c b/src/java.desktop/share/native/liblcms/cmsps2.c
index 476817e9c1a2..80f7c8084ae7 100644
--- a/src/java.desktop/share/native/liblcms/cmsps2.c
+++ b/src/java.desktop/share/native/liblcms/cmsps2.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmssamp.c b/src/java.desktop/share/native/liblcms/cmssamp.c
index ca5c4a9d6931..c54a0d4ea723 100644
--- a/src/java.desktop/share/native/liblcms/cmssamp.c
+++ b/src/java.desktop/share/native/liblcms/cmssamp.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -152,9 +152,12 @@ cmsBool  BlackPointAsDarkerColorant(cmsHPROFILE    hInput,
     // Convert black to Lab
     cmsDoTransform(xform, Black, &Lab, 1);
 
-    // Force it to be neutral, check for inconsistencies
-    Lab.a = Lab.b = 0;
-    if (Lab.L > 50 || Lab.L < 0) Lab.L = 0;
+    if (Lab.L > 95)
+        Lab.L = 0;  // for synthetical negative profiles
+    else if (Lab.L < 0)
+        Lab.L = 0;
+    else if (Lab.L > 50)
+        Lab.L = 50;
 
     // Free the resources
     cmsDeleteTransform(xform);
@@ -352,7 +355,7 @@ cmsFloat64Number RootOfLeastSquaresFitQuadraticCurve(int n, cmsFloat64Number x[]
     if (fabs(a) < 1.0E-10) {
 
         if (fabs(b) < 1.0E-10) return 0;
-        return cmsmin(0, cmsmax(50, -c/b ));
+        return cmsmax(0, cmsmin(50, -c/b ));
     }
     else {
 
diff --git a/src/java.desktop/share/native/liblcms/cmssm.c b/src/java.desktop/share/native/liblcms/cmssm.c
index e2a810a26695..b79cd85488bf 100644
--- a/src/java.desktop/share/native/liblcms/cmssm.c
+++ b/src/java.desktop/share/native/liblcms/cmssm.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmstypes.c b/src/java.desktop/share/native/liblcms/cmstypes.c
index 22514f882268..eab74940cd09 100644
--- a/src/java.desktop/share/native/liblcms/cmstypes.c
+++ b/src/java.desktop/share/native/liblcms/cmstypes.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -4786,7 +4786,6 @@ cmsBool ReadMPEElem(struct _cms_typehandler_struct* self,
 
     return TRUE;
 
-    cmsUNUSED_PARAMETER(SizeOfTag);
     cmsUNUSED_PARAMETER(n);
 }
 
@@ -4894,9 +4893,11 @@ cmsBool Type_MPE_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, v
                  goto Error;
         }
 
+         Before = io ->Tell(io);
+
         if (!_cmsWriteUInt32Number(io, ElementSig)) goto Error;
         if (!_cmsWriteUInt32Number(io, 0)) goto Error;
-        Before = io ->Tell(io);
+
         if (!TypeHandler ->WritePtr(self, io, Elem, 1)) goto Error;
         if (!_cmsWriteAlignment(io)) goto Error;
 
@@ -5645,9 +5646,7 @@ void* Type_VideoSignal_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER*
 {
     cmsVideoSignalType* cicp = NULL;
 
-    if (SizeOfTag != 8) return NULL;
-
-    if (!_cmsReadUInt32Number(io, NULL)) return NULL;
+    if (SizeOfTag != 4) return NULL;
 
     cicp = (cmsVideoSignalType*)_cmsCalloc(self->ContextID, 1, sizeof(cmsVideoSignalType));
     if (cicp == NULL) return NULL;
@@ -5671,7 +5670,6 @@ cmsBool Type_VideoSignal_Write(struct _cms_typehandler_struct* self, cmsIOHANDLE
 {
     cmsVideoSignalType* cicp = (cmsVideoSignalType*)Ptr;
 
-    if (!_cmsWriteUInt32Number(io, 0)) return FALSE;
     if (!_cmsWriteUInt8Number(io, cicp->ColourPrimaries)) return FALSE;
     if (!_cmsWriteUInt8Number(io, cicp->TransferCharacteristics)) return FALSE;
     if (!_cmsWriteUInt8Number(io, cicp->MatrixCoefficients)) return FALSE;
@@ -5744,11 +5742,11 @@ void Type_MHC2_Free(struct _cms_typehandler_struct* self, void* Ptr)
 
 void* Type_MHC2_Dup(struct _cms_typehandler_struct* self, const void* Ptr, cmsUInt32Number n)
 {
-    cmsMHC2Type* mhc2 = _cmsDupMem(self->ContextID, Ptr, sizeof(cmsMHC2Type));
+    cmsMHC2Type* mhc2 = (cmsMHC2Type*)_cmsDupMem(self->ContextID, Ptr, sizeof(cmsMHC2Type));
 
-    mhc2->RedCurve = _cmsDupMem(self->ContextID,   mhc2->RedCurve, mhc2->CurveEntries*sizeof(cmsFloat64Number));
-    mhc2->GreenCurve = _cmsDupMem(self->ContextID, mhc2->GreenCurve, mhc2->CurveEntries * sizeof(cmsFloat64Number));
-    mhc2->BlueCurve = _cmsDupMem(self->ContextID,  mhc2->BlueCurve, mhc2->CurveEntries * sizeof(cmsFloat64Number));
+    mhc2->RedCurve = (cmsFloat64Number*) _cmsDupMem(self->ContextID,   mhc2->RedCurve, mhc2->CurveEntries*sizeof(cmsFloat64Number));
+    mhc2->GreenCurve = (cmsFloat64Number*) _cmsDupMem(self->ContextID, mhc2->GreenCurve, mhc2->CurveEntries * sizeof(cmsFloat64Number));
+    mhc2->BlueCurve = (cmsFloat64Number*) _cmsDupMem(self->ContextID,  mhc2->BlueCurve, mhc2->CurveEntries * sizeof(cmsFloat64Number));
 
     if (mhc2->RedCurve == NULL ||
         mhc2->GreenCurve == NULL ||
@@ -5786,7 +5784,6 @@ cmsBool Type_MHC2_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io,
     cmsUInt32Number MatrixOffset;
     cmsUInt32Number OffsetRedTable, OffsetGreenTable, OffsetBlueTable;
 
-    if (!_cmsWriteUInt32Number(io, 0)) return FALSE;
     if (!_cmsWriteUInt32Number(io, mhc2->CurveEntries)) return FALSE;
 
     if (!_cmsWrite15Fixed16Number(io, mhc2->MinLuminance)) return FALSE;
@@ -5811,10 +5808,20 @@ cmsBool Type_MHC2_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io,
     }
 
     OffsetRedTable = io->Tell(io) - BaseOffset;
+
+    if(!_cmsWriteUInt32Number(io, cmsSigS15Fixed16ArrayType)) return FALSE;
+    if(!_cmsWriteUInt32Number(io, 0)) return FALSE;
+
     if (!WriteDoubles(io, mhc2->CurveEntries, mhc2->RedCurve)) return FALSE;
+
     OffsetGreenTable = io->Tell(io) - BaseOffset;
+    if (!_cmsWriteUInt32Number(io, cmsSigS15Fixed16ArrayType)) return FALSE;
+    if (!_cmsWriteUInt32Number(io, 0)) return FALSE;
     if (!WriteDoubles(io, mhc2->CurveEntries, mhc2->GreenCurve)) return FALSE;
+
     OffsetBlueTable = io->Tell(io) - BaseOffset;
+    if (!_cmsWriteUInt32Number(io, cmsSigS15Fixed16ArrayType)) return FALSE;
+    if (!_cmsWriteUInt32Number(io, 0)) return FALSE;
     if (!WriteDoubles(io, mhc2->CurveEntries, mhc2->BlueCurve)) return FALSE;
 
     if (!io->Seek(io, TablesOffsetPos)) return FALSE;
@@ -5858,8 +5865,6 @@ void* Type_MHC2_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cms
     cmsUInt32Number MatrixOffset;
     cmsUInt32Number OffsetRedTable, OffsetGreenTable, OffsetBlueTable;
 
-    if (!_cmsReadUInt32Number(io, NULL)) return NULL;
-
     mhc2 = (cmsMHC2Type*)_cmsCalloc(self->ContextID, 1, sizeof(cmsMHC2Type));
     if (mhc2 == NULL) return NULL;
 
@@ -5890,9 +5895,10 @@ void* Type_MHC2_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cms
         if (!ReadDoublesAt(io, BaseOffset + MatrixOffset, 3*4, &mhc2->XYZ2XYZmatrix[0][0])) goto Error;
     }
 
-    if (!ReadDoublesAt(io, BaseOffset + OffsetRedTable, mhc2->CurveEntries, mhc2->RedCurve)) goto Error;
-    if (!ReadDoublesAt(io, BaseOffset + OffsetGreenTable, mhc2->CurveEntries, mhc2->GreenCurve)) goto Error;
-    if (!ReadDoublesAt(io, BaseOffset + OffsetBlueTable, mhc2->CurveEntries, mhc2->BlueCurve)) goto Error;
+    // Skip sf32 tag and filler (8bytes)
+    if (!ReadDoublesAt(io, BaseOffset + OffsetRedTable + 8, mhc2->CurveEntries, mhc2->RedCurve)) goto Error;
+    if (!ReadDoublesAt(io, BaseOffset + OffsetGreenTable + 8, mhc2->CurveEntries, mhc2->GreenCurve)) goto Error;
+    if (!ReadDoublesAt(io, BaseOffset + OffsetBlueTable + 8, mhc2->CurveEntries, mhc2->BlueCurve)) goto Error;
 
     // Success
     *nItems = 1;
diff --git a/src/java.desktop/share/native/liblcms/cmsvirt.c b/src/java.desktop/share/native/liblcms/cmsvirt.c
index 1ef86dae0544..0dfc6e947a55 100644
--- a/src/java.desktop/share/native/liblcms/cmsvirt.c
+++ b/src/java.desktop/share/native/liblcms/cmsvirt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -400,7 +400,7 @@ int InkLimitingSampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUI
     SumCMY   = (cmsFloat64Number) In[0]  + In[1] + In[2];
     SumCMYK  = SumCMY + In[3];
 
-    if (SumCMYK > InkLimit) {
+    if (SumCMYK > InkLimit && SumCMY > 0) {
 
         Ratio = 1 - ((SumCMYK - InkLimit) / SumCMY);
         if (Ratio < 0)
@@ -513,16 +513,20 @@ cmsHPROFILE CMSEXPORT cmsCreateLab2ProfileTHR(cmsContext ContextID, const cmsCIE
     cmsSetColorSpace(hProfile,  cmsSigLabData);
     cmsSetPCS(hProfile,         cmsSigLabData);
 
-    if (!SetTextTags(hProfile, L"Lab identity built-in")) return NULL;
+    if (!SetTextTags(hProfile, L"Lab identity built-in"))
+        goto Error;
 
     // An identity LUT is all we need
     LUT = cmsPipelineAlloc(ContextID, 3, 3);
-    if (LUT == NULL) goto Error;
+    if (LUT == NULL)
+        goto Error;
 
     if (!cmsPipelineInsertStage(LUT, cmsAT_BEGIN, _cmsStageAllocIdentityCLut(ContextID, 3)))
         goto Error;
 
-    if (!cmsWriteTag(hProfile, cmsSigAToB0Tag, LUT)) goto Error;
+    if (!cmsWriteTag(hProfile, cmsSigAToB0Tag, LUT))
+        goto Error;
+
     cmsPipelineFree(LUT);
 
     return hProfile;
@@ -550,8 +554,14 @@ cmsHPROFILE CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIE
 {
     cmsHPROFILE hProfile;
     cmsPipeline* LUT = NULL;
+    cmsCIEXYZ xyz;
 
-    hProfile = cmsCreateRGBProfileTHR(ContextID, WhitePoint == NULL ? cmsD50_xyY() : WhitePoint, NULL, NULL);
+    if (WhitePoint == NULL)
+        xyz = *cmsD50_XYZ();
+    else
+        cmsxyY2XYZ(&xyz, WhitePoint);
+
+    hProfile = cmsCreateRGBProfileTHR(ContextID, NULL, NULL, NULL);
     if (hProfile == NULL) return NULL;
 
     cmsSetProfileVersion(hProfile, 4.4);
@@ -560,6 +570,7 @@ cmsHPROFILE CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIE
     cmsSetColorSpace(hProfile,  cmsSigLabData);
     cmsSetPCS(hProfile,         cmsSigLabData);
 
+    if (!cmsWriteTag(hProfile, cmsSigMediaWhitePointTag, &xyz)) goto Error;
     if (!SetTextTags(hProfile, L"Lab identity built-in")) goto Error;
 
     // An empty LUTs is all we need
@@ -929,25 +940,24 @@ cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfileTHR(cmsContext ContextID,
 
     for (i=0; i < MAX_INPUT_DIMENSIONS; i++) Dimensions[i] = nLUTPoints;
     CLUT = cmsStageAllocCLut16bitGranular(ContextID, Dimensions, 3, 3, NULL);
-    if (CLUT == NULL) goto Error;
-
-
-    if (!cmsStageSampleCLut16bit(CLUT, bchswSampler, (void*) &bchsw, 0)) {
+    if (CLUT == NULL)
+        goto Error;
 
-        // Shouldn't reach here
+    if (!cmsStageSampleCLut16bit(CLUT, bchswSampler, (void*) &bchsw, 0))
         goto Error;
-    }
 
-    if (!cmsPipelineInsertStage(Pipeline, cmsAT_END, CLUT)) {
+    if (!cmsPipelineInsertStage(Pipeline, cmsAT_END, CLUT))
         goto Error;
-    }
 
     // Create tags
-    if (!SetTextTags(hICC, L"BCHS built-in")) return NULL;
+    if (!SetTextTags(hICC, L"BCHS built-in"))
+        goto Error;
 
-    cmsWriteTag(hICC, cmsSigMediaWhitePointTag, (void*) cmsD50_XYZ());
+    if (!cmsWriteTag(hICC, cmsSigMediaWhitePointTag, (void*)cmsD50_XYZ()))
+        goto Error;
 
-    cmsWriteTag(hICC, cmsSigAToB0Tag, (void*) Pipeline);
+    if (!cmsWriteTag(hICC, cmsSigAToB0Tag, (void*)Pipeline))
+        goto Error;
 
     // Pipeline is already on virtual profile
     cmsPipelineFree(Pipeline);
diff --git a/src/java.desktop/share/native/liblcms/cmswtpnt.c b/src/java.desktop/share/native/liblcms/cmswtpnt.c
index ebba2cd6a978..f6337765c0c7 100644
--- a/src/java.desktop/share/native/liblcms/cmswtpnt.c
+++ b/src/java.desktop/share/native/liblcms/cmswtpnt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsxform.c b/src/java.desktop/share/native/liblcms/cmsxform.c
index 1eb3eecbf182..b5dd302b973a 100644
--- a/src/java.desktop/share/native/liblcms/cmsxform.c
+++ b/src/java.desktop/share/native/liblcms/cmsxform.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -1101,6 +1101,8 @@ cmsBool  IsProperColorSpace(cmsColorSpaceSignature Check, cmsUInt32Number dwForm
     int Space1 = (int) T_COLORSPACE(dwFormat);
     int Space2 = _cmsLCMScolorSpace(Check);
 
+    if (dwFormat == 0) return TRUE; // Bypass used by linkicc
+
     if (Space1 == PT_ANY) return (T_CHANNELS(dwFormat) == cmsChannelsOf(Check));
     if (Space1 == Space2) return TRUE;
 
@@ -1183,6 +1185,11 @@ cmsHTRANSFORM CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID,
         if (hGamutProfile == NULL) dwFlags &= ~cmsFLAGS_GAMUTCHECK;
     }
 
+    if ((dwFlags & cmsFLAGS_GAMUTCHECK) && (nGamutPCSposition <= 0 || nGamutPCSposition >= nProfiles - 1)) {
+        cmsSignalError(ContextID, cmsERROR_RANGE, "Wrong gamut PCS position '%d'", nGamutPCSposition);
+        return NULL;
+    }
+
     // On floating point transforms, inhibit cache
     if (_cmsFormatterIsFloat(InputFormat) || _cmsFormatterIsFloat(OutputFormat))
         dwFlags |= cmsFLAGS_NOCACHE;
diff --git a/src/java.desktop/share/native/liblcms/lcms2.h b/src/java.desktop/share/native/liblcms/lcms2.h
index 5ba096613088..17a523847211 100644
--- a/src/java.desktop/share/native/liblcms/lcms2.h
+++ b/src/java.desktop/share/native/liblcms/lcms2.h
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2025 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -52,7 +52,7 @@
 //
 //---------------------------------------------------------------------------------
 //
-// Version 2.17
+// Version 2.18
 //
 
 #ifndef _lcms2_H
@@ -116,7 +116,7 @@ extern "C" {
 #endif
 
 // Version/release
-#define LCMS_VERSION        2170
+#define LCMS_VERSION        2180
 
 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
diff --git a/src/java.desktop/share/native/liblcms/lcms2_internal.h b/src/java.desktop/share/native/liblcms/lcms2_internal.h
index d14c0dd823ea..6bfe67e53501 100644
--- a/src/java.desktop/share/native/liblcms/lcms2_internal.h
+++ b/src/java.desktop/share/native/liblcms/lcms2_internal.h
@@ -30,7 +30,7 @@
 
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/lcms2_plugin.h b/src/java.desktop/share/native/liblcms/lcms2_plugin.h
index bdfc76f6bf5d..85de9bc56d5f 100644
--- a/src/java.desktop/share/native/liblcms/lcms2_plugin.h
+++ b/src/java.desktop/share/native/liblcms/lcms2_plugin.h
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),

From 95ef1c5dbc468f6ff0a93050fe53d4936c5ab100 Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Fri, 27 Mar 2026 09:43:10 +0000
Subject: [PATCH 081/223] 8372661: Add a null-safe static factory method to
 "jdk.test.lib.net.SimpleSSLContext"

Reviewed-by: rschmelter
Backport-of: 629e4ac6f45c87898f6a014f28a443c800413869
---
 .../jdk/test/lib/net/SimpleSSLContext.java    | 174 +++++++++++-------
 1 file changed, 107 insertions(+), 67 deletions(-)

diff --git a/test/lib/jdk/test/lib/net/SimpleSSLContext.java b/test/lib/jdk/test/lib/net/SimpleSSLContext.java
index e8611fb007f3..a4ea873ec693 100644
--- a/test/lib/jdk/test/lib/net/SimpleSSLContext.java
+++ b/test/lib/jdk/test/lib/net/SimpleSSLContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2025, 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,69 +23,100 @@
 
 package jdk.test.lib.net;
 
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.*;
 import java.io.*;
 import java.security.*;
-import java.security.cert.*;
-import java.util.function.Supplier;
 import javax.net.ssl.*;
 
 /**
- * Creates a simple usable SSLContext for SSLSocketFactory
- * or a HttpsServer using either a given keystore or a default
- * one in the test tree.
- *
- * Using this class with a security manager requires the following
- * permissions to be granted:
- *
- * permission "java.util.PropertyPermission" "test.src.path", "read";
- * permission java.io.FilePermission "/path/to/test/lib/jdk/test/lib/testkeys", "read";
- * The exact path above depends on the location of the test.
+ * Utility for creating a simple usable {@link SSLContext} for testing purposes.
  */
-public class SimpleSSLContext {
+public final class SimpleSSLContext {
+
+    private static final String DEFAULT_PROTOCOL = "TLS";
+
+    private static final String DEFAULT_KEY_STORE_FILE_REL_PATH = "jdk/test/lib/net/testkeys";
 
-    SSLContext ssl;
+    private final SSLContext ssl;
+
+    // Made `public` for backward compatibility
+    public SimpleSSLContext() throws IOException {
+        this.ssl = findSSLContext(DEFAULT_KEY_STORE_FILE_REL_PATH, DEFAULT_PROTOCOL);
+    }
+
+    // Kept for backward compatibility
+    public SimpleSSLContext(String keyStoreFileRelPath) throws IOException {
+        this.ssl = findSSLContext(Objects.requireNonNull(keyStoreFileRelPath), DEFAULT_PROTOCOL);
+    }
 
     /**
-     * loads default keystore from SimpleSSLContext
-     * source directory
+     * {@return a new {@link SSLContext} instance by searching for a key store
+     * file path, and loading the first found one}
+     *
+     * @throws RuntimeException if no key store file can be found or the found
+     * one cannot be loaded
      */
-    public SimpleSSLContext() throws IOException {
-        this(() -> "TLS");
+    public static SSLContext findSSLContext() throws IOException {
+        return findSSLContext(DEFAULT_PROTOCOL);
+    }
+
+    /**
+     * {@return a new {@link SSLContext} instance by searching for a key store
+     * file path, and loading the first found one}
+     *
+     * @param protocol an {@link SSLContext} protocol
+     *
+     * @throws NullPointerException if {@code protocol} is null
+     * @throws RuntimeException if no key store file can be found or the found
+     * one cannot be loaded
+     */
+    public static SSLContext findSSLContext(String protocol) throws IOException {
+        Objects.requireNonNull(protocol);
+        return findSSLContext(DEFAULT_KEY_STORE_FILE_REL_PATH, protocol);
     }
 
+    /**
+     * {@return a new {@link SSLContext} instance by searching for a key store
+     * file path, and loading the first found one}
+     *
+     * @param keyStoreFileRelPath a key store file path to be concatenated with
+     *                            the search path(s) obtained from the
+     *                            {@code test.src.path} system property
+     * @param protocol an {@link SSLContext} protocol
+     *
+     * @throws NullPointerException if {@code keyStoreFileRelPath} or {@code protocol} is null
+     * @throws RuntimeException if no key store file can be found or the found
+     * one cannot be loaded
+     */
     @SuppressWarnings("removal")
-    private SimpleSSLContext(Supplier protocols) throws IOException {
+    public static SSLContext findSSLContext(String keyStoreFileRelPath, String protocol) throws IOException {
+        Objects.requireNonNull(keyStoreFileRelPath);
+        Objects.requireNonNull(protocol);
+
         try {
-            final String proto = protocols.get();
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                @Override
-                public Void run() throws Exception {
-                    String paths = System.getProperty("test.src.path");
-                    StringTokenizer st = new StringTokenizer(paths, File.pathSeparator);
-                    boolean securityExceptions = false;
-                    while (st.hasMoreTokens()) {
-                        String path = st.nextToken();
-                        try {
-                            File f = new File(path, "jdk/test/lib/net/testkeys");
-                            if (f.exists()) {
-                                try (FileInputStream fis = new FileInputStream(f)) {
-                                    init(fis, proto);
-                                    return null;
-                                }
-                            }
-                        } catch (SecurityException e) {
-                            // catch and ignore because permission only required
-                            // for one entry on path (at most)
-                            securityExceptions = true;
+            SSLContext res = (SSLContext) AccessController.doPrivileged((PrivilegedExceptionAction) () -> {
+                String sourcePaths = System.getProperty("test.src.path");
+                boolean securityExceptions = false;
+                for (var sourcePath : Collections.list(new StringTokenizer(sourcePaths, File.pathSeparator))) {
+                    try {
+                        var keyStoreFileAbsPath = Path.of((String) sourcePath, keyStoreFileRelPath);
+                        if (Files.exists(keyStoreFileAbsPath)) {
+                            return loadSSLContext(keyStoreFileAbsPath, protocol);
                         }
+                    } catch (SecurityException e) {
+                        // catch and ignore because permission only required
+                        // for one entry on path (at most)
+                        securityExceptions = true;
                     }
-                    if (securityExceptions) {
-                        System.err.println("SecurityExceptions thrown on loading testkeys");
-                    }
-                    return null;
                 }
+                if (securityExceptions) {
+                    System.err.println("SecurityExceptions thrown on loading testkeys");
+                }
+                return null;
             });
+            if (res != null) return res;
         } catch (PrivilegedActionException pae) {
             Throwable t = pae.getCause() != null ? pae.getCause() : pae;
             if (t instanceof IOException)
@@ -96,23 +127,25 @@ public Void run() throws Exception {
                 throw (Error)t;
             throw new RuntimeException(t);
         }
+        throw new RuntimeException(
+                "Could not find any key store at source path(s) using key store file relative path '%s'".formatted(
+                        keyStoreFileRelPath));
     }
 
     /**
-     * loads default keystore from given directory
+     * {@return a new {@link SSLContext} loaded from the provided key store file
+     * path using the given protocol}
+     *
+     * @param keyStoreFilePath a {@link KeyStore} file path
+     * @param protocol an {@link SSLContext} protocol
+     *
+     * @throws RuntimeException if loading fails
      */
-    public SimpleSSLContext(String dir) throws IOException {
-        String file = dir + "/testkeys";
-        try (FileInputStream fis = new FileInputStream(file)) {
-            init(fis, "TLS");
-        }
-    }
-
-    private void init(InputStream i, String protocol) throws IOException {
-        try {
+    private static SSLContext loadSSLContext(Path keyStoreFilePath, String protocol) {
+        try (var storeStream = Files.newInputStream(keyStoreFilePath)) {
             char[] passphrase = "passphrase".toCharArray();
             KeyStore ks = KeyStore.getInstance("PKCS12");
-            ks.load(i, passphrase);
+            ks.load(storeStream, passphrase);
 
             KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX");
             kmf.init(ks, passphrase);
@@ -120,25 +153,32 @@ private void init(InputStream i, String protocol) throws IOException {
             TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
             tmf.init(ks);
 
-            ssl = SSLContext.getInstance(protocol);
-            ssl.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
-        } catch (KeyManagementException | KeyStoreException |
-                UnrecoverableKeyException | CertificateException |
-                NoSuchAlgorithmException e) {
-            throw new RuntimeException(e.getMessage());
+            var sslContext = SSLContext.getInstance(protocol);
+            sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+            return sslContext;
+        } catch (SecurityException e) {
+            throw e;
+        } catch (Exception e) {
+            var message = "Failed loading 'SSLContext' from key store at location '%s' for protocol '%s'".formatted(
+                    keyStoreFilePath, protocol);
+            throw new RuntimeException(message, e);
         }
     }
 
+    // Kept for backward compatibility
     public static SSLContext getContext(String protocol) throws IOException {
-        if(protocol == null || protocol.isEmpty()) {
-            return new SimpleSSLContext().get();
-        }
-        else {
-            return new SimpleSSLContext(() -> protocol).get();
+        try {
+            return protocol == null || protocol.isEmpty()
+                    ? findSSLContext()
+                    : findSSLContext(protocol);
+        } catch (RuntimeException re) {
+            throw new IOException(re);
         }
     }
 
+    // Kept for backward compatibility
     public SSLContext get() {
         return ssl;
     }
+
 }

From 0cb5ec4ceeea41e7c5cf765ae2cb6bd1971e0543 Mon Sep 17 00:00:00 2001
From: Matthias Baesken 
Date: Fri, 27 Mar 2026 10:53:54 +0000
Subject: [PATCH 082/223] 8374998: Failing os::write - remove bad file

Backport-of: 4c9103f7b6c91b0f237859516ef72bb9ee27157e
---
 src/hotspot/os/posix/perfMemory_posix.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/hotspot/os/posix/perfMemory_posix.cpp b/src/hotspot/os/posix/perfMemory_posix.cpp
index 7c39c5af466d..790db31348c3 100644
--- a/src/hotspot/os/posix/perfMemory_posix.cpp
+++ b/src/hotspot/os/posix/perfMemory_posix.cpp
@@ -112,6 +112,10 @@ static void save_memory_to_file(char* addr, size_t size) {
     result = ::close(fd);
     if (result == OS_ERR) {
       warning("Could not close %s: %s\n", destfile, os::strerror(errno));
+    } else {
+      if (!successful_write) {
+        remove(destfile);
+      }
     }
   }
   FREE_C_HEAP_ARRAY(char, destfile);
@@ -954,6 +958,7 @@ static int create_sharedmem_file(const char* dirname, const char* filename, size
         warning("Insufficient space for shared memory file:\n   %s\nTry using the -Djava.io.tmpdir= option to select an alternate temp location.\n", filename);
       }
       result = OS_ERR;
+      remove(filename);
       break;
     }
   }

From 962012ca3b5a8957dbcc619aa5a931388a5ad4b3 Mon Sep 17 00:00:00 2001
From: Matthias Baesken 
Date: Fri, 27 Mar 2026 10:57:43 +0000
Subject: [PATCH 083/223] 8376889: Enhance JfrRecorder::on_create_vm_3() assert
 output

Reviewed-by: mdoerr
Backport-of: a5b4c0795d88db3d02d31fb4740612c6a53f7204
---
 src/hotspot/share/jfr/recorder/jfrRecorder.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp
index 6f2f9a5857d8..7f49c06bd58a 100644
--- a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp
+++ b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2026, 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
@@ -227,7 +227,7 @@ bool JfrRecorder::on_create_vm_2() {
 }
 
 bool JfrRecorder::on_create_vm_3() {
-  assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE, "invalid init sequence");
+  JVMTI_ONLY( assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE, "invalid init sequence, phase is %d", (int)JvmtiEnvBase::get_phase()); )
   return Arguments::is_dumping_archive() || launch_command_line_recordings(JavaThread::current());
 }
 

From 449b3dfb8d411f0cbe64f1c0833c8dcc14dde55f Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Fri, 27 Mar 2026 14:57:50 +0000
Subject: [PATCH 084/223] 8378201: [OGL] glXMakeContextCurrent() drops the
 buffers of the unbound drawable 8369561:
 sun/java2d/OpenGL/DrawBitmaskImage.java#id0: Incorrect color for first pixel
 (actual=ff000000)

Backport-of: e24a8f06e30a0889b1fb5689ac3d4180f90d25d4
---
 .../common/java2d/opengl/GLXSurfaceData.c     | 100 ++++++++++++-
 test/jdk/ProblemList.txt                      |   1 +
 .../sun/java2d/OpenGL/FlipCoexistTest.java    | 134 ++++++++++++++++++
 .../java2d/OpenGL/MultiWindowFillTest.java    | 122 ++++++++++++++++
 4 files changed, 352 insertions(+), 5 deletions(-)
 create mode 100644 test/jdk/sun/java2d/OpenGL/FlipCoexistTest.java
 create mode 100644 test/jdk/sun/java2d/OpenGL/MultiWindowFillTest.java

diff --git a/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c b/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c
index c48b38fa1f3e..2ed575c10c7c 100644
--- a/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c
+++ b/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2026, 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
@@ -40,6 +40,8 @@
 
 #ifndef HEADLESS
 
+#include 
+
 extern LockFunc       OGLSD_Lock;
 extern GetRasInfoFunc OGLSD_GetRasInfo;
 extern UnlockFunc     OGLSD_Unlock;
@@ -50,6 +52,74 @@ extern void
 
 jboolean surfaceCreationFailed = JNI_FALSE;
 
+/**
+ * Per-Window GLXWindow entry with reference counting.
+ * Stored in an XContext keyed by the X Window XID.
+ */
+typedef struct {
+    GLXWindow glxWindow;
+    int       refCount;
+} GLXWindowRef;
+
+static XContext glxWindowContext;
+
+/**
+ * Gets or creates a shared GLXWindow for the given X Window.
+ * All callers are synchronized by the AWT lock.
+ */
+static GLXWindow acquireGLXWindow(Window window, GLXFBConfig fbconfig)
+{
+    if (glxWindowContext == 0) {
+        glxWindowContext = XUniqueContext();
+    }
+
+    XPointer data;
+    if (XFindContext(awt_display, window, glxWindowContext, &data) == 0) {
+        GLXWindowRef *ref = (GLXWindowRef *)data;
+        ref->refCount++;
+        return ref->glxWindow;
+    }
+
+    GLXWindow glxWin = j2d_glXCreateWindow(awt_display, fbconfig, window, NULL);
+    if (glxWin == 0) {
+        return 0;
+    }
+
+    GLXWindowRef *ref = malloc(sizeof(*ref));
+    if (ref == NULL) {
+        j2d_glXDestroyWindow(awt_display, glxWin);
+        return 0;
+    }
+    ref->glxWindow = glxWin;
+    ref->refCount = 1;
+    if (XSaveContext(awt_display, window, glxWindowContext, (XPointer)ref) != 0)
+    {
+        j2d_glXDestroyWindow(awt_display, glxWin);
+        free(ref);
+        return 0;
+    }
+    return glxWin;
+}
+
+/**
+ * Decrements the reference count for the GLXWindow associated with the given
+ * X Window. Destroys it when the count reaches zero.
+ * All callers are synchronized by the AWT lock.
+ */
+static void releaseGLXWindow(Window window)
+{
+    XPointer data;
+    if (XFindContext(awt_display, window, glxWindowContext, &data) != 0) {
+        return;
+    }
+    GLXWindowRef *ref = (GLXWindowRef *)data;
+    if (--ref->refCount <= 0) {
+        j2d_glXDestroyWindow(awt_display, ref->glxWindow);
+        XDeleteContext(awt_display, window, glxWindowContext);
+        free(ref);
+    }
+}
+
 #endif /* !HEADLESS */
 
 JNIEXPORT void JNICALL
@@ -74,7 +144,7 @@ Java_sun_java2d_opengl_GLXSurfaceData_initOps(JNIEnv *env, jobject glxsd,
     // later the graphicsConfig will be used for deallocation of oglsdo
     oglsdo->graphicsConfig = gc;
 
-    GLXSDOps *glxsdo = (GLXSDOps *)malloc(sizeof(GLXSDOps));
+    GLXSDOps *glxsdo = (GLXSDOps *)calloc(1, sizeof(GLXSDOps));
 
     if (glxsdo == NULL) {
         JNU_ThrowOutOfMemoryError(env, "creating native GLX ops");
@@ -125,8 +195,13 @@ Java_sun_java2d_opengl_GLXSurfaceData_initOps(JNIEnv *env, jobject glxsd,
 void
 OGLSD_DestroyOGLSurface(JNIEnv *env, OGLSDOps *oglsdo)
 {
+    GLXSDOps *glxsdo = (GLXSDOps *)oglsdo->privOps;
     J2dTraceLn(J2D_TRACE_INFO, "OGLSD_DestroyOGLSurface");
-    // X Window is free'd later by AWT code...
+    if (glxsdo != NULL && glxsdo->drawable != 0) {
+        releaseGLXWindow(glxsdo->window);
+        glxsdo->drawable = 0;
+        oglsdo->drawableType = OGLSD_UNDEFINED;
+    }
 }
 
 /**
@@ -296,6 +371,13 @@ OGLSD_InitOGLWindow(JNIEnv *env, OGLSDOps *oglsdo)
         return JNI_FALSE;
     }
 
+    glxsdo->drawable = acquireGLXWindow(window,
+                                        glxsdo->configData->glxInfo->fbconfig);
+    if (glxsdo->drawable == 0) {
+        J2dRlsTraceLn(J2D_TRACE_ERROR, "OGLSD_InitOGLWindow: GLXWindow is 0");
+        return JNI_FALSE;
+    }
+
     XGetWindowAttributes(awt_display, window, &attr);
     oglsdo->width = attr.width;
     oglsdo->height = attr.height;
@@ -304,7 +386,6 @@ OGLSD_InitOGLWindow(JNIEnv *env, OGLSDOps *oglsdo)
     oglsdo->isOpaque = JNI_TRUE;
     oglsdo->xOffset = 0;
     oglsdo->yOffset = 0;
-    glxsdo->drawable = window;
     glxsdo->xdrawable = window;
 
     J2dTraceLn2(J2D_TRACE_VERBOSE, "  created window: w=%d h=%d",
@@ -333,7 +414,16 @@ OGLSD_SwapBuffers(JNIEnv *env, jlong window)
         return;
     }
 
-    j2d_glXSwapBuffers(awt_display, (Window)window);
+    XPointer data;
+    if (XFindContext(awt_display, (Window)window, glxWindowContext, &data) != 0)
+    {
+        J2dRlsTraceLn(J2D_TRACE_ERROR,
+                      "OGLSD_SwapBuffers: GLXWindow not found");
+        return;
+    }
+
+    GLXWindowRef *ref = (GLXWindowRef *)data;
+    j2d_glXSwapBuffers(awt_display, ref->glxWindow);
 }
 
 // needed by Mac OS X port, no-op on other platforms
diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
index c73f0486bf19..a1efcd5fcb20 100644
--- a/test/jdk/ProblemList.txt
+++ b/test/jdk/ProblemList.txt
@@ -246,6 +246,7 @@ sun/awt/datatransfer/SuplementaryCharactersTransferTest.java 8011371 generic-all
 sun/awt/shell/ShellFolderMemoryLeak.java 8197794 windows-all
 sun/java2d/DirectX/OverriddenInsetsTest/OverriddenInsetsTest.java 8196102 generic-all
 sun/java2d/DirectX/RenderingToCachedGraphicsTest/RenderingToCachedGraphicsTest.java 8196180 windows-all,macosx-all
+sun/java2d/OpenGL/MultiWindowFillTest.java 8378506 macosx-all
 sun/java2d/OpenGL/OpaqueDest.java#id1 8367574 macosx-all
 sun/java2d/OpenGL/ScaleParamsOOB.java#id0 8377908 linux-all
 sun/java2d/SunGraphics2D/EmptyClipRenderingTest.java 8144029 macosx-all,linux-all
diff --git a/test/jdk/sun/java2d/OpenGL/FlipCoexistTest.java b/test/jdk/sun/java2d/OpenGL/FlipCoexistTest.java
new file mode 100644
index 000000000000..beb5da887b4b
--- /dev/null
+++ b/test/jdk/sun/java2d/OpenGL/FlipCoexistTest.java
@@ -0,0 +1,134 @@
+/*
+ * 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.
+ */
+
+import java.awt.Color;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.image.BufferStrategy;
+import java.awt.image.BufferedImage;
+import java.io.File;
+
+import javax.imageio.ImageIO;
+
+/**
+ * @test
+ * @bug 8378201
+ * @key headful
+ * @summary Verifies that WINDOW and FLIP_BACKBUFFER surfaces sharing the same X
+ *          Window render and flip correctly
+ * @run main/othervm FlipCoexistTest
+ * @run main/othervm -Dsun.java2d.opengl=True FlipCoexistTest
+ */
+public final class FlipCoexistTest {
+
+    private static final int SIZE = 200;
+    private static final int TOLERANCE = 10;
+
+    public static void main(String[] args) throws Exception {
+        Frame f = new Frame("FlipCoexistTest");
+        try {
+            f.setUndecorated(true);
+            f.setSize(SIZE, SIZE);
+            f.setLocation(100, 100);
+            f.setVisible(true);
+
+            Robot robot = new Robot();
+            robot.waitForIdle();
+            robot.delay(1000);
+
+            int w = f.getWidth();
+            int h = f.getHeight();
+
+            // Fill window RED via direct render (WINDOW surface)
+            Graphics g = f.getGraphics();
+            g.setColor(Color.RED);
+            g.fillRect(0, 0, w, h);
+            g.dispose();
+            robot.waitForIdle();
+            robot.delay(500);
+
+            // Request flip if available, blit is also useful to cover
+            f.createBufferStrategy(2);
+            BufferStrategy bs = f.getBufferStrategy();
+
+            // Render BLUE to back buffer, do not flip yet
+            Graphics bg = bs.getDrawGraphics();
+            bg.setColor(Color.BLUE);
+            bg.fillRect(0, 0, w, h);
+            bg.dispose();
+
+            // Paint small GREEN rect via direct render
+            g = f.getGraphics();
+            g.setColor(Color.GREEN);
+            g.fillRect(0, 0, 10, 10);
+            g.dispose();
+            robot.waitForIdle();
+            robot.delay(500);
+
+            // GREEN rect must be visible
+            check(robot, f, 5, 5, Color.GREEN, "small rect");
+
+            // RED must survive the context round-trip
+            check(robot, f, w / 2, h / 2, Color.RED, "survived");
+
+            // Show back buffer, BLUE must appear
+            bs.show();
+
+            robot.waitForIdle();
+            robot.delay(500);
+            check(robot, f, w / 2, h / 2, Color.BLUE, "flip");
+        } finally {
+            f.dispose();
+        }
+    }
+
+    private static void check(Robot robot, Frame frame, int x, int y, Color exp,
+                              String desc)
+    {
+        Point loc = frame.getLocationOnScreen();
+        Color c = robot.getPixelColor(loc.x + x, loc.y + y);
+        if (!isAlmostEqual(c, exp)) {
+            saveImage(robot, frame, desc);
+            throw new RuntimeException("%s: %s != %s".formatted(desc, exp, c));
+        }
+    }
+
+    private static void saveImage(Robot r, Frame f, String name) {
+        try {
+            Rectangle rect = f.getBounds();
+            BufferedImage img = r.createScreenCapture(rect);
+            ImageIO.write(img, "png", new File(name + ".png"));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static boolean isAlmostEqual(Color c1, Color c2) {
+        return Math.abs(c1.getRed() - c2.getRed()) <= TOLERANCE
+                && Math.abs(c1.getGreen() - c2.getGreen()) <= TOLERANCE
+                && Math.abs(c1.getBlue() - c2.getBlue()) <= TOLERANCE;
+    }
+}
diff --git a/test/jdk/sun/java2d/OpenGL/MultiWindowFillTest.java b/test/jdk/sun/java2d/OpenGL/MultiWindowFillTest.java
new file mode 100644
index 000000000000..59c58d944d79
--- /dev/null
+++ b/test/jdk/sun/java2d/OpenGL/MultiWindowFillTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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.
+ */
+
+import java.awt.Color;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.image.BufferedImage;
+import java.io.File;
+
+import javax.imageio.ImageIO;
+
+/**
+ * @test
+ * @bug 8378201
+ * @key headful
+ * @summary Verifies that window content survives a GL context switch to another
+ *          window and back
+ * @run main/othervm MultiWindowFillTest
+ * @run main/othervm -Dsun.java2d.opengl=True MultiWindowFillTest
+ */
+public final class MultiWindowFillTest {
+
+    private static final int SIZE = 100;
+    private static final int TOLERANCE = 10;
+
+    public static void main(String[] args) throws Exception {
+        Frame f1 = new Frame("f1");
+        Frame f2 = new Frame("f2");
+        try {
+            f1.setUndecorated(true);
+            f1.setSize(SIZE, SIZE);
+            f1.setLocation(100, 100);
+            f2.setUndecorated(true);
+            f2.setSize(SIZE, SIZE);
+            f2.setLocation(300, 100);
+
+            f1.setVisible(true);
+            f2.setVisible(true);
+
+            Robot robot = new Robot();
+            robot.waitForIdle();
+            robot.delay(1000);
+
+            int w = f1.getWidth();
+            int h = f1.getHeight();
+
+            // Fill both, initializes surfaces
+            fill(f1, Color.RED, w, h);
+            fill(f2, Color.BLUE, w, h);
+
+            // Touch both again
+            fill(f1, Color.RED, 2, 2);
+            fill(f2, Color.BLUE, 2, 2);
+
+            robot.waitForIdle();
+            robot.delay(1000);
+
+            check(robot, f1, w, h, Color.RED, "f1 red");
+            check(robot, f2, w, h, Color.BLUE, "f2 blue");
+        } finally {
+            f1.dispose();
+            f2.dispose();
+        }
+    }
+
+    private static void fill(Frame frame, Color c, int w, int h) {
+        Graphics g = frame.getGraphics();
+        g.setColor(c);
+        g.fillRect(0, 0, w, h);
+        g.dispose();
+    }
+
+    private static void check(Robot robot, Frame frame, int w, int h,
+                              Color exp, String desc)
+    {
+        Point loc = frame.getLocationOnScreen();
+        Color c = robot.getPixelColor(loc.x + w / 2, loc.y + h / 2);
+        if (!isAlmostEqual(c, exp)) {
+            saveImage(robot, frame, desc);
+            throw new RuntimeException("%s: %s != %s".formatted(desc, exp, c));
+        }
+    }
+
+    private static void saveImage(Robot r, Frame f, String name) {
+        try {
+            Rectangle rect = f.getBounds();
+            BufferedImage img = r.createScreenCapture(rect);
+            ImageIO.write(img, "png", new File(name + ".png"));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static boolean isAlmostEqual(Color c1, Color c2) {
+        return Math.abs(c1.getRed() - c2.getRed()) <= TOLERANCE
+                && Math.abs(c1.getGreen() - c2.getGreen()) <= TOLERANCE
+                && Math.abs(c1.getBlue() - c2.getBlue()) <= TOLERANCE;
+    }
+}

From 496caad234f6b7b7d9b0600b63d6b72bd8541468 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Fri, 27 Mar 2026 14:58:26 +0000
Subject: [PATCH 085/223] 8361894:
 sun/security/krb5/config/native/TestDynamicStore.java ensure that the test is
 run with sudo

Backport-of: f73e56e24f0edfaeb99e2106a56725ea033bd6d6
---
 .../krb5/config/native/TestDynamicStore.java    | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java b/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java
index 7e396013a71e..0ee559f33e47 100644
--- a/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java
+++ b/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -27,13 +27,15 @@
  * @summary SCDynamicStoreConfig works
  * @modules java.security.jgss/sun.security.krb5
  * @library /test/lib
- * @run main/manual/native TestDynamicStore
+ * @run main/manual/native/timeout=180 TestDynamicStore
  * @requires (os.family == "mac")
  */
 
 import jdk.test.lib.Asserts;
 import sun.security.krb5.Config;
 
+import javax.swing.JOptionPane;
+
 // =================== Attention ===================
 // This test calls a native method implemented in libTestDynamicStore.m
 // to modify system-level Kerberos 5 settings stored in the dynamic store.
@@ -56,6 +58,17 @@ static int action(char what, char whom) throws Exception {
 
     public static void main(String[] args) throws Exception {
 
+        // Show a popup to remind to run this test as sudo user
+        // this will only trigger if sudo (root) user is not detected
+        if (!"root".equals(System.getProperty("user.name"))) {
+
+            JOptionPane.showMessageDialog(null, """
+                            This test MUST be run as ROOT.\s
+                            Please close and RESTART the test.""");
+
+            Asserts.assertFalse(true, "This test must be run as ROOT");
+        }
+
         System.loadLibrary("TestDynamicStore");
 
         Config cfg = Config.getInstance();

From 40329523db13c0c83698d1700b38f98a2511e87a Mon Sep 17 00:00:00 2001
From: Ozan Cetin 
Date: Fri, 27 Mar 2026 15:23:02 +0000
Subject: [PATCH 086/223] 8372609: Bug4944439 does not enforce locale correctly

Backport-of: 45c0600d3abfa4bcd0338840523c0df69283afe2
---
 .../text/Format/NumberFormat/Bug4944439.java  | 25 +++----------------
 1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/test/jdk/java/text/Format/NumberFormat/Bug4944439.java b/test/jdk/java/text/Format/NumberFormat/Bug4944439.java
index 561052e9a95d..a13a36733e2f 100644
--- a/test/jdk/java/text/Format/NumberFormat/Bug4944439.java
+++ b/test/jdk/java/text/Format/NumberFormat/Bug4944439.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, 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,22 +23,19 @@
 
 /*
  * @test
- * @bug 4944439
+ * @bug 4944439 8372609
  * @summary Confirm that numbers where all digits after the decimal separator are 0
  *          and which are between Long.MIN_VALUE and Long.MAX_VALUE are returned
  *          as Long(not double).
  * @run junit Bug4944439
  */
 
-import java.text.DecimalFormat;
+import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.Locale;
 import java.util.stream.Stream;
 
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
 import org.junit.jupiter.params.provider.MethodSource;
 
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
@@ -47,21 +44,7 @@
 
 public class Bug4944439 {
 
-    // Save JVM default locale
-    private static final Locale savedLocale = Locale.getDefault();
-    private static final DecimalFormat df = new DecimalFormat();
-
-    // Set JVM default locale to US for testing
-    @BeforeAll
-    static void initAll() {
-        Locale.setDefault(Locale.US);
-    }
-
-    // Restore JVM default locale
-    @AfterAll
-    static void tearDownAll() {
-        Locale.setDefault(savedLocale);
-    }
+    private static final NumberFormat df = NumberFormat.getInstance(Locale.US);
 
     // Check return type and value returned by DecimalFormat.parse() for longs
     @ParameterizedTest

From 3103cd5720d3fd8350c2686060e1939cb968c103 Mon Sep 17 00:00:00 2001
From: Ozan Cetin 
Date: Fri, 27 Mar 2026 15:44:00 +0000
Subject: [PATCH 087/223] 8366369: Add @requires linux for GTK L&F tests

Backport-of: e365b7d69c58f8a4d85dde15b6ca335f9d85c0b2
---
 .../swing/plaf/gtk/4928019/bug4928019.java    | 20 +++++------
 .../sun/java/swing/plaf/gtk/Test6635110.java  | 36 ++++++++++++-------
 .../sun/java/swing/plaf/gtk/Test6963870.java  | 30 +++++++++-------
 3 files changed, 50 insertions(+), 36 deletions(-)

diff --git a/test/jdk/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java b/test/jdk/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java
index cb90f374d847..7824b030d418 100644
--- a/test/jdk/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java
+++ b/test/jdk/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2025, 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
@@ -26,25 +26,25 @@
  * @bug 4928019
  * @key headful
  * @summary Makes sure all the basic classes can be created with GTK.
- * @author Scott Violet
+ * @requires (os.family != "windows" & os.family != "mac")
+ * @library /test/lib
+ * @build jtreg.SkippedException
+ * @run main bug4928019
  */
 
 import javax.swing.*;
 import javax.swing.plaf.basic.*;
 
+import jtreg.SkippedException;
+
 public class bug4928019 {
     public static void main(String[] args) throws Throwable {
         try {
             UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
-        } catch (UnsupportedLookAndFeelException ex) {
-            System.err.println("GTKLookAndFeel is not supported on this platform." +
-                    " Test is considered passed.");
-            return;
-        } catch (ClassNotFoundException ex) {
-            System.err.println("GTKLookAndFeel class is not found." +
-                    " Test is considered passed.");
-            return;
+        } catch (Exception e) {
+            throw new SkippedException("GTKLookAndFeel isn't supported", e);
         }
+
         new JButton() {
             public void updateUI() {
                 setUI(new BasicButtonUI());
diff --git a/test/jdk/com/sun/java/swing/plaf/gtk/Test6635110.java b/test/jdk/com/sun/java/swing/plaf/gtk/Test6635110.java
index ddf8363e2ee4..eb3e1e7ca62b 100644
--- a/test/jdk/com/sun/java/swing/plaf/gtk/Test6635110.java
+++ b/test/jdk/com/sun/java/swing/plaf/gtk/Test6635110.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, 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
@@ -21,18 +21,28 @@
  * questions.
  */
 
-/* @test
-   @bug 6635110
-   @key headful
-   @summary GTK icons should not throw NPE when called by non-GTK UI
-   @author Peter Zhelezniakov
-   @run main Test6635110
+/*
+ * @test
+ * @bug 6635110
+ * @key headful
+ * @summary GTK icons should not throw NPE when called by non-GTK UI
+ * @requires (os.family != "windows" & os.family != "mac")
+ * @library /test/lib
+ * @build jtreg.SkippedException
+ * @run main Test6635110
 */
 
-import javax.swing.*;
-import java.awt.*;
+import java.awt.Component;
 import java.awt.image.BufferedImage;
-import javax.swing.plaf.basic.*;
+
+import javax.swing.JMenu;
+import javax.swing.JToolBar;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.plaf.basic.BasicMenuUI;
+import javax.swing.plaf.basic.BasicToolBarUI;
+
+import jtreg.SkippedException;
 
 
 public class Test6635110 implements Runnable {
@@ -53,7 +63,7 @@ public class Test6635110 implements Runnable {
         paint(tb);
     }
 
-    void paint(Component c) {
+    private void paint(Component c) {
         c.setSize(WIDTH, HEIGHT);
         c.paint(IMAGE.getGraphics());
     }
@@ -62,9 +72,9 @@ public static void main(String[] args) throws Exception {
         try {
             UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
         } catch (Exception e) {
-            System.out.println("GTKLookAndFeel cannot be set, skipping this test");
-            return;
+            throw new SkippedException("GTKLookAndFeel isn't supported", e);
         }
+
         SwingUtilities.invokeAndWait(new Test6635110());
     }
 }
diff --git a/test/jdk/com/sun/java/swing/plaf/gtk/Test6963870.java b/test/jdk/com/sun/java/swing/plaf/gtk/Test6963870.java
index 962a2d1a0aff..ea072419a594 100644
--- a/test/jdk/com/sun/java/swing/plaf/gtk/Test6963870.java
+++ b/test/jdk/com/sun/java/swing/plaf/gtk/Test6963870.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2025, 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
@@ -21,23 +21,28 @@
  * questions.
  */
 
-/* @test
-   @bug 6963870
-   @key headful
-   @summary Tests that GTKPainter.ListTableFocusBorder.getBorderInsets()
-            doesn't return null
-   @author Peter Zhelezniakov
-   @run main Test6963870
-*/
+/*
+ * @test
+ * @bug 6963870
+ * @key headful
+ * @summary Tests that GTKPainter.ListTableFocusBorder.getBorderInsets()
+ *          doesn't return null
+ * @requires (os.family != "windows" & os.family != "mac")
+ * @library /test/lib
+ * @build jtreg.SkippedException
+ * @run main Test6963870
+ */
 
 import java.awt.Insets;
 import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
 import javax.swing.border.Border;
 
+import jtreg.SkippedException;
+
 public class Test6963870 implements Runnable {
 
-    final static String[] UI_NAMES = {
+    static final String[] UI_NAMES = {
         "List.focusCellHighlightBorder",
         "List.focusSelectedCellHighlightBorder",
         "List.noFocusBorder",
@@ -45,6 +50,7 @@ public class Test6963870 implements Runnable {
         "Table.focusSelectedCellHighlightBorder",
     };
 
+    @Override
     public void run() {
         for (String uiName: UI_NAMES) {
             test(uiName);
@@ -63,11 +69,9 @@ public static void main(String[] args) throws Exception {
         try {
             UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
         } catch (Exception e) {
-            System.out.println("GTKLookAndFeel cannot be set, skipping this test");
-            return;
+            throw new SkippedException("GTKLookAndFeel isn't supported", e);
         }
 
         SwingUtilities.invokeAndWait(new Test6963870());
     }
 }
-

From 75e97a4a6f44dd3ec384d2de89a0fd4da4a3d0b9 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Fri, 27 Mar 2026 22:21:46 +0000
Subject: [PATCH 088/223] 8373793: TestDynamicStore.java '/manual' disables use
 of '/timeout'

Backport-of: 400d8cfb6914982e636b23bacf810ef61fc90ee1
---
 test/jdk/sun/security/krb5/config/native/TestDynamicStore.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java b/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java
index 0ee559f33e47..a1281995c46e 100644
--- a/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java
+++ b/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java
@@ -27,7 +27,7 @@
  * @summary SCDynamicStoreConfig works
  * @modules java.security.jgss/sun.security.krb5
  * @library /test/lib
- * @run main/manual/native/timeout=180 TestDynamicStore
+ * @run main/manual/native TestDynamicStore
  * @requires (os.family == "mac")
  */
 

From fe5869d4550983f964ef9bccc2713e894a403e5a Mon Sep 17 00:00:00 2001
From: SendaoYan 
Date: Sun, 29 Mar 2026 08:15:10 +0000
Subject: [PATCH 089/223] 8365893:
 test/jdk/java/lang/Thread/virtual/JfrEvents.java failing intermittently

Reviewed-by: phh
Backport-of: 58e7581527208dfd6dd694793e4790dcad8fc3ef
---
 test/jdk/java/lang/Thread/virtual/JfrEvents.java | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/test/jdk/java/lang/Thread/virtual/JfrEvents.java b/test/jdk/java/lang/Thread/virtual/JfrEvents.java
index f731702990f0..1cad7fa42028 100644
--- a/test/jdk/java/lang/Thread/virtual/JfrEvents.java
+++ b/test/jdk/java/lang/Thread/virtual/JfrEvents.java
@@ -27,7 +27,8 @@
  * @requires vm.continuations & vm.hasJFR
  * @modules jdk.jfr java.base/java.lang:+open
  * @library /test/lib
- * @run junit/othervm --enable-native-access=ALL-UNNAMED JfrEvents
+ * @compile --enable-preview -source ${jdk.version} JfrEvents.java
+ * @run junit/othervm --enable-preview --enable-native-access=ALL-UNNAMED JfrEvents
  */
 
 import java.io.IOException;
@@ -44,6 +45,7 @@
 import java.util.concurrent.locks.LockSupport;
 import java.util.function.Consumer;
 import java.util.stream.Collectors;
+import java.util.stream.IntStream;
 import java.util.stream.Stream;
 
 import jdk.jfr.EventType;
@@ -72,12 +74,13 @@ void testVirtualThreadStartAndEnd() throws Exception {
 
             // execute 100 tasks, each in their own virtual thread
             recording.start();
-            ThreadFactory factory = Thread.ofVirtual().factory();
-            try (var executor = Executors.newThreadPerTaskExecutor(factory)) {
-                for (int i = 0; i < 100; i++) {
-                    executor.submit(() -> { });
+            try {
+                List threads = IntStream.range(0, 100)
+                        .mapToObj(_ -> Thread.startVirtualThread(() -> { }))
+                        .toList();
+                for (Thread t : threads) {
+                    t.join();
                 }
-                Thread.sleep(1000); // give time for thread end events to be recorded
             } finally {
                 recording.stop();
             }

From a02cea10d7489e839f1d41470c50338b6862efa3 Mon Sep 17 00:00:00 2001
From: SendaoYan 
Date: Mon, 30 Mar 2026 07:51:27 +0000
Subject: [PATCH 090/223] 8377944: LowMemoryTest2.java#id1 intermittent fails
 OOME: Metaspace

Backport-of: 0ed34913bac44f3f0895cd9ab15d4e7ff2d5f5c2
---
 .../MemoryMXBean/LowMemoryTest2.java          | 26 +++++++++----------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java b/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java
index de1b22c4075a..b093f086ba44 100644
--- a/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java
+++ b/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2026, 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
@@ -35,18 +35,14 @@
  * @test
  * @bug     4982128
  * @summary Test low memory detection of non-heap memory pool
- *
- * @run main/othervm/timeout=600 -Xnoclassgc -XX:MaxMetaspaceSize=32m
- * LowMemoryTest2
- */
-
-/*
- * @test
- * @bug     4982128
- * @summary Test low memory detection of non-heap memory pool
- *
- * @run main/othervm/timeout=600 -Xnoclassgc -XX:MaxMetaspaceSize=16m
- * -XX:CompressedClassSpaceSize=4m LowMemoryTest2
+ * @library /test/lib
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
+ * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
+ *                               -Xnoclassgc -XX:MaxMetaspaceSize=32m LowMemoryTest2
+ * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
+ *                               -Xnoclassgc -XX:MaxMetaspaceSize=16m
+ *                               -XX:CompressedClassSpaceSize=4m LowMemoryTest2
  */
 
 import java.lang.management.*;
@@ -54,6 +50,8 @@
 import javax.management.openmbean.CompositeData;
 import java.util.*;
 
+import jdk.test.whitebox.WhiteBox;
+
 public class LowMemoryTest2 {
 
     private static volatile boolean listenerInvoked = false;
@@ -177,7 +175,7 @@ public void run() {
                         // If we don't force a GC we may get an
                         // OutOfMemoryException before the counters are updated.
                         System.out.println("Force GC");
-                        System.gc();
+                        WhiteBox.getWhiteBox().fullGC();
                     }
                     isThresholdCountSet = isAnyThresholdCountSet(pools);
                 }

From 4f9850a764ab77dc32965847fdf6df526f4ce48d Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Mon, 30 Mar 2026 08:09:32 +0000
Subject: [PATCH 091/223] 8365863: /test/jdk/sun/security/pkcs11/Cipher tests
 skip without SkippedException

Reviewed-by: rschmelter
Backport-of: 993babb326f937dc1630a5a8fa5e469a64c51206
---
 .../security/pkcs11/Cipher/ReinitCipher.java  |  7 +-
 .../security/pkcs11/Cipher/Test4512704.java   | 21 ++---
 .../pkcs11/Cipher/TestCICOWithGCM.java        | 27 ++++---
 .../pkcs11/Cipher/TestCICOWithGCMAndAAD.java  | 10 +--
 .../pkcs11/Cipher/TestChaChaPoly.java         |  7 +-
 .../pkcs11/Cipher/TestChaChaPolyKAT.java      | 16 ++--
 .../pkcs11/Cipher/TestChaChaPolyNoReuse.java  | 15 ++--
 .../Cipher/TestChaChaPolyOutputSize.java      |  9 +--
 .../pkcs11/Cipher/TestCipherMode.java         | 37 ++++++---
 .../pkcs11/Cipher/TestGCMKeyAndIvCheck.java   | 25 +++---
 .../security/pkcs11/Cipher/TestKATForGCM.java |  9 ++-
 .../security/pkcs11/Cipher/TestRSACipher.java |  6 +-
 .../pkcs11/Cipher/TestRSACipherWrap.java      |  6 +-
 .../pkcs11/Cipher/TestRawRSACipher.java       |  6 +-
 .../pkcs11/Cipher/TestSymmCiphers.java        | 80 +++++++++----------
 .../pkcs11/Cipher/TestSymmCiphersNoPad.java   | 56 +++++++------
 16 files changed, 184 insertions(+), 153 deletions(-)

diff --git a/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java b/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java
index da547da752b0..78a623cb3738 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, 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
@@ -33,6 +33,8 @@
  * @run main/othervm -Djava.security.manager=allow ReinitCipher sm
  */
 
+import jtreg.SkippedException;
+
 import java.security.Provider;
 import java.util.Random;
 import javax.crypto.Cipher;
@@ -47,8 +49,7 @@ public static void main(String[] args) throws Exception {
     @Override
     public void main(Provider p) throws Exception {
         if (p.getService("Cipher", "ARCFOUR") == null) {
-            System.out.println("Not supported by provider, skipping");
-            return;
+            throw new SkippedException("Algorithm ARCFOUR is not supported by provider, skipping");
         }
         Random random = new Random();
         byte[] data1 = new byte[10 * 1024];
diff --git a/test/jdk/sun/security/pkcs11/Cipher/Test4512704.java b/test/jdk/sun/security/pkcs11/Cipher/Test4512704.java
index ddca64ecb691..7aafa4fd70f4 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/Test4512704.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/Test4512704.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,14 +29,16 @@
  * @run main Test4512704
  * @summary Verify that AES cipher can generate default IV in encrypt mode
  */
-import java.io.PrintStream;
-import java.security.*;
-import java.security.spec.*;
-import java.util.Random;
+import jtreg.SkippedException;
 
-import javax.crypto.*;
-import javax.crypto.spec.*;
+import java.security.GeneralSecurityException;
+import java.security.InvalidAlgorithmParameterException;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
 import java.security.Provider;
+import java.security.spec.AlgorithmParameterSpec;
 
 public class Test4512704 extends PKCS11Test {
 
@@ -48,9 +50,8 @@ public void test(String mode, Provider p) throws Exception {
             transformation = "AES/" + mode + "/NoPadding";
             c = Cipher.getInstance(transformation, p);
         } catch (GeneralSecurityException e) {
-            System.out.println("Skip testing " + p.getName() +
-                    ", no support for " + mode);
-            return;
+            throw new SkippedException("Skip testing " + p.getName() +
+                                       ", no support for " + mode);
         }
         SecretKey key = new SecretKeySpec(new byte[16], "AES");
 
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCM.java b/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCM.java
index 06c1e84392c3..f6b6157cefa2 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCM.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCM.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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
@@ -31,13 +31,21 @@
  * @key randomness
  */
 
-import java.security.*;
-import javax.crypto.*;
-import javax.crypto.spec.*;
-import java.math.*;
-import java.io.*;
+import jtreg.SkippedException;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import javax.crypto.Cipher;
+import javax.crypto.CipherInputStream;
+import javax.crypto.CipherOutputStream;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+
+import java.security.GeneralSecurityException;
+import java.security.Provider;
+import java.util.Arrays;
+import java.util.Random;
 
-import java.util.*;
 
 public class TestCICOWithGCM extends PKCS11Test {
     public static void main(String[] args) throws Exception {
@@ -55,9 +63,8 @@ public void test(String mode, Provider p) throws Exception {
             String transformation = "AES/" + mode + "/NoPadding";
             c = Cipher.getInstance(transformation, p);
         } catch (GeneralSecurityException e) {
-            System.out.println("Skip testing " + p.getName() +
-                    ", no support for " + mode);
-            return;
+            throw new SkippedException("Skip testing " + p.getName() +
+                                       ", no support for " + mode);
         }
 
         SecretKey key = new SecretKeySpec(new byte[16], "AES");
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCMAndAAD.java b/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCMAndAAD.java
index be2b1d18c8f0..13ab8541351d 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCMAndAAD.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCMAndAAD.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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
@@ -30,6 +30,8 @@
  * @summary Test CipherInputStream/OutputStream with AES GCM mode with AAD.
  * @key randomness
  */
+import jtreg.SkippedException;
+
 import java.io.*;
 import java.security.*;
 import java.util.*;
@@ -44,7 +46,6 @@ public static void main(String[] args) throws Exception {
     @Override
     public void main(Provider p) throws Exception {
         test("GCM", p);
-//        test("CCM", p);
     }
 
     public void test(String mode, Provider p) throws Exception {
@@ -53,9 +54,8 @@ public void test(String mode, Provider p) throws Exception {
             String transformation = "AES/" + mode + "/NoPadding";
             c = Cipher.getInstance(transformation, p);
         } catch (GeneralSecurityException e) {
-            System.out.println("Skip testing " + p.getName() +
-                    ", no support for " + mode);
-            return;
+            throw new SkippedException("Skip testing " + p.getName() +
+                                       ", no support for " + mode);
         }
         SecretKey key = new SecretKeySpec(new byte[16], "AES");
 
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPoly.java b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPoly.java
index 26853ae3ee6d..da351bc7493d 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPoly.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPoly.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -47,7 +47,7 @@
 import javax.crypto.spec.SecretKeySpec;
 import javax.crypto.NoSuchPaddingException;
 
-import jdk.test.lib.Utils;
+import jtreg.SkippedException;
 
 public class TestChaChaPoly extends PKCS11Test {
 
@@ -70,8 +70,7 @@ public void main(Provider p) throws Exception {
         try {
             Cipher.getInstance(ALGO, p);
         } catch (NoSuchAlgorithmException nsae) {
-            System.out.println("Skip; no support for " + ALGO);
-            return;
+            throw new SkippedException("Skip; no support for " + ALGO);
         }
         this.p = p;
         testTransformations();
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyKAT.java b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyKAT.java
index 5649ed013ef5..d2590b2c3cba 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyKAT.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyKAT.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -26,22 +26,25 @@
  * @bug 8255410
  * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
- * @build jdk.test.lib.Convert
  * @run main/othervm TestChaChaPolyKAT
  * @summary ChaCha20-Poly1305 Cipher Implementation (KAT)
  */
 
-import java.util.*;
+import jtreg.SkippedException;
+
 import java.security.GeneralSecurityException;
 import java.security.Provider;
 import java.security.NoSuchAlgorithmException;
 import javax.crypto.Cipher;
-import javax.crypto.spec.ChaCha20ParameterSpec;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
 import javax.crypto.AEADBadTagException;
 import java.nio.ByteBuffer;
-import jdk.test.lib.Convert;
+import java.util.Arrays;
+import java.util.HexFormat;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
 
 public class TestChaChaPolyKAT extends PKCS11Test {
     public static class TestData {
@@ -126,8 +129,7 @@ public void main(Provider p) throws Exception {
         try {
             Cipher.getInstance(ALGO, p);
         } catch (NoSuchAlgorithmException nsae) {
-            System.out.println("Skip; no support for " + ALGO);
-            return;
+            throw new SkippedException("Skip; no support for " + ALGO);
         }
 
         int testsPassed = 0;
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyNoReuse.java b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyNoReuse.java
index 94272367caa3..60d80b9e3653 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyNoReuse.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyNoReuse.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -30,18 +30,22 @@
  * (key/nonce reuse check)
  */
 
-import java.util.*;
+import jtreg.SkippedException;
+
 import javax.crypto.Cipher;
 import java.security.spec.AlgorithmParameterSpec;
 import java.security.Provider;
 import java.security.NoSuchAlgorithmException;
-import javax.crypto.spec.ChaCha20ParameterSpec;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
-import javax.crypto.AEADBadTagException;
 import javax.crypto.SecretKey;
 import java.security.InvalidKeyException;
 import java.security.InvalidAlgorithmParameterException;
+import java.util.Arrays;
+import java.util.HexFormat;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
 
 public class TestChaChaPolyNoReuse extends PKCS11Test {
 
@@ -238,8 +242,7 @@ public void main(Provider p) throws Exception {
         try {
             Cipher.getInstance(CIPHER_ALGO, p);
         } catch (NoSuchAlgorithmException nsae) {
-            System.out.println("Skip; no support for " + CIPHER_ALGO);
-            return;
+            throw new SkippedException("Skip; no support for " + CIPHER_ALGO);
         }
 
         int testsPassed = 0;
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyOutputSize.java b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyOutputSize.java
index 57a7b9a46067..f68340658fa3 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyOutputSize.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyOutputSize.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -30,14 +30,14 @@
  * @run main TestChaChaPolyOutputSize
  */
 
+import jtreg.SkippedException;
+
 import java.nio.ByteBuffer;
 import java.security.GeneralSecurityException;
-import java.security.Key;
 import java.security.SecureRandom;
 import java.security.Provider;
 import java.security.NoSuchAlgorithmException;
 import javax.crypto.Cipher;
-import javax.crypto.spec.ChaCha20ParameterSpec;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
 
@@ -60,8 +60,7 @@ public void main(Provider p) throws GeneralSecurityException {
         try {
             Cipher.getInstance(ALGO, p);
         } catch (NoSuchAlgorithmException nsae) {
-            System.out.println("Skip; no support for " + ALGO);
-            return;
+            throw new SkippedException("Skip; no support for " + ALGO);
         }
         testGetOutSize(p);
         testMultiPartAEADDec(p);
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestCipherMode.java b/test/jdk/sun/security/pkcs11/Cipher/TestCipherMode.java
index 76f0c9dc4122..cf3d948be17f 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestCipherMode.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestCipherMode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -30,6 +30,8 @@
  * @run main/othervm TestCipherMode
  */
 
+import jtreg.SkippedException;
+
 import java.security.Provider;
 import java.security.Key;
 import java.security.KeyPair;
@@ -38,20 +40,22 @@
 import java.security.PublicKey;
 import java.security.InvalidParameterException;
 import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 import javax.crypto.Cipher;
 import javax.crypto.SecretKey;
 import javax.crypto.spec.SecretKeySpec;
 
 public class TestCipherMode extends PKCS11Test {
 
-    private static String[] TRANSFORMATIONS = {
-        "AES/ECB/PKCS5Padding", "AES/GCM/NoPadding",
-        "RSA/ECB/PKCS1Padding"
+    private static final String[] TRANSFORMATIONS = {
+            "AES/ECB/PKCS5Padding", "AES/GCM/NoPadding",
+            "RSA/ECB/PKCS1Padding"
     };
 
-    private static byte[] BYTES16 =
-            Arrays.copyOf(TRANSFORMATIONS[0].getBytes(), 16);
+    private static final byte[] BYTES16 =
+            Arrays.copyOf("AES/ECB/PKCS5Padding".getBytes(), 16);
     private static SecretKey AES_KEY = new SecretKeySpec(BYTES16, "AES");
     private static PublicKey RSA_PUBKEY = null;
     private static PrivateKey RSA_PRIVKEY = null;
@@ -97,18 +101,29 @@ public void main(Provider p) throws Exception {
 
         // test all cipher impls, e.g. P11Cipher, P11AEADCipher, and
         // P11RSACipher
-        for (String t : TRANSFORMATIONS) {
-            checkModes(t, p);
+        List skipped = new ArrayList<>();
+        for (final String t : TRANSFORMATIONS) {
+            try {
+                checkModes(t, p);
+            } catch (SkippedException skippedException) {
+                // printing to System.out, so it's easier to see which test it relates to
+                skippedException.printStackTrace(System.out);
+                skipped.add(t);
+            }
+        }
+
+        if (!skipped.isEmpty()) {
+            throw new SkippedException("Some tests skipped: " + skipped);
+        } else {
+            System.out.println("All tests passed");
         }
-        System.out.println("All tests passed");
     }
 
     private static void checkModes(String t, Provider p) throws Exception {
         try {
             Cipher.getInstance(t, p);
         } catch (Exception e) {
-            System.out.println("Skip " + t + " due to " + e.getMessage());
-            return;
+            throw new SkippedException("Skip " + t + " due to " + e.getMessage());
         }
 
         for (CipherMode m : CipherMode.values()) {
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestGCMKeyAndIvCheck.java b/test/jdk/sun/security/pkcs11/Cipher/TestGCMKeyAndIvCheck.java
index adabcc571aaa..4e78d8d39d77 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestGCMKeyAndIvCheck.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestGCMKeyAndIvCheck.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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
@@ -31,13 +31,21 @@
  */
 
 
-import java.security.*;
+import jtreg.SkippedException;
+
+import java.security.AlgorithmParameters;
+import java.security.GeneralSecurityException;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Provider;
 import java.security.spec.AlgorithmParameterSpec;
-import javax.crypto.*;
-import javax.crypto.spec.*;
-import java.math.*;
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.GCMParameterSpec;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
 
-import java.util.*;
+import java.util.Arrays;
 
 public class TestGCMKeyAndIvCheck extends PKCS11Test {
 
@@ -77,9 +85,8 @@ public void test(String mode, Provider p) throws Exception {
             String transformation = "AES/" + mode + "/NoPadding";
             c = Cipher.getInstance(transformation, p);
         } catch (GeneralSecurityException e) {
-            System.out.println("Skip testing " + p.getName() +
-                    ", no support for " + mode);
-            return;
+            throw new SkippedException("Skip testing " + p.getName() +
+                                       ", no support for " + mode);
         }
         System.out.println("Testing against " + p.getName());
         SecretKey key = new SecretKeySpec(new byte[16], "AES");
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java b/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java
index fecf5813ceab..e5e8284e6f4a 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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
@@ -30,6 +30,8 @@
  * @summary Known Answer Test for AES cipher with GCM mode support in
  * PKCS11 provider.
  */
+import jtreg.SkippedException;
+
 import java.security.GeneralSecurityException;
 import java.security.Provider;
 import java.util.Arrays;
@@ -311,9 +313,8 @@ public void main(Provider p) throws Exception {
         try {
             c = Cipher.getInstance(transformation, p);
         } catch (GeneralSecurityException e) {
-            System.out.println("Skip testing " + p.getName() +
-                    ", no support for " + transformation);
-            return;
+            throw new SkippedException("Skip testing " + p.getName() +
+                                       ", no support for " + transformation);
         }
         try {
             if (execute(testValues, c)) {
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java
index 6799b19d3e7c..3460eb64e171 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, 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
@@ -45,6 +45,7 @@
 import javax.crypto.Cipher;
 import javax.crypto.IllegalBlockSizeException;
 import jdk.test.lib.security.SecurityUtils;
+import jtreg.SkippedException;
 
 public class TestRSACipher extends PKCS11Test {
 
@@ -56,8 +57,7 @@ public void main(Provider p) throws Exception {
         try {
             Cipher.getInstance(RSA_ALGOS[0], p);
         } catch (GeneralSecurityException e) {
-            System.out.println("Not supported by provider, skipping");
-            return;
+            throw new SkippedException("Algorithm " + RSA_ALGOS[0] + " is not supported by provider, skipping");
         }
         String kpgAlgorithm = "RSA";
         int keySize = SecurityUtils.getTestKeySize(kpgAlgorithm);
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java
index 0be916ebf9e7..23568da93e11 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, 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
@@ -44,6 +44,7 @@
 import javax.crypto.SecretKey;
 import javax.crypto.spec.SecretKeySpec;
 import jdk.test.lib.security.SecurityUtils;
+import jtreg.SkippedException;
 
 public class TestRSACipherWrap extends PKCS11Test {
 
@@ -55,8 +56,7 @@ public void main(Provider p) throws Exception {
         try {
             Cipher.getInstance(RSA_ALGOS[0], p);
         } catch (GeneralSecurityException e) {
-            System.out.println(RSA_ALGOS[0] + " unsupported, skipping");
-            return;
+            throw new SkippedException(RSA_ALGOS[0] + " unsupported, skipping");
         }
         String kpgAlgorithm = "RSA";
         KeyPairGenerator kpg = KeyPairGenerator.getInstance(kpgAlgorithm, p);
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java b/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java
index fe6433d096e3..dae331bc85f6 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,7 @@
 import java.util.Random;
 import javax.crypto.Cipher;
 import jdk.test.lib.security.SecurityUtils;
+import jtreg.SkippedException;
 
 public class TestRawRSACipher extends PKCS11Test {
 
@@ -50,8 +51,7 @@ public void main(Provider p) throws Exception {
         try {
             Cipher.getInstance("RSA/ECB/NoPadding", p);
         } catch (GeneralSecurityException e) {
-            System.out.println("Not supported by provider, skipping");
-            return;
+            throw new SkippedException("Algorithm RSA/ECB/NoPadding is not supported by provider, skipping");
         }
 
         String kpgAlgorithm = "RSA";
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java
index 5082336d36b8..81862fb05f28 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, 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
@@ -33,11 +33,15 @@
  * @run main/othervm -Djava.security.manager=allow TestSymmCiphers sm
  */
 
+import jtreg.SkippedException;
+
 import java.io.ByteArrayOutputStream;
 import java.nio.ByteBuffer;
 import java.security.AlgorithmParameters;
 import java.security.NoSuchAlgorithmException;
 import java.security.Provider;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Random;
 import javax.crypto.Cipher;
 import javax.crypto.KeyGenerator;
@@ -45,42 +49,32 @@
 
 public class TestSymmCiphers extends PKCS11Test {
 
-    private static class CI { // class for holding Cipher Information
-
-        String transformation;
-        String keyAlgo;
-        int dataSize;
+    private record CI (String transformation, String keyAlgo, int dataSize){}  // record for holding Cipher Information
 
-        CI(String transformation, String keyAlgo, int dataSize) {
-            this.transformation = transformation;
-            this.keyAlgo = keyAlgo;
-            this.dataSize = dataSize;
-        }
-    }
     private static final CI[] TEST_LIST = {
-        new CI("ARCFOUR", "ARCFOUR", 400),
-        new CI("RC4", "RC4", 401),
-        new CI("DES/CBC/NoPadding", "DES", 400),
-        new CI("DESede/CBC/NoPadding", "DESede", 160),
-        new CI("AES/CBC/NoPadding", "AES", 4800),
-        new CI("Blowfish/CBC/NoPadding", "Blowfish", 24),
-        new CI("DES/cbc/PKCS5Padding", "DES", 6401),
-        new CI("DESede/CBC/PKCS5Padding", "DESede", 402),
-        new CI("AES/CBC/PKCS5Padding", "AES", 30),
-        new CI("Blowfish/CBC/PKCS5Padding", "Blowfish", 19),
-        new CI("DES/ECB/NoPadding", "DES", 400),
-        new CI("DESede/ECB/NoPadding", "DESede", 160),
-        new CI("AES/ECB/NoPadding", "AES", 4800),
-        new CI("DES/ECB/PKCS5Padding", "DES", 32),
-        new CI("DES/ECB/PKCS5Padding", "DES", 6400),
-        new CI("DESede/ECB/PKCS5Padding", "DESede", 400),
-        new CI("AES/ECB/PKCS5Padding", "AES", 64),
-
-        new CI("DES", "DES", 6400),
-        new CI("DESede", "DESede", 408),
-        new CI("AES", "AES", 128),
-
-        new CI("AES/CTR/NoPadding", "AES", 3200)
+            new CI("ARCFOUR", "ARCFOUR", 400),
+            new CI("RC4", "RC4", 401),
+            new CI("DES/CBC/NoPadding", "DES", 400),
+            new CI("DESede/CBC/NoPadding", "DESede", 160),
+            new CI("AES/CBC/NoPadding", "AES", 4800),
+            new CI("Blowfish/CBC/NoPadding", "Blowfish", 24),
+            new CI("DES/cbc/PKCS5Padding", "DES", 6401),
+            new CI("DESede/CBC/PKCS5Padding", "DESede", 402),
+            new CI("AES/CBC/PKCS5Padding", "AES", 30),
+            new CI("Blowfish/CBC/PKCS5Padding", "Blowfish", 19),
+            new CI("DES/ECB/NoPadding", "DES", 400),
+            new CI("DESede/ECB/NoPadding", "DESede", 160),
+            new CI("AES/ECB/NoPadding", "AES", 4800),
+            new CI("DES/ECB/PKCS5Padding", "DES", 32),
+            new CI("DES/ECB/PKCS5Padding", "DES", 6400),
+            new CI("DESede/ECB/PKCS5Padding", "DESede", 400),
+            new CI("AES/ECB/PKCS5Padding", "AES", 64),
+
+            new CI("DES", "DES", 6400),
+            new CI("DESede", "DESede", 408),
+            new CI("AES", "AES", 128),
+
+            new CI("AES/CTR/NoPadding", "AES", 3200)
 
     };
     private static StringBuffer debugBuf = new StringBuffer();
@@ -90,11 +84,10 @@ public void main(Provider p) throws Exception {
         // NSS reports CKR_DEVICE_ERROR when the data passed to
         // its EncryptUpdate/DecryptUpdate is not multiple of blocks
         int firstBlkSize = 16;
-        boolean status = true;
+        List skippedList = new ArrayList<>();
         Random random = new Random();
         try {
-            for (int i = 0; i < TEST_LIST.length; i++) {
-                CI currTest = TEST_LIST[i];
+            for (CI currTest : TEST_LIST) {
                 System.out.println("===" + currTest.transformation + "===");
                 try {
                     KeyGenerator kg =
@@ -123,7 +116,8 @@ public void main(Provider p) throws Exception {
                     System.out.println("Decryption tests: DONE");
                 } catch (NoSuchAlgorithmException nsae) {
                     System.out.println("Skipping unsupported algorithm: " +
-                            nsae);
+                                       nsae);
+                    skippedList.add(currTest);
                 }
             }
         } catch (Exception ex) {
@@ -134,11 +128,15 @@ public void main(Provider p) throws Exception {
             }
             throw ex;
         }
+
+        if (!skippedList.isEmpty()){
+            throw new SkippedException("Some tests skipped: " + skippedList);
+        }
     }
 
     private static void test(Cipher cipher, int mode, SecretKey key,
-            AlgorithmParameters params, int firstBlkSize,
-            byte[] in, byte[] answer) throws Exception {
+                             AlgorithmParameters params, int firstBlkSize,
+                             byte[] in, byte[] answer) throws Exception {
         // test setup
         long startTime, endTime;
         cipher.init(mode, key, params);
diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java
index ea5181e98dc3..cc27fedf2dab 100644
--- a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java
+++ b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2025, 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
@@ -33,6 +33,8 @@
  * @run main/othervm -Djava.security.manager=allow TestSymmCiphersNoPad sm
  */
 
+import jtreg.SkippedException;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
@@ -40,6 +42,8 @@
 import java.security.AlgorithmParameters;
 import java.security.NoSuchAlgorithmException;
 import java.security.Provider;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Random;
 import javax.crypto.Cipher;
 import javax.crypto.CipherInputStream;
@@ -48,46 +52,35 @@
 
 public class TestSymmCiphersNoPad extends PKCS11Test {
 
-    private static class CI { // class for holding Cipher Information
-        String transformation;
-        String keyAlgo;
-        int dataSize;
+    private record CI (String transformation, String keyAlgo, int dataSize){}  // record for holding Cipher Information
 
-        CI(String transformation, String keyAlgo, int dataSize) {
-            this.transformation = transformation;
-            this.keyAlgo = keyAlgo;
-            this.dataSize = dataSize;
-        }
-    }
+    private static StringBuffer debugBuf;
 
-    private static final CI TEST_LIST[] = {
-        new CI("ARCFOUR", "ARCFOUR", 400),
-        new CI("RC4", "RC4", 401),
-        new CI("DES/CBC/NoPadding", "DES", 400),
-        new CI("DESede/CBC/NoPadding", "DESede", 160),
-        new CI("AES/CBC/NoPadding", "AES", 4800),
-        new CI("Blowfish/CBC/NoPadding", "Blowfish", 24),
-        new CI("AES/CTR/NoPadding", "AES", 1600),
-        new CI("AES/CTR/NoPadding", "AES", 65)
+    private static final CI[] TEST_LIST = {
+            new CI("ARCFOUR", "ARCFOUR", 400),
+            new CI("RC4", "RC4", 401),
+            new CI("DES/CBC/NoPadding", "DES", 400),
+            new CI("DESede/CBC/NoPadding", "DESede", 160),
+            new CI("AES/CBC/NoPadding", "AES", 4800),
+            new CI("Blowfish/CBC/NoPadding", "Blowfish", 24),
+            new CI("AES/CTR/NoPadding", "AES", 1600),
+            new CI("AES/CTR/NoPadding", "AES", 65)
     };
 
-    private static StringBuffer debugBuf;
-
     @Override
     public void main(Provider p) throws Exception {
-        boolean status = true;
+        List skippedList = new ArrayList<>();
         Random random = new Random();
         try {
-            for (int i = 0; i < TEST_LIST.length; i++) {
-                CI currTest = TEST_LIST[i];
+            for (CI currTest : TEST_LIST) {
                 System.out.println("===" + currTest.transformation + "===");
                 try {
                     KeyGenerator kg =
-                        KeyGenerator.getInstance(currTest.keyAlgo, p);
+                            KeyGenerator.getInstance(currTest.keyAlgo, p);
                     SecretKey key = kg.generateKey();
                     Cipher c1 = Cipher.getInstance(currTest.transformation, p);
                     Cipher c2 = Cipher.getInstance(currTest.transformation,
-                               System.getProperty("test.provider.name", "SunJCE"));
+                            System.getProperty("test.provider.name", "SunJCE"));
 
                     byte[] plainTxt = new byte[currTest.dataSize];
                     random.nextBytes(plainTxt);
@@ -97,16 +90,17 @@ public void main(Provider p) throws Exception {
                     AlgorithmParameters params = c2.getParameters();
                     byte[] answer = c2.doFinal(plainTxt);
                     test(c1, Cipher.ENCRYPT_MODE, key, params,
-                         plainTxt, answer);
+                            plainTxt, answer);
                     System.out.println("Encryption tests: DONE");
                     c2.init(Cipher.DECRYPT_MODE, key, params);
                     byte[] answer2 = c2.doFinal(answer);
                     test(c1, Cipher.DECRYPT_MODE, key, params,
-                         answer, answer2);
+                            answer, answer2);
                     System.out.println("Decryption tests: DONE");
                 } catch (NoSuchAlgorithmException nsae) {
                     System.out.println("Skipping unsupported algorithm: " +
                                        nsae);
+                    skippedList.add(currTest);
                 }
             }
         } catch (Exception ex) {
@@ -116,6 +110,10 @@ public void main(Provider p) throws Exception {
             }
             throw ex;
         }
+
+        if (!skippedList.isEmpty()){
+            throw new SkippedException("Some tests skipped: " + skippedList);
+        }
     }
 
     private static void test(Cipher cipher, int mode, SecretKey key,

From f4a29a9139524cc393c760b0aec8c4735fc52f34 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:11:39 +0000
Subject: [PATCH 092/223] 8373931: Test
 javax/sound/sampled/Clip/AutoCloseTimeCheck.java timed out

Backport-of: f3121d10237a933087dde926f83a12ce826cde02
---
 test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java b/test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java
index 940124b244ba..ecf958d4a291 100644
--- a/test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java
+++ b/test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java
@@ -39,6 +39,7 @@
 
 /**
  * @test
+ * @key sound
  * @bug 8202264
  */
 public final class AutoCloseTimeCheck {

From 2ecaae3c02cf6595edaa3c5c180002b522f27098 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:11:56 +0000
Subject: [PATCH 093/223] 8376151: Test
 javax/swing/JFileChooser/4966171/bug4966171.java is failing with OOME

Backport-of: 12570be64ae2114587e6de4ef79f79be961023b9
---
 test/jdk/javax/swing/JFileChooser/4966171/bug4966171.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/jdk/javax/swing/JFileChooser/4966171/bug4966171.java b/test/jdk/javax/swing/JFileChooser/4966171/bug4966171.java
index f3b3ba684e6d..27f26d570bed 100644
--- a/test/jdk/javax/swing/JFileChooser/4966171/bug4966171.java
+++ b/test/jdk/javax/swing/JFileChooser/4966171/bug4966171.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, 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
@@ -50,8 +50,8 @@ public static void main(String[] args) throws Exception {
     }
 
     private static void test() {
-        // Will run the test no more than 10 seconds per L&F
-        long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(10);
+        // Will run the test no more than 5 seconds per L&F
+        long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(5);
         while (System.nanoTime() < endtime) {
             try {
                 var byteOut = new ByteArrayOutputStream();

From b20fda59b808b94eed1d966764e1788ae3d8dd65 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:12:14 +0000
Subject: [PATCH 094/223] 8370905: Update vm.defmeth tests to use virtual
 threads

Backport-of: 153c567a4d3a537277a8c599142511aa4f4f3ae3
---
 .../vm/runtime/defmeth/StressTest.java        | 23 +++++++++++--------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/StressTest.java b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/StressTest.java
index 40fd0500816e..e238da8be014 100644
--- a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/StressTest.java
+++ b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/StressTest.java
@@ -44,6 +44,7 @@
 import java.util.List;
 import java.util.Random;
 
+import jdk.test.lib.thread.TestThreadFactory;
 import nsk.share.TestFailure;
 import nsk.share.test.StressOptions;
 import nsk.share.test.Stresser;
@@ -82,16 +83,18 @@ public class StressTest implements Runnable {
     @Option(name="ignoreTestFailures", default_value="false", description="ignore failures of the executed tests")
     private boolean ignoreTestFailures;
 
-    class Worker extends Thread {
+    class Worker implements Runnable {
         private final Random rand;
 
         private volatile DefMethTest failedTest;
         private Throwable reason;
         private volatile long executedTests = 0;
 
-        public Worker(String id, long seed) {
-            setName(id);
-            this.rand = new Random(seed);
+        private final Thread thread;
+
+         Worker(String id, long seed) {
+             this.rand = new Random(seed);
+             this.thread = TestThreadFactory.newThread(this, id);
         }
 
         @Override
@@ -247,13 +250,13 @@ private void startWorkers() {
         }
 
         for (Worker worker : workers) {
-            worker.start();
+            worker.thread.start();
         }
     }
 
     private void interruptWorkers() {
         for (Worker worker : workers) {
-            worker.interrupt();
+            worker.thread.interrupt();
         }
     }
 
@@ -261,14 +264,14 @@ private void joinWorkers() {
         boolean isFailed = false;
 
         for (Worker worker : workers) {
-            while (worker.isAlive()) {
+            while (worker.thread.isAlive()) {
                 try {
-                    worker.join();
+                    worker.thread.join();
                 } catch (InterruptedException e) {}
             }
 
             System.out.printf("%s: %s (executed: %d)\n",
-                    worker.getName(),
+                    worker.thread.getName(),
                     worker.isFailed() ? "FAILED: " + worker.getFailedTest() : "PASSED",
                     worker.getExecutedTests());
 
@@ -288,7 +291,7 @@ private void joinWorkers() {
 
     private boolean workersAlive() {
         for (Worker worker : workers) {
-            if (!worker.isAlive()) {
+            if (!worker.thread.isAlive()) {
                 return false;
             }
         }

From 7992bdcddbc7b0aee8203d3dbd313dc39bd763fe Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:12:41 +0000
Subject: [PATCH 095/223] 8373632: Some sound tests failing in CI due to lack
 of sound key

Backport-of: fb531cdaf3b30034e0efa86b9b20558478ce94d0
---
 test/jdk/javax/sound/midi/Sequencer/Looping.java             | 2 +-
 test/jdk/javax/sound/sampled/Clip/IsRunningHang.java         | 1 +
 test/jdk/javax/sound/sampled/DataLine/LongFramePosition.java | 1 +
 test/jdk/javax/sound/sampled/DirectAudio/bug6372428.java     | 1 +
 4 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/jdk/javax/sound/midi/Sequencer/Looping.java b/test/jdk/javax/sound/midi/Sequencer/Looping.java
index 9bcc9254653d..9a5a89c64723 100644
--- a/test/jdk/javax/sound/midi/Sequencer/Looping.java
+++ b/test/jdk/javax/sound/midi/Sequencer/Looping.java
@@ -36,7 +36,7 @@
  * @test
  * @bug 4204105
  * @summary RFE: add loop() method(s) to Sequencer
- * @key intermittent
+ * @key sound
  */
 public class Looping {
 
diff --git a/test/jdk/javax/sound/sampled/Clip/IsRunningHang.java b/test/jdk/javax/sound/sampled/Clip/IsRunningHang.java
index c417c5ad8d0b..8ffd760b08ac 100644
--- a/test/jdk/javax/sound/sampled/Clip/IsRunningHang.java
+++ b/test/jdk/javax/sound/sampled/Clip/IsRunningHang.java
@@ -36,6 +36,7 @@
 /**
  * @test
  * @bug 8156169
+ * @key sound
  * @run main/othervm/timeout=300 IsRunningHang
  */
 public final class IsRunningHang {
diff --git a/test/jdk/javax/sound/sampled/DataLine/LongFramePosition.java b/test/jdk/javax/sound/sampled/DataLine/LongFramePosition.java
index 079a785de8bd..42e70521b2b6 100644
--- a/test/jdk/javax/sound/sampled/DataLine/LongFramePosition.java
+++ b/test/jdk/javax/sound/sampled/DataLine/LongFramePosition.java
@@ -29,6 +29,7 @@
 /**
  * @test
  * @bug 5049129
+ * @key sound
  * @summary DataLine.getLongFramePosition
  */
 public class LongFramePosition {
diff --git a/test/jdk/javax/sound/sampled/DirectAudio/bug6372428.java b/test/jdk/javax/sound/sampled/DirectAudio/bug6372428.java
index 177ebce85a01..a99caeea0552 100644
--- a/test/jdk/javax/sound/sampled/DirectAudio/bug6372428.java
+++ b/test/jdk/javax/sound/sampled/DirectAudio/bug6372428.java
@@ -31,6 +31,7 @@
 /*
  * @test
  * @bug 6372428
+ * @key sound
  * @summary playback and capture doesn't interrupt after terminating thread that
  *          calls start()
  * @run main bug6372428

From 6d2e6e92c8bcb75b7cf6f5912f4f6b2be020f112 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:13:04 +0000
Subject: [PATCH 096/223] 8213530: Test
 java/awt/Modal/ToFront/DialogToFrontModeless1Test.java fails on Linux

Backport-of: 5e12ff9ff64f2d7ebb501cdb19d5f013dde17be4
---
 test/jdk/ProblemList.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
index a1efcd5fcb20..6ecac6445f1d 100644
--- a/test/jdk/ProblemList.txt
+++ b/test/jdk/ProblemList.txt
@@ -411,7 +411,6 @@ java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java 8005021 macosx-all
 java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java 8051455 macosx-all
 java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Standard.java 7124407,8302787  macosx-all,windows-all
 java/awt/Mouse/RemovedComponentMouseListener/RemovedComponentMouseListener.java 8157170 macosx-all
-java/awt/Modal/ToFront/DialogToFrontModeless1Test.java 8213530 linux-all
 java/awt/Modal/ToFront/DialogToFrontNonModalTest.java 8221899 linux-all
 java/awt/Modal/ToBack/ToBackAppModal1Test.java 8196441 linux-all,macosx-all
 java/awt/Modal/ToBack/ToBackAppModal2Test.java 8196441 linux-all,macosx-all

From b51d2fe6d9ee4b7af02cfe00f3c5216d0fdc41eb Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:13:48 +0000
Subject: [PATCH 097/223] 8321687: Test
 vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/TestDescription.java
 failed: JVMTI_ERROR_THREAD_NOT_ALIVE

Backport-of: 181657084a547457327b8657d7a8d3faa17eb1f5
---
 .../scenarios/contention/TC03/tc03t001.java   |  6 +-
 .../contention/TC03/tc03t001/tc03t001.cpp     | 64 ++++++++++--------
 .../scenarios/contention/TC03/tc03t002.java   |  7 +-
 .../contention/TC03/tc03t002/tc03t002.cpp     | 65 +++++++++++--------
 4 files changed, 85 insertions(+), 57 deletions(-)

diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001.java
index 4c7905809d97..eb202c87ef3d 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2025, 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
@@ -123,6 +123,8 @@ public int runIt(String argv[], PrintStream out) {
 /* =================================================================== */
 
 class tc03t001Thread extends Thread {
+    // The thread name prefix is used to find thread from jvmti agent.
+    final static String threadNamePrefix = "Debuggee Thread";
 
     Object lock1;
     Object lock2;
@@ -130,7 +132,7 @@ class tc03t001Thread extends Thread {
     int lock2Counter = 0;
 
     public tc03t001Thread(Object o1, Object o2) {
-        super("Debuggee Thread " + o1 + o2);
+        super(threadNamePrefix + " " + o1 + o2);
         lock1 = o1;
         lock2 = o2;
     }
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp
index ff7d346d237a..9ea61a27bc65 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2025, 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
@@ -41,10 +41,13 @@ typedef struct {
 static jlong timeout = 0;
 
 /* test objects */
-static threadDesc *threadList = nullptr;
-static jint threads_count = 0;
+static threadDesc *debuggee_threads = nullptr;
+static jint debuggee_threads_cnt = 0;
 static int numberOfDeadlocks = 0;
 
+static const char* THREAD_NAME_PREFIX = "Debugee Thread";
+static const size_t THREAD_NAME_PREFIX_LEN = strlen(THREAD_NAME_PREFIX);
+
 /* ========================================================================== */
 
 static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) {
@@ -56,9 +59,9 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) {
 
     NSK_DISPLAY1("Found deadlock #%d:\n", numberOfDeadlocks);
     for (pThread = dThread;;pThread = cThread) {
-        NSK_DISPLAY1(" \"%s\":\n", threadList[pThread].name);
+        NSK_DISPLAY1(" \"%s\":\n", debuggee_threads[pThread].name);
         if (!NSK_JVMTI_VERIFY(
-                jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor)))
+                jvmti->GetCurrentContendedMonitor(debuggee_threads[pThread].thread, &monitor)))
             return NSK_FALSE;
         if (monitor != nullptr) {
             if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != nullptr))
@@ -74,8 +77,8 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) {
             return NSK_FALSE;
         if (usageInfo.owner == nullptr)
             break;
-        for (cThread = 0; cThread < threads_count; cThread++) {
-            if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner))
+        for (cThread = 0; cThread < debuggee_threads_cnt; cThread++) {
+            if (jni->IsSameObject(debuggee_threads[cThread].thread, usageInfo.owner))
                 break;
         }
         if (usageInfo.waiters != nullptr) {
@@ -84,10 +87,10 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) {
         if (usageInfo.notify_waiters != nullptr) {
             jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters);
         }
-        if (!NSK_VERIFY(cThread != threads_count))
+        if (!NSK_VERIFY(cThread != debuggee_threads_cnt))
             return NSK_FALSE;
         NSK_DISPLAY1("    which is held by \"%s\"\n",
-            threadList[cThread].name);
+            debuggee_threads[cThread].name);
         if (cThread == dThread)
             break;
     }
@@ -103,8 +106,9 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) {
     int tDfn = 0, gDfn = 0;
     int pThread, cThread;
     int i;
+    int threads_count = 0;
 
-    NSK_DISPLAY0("Create threadList\n");
+    NSK_DISPLAY0("Create debuggee_threads\n");
 
     /* get all live threads */
     if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
@@ -114,7 +118,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) {
         return NSK_FALSE;
 
     if (!NSK_JVMTI_VERIFY(
-            jvmti->Allocate(threads_count*sizeof(threadDesc), (unsigned char**)&threadList)))
+            jvmti->Allocate(threads_count*sizeof(threadDesc), (unsigned char**)&debuggee_threads)))
         return NSK_FALSE;
 
     for (i = 0; i < threads_count; i++) {
@@ -127,22 +131,30 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) {
 
         NSK_DISPLAY3("    thread #%d (%s): %p\n", i, info.name, threads[i]);
 
-        threadList[i].thread = threads[i];
-        threadList[i].dfn = -1;
-        threadList[i].name = info.name;
+        if (!strncmp(info.name, THREAD_NAME_PREFIX, THREAD_NAME_PREFIX_LEN)) {
+            NSK_DISPLAY1("Skipping thread %s\n", info.name);
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name)))
+                return NSK_FALSE;
+            continue;
+        }
+
+        debuggee_threads[debuggee_threads_cnt].thread = threads[i];
+        debuggee_threads[debuggee_threads_cnt].dfn = -1;
+        debuggee_threads[debuggee_threads_cnt].name = info.name;
+        debuggee_threads_cnt++;
     }
 
     /* deallocate thread list */
     if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
         return NSK_FALSE;
 
-    for (i = 0; i < threads_count; i++) {
-        if (threadList[i].dfn < 0) {
+    for (i = 0; i < debuggee_threads_cnt; i++) {
+        if (debuggee_threads[i].dfn < 0) {
             tDfn = gDfn;
-            threadList[i].dfn = gDfn++;
+            debuggee_threads[i].dfn = gDfn++;
             for (pThread = i;;pThread = cThread) {
                 if (!NSK_JVMTI_VERIFY(
-                        jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor)))
+                        jvmti->GetCurrentContendedMonitor(debuggee_threads[pThread].thread, &monitor)))
                     return NSK_FALSE;
                 if (monitor == nullptr)
                     break;
@@ -150,8 +162,8 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) {
                     return NSK_FALSE;
                 if (usageInfo.owner == nullptr)
                     break;
-                for (cThread = 0; cThread < threads_count; cThread++) {
-                    if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner))
+                for (cThread = 0; cThread < debuggee_threads_cnt; cThread++) {
+                    if (jni->IsSameObject(debuggee_threads[cThread].thread, usageInfo.owner))
                         break;
                 }
                 if (usageInfo.waiters != nullptr) {
@@ -160,10 +172,10 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) {
                 if (usageInfo.notify_waiters != nullptr) {
                     jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters);
                 }
-                if (!NSK_VERIFY(cThread != threads_count))
+                if (!NSK_VERIFY(cThread != debuggee_threads_cnt))
                     return NSK_FALSE;
-                if (threadList[cThread].dfn < 0) {
-                    threadList[cThread].dfn = gDfn++;
+                if (debuggee_threads[cThread].dfn < 0) {
+                    debuggee_threads[cThread].dfn = gDfn++;
                 } else if (cThread == pThread) {
                     break;
                 } else {
@@ -179,9 +191,9 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) {
     }
 
     /* deallocate thread names */
-    for (i = 0; i < threads_count; i++) {
-        if (threadList[i].name != nullptr) {
-            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadList[i].name)))
+    for (i = 0; i < debuggee_threads_cnt; i++) {
+        if (debuggee_threads[i].name != nullptr) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)debuggee_threads[i].name)))
                 return NSK_FALSE;
         }
     }
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002.java
index f4ca83c0b546..852b915acd74 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2025, 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
@@ -104,7 +104,8 @@ public int runIt(String argv[], PrintStream out) {
 /* =================================================================== */
 
 class tc03t002Thread extends Thread {
-
+    // The thread name prefix is used to find thread from jvmti agent.
+    final static String threadNamePrefix = "Debuggee Thread";
     static Wicket startingBarrier = new Wicket(3);
     static Wicket lockingBarrier = new Wicket(3);
     Wicket waitingBarrier = new Wicket();
@@ -112,7 +113,7 @@ class tc03t002Thread extends Thread {
     Object lock2;
 
     public tc03t002Thread(Object o1, Object o2) {
-        super("Debuggee Thread " + o1 + o2);
+        super(threadNamePrefix + " " + o1 + o2);
         lock1 = o1;
         lock2 = o2;
     }
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp
index 11c74e3a9e2c..5d18d6c23afd 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2025, 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
@@ -41,10 +41,13 @@ typedef struct {
 static jlong timeout = 0;
 
 /* test objects */
-static threadDesc *threadList = nullptr;
-static jint threads_count = 0;
+static threadDesc *debuggee_threads = nullptr;
+static jint debuggee_threads_cnt = 0;
 static int numberOfDeadlocks = 0;
 
+static const char* THREAD_NAME_PREFIX = "Debugee Thread";
+static const size_t THREAD_NAME_PREFIX_LEN = strlen(THREAD_NAME_PREFIX);
+
 /* ========================================================================== */
 
 static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) {
@@ -56,9 +59,9 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) {
 
     NSK_DISPLAY1("Found deadlock #%d:\n", numberOfDeadlocks);
     for (pThread = dThread;;pThread = cThread) {
-        NSK_DISPLAY1(" \"%s\":\n", threadList[pThread].name);
+        NSK_DISPLAY1(" \"%s\":\n", debuggee_threads[pThread].name);
         if (!NSK_JVMTI_VERIFY(
-                jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor)))
+                jvmti->GetCurrentContendedMonitor(debuggee_threads[pThread].thread, &monitor)))
             return NSK_FALSE;
         if (monitor != nullptr) {
             if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != nullptr))
@@ -74,8 +77,8 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) {
             return NSK_FALSE;
         if (usageInfo.owner == nullptr)
             break;
-        for (cThread = 0; cThread < threads_count; cThread++) {
-            if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner))
+        for (cThread = 0; cThread < debuggee_threads_cnt; cThread++) {
+            if (jni->IsSameObject(debuggee_threads[cThread].thread, usageInfo.owner))
                 break;
         }
         if (usageInfo.waiters != nullptr) {
@@ -84,10 +87,10 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) {
         if (usageInfo.notify_waiters != nullptr) {
             jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters);
         }
-        if (!NSK_VERIFY(cThread != threads_count))
+        if (!NSK_VERIFY(cThread != debuggee_threads_cnt))
             return NSK_FALSE;
         NSK_DISPLAY1("    which is held by \"%s\"\n",
-            threadList[cThread].name);
+            debuggee_threads[cThread].name);
         if (cThread == dThread)
             break;
     }
@@ -103,8 +106,9 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) {
     int tDfn = 0, gDfn = 0;
     int pThread, cThread;
     int i;
+    int threads_count = 0;
 
-    NSK_DISPLAY0("Create threadList\n");
+    NSK_DISPLAY0("Create debuggee_threads\n");
 
     /* get all live threads */
     if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
@@ -114,7 +118,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) {
         return NSK_FALSE;
 
     if (!NSK_JVMTI_VERIFY(
-            jvmti->Allocate(threads_count*sizeof(threadDesc), (unsigned char**)&threadList)))
+            jvmti->Allocate(threads_count*sizeof(threadDesc), (unsigned char**)&debuggee_threads)))
         return NSK_FALSE;
 
     for (i = 0; i < threads_count; i++) {
@@ -127,22 +131,31 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) {
 
         NSK_DISPLAY3("    thread #%d (%s): %p\n", i, info.name, threads[i]);
 
-        threadList[i].thread = threads[i];
-        threadList[i].dfn = -1;
-        threadList[i].name = info.name;
+        if (!strncmp(info.name, THREAD_NAME_PREFIX, THREAD_NAME_PREFIX_LEN)) {
+            NSK_DISPLAY1("Skipping thread %s\n", info.name);
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name)))
+                return NSK_FALSE;
+            continue;
+        }
+
+        debuggee_threads[debuggee_threads_cnt].thread = threads[i];
+        debuggee_threads[debuggee_threads_cnt].dfn = -1;
+        debuggee_threads[debuggee_threads_cnt].name = info.name;
+        debuggee_threads_cnt++;
     }
 
     /* deallocate thread list */
     if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
         return NSK_FALSE;
 
-    for (i = 0; i < threads_count; i++) {
-        if (threadList[i].dfn < 0) {
+    for (i = 0; i < debuggee_threads_cnt; i++) {
+
+        if (debuggee_threads[i].dfn < 0) {
             tDfn = gDfn;
-            threadList[i].dfn = gDfn++;
+            debuggee_threads[i].dfn = gDfn++;
             for (pThread = i;;pThread = cThread) {
                 if (!NSK_JVMTI_VERIFY(
-                        jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor)))
+                        jvmti->GetCurrentContendedMonitor(debuggee_threads[pThread].thread, &monitor)))
                     return NSK_FALSE;
                 if (monitor == nullptr)
                     break;
@@ -150,8 +163,8 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) {
                     return NSK_FALSE;
                 if (usageInfo.owner == nullptr)
                     break;
-                for (cThread = 0; cThread < threads_count; cThread++) {
-                    if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner))
+                for (cThread = 0; cThread < debuggee_threads_cnt; cThread++) {
+                    if (jni->IsSameObject(debuggee_threads[cThread].thread, usageInfo.owner))
                         break;
                 }
                 if (usageInfo.waiters != nullptr) {
@@ -160,10 +173,10 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) {
                 if (usageInfo.notify_waiters != nullptr) {
                     jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters);
                 }
-                if (!NSK_VERIFY(cThread != threads_count))
+                if (!NSK_VERIFY(cThread != debuggee_threads_cnt))
                     return NSK_FALSE;
-                if (threadList[cThread].dfn < 0) {
-                    threadList[cThread].dfn = gDfn++;
+                if (debuggee_threads[cThread].dfn < 0) {
+                    debuggee_threads[cThread].dfn = gDfn++;
                 } else if (cThread == pThread) {
                     break;
                 } else {
@@ -179,9 +192,9 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) {
     }
 
     /* deallocate thread names */
-    for (i = 0; i < threads_count; i++) {
-        if (threadList[i].name != nullptr) {
-            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadList[i].name)))
+    for (i = 0; i < debuggee_threads_cnt; i++) {
+        if (debuggee_threads[i].name != nullptr) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)debuggee_threads[i].name)))
                 return NSK_FALSE;
         }
     }

From 8fe7d5e134991e21e8d74a22d17073e4e7035fb2 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:14:25 +0000
Subject: [PATCH 098/223] 8370511: test/jdk/javax/swing/JSlider/bug4382876.java
 does not release previously pressed keys

Backport-of: 470eedb1e9d67058ff8d67a5b0c2250d9f9b3fa5
---
 test/jdk/javax/swing/JSlider/bug4382876.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/test/jdk/javax/swing/JSlider/bug4382876.java b/test/jdk/javax/swing/JSlider/bug4382876.java
index b9ec64aab216..b0988de3cabd 100644
--- a/test/jdk/javax/swing/JSlider/bug4382876.java
+++ b/test/jdk/javax/swing/JSlider/bug4382876.java
@@ -48,8 +48,8 @@ public class bug4382876 {
     private static Robot r;
     private static JFrame f;
     private static JSlider slider;
-    private static boolean upFail;
-    private static boolean downFail;
+    private static volatile boolean upFail;
+    private static volatile boolean downFail;
 
     public static void main(String[] args) throws Exception {
         try {
@@ -70,23 +70,30 @@ public static void main(String[] args) throws Exception {
             r.delay(1000);
 
             r.keyPress(KeyEvent.VK_PAGE_UP);
+            r.keyRelease(KeyEvent.VK_PAGE_UP);
+
             SwingUtilities.invokeAndWait(() -> {
                 if (slider.getValue() < -1000) {
                     System.out.println("PAGE_UP VAL: " + slider.getValue());
                     upFail = true;
                 }
             });
+
             if (upFail) {
                 writeFailImage();
                 throw new RuntimeException("Slider value did NOT change with PAGE_UP");
             }
+
             r.keyPress(KeyEvent.VK_PAGE_DOWN);
+            r.keyRelease(KeyEvent.VK_PAGE_DOWN);
+
             SwingUtilities.invokeAndWait(() -> {
                 if (slider.getValue() > -1000) {
                     System.out.println("PAGE_DOWN VAL: " + slider.getValue());
                     downFail = true;
                 }
             });
+
             if (downFail) {
                 writeFailImage();
                 throw new RuntimeException("Slider value did NOT change with PAGE_DOWN");

From 67d1db721f0c72a366b9d466624d0546da86e955 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:14:54 +0000
Subject: [PATCH 099/223] 8375742: Test
 java/lang/invoke/MethodHandleProxies/Driver.java does not run Unnamed.java

Backport-of: aaca0a2c1f3de06a1349ae9084e9e9dbec991421
---
 test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java  | 6 +++---
 test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java b/test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java
index 6acd4fb30e1d..0e9c708e8e9f 100644
--- a/test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java
+++ b/test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2026, 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
@@ -21,12 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 8280377
  * @build m1/* m2/* Unnamed
  * @run testng/othervm m1/p1.Main
- * @run testng/othervm Unnamed
+ * @run main/othervm Unnamed
  * @summary Test MethodHandleProxies::asInterfaceInstance with a default
  *          method with varargs
  */
diff --git a/test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java b/test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java
index f42071f04275..f60f36ca9de7 100644
--- a/test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java
+++ b/test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2026, 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
@@ -39,7 +39,7 @@ public static void main(String... args) throws Throwable {
 
         // verify that the caller has no access to the proxy created on an
         // inaccessible interface
-        Method m = intf.getMethod("test", Object[].class);
-        assertFalse(m.canAccess(null));
+        Method m = intf.getMethod("test");
+        assertFalse(m.canAccess(t));
     }
 }

From f56e97fdd87a3ac5d12650ac61ddc6c4a4b75779 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:15:48 +0000
Subject: [PATCH 100/223] =?UTF-8?q?8373847:=20Test=20javax/swing/JMenuItem?=
 =?UTF-8?q?/MenuItemTest/bug6197830.java=20failed=20because=20The=20test?=
 =?UTF-8?q?=20case=20automatically=20fails=20when=20clicking=20any=20items?=
 =?UTF-8?q?=20in=20the=20=E2=80=9CNothing=E2=80=9D=20menu=20in=20all=20fou?=
 =?UTF-8?q?r=20windows=20(Left-to-right)-Menu=20Item=20Test=20and=20(Right?=
 =?UTF-8?q?-to-left)-Menu=20Item=20Test?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Backport-of: 05d2f7f4080f5cc6d3eef97878806e28773d6f70
---
 test/jdk/javax/swing/JMenuItem/MenuItemTest/bug6197830.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/jdk/javax/swing/JMenuItem/MenuItemTest/bug6197830.java b/test/jdk/javax/swing/JMenuItem/MenuItemTest/bug6197830.java
index afb1c7bb33f9..5a30e202d9da 100644
--- a/test/jdk/javax/swing/JMenuItem/MenuItemTest/bug6197830.java
+++ b/test/jdk/javax/swing/JMenuItem/MenuItemTest/bug6197830.java
@@ -49,6 +49,7 @@ public static void main(String[] args) throws Exception {
                 .columns(35)
                 .testUI(bug6197830::createTestUI)
                 .positionTestUIBottomRowCentered()
+                .logArea()
                 .build()
                 .awaitAndCheck();
     }

From 896dd4842d18411d2102df64db18c888386e2392 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:16:22 +0000
Subject: [PATCH 101/223] 8375231: Refactor util/ServiceLoader tests to use
 JUnit 8375232: Refactor util/StringJoiner tests to use JUnit 8375233:
 Refactor util/Vector tests to use JUnit

Reviewed-by: phh
Backport-of: 34705a77f9a90da5ab2a440c11d79aef7bb3ba54
---
 .../util/ServiceLoader/BadProvidersTest.java  |  78 +++-----
 .../java/util/ServiceLoader/CachingTest.java  |  18 +-
 .../java/util/ServiceLoader/ModulesTest.java  |  42 ++--
 .../ServiceLoader/NoInterferenceTest.java     |  14 +-
 .../java/util/ServiceLoader/ReloadTest.java   |  31 +--
 .../java/util/ServiceLoader/TwoIterators.java |  19 +-
 .../basic/ServiceLoaderBasicTest.java         |  40 ++--
 .../jdk/java/util/StringJoiner/MergeTest.java |  55 +++---
 .../StringJoinerOomUtf16Test.java             |  19 +-
 .../util/StringJoiner/StringJoinerTest.java   | 182 ++++++++++--------
 .../jdk/java/util/Vector/ArrayManagement.java |  81 ++++----
 11 files changed, 304 insertions(+), 275 deletions(-)

diff --git a/test/jdk/java/util/ServiceLoader/BadProvidersTest.java b/test/jdk/java/util/ServiceLoader/BadProvidersTest.java
index 58613c7b5e35..39c90824e4c9 100644
--- a/test/jdk/java/util/ServiceLoader/BadProvidersTest.java
+++ b/test/jdk/java/util/ServiceLoader/BadProvidersTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2026, 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
@@ -27,7 +27,7 @@
  * @modules java.base/jdk.internal.org.objectweb.asm
  *          jdk.compiler
  * @build jdk.test.lib.compiler.CompilerUtils
- * @run testng/othervm BadProvidersTest
+ * @run junit/othervm BadProvidersTest
  * @summary Basic test of ServiceLoader with bad provider and bad provider
  *          factories deployed on the module path
  */
@@ -51,15 +51,16 @@
 
 import jdk.test.lib.compiler.CompilerUtils;
 
-import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
-import static org.testng.Assert.*;
+import org.junit.jupiter.api.Assertions;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 
 /**
  * Basic test of `provides S with PF` and `provides S with P` where the provider
  * factory or provider
  */
-
 public class BadProvidersTest {
 
     private static final String TEST_SRC = System.getProperty("test.src");
@@ -132,21 +133,10 @@ public void sanityTest2() throws Exception {
     }
 
 
-    @DataProvider(name = "badfactories")
-    public Object[][] createBadFactories() {
-        return new Object[][] {
-                { "classnotpublic",     null },
-                { "methodnotpublic",    null },
-                { "badreturntype",      null },
-                { "returnsnull",        null },
-                { "throwsexception",    null },
-        };
-    }
-
-
-    @Test(dataProvider = "badfactories",
-          expectedExceptions = ServiceConfigurationError.class)
-    public void testBadFactory(String testName, String ignore) throws Exception {
+    @ParameterizedTest
+    @ValueSource(strings = { "classnotpublic", "methodnotpublic", "badreturntype",
+            "returnsnull", "throwsexception" })
+    public void testBadFactory(String testName) throws Exception {
         Path mods = compileTest(TEST1_MODULE);
 
         // compile the bad factory
@@ -158,28 +148,18 @@ public void testBadFactory(String testName, String ignore) throws Exception {
         // copy the compiled class into the module
         Path classFile = Paths.get("p", "ProviderFactory.class");
         Files.copy(output.resolve(classFile),
-                   mods.resolve(TEST1_MODULE).resolve(classFile),
-                   StandardCopyOption.REPLACE_EXISTING);
+               mods.resolve(TEST1_MODULE).resolve(classFile),
+               StandardCopyOption.REPLACE_EXISTING);
 
-        // load providers and instantiate each one
-        loadProviders(mods, TEST1_MODULE).forEach(Provider::get);
+        Assertions.assertThrows(ServiceConfigurationError.class,
+                // load providers and instantiate each one
+                () -> loadProviders(mods, TEST1_MODULE).forEach(Provider::get)
+        );
     }
 
-
-    @DataProvider(name = "badproviders")
-    public Object[][] createBadProviders() {
-        return new Object[][] {
-                { "notpublic",          null },
-                { "ctornotpublic",      null },
-                { "notasubtype",        null },
-                { "throwsexception",    null }
-        };
-    }
-
-
-    @Test(dataProvider = "badproviders",
-          expectedExceptions = ServiceConfigurationError.class)
-    public void testBadProvider(String testName, String ignore) throws Exception {
+    @ParameterizedTest
+    @ValueSource(strings = { "notpublic", "ctornotpublic", "notasubtype", "throwsexception" })
+    public void testBadProvider(String testName) throws Exception {
         Path mods = compileTest(TEST2_MODULE);
 
         // compile the bad provider
@@ -191,11 +171,13 @@ public void testBadProvider(String testName, String ignore) throws Exception {
         // copy the compiled class into the module
         Path classFile = Paths.get("p", "Provider.class");
         Files.copy(output.resolve(classFile),
-                   mods.resolve(TEST2_MODULE).resolve(classFile),
-                   StandardCopyOption.REPLACE_EXISTING);
+               mods.resolve(TEST2_MODULE).resolve(classFile),
+               StandardCopyOption.REPLACE_EXISTING);
 
-        // load providers and instantiate each one
-        loadProviders(mods, TEST2_MODULE).forEach(Provider::get);
+        Assertions.assertThrows(ServiceConfigurationError.class,
+                // load providers and instantiate each one
+                () -> loadProviders(mods, TEST2_MODULE).forEach(Provider::get)
+        );
     }
 
 
@@ -203,7 +185,7 @@ public void testBadProvider(String testName, String ignore) throws Exception {
      * Test a service provider that defines more than one no-args
      * public static "provider" method.
      */
-    @Test(expectedExceptions = ServiceConfigurationError.class)
+    @Test
     public void testWithTwoFactoryMethods() throws Exception {
         Path mods = compileTest(TEST1_MODULE);
 
@@ -257,8 +239,10 @@ public void testWithTwoFactoryMethods() throws Exception {
                 .resolve("ProviderFactory.class");
         Files.write(classFile, cw.toByteArray());
 
-        // load providers and instantiate each one
-        loadProviders(mods, TEST1_MODULE).forEach(Provider::get);
+        Assertions.assertThrows(ServiceConfigurationError.class,
+                // load providers and instantiate each one
+                () -> loadProviders(mods, TEST1_MODULE).forEach(Provider::get)
+        );
     }
 
 }
diff --git a/test/jdk/java/util/ServiceLoader/CachingTest.java b/test/jdk/java/util/ServiceLoader/CachingTest.java
index 264c646b5af0..138b6b6862ff 100644
--- a/test/jdk/java/util/ServiceLoader/CachingTest.java
+++ b/test/jdk/java/util/ServiceLoader/CachingTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, 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
@@ -24,7 +24,7 @@
 /**
  * @test
  * @summary Test ServiceLoader caches
- * @run testng CachingTest
+ * @run junit CachingTest
  */
 
 import java.nio.file.Files;
@@ -38,9 +38,9 @@
 import java.util.Spliterator;
 import java.util.stream.Collectors;
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 public class CachingTest {
 
@@ -52,17 +52,17 @@ public static class S1 implements S { }
 
     public static class S2 implements S { }
 
-    private ClassLoader testClassLoader;
+    private static ClassLoader testClassLoader;
 
     // creates the services configuration file and sets the ClassLoader
-    @BeforeClass
-    void setup() throws Exception {
+    @BeforeAll
+    static void setup() throws Exception {
         String classes = System.getProperty("test.classes");
         Path dir = Paths.get(classes, "META-INF", "services");
         Files.createDirectories(dir);
         Path config = dir.resolve(S.class.getName());
         Files.write(config, List.of(S1.class.getName(), S2.class.getName()));
-        this.testClassLoader = CachingTest.class.getClassLoader();
+        testClassLoader = CachingTest.class.getClassLoader();
     }
 
     private void checkLists(List list1, List list2) {
diff --git a/test/jdk/java/util/ServiceLoader/ModulesTest.java b/test/jdk/java/util/ServiceLoader/ModulesTest.java
index 002b8458865d..d265ce18f60b 100644
--- a/test/jdk/java/util/ServiceLoader/ModulesTest.java
+++ b/test/jdk/java/util/ServiceLoader/ModulesTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2026, 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,7 @@
  * @build jdk.test.lib.util.JarUtils
  * @compile classpath/pearscript/org/pear/PearScriptEngineFactory.java
  *          classpath/pearscript/org/pear/PearScript.java
- * @run testng/othervm ModulesTest
+ * @run junit/othervm ModulesTest
  * @summary Basic test for ServiceLoader with a provider deployed as a module.
  */
 
@@ -55,9 +55,10 @@
 
 import jdk.test.lib.util.JarUtils;
 
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeTest;
-import static org.testng.Assert.*;
+import org.junit.jupiter.api.Assertions;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 /**
  * Basic test for ServiceLoader. The test make use of two service providers:
@@ -67,12 +68,11 @@
  * 2. PearScriptEngine - a ScriptEngineFactory deployed on the class path
  *    with a service configuration file.
  */
-
 public class ModulesTest {
 
     // Copy the services configuration file for "pearscript" into place.
-    @BeforeTest
-    public void setup() throws Exception {
+    @BeforeAll
+    public static void setup() throws Exception {
         Path src = Paths.get(System.getProperty("test.src"));
         Path classes = Paths.get(System.getProperty("test.classes"));
         String st = ScriptEngineFactory.class.getName();
@@ -428,30 +428,36 @@ public void testWithCustomLayer3() {
 
     // -- nulls --
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test
     public void testLoadNull1() {
-        ServiceLoader.load(null);
+        Assertions.assertThrows(NullPointerException.class,
+                () -> ServiceLoader.load(null));
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test
     public void testLoadNull2() {
-        ServiceLoader.load((Class) null, ClassLoader.getSystemClassLoader());
+        Assertions.assertThrows(NullPointerException.class,
+                () -> ServiceLoader.load((Class) null, ClassLoader.getSystemClassLoader()));
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test
     public void testLoadNull3() {
         class S { }
-        ServiceLoader.load((ModuleLayer) null, S.class);
+        Assertions.assertThrows(NullPointerException.class, () -> {
+            ServiceLoader.load((ModuleLayer) null, S.class);
+        });
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test
     public void testLoadNull4() {
-        ServiceLoader.load(ModuleLayer.empty(), null);
+        Assertions.assertThrows(NullPointerException.class,
+                () -> ServiceLoader.load(ModuleLayer.empty(), null));
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test
     public void testLoadNull5() {
-        ServiceLoader.loadInstalled(null);
+        Assertions.assertThrows(NullPointerException.class,
+                () -> ServiceLoader.loadInstalled(null));
     }
 
     /**
diff --git a/test/jdk/java/util/ServiceLoader/NoInterferenceTest.java b/test/jdk/java/util/ServiceLoader/NoInterferenceTest.java
index ff83b836e200..d91bc9c759f4 100644
--- a/test/jdk/java/util/ServiceLoader/NoInterferenceTest.java
+++ b/test/jdk/java/util/ServiceLoader/NoInterferenceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, 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
@@ -26,7 +26,7 @@
  * @library /test/lib
  * @modules jdk.compiler
  * @build jdk.test.lib.compiler.CompilerUtils
- * @run testng NoInterferenceTest
+ * @run junit NoInterferenceTest
  * @summary Basic test of ServiceLoader that ensures there is no interference
  *          when there are two service interfaces of the same name in a layer
  *          or overridden in a child layer.
@@ -46,9 +46,9 @@
 
 import jdk.test.lib.compiler.CompilerUtils;
 
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 public class NoInterferenceTest {
 
@@ -57,8 +57,8 @@ public class NoInterferenceTest {
     private static final Path MODS_DIR = Paths.get("mods");
     private static final List MODULES = Arrays.asList("s1", "p1", "s2", "p2");
 
-    @BeforeTest
-    void compile() throws Exception {
+    @BeforeAll
+    static void compile() throws Exception {
         Files.createDirectory(MODS_DIR);
         for (String name : MODULES) {
             Path src = SRC_DIR.resolve(name);
diff --git a/test/jdk/java/util/ServiceLoader/ReloadTest.java b/test/jdk/java/util/ServiceLoader/ReloadTest.java
index d48b5c29f4d6..be2c0d687732 100644
--- a/test/jdk/java/util/ServiceLoader/ReloadTest.java
+++ b/test/jdk/java/util/ServiceLoader/ReloadTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, 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
@@ -26,7 +26,7 @@
  * @modules java.scripting
  * @library modules classpath/pearscript
  * @build ReloadTest org.pear.PearScript org.pear.PearScriptEngineFactory bananascript/*
- * @run testng/othervm ReloadTest
+ * @run junit/othervm ReloadTest
  * @summary Basic test of ServiceLoader.reload
  */
 
@@ -40,12 +40,14 @@
 import java.util.stream.Stream;
 import static java.util.ServiceLoader.*;
 import javax.script.ScriptEngineFactory;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
 
-@Test
+import org.junit.jupiter.api.Assertions;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+
 public class ReloadTest {
 
+    @Test
     public void testReload() {
         ServiceLoader sl = load(ScriptEngineFactory.class);
         List names1 = sl.stream()
@@ -58,41 +60,42 @@ public void testReload() {
                 .map(Provider::get)
                 .map(ScriptEngineFactory::getEngineName)
                 .collect(Collectors.toList());
-        assertEquals(names1, names2);
+        assertEquals(names2, names1);
     }
 
-    @Test(expectedExceptions = { ConcurrentModificationException.class })
+    @Test
     public void testIteratorHasNext() {
         ServiceLoader sl = load(ScriptEngineFactory.class);
         Iterator iterator = sl.iterator();
         sl.reload();
-        iterator.hasNext();
+        Assertions.assertThrows(ConcurrentModificationException.class, iterator::hasNext);
     }
 
-    @Test(expectedExceptions = { ConcurrentModificationException.class })
+    @Test
     public void testIteratorNext() {
         ServiceLoader sl = load(ScriptEngineFactory.class);
         Iterator iterator = sl.iterator();
         assertTrue(iterator.hasNext());
         sl.reload();
-        iterator.next();
+        Assertions.assertThrows(ConcurrentModificationException.class, iterator::next);
     }
 
-    @Test(expectedExceptions = { ConcurrentModificationException.class })
+    @Test
     public void testStreamFindAny() {
         ServiceLoader sl = load(ScriptEngineFactory.class);
         Stream> stream = sl.stream();
         sl.reload();
-        stream.findAny();
+        Assertions.assertThrows(ConcurrentModificationException.class, stream::findAny);
     }
 
-    @Test(expectedExceptions = { ConcurrentModificationException.class })
+    @Test
     public void testSpliteratorTryAdvance() {
         ServiceLoader sl = load(ScriptEngineFactory.class);
         Stream> stream = sl.stream();
         Spliterator> spliterator = stream.spliterator();
         sl.reload();
-        spliterator.tryAdvance(System.out::println);
+        Assertions.assertThrows(ConcurrentModificationException.class,
+                () -> spliterator.tryAdvance(System.out::println));
     }
 
 }
diff --git a/test/jdk/java/util/ServiceLoader/TwoIterators.java b/test/jdk/java/util/ServiceLoader/TwoIterators.java
index ddb9cc09508b..b86cc45f17f9 100644
--- a/test/jdk/java/util/ServiceLoader/TwoIterators.java
+++ b/test/jdk/java/util/ServiceLoader/TwoIterators.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2026, 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
@@ -25,7 +25,7 @@
  * @test
  * @summary Test ServiceLoader with two iterators, interleaving their use
  *   to test that they don't interfere with each other
- * @run testng TwoIterators
+ * @run junit TwoIterators
  */
 
 import java.nio.file.Files;
@@ -35,9 +35,9 @@
 import java.util.Iterator;
 import java.util.ServiceLoader;
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 public class TwoIterators {
 
@@ -48,18 +48,17 @@ public static interface S { }
     public static class S1 implements S { }
     public static class S2 implements S { }
 
-    private ClassLoader testClassLoader;
+    private static ClassLoader testClassLoader;
 
     // creates the services configuration file and sets the ClassLoader
-    @BeforeClass
-    void setup() throws Exception {
+    @BeforeAll
+    static void setup() throws Exception {
         String classes = System.getProperty("test.classes");
         Path dir = Paths.get(classes, "META-INF", "services");
         Files.createDirectories(dir);
         Path config = dir.resolve(S.class.getName());
         Files.write(config, Arrays.asList(S1.class.getName(), S2.class.getName()));
-
-        this.testClassLoader = TwoIterators.class.getClassLoader();
+        testClassLoader = TwoIterators.class.getClassLoader();
     }
 
     @Test
diff --git a/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java b/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java
index 91aba564cd18..4a9bc8088512 100644
--- a/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java
+++ b/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2026, 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,7 @@
  * @build jdk.test.lib.process.*
  *        jdk.test.lib.util.JarUtils
  *        Basic Load FooService FooProvider1 FooProvider2 FooProvider3 BarProvider
- * @run testng ServiceLoaderBasicTest
+ * @run junit ServiceLoaderBasicTest
  */
 
 
@@ -44,14 +44,16 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.util.JarUtils;
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 
 import static java.nio.file.StandardOpenOption.CREATE;
 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
 import static java.util.Arrays.asList;
 
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.junit.jupiter.params.provider.ValueSource;
+
 public class ServiceLoaderBasicTest {
 
     private static final String METAINFO = "META-INF/services/FooService";
@@ -79,8 +81,8 @@ public class ServiceLoaderBasicTest {
     private static final String XTESTXMETA_CP = XTEST_CP + XMETA;
     private static final String XTESTXMETAP2_CP = XTESTXMETA_CP + P2;
 
-    @BeforeClass
-    public void initialize() throws Exception {
+    @BeforeAll
+    public static void initialize() throws Exception {
         createProviderConfig(XTEST_CONFIG, "FooProvider1");
         createProviderConfig(XMETA_CONFIG, "FooProvider42");
         createJar(P2JAR, "FooProvider2", List.of("FooProvider2"));
@@ -88,8 +90,7 @@ public void initialize() throws Exception {
         Files.copy(P2JAR, P2DUPJAR, REPLACE_EXISTING);
     }
 
-    @DataProvider
-    public Object[][] testCases() {
+    private static Object[][] testCases() {
         return new Object[][]{
             //       CLI options,            Test,       Runtime arguments
             // Success cases
@@ -110,23 +111,14 @@ public Object[][] testCases() {
         };
     }
 
-    @DataProvider
-    public Object[][] negativeTestCases() {
-        return new Object[][]{
-            {"blah blah"},
-            {"9234"},
-            {"X!"},
-            {"BarProvider"},
-            {"FooProvider42"}
-        };
-    }
-
-    @Test(dataProvider = "testCases")
+    @ParameterizedTest
+    @MethodSource("testCases")
     public void testProvider(List args) throws Throwable {
         runJava(args);
     }
 
-    @Test(dataProvider = "negativeTestCases")
+    @ParameterizedTest // negative test cases
+    @ValueSource(strings = { "blah blah", "9234", "X!", "BarProvider", "FooProvider42" })
     public void testBadProvider(String providerName) throws Throwable {
         Files.write(XMETA_CONFIG, providerName.getBytes());
         runJava(List.of("-cp", XMETA_CP, "Load", "fail"));
@@ -144,12 +136,12 @@ private void runJava(List opts) throws Throwable {
                     .shouldHaveExitValue(0);
     }
 
-    private void createProviderConfig(Path config, String providerName) throws Exception {
+    private static void createProviderConfig(Path config, String providerName) throws Exception {
         Files.createDirectories(config.getParent());
         Files.write(config, providerName.getBytes(), CREATE);
     }
 
-    private void createJar(Path jar, String provider, List files) throws Exception {
+    private static void createJar(Path jar, String provider, List files) throws Exception {
         Path xdir = Path.of(provider);
         createProviderConfig(xdir.resolve(METAINFO), provider);
 
diff --git a/test/jdk/java/util/StringJoiner/MergeTest.java b/test/jdk/java/util/StringJoiner/MergeTest.java
index f47ed3ee094a..574124b9bdde 100644
--- a/test/jdk/java/util/StringJoiner/MergeTest.java
+++ b/test/jdk/java/util/StringJoiner/MergeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2026, 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
@@ -27,17 +27,18 @@
  * @summary test  StringJoiner::merge
  * @modules java.base/jdk.internal.util
  * @requires vm.bits == "64" & os.maxMemory > 4G
- * @run testng/othervm -Xmx4g -XX:+CompactStrings MergeTest
+ * @run junit/othervm -Xmx4g -XX:+CompactStrings MergeTest
  */
 
 import java.util.StringJoiner;
 import java.util.stream.Stream;
-import org.testng.annotations.Test;
 import static jdk.internal.util.ArraysSupport.SOFT_MAX_ARRAY_LENGTH;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
 
-@Test
+import org.junit.jupiter.api.Assertions;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Test;
+
 public class MergeTest {
     private static final String[] PREFIXES = {"", "{", "@#$%"};
     private static final String[] SUFFIXES = {"", "}", "*&%$"};
@@ -69,12 +70,13 @@ private static Stream fixesStream() {
         return builder.build();
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test
     public void testNull() {
         StringJoiner sj = new StringJoiner(",", "{", "}");
-        sj.merge(null);
+        Assertions.assertThrows(NullPointerException.class, () -> sj.merge(null));
     }
 
+    @Test
     public void testSimple() {
         fixesStream().forEach(fixes -> {
             StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0);
@@ -83,10 +85,11 @@ public void testSimple() {
             Stream.of("d", "e", "f").forEachOrdered(other::add);
 
             sj.merge(other);
-            assertEquals(sj.toString(), fixes.pre0 + "a,b,c,d,e,f" + fixes.suf0);
+            assertEquals(fixes.pre0 + "a,b,c,d,e,f" + fixes.suf0, sj.toString());
         });
     }
 
+    @Test
     public void testEmptyOther() {
         fixesStream().forEach(fixes -> {
             StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0);
@@ -94,14 +97,15 @@ public void testEmptyOther() {
             Stream.of("a", "b", "c").forEachOrdered(sj::add);
 
             sj.merge(other);
-            assertEquals(sj.toString(), fixes.pre0 + "a,b,c" + fixes.suf0);
+            assertEquals(fixes.pre0 + "a,b,c" + fixes.suf0, sj.toString());
 
             other.setEmptyValue("EMPTY");
             sj.merge(other);
-            assertEquals(sj.toString(), fixes.pre0 + "a,b,c" + fixes.suf0);
+            assertEquals(fixes.pre0 + "a,b,c" + fixes.suf0, sj.toString());
         });
     }
 
+    @Test
     public void testEmptyThis() {
         fixesStream().forEach(fixes -> {
             StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0);
@@ -109,34 +113,36 @@ public void testEmptyThis() {
             Stream.of("d", "e", "f").forEachOrdered(other::add);
 
             sj.merge(other);
-            assertEquals(sj.toString(), fixes.pre0 + "d:e:f" + fixes.suf0);
+            assertEquals(fixes.pre0 + "d:e:f" + fixes.suf0, sj.toString());
 
             sj = new StringJoiner(",", fixes.pre0, fixes.suf0).setEmptyValue("EMPTY");
-            assertEquals(sj.toString(), "EMPTY");
+            assertEquals("EMPTY", sj.toString());
             sj.merge(other);
-            assertEquals(sj.toString(), fixes.pre0 + "d:e:f" + fixes.suf0);
+            assertEquals(fixes.pre0 + "d:e:f" + fixes.suf0, sj.toString());
         });
     }
 
+    @Test
     public void testEmptyBoth() {
         fixesStream().forEach(fixes -> {
             StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0);
             StringJoiner other = new StringJoiner(":", fixes.pre1, fixes.suf1);
 
             sj.merge(other);
-            assertEquals(sj.toString(), fixes.pre0 + fixes.suf0);
+            assertEquals(fixes.pre0 + fixes.suf0, sj.toString());
 
             other.setEmptyValue("NOTHING");
             sj.merge(other);
-            assertEquals(sj.toString(), fixes.pre0 + fixes.suf0);
+            assertEquals(fixes.pre0 + fixes.suf0, sj.toString());
 
             sj = new StringJoiner(",", fixes.pre0, fixes.suf0).setEmptyValue("EMPTY");
-            assertEquals(sj.toString(), "EMPTY");
+            assertEquals("EMPTY", sj.toString());
             sj.merge(other);
-            assertEquals(sj.toString(), "EMPTY");
+            assertEquals("EMPTY", sj.toString());
         });
     }
 
+    @Test
     public void testCascadeEmpty() {
         fixesStream().forEach(fixes -> {
             StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0);
@@ -144,13 +150,14 @@ public void testCascadeEmpty() {
             StringJoiner o2 = new StringJoiner(",", "<", ">").setEmptyValue("Empty2");
 
             o1.merge(o2);
-            assertEquals(o1.toString(), "Empty1");
+            assertEquals("Empty1", o1.toString());
 
             sj.merge(o1);
-            assertEquals(sj.toString(), fixes.pre0 + fixes.suf0);
+            assertEquals(fixes.pre0 + fixes.suf0, sj.toString());
         });
     }
 
+    @Test
     public void testDelimiter() {
         fixesStream().forEach(fixes -> {
             StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0);
@@ -159,18 +166,20 @@ public void testDelimiter() {
             Stream.of("d", "e", "f").forEachOrdered(other::add);
 
             sj.merge(other);
-            assertEquals(sj.toString(), fixes.pre0 + "a,b,c,d:e:f" + fixes.suf0);
+            assertEquals(fixes.pre0 + "a,b,c,d:e:f" + fixes.suf0, sj.toString());
         });
     }
 
+    @Test
     public void testMergeSelf() {
         fixesStream().forEach(fixes -> {
             final StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0).add("a").add("b");
-            assertEquals(sj.merge(sj).toString(), fixes.pre0 + "a,b,a,b" + fixes.suf0);
-            assertEquals(sj.merge(sj).toString(), fixes.pre0 + "a,b,a,b,a,b,a,b" + fixes.suf0);
+            assertEquals(fixes.pre0 + "a,b,a,b" + fixes.suf0, sj.merge(sj).toString());
+            assertEquals(fixes.pre0 + "a,b,a,b,a,b,a,b" + fixes.suf0, sj.merge(sj).toString());
         });
     }
 
+    @Test
     public void OOM() {
         String maxString = "*".repeat(SOFT_MAX_ARRAY_LENGTH);
 
diff --git a/test/jdk/java/util/StringJoiner/StringJoinerOomUtf16Test.java b/test/jdk/java/util/StringJoiner/StringJoinerOomUtf16Test.java
index b45e66b4d8bd..7fde8b36ffa1 100644
--- a/test/jdk/java/util/StringJoiner/StringJoinerOomUtf16Test.java
+++ b/test/jdk/java/util/StringJoiner/StringJoinerOomUtf16Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, 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
@@ -26,18 +26,23 @@
  * @summary tests StringJoiner OOME when joining sub-max-length Strings
  * @modules java.base/jdk.internal.util
  * @requires vm.bits == "64" & os.maxMemory > 4G
- * @run testng/othervm -Xmx4g -XX:+CompactStrings StringJoinerOomUtf16Test
+ * @run junit/othervm -Xmx4g -XX:+CompactStrings StringJoinerOomUtf16Test
  */
 
-import org.testng.annotations.Test;
 
 import static jdk.internal.util.ArraysSupport.SOFT_MAX_ARRAY_LENGTH;
-import static org.testng.Assert.fail;
+
+import static org.junit.jupiter.api.Assertions.fail;
 
 import java.util.StringJoiner;
 
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
 
-@Test(groups = {"unit","string","util","libs"})
+@Tag("unit")
+@Tag("string")
+@Tag("util")
+@Tag("libs")
 public class StringJoinerOomUtf16Test {
 
     // the sum of lengths of the following two strings is way less than
@@ -48,6 +53,7 @@ public class StringJoinerOomUtf16Test {
     private static final String OVERFLOW_UTF16_STRING =
         "\u017D".repeat(((Integer.MAX_VALUE - SOFT_MAX_ARRAY_LENGTH) >> 1) + 1);
 
+    @Test
     public void OOM1() {
         try {
             new StringJoiner("")
@@ -60,6 +66,7 @@ public void OOM1() {
         }
     }
 
+    @Test
     public void OOM2() {
         try {
             new StringJoiner(HALF_MAX_LATIN1_STRING)
@@ -72,6 +79,7 @@ public void OOM2() {
         }
     }
 
+    @Test
     public void OOM3() {
         try {
             new StringJoiner(OVERFLOW_UTF16_STRING)
@@ -84,6 +92,7 @@ public void OOM3() {
         }
     }
 
+    @Test
     public void OOM4() {
         try {
             new StringJoiner("", HALF_MAX_LATIN1_STRING, OVERFLOW_UTF16_STRING)
diff --git a/test/jdk/java/util/StringJoiner/StringJoinerTest.java b/test/jdk/java/util/StringJoiner/StringJoinerTest.java
index 25948fb8e55d..aa25623dbc39 100644
--- a/test/jdk/java/util/StringJoiner/StringJoinerTest.java
+++ b/test/jdk/java/util/StringJoiner/StringJoinerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2026, 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
@@ -26,18 +26,25 @@
  * @summary tests StringJoinerTest
  * @modules java.base/jdk.internal.util
  * @requires vm.bits == "64" & os.maxMemory > 4G
- * @run testng/othervm -Xmx4g -XX:+CompactStrings StringJoinerTest
+ * @run junit/othervm -Xmx4g -XX:+CompactStrings StringJoinerTest
  * @author Jim Gish
  */
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+
 import java.util.ArrayList;
 import java.util.StringJoiner;
-import org.testng.annotations.Test;
-import static jdk.internal.util.ArraysSupport.SOFT_MAX_ARRAY_LENGTH;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
 
+import static jdk.internal.util.ArraysSupport.SOFT_MAX_ARRAY_LENGTH;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
 
-@Test(groups = {"unit","string","util","libs"})
+@Tag("unit")
+@Tag("string")
+@Tag("util")
+@Tag("libs")
 public class StringJoinerTest {
 
     private static final String EMPTY = "EMPTY";
@@ -51,6 +58,7 @@ public class StringJoinerTest {
     private static final String DASH = "-";
     private static final String MAX_STRING = "*".repeat(SOFT_MAX_ARRAY_LENGTH);
 
+    @Test
     public void addAddAll() {
         StringJoiner sj = new StringJoiner(DASH, "{", "}");
         sj.add(ONE);
@@ -61,7 +69,7 @@ public void addAddAll() {
         nextOne.stream().forEachOrdered(sj::add);
 
         String expected = "{"+ONE+DASH+TWO+DASH+THREE+"}";
-        assertEquals(sj.toString(), expected);
+        assertEquals(expected, sj.toString());
     }
 
     void addAlladd() {
@@ -75,10 +83,11 @@ void addAlladd() {
         sj.add(THREE);
 
         String expected = "{"+ONE+DASH+TWO+DASH+THREE+"}";
-        assertEquals(sj.toString(), expected);
+        assertEquals(expected, sj.toString());
     }
 
     // The following tests do two successive adds of different types
+    @Test
     public void addAlladdAll() {
         StringJoiner sj = new StringJoiner(DASH, "{", "}");
         ArrayList firstOne = new ArrayList<>();
@@ -93,9 +102,10 @@ public void addAlladdAll() {
         nextOne.stream().forEachOrdered(sj::add);
 
         String expected = "{"+ONE+DASH+TWO+DASH+THREE+DASH+FOUR+DASH+FIVE+"}";
-        assertEquals(sj.toString(), expected);
+        assertEquals(expected, sj.toString());
     }
 
+    @Test
     public void addCharSequence() {
         StringJoiner sj = new StringJoiner(",");
         CharSequence cs_one = ONE;
@@ -104,13 +114,13 @@ public void addCharSequence() {
         sj.add(cs_one);
         sj.add(cs_two);
 
-        assertEquals(sj.toString(), ONE + "," + TWO);
+        assertEquals(ONE + "," + TWO, sj.toString());
 
         sj = new StringJoiner(DASH, "{", "}");
         sj.add(cs_one);
         sj.add(cs_two);
 
-        assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
+        assertEquals("{" + ONE + DASH + TWO + "}", sj.toString());
 
         StringBuilder builder = new StringBuilder(ONE);
         StringBuffer buffer = new StringBuffer(THREE);
@@ -118,13 +128,14 @@ public void addCharSequence() {
         sj.add(builder).add(buffer);
         builder.append(TWO);
         buffer.append(FOUR);
-        assertEquals(sj.toString(), "{ " + ONE + ", " + THREE + " }",
+        assertEquals("{ " + ONE + ", " + THREE + " }", sj.toString(),
                 "CharSequence is copied when add");
         sj.add(builder);
-        assertEquals(sj.toString(), "{ " + ONE + ", " + THREE + ", " + ONE +
-                TWO + " }");
+        assertEquals("{ " + ONE + ", " + THREE + ", " + ONE +
+                TWO + " }", sj.toString());
     }
 
+    @Test
     public void addCharSequenceWithEmptyValue() {
         StringJoiner sj = new StringJoiner(",").setEmptyValue(EMPTY);
         CharSequence cs_one = ONE;
@@ -133,189 +144,200 @@ public void addCharSequenceWithEmptyValue() {
         sj.add(cs_one);
         sj.add(cs_two);
 
-        assertEquals(sj.toString(), ONE + "," + TWO);
+        assertEquals(ONE + "," + TWO, sj.toString());
 
         sj = new StringJoiner(DASH, "{", "}");
         sj.add(cs_one);
         sj.add(cs_two);
-        assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
+        assertEquals("{" + ONE + DASH + TWO + "}", sj.toString());
 
         sj = new StringJoiner(DASH, "{", "}");
-        assertEquals(sj.toString(), "{}");
+        assertEquals("{}", sj.toString());
 
         sj = new StringJoiner("=", "{", "}").setEmptyValue("");
-        assertEquals(sj.toString(), "");
+        assertEquals("", sj.toString());
 
         sj = new StringJoiner(DASH, "{", "}").setEmptyValue(EMPTY);
-        assertEquals(sj.toString(), EMPTY);
+        assertEquals(EMPTY, sj.toString());
 
         sj.add(cs_one);
         sj.add(cs_two);
-        assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
+        assertEquals("{" + ONE + DASH + TWO + "}", sj.toString());
     }
 
+    @Test
     public void addString() {
         StringJoiner sj = new StringJoiner(DASH);
         sj.add(ONE);
-        assertEquals(sj.toString(), ONE);
+        assertEquals(ONE, sj.toString());
 
         sj = new StringJoiner(DASH, "{", "}");
         sj.add(ONE);
-        assertEquals(sj.toString(), "{" + ONE + "}");
+        assertEquals("{" + ONE + "}", sj.toString());
 
         sj.add(TWO);
-        assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
+        assertEquals("{" + ONE + DASH + TWO + "}", sj.toString());
     }
 
+    @Test
     public void lengthWithCustomEmptyValue() {
         StringJoiner sj = new StringJoiner(DASH, "<", ">").setEmptyValue(EMPTY);
-        assertEquals(sj.length(), EMPTY.length());
+        assertEquals(EMPTY.length(), sj.length());
         sj.add("");
-        assertEquals(sj.length(), "<>".length());
+        assertEquals("<>".length(), sj.length());
         sj.add("");
-        assertEquals(sj.length(), "<->".length());
+        assertEquals("<->".length(), sj.length());
         sj.add(ONE);
-        assertEquals(sj.length(), 4 + ONE_LEN);
-        assertEquals(sj.toString().length(), sj.length());
+        assertEquals(4 + ONE_LEN, sj.length());
+        assertEquals(sj.length(), sj.toString().length());
         sj.add(TWO);
-        assertEquals(sj.length(), 5 + ONE_LEN + TWO_LEN);
-        assertEquals(sj.toString().length(), sj.length());
+        assertEquals(5 + ONE_LEN + TWO_LEN, sj.length());
+        assertEquals(sj.length(), sj.toString().length());
         sj = new StringJoiner("||", "<", "-->");
-        assertEquals(sj.length(), 4);
-        assertEquals(sj.toString().length(), sj.length());
+        assertEquals(4, sj.length());
+        assertEquals(sj.length(), sj.toString().length());
         sj.add("abcdef");
-        assertEquals(sj.length(), 10);
-        assertEquals(sj.toString().length(), sj.length());
+        assertEquals(10, sj.length());
+        assertEquals(sj.length(), sj.toString().length());
         sj.add("xyz");
-        assertEquals(sj.length(), 15);
-        assertEquals(sj.toString().length(), sj.length());
+        assertEquals(15, sj.length());
+        assertEquals(sj.length(), sj.toString().length());
     }
 
+    @Test
     public void noAddAndEmptyValue() {
         StringJoiner sj = new StringJoiner(DASH, "", "").setEmptyValue(EMPTY);
-        assertEquals(sj.toString(), EMPTY);
+        assertEquals(EMPTY, sj.toString());
 
         sj = new StringJoiner(DASH, "<..", "");
-        assertEquals(sj.toString(), "<..");
+        assertEquals("<..", sj.toString());
 
         sj = new StringJoiner(DASH, "<..", "");
-        assertEquals(sj.toString(), "<..");
+        assertEquals("<..", sj.toString());
 
         sj = new StringJoiner(DASH, "", "==>");
-        assertEquals(sj.toString(), "==>");
+        assertEquals("==>", sj.toString());
 
         sj = new StringJoiner(DASH, "{", "}");
-        assertEquals(sj.toString(), "{}");
+        assertEquals("{}", sj.toString());
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test
     public void setEmptyValueNull() {
-        new StringJoiner(DASH, "{", "}").setEmptyValue(null);
+        Assertions.assertThrows(NullPointerException.class,
+                () -> new StringJoiner(DASH, "{", "}").setEmptyValue(null));
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test
     public void setDelimiterNull() {
-        new StringJoiner(null);
+        Assertions.assertThrows(NullPointerException.class,
+                () -> new StringJoiner(null));
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test
     public void setPrefixNull() {
-        new StringJoiner(DASH, null, "}");
+        Assertions.assertThrows(NullPointerException.class,
+                () -> new StringJoiner(DASH, null, "}"));
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test
     public void setSuffixNull() {
-        new StringJoiner(DASH, "{", null);
+        Assertions.assertThrows(NullPointerException.class,
+                () -> new StringJoiner(DASH, "{", null));
     }
 
+    @Test
     public void stringFromtoString() {
         StringJoiner sj = new StringJoiner(", ");
-        assertEquals(sj.toString(), "");
+        assertEquals("", sj.toString());
         sj = new StringJoiner(",", "{", "}");
-        assertEquals(sj.toString(), "{}");
+        assertEquals("{}", sj.toString());
 
         sj = new StringJoiner(",");
         sj.add(ONE);
-        assertEquals(sj.toString(), ONE);
+        assertEquals(ONE, sj.toString());
 
         sj.add(TWO);
-        assertEquals(sj.toString(), ONE + "," + TWO);
+        assertEquals(ONE + "," + TWO, sj.toString());
 
         sj = new StringJoiner(",", "{--", "--}");
         sj.add(ONE);
         sj.add(TWO);
-        assertEquals(sj.toString(), "{--" + ONE + "," + TWO + "--}");
+        assertEquals("{--" + ONE + "," + TWO + "--}", sj.toString());
 
     }
 
+    @Test
     public void stringFromtoStringWithEmptyValue() {
         StringJoiner sj = new StringJoiner(" ", "", "");
-        assertEquals(sj.toString(), "");
+        assertEquals("", sj.toString());
         sj = new StringJoiner(", ");
-        assertEquals(sj.toString(), "");
+        assertEquals("", sj.toString());
         sj = new StringJoiner(",", "{", "}");
-        assertEquals(sj.toString(), "{}");
+        assertEquals("{}", sj.toString());
 
         sj = new StringJoiner(",", "{", "}").setEmptyValue("");
-        assertEquals(sj.toString(), "");
+        assertEquals("", sj.toString());
 
         sj = new StringJoiner(",");
         sj.add(ONE);
-        assertEquals(sj.toString(), ONE);
+        assertEquals(ONE, sj.toString());
 
         sj.add(TWO);
-        assertEquals(sj.toString(), ONE + "," + TWO);
+        assertEquals(ONE + "," + TWO, sj.toString());
 
         sj = new StringJoiner(",", "{--", "--}");
         sj.add(ONE);
-        assertEquals(sj.toString(), "{--" + ONE + "--}" );
+        assertEquals("{--" + ONE + "--}", sj.toString() );
 
         sj.add(TWO);
-        assertEquals(sj.toString(), "{--" + ONE + "," + TWO + "--}");
+        assertEquals("{--" + ONE + "," + TWO + "--}", sj.toString());
 
     }
 
+    @Test
     public void toStringWithCustomEmptyValue() {
         StringJoiner sj = new StringJoiner(DASH, "<", ">").setEmptyValue(EMPTY);
-        assertEquals(sj.toString(), EMPTY);
+        assertEquals(EMPTY, sj.toString());
         sj.add("");
-        assertEquals(sj.toString(), "<>");
+        assertEquals("<>", sj.toString());
         sj.add("");
-        assertEquals(sj.toString(), "<->");
+        assertEquals("<->", sj.toString());
     }
 
     private void testCombos(String infix, String prefix, String suffix) {
         StringJoiner sj = new StringJoiner(infix, prefix, suffix);
-        assertEquals(sj.toString(), prefix + suffix);
-        assertEquals(sj.toString().length(), sj.length());
+        assertEquals(prefix + suffix, sj.toString());
+        assertEquals(sj.length(), sj.toString().length());
         // EmptyValue
         sj = new StringJoiner(infix, prefix, suffix).setEmptyValue("");
-        assertEquals(sj.toString(), "");
-        assertEquals(sj.toString().length(), sj.length());
+        assertEquals("", sj.toString());
+        assertEquals(sj.length(), sj.toString().length());
 
         // empty in front
         sj.add("");
-        assertEquals(sj.toString(), prefix + suffix);
+        assertEquals(prefix + suffix, sj.toString());
         // empty in middle
         sj.add("");
-        assertEquals(sj.toString(), prefix + infix + suffix);
+        assertEquals(prefix + infix + suffix, sj.toString());
         sj.add("1");
-        assertEquals(sj.toString(), prefix + infix + infix + "1" + suffix);
+        assertEquals(prefix + infix + infix + "1" + suffix, sj.toString());
         // empty at end
         sj.add("");
-        assertEquals(sj.toString(), prefix + infix + infix + "1" + infix + suffix);
+        assertEquals(prefix + infix + infix + "1" + infix + suffix, sj.toString());
 
         sj = new StringJoiner(infix, prefix, suffix).setEmptyValue("");
         sj.add("1");
-        assertEquals(sj.toString(), prefix + "1" + suffix);
+        assertEquals(prefix + "1" + suffix, sj.toString());
         sj.add("2");
-        assertEquals(sj.toString(), prefix + "1" + infix + "2" + suffix);
+        assertEquals(prefix + "1" + infix + "2" + suffix, sj.toString());
         sj.add("");
-        assertEquals(sj.toString(), prefix + "1" + infix + "2" + infix + suffix);
+        assertEquals(prefix + "1" + infix + "2" + infix + suffix, sj.toString());
         sj.add("3");
-        assertEquals(sj.toString(), prefix + "1" + infix + "2" + infix + infix + "3" + suffix);
+        assertEquals(prefix + "1" + infix + "2" + infix + infix + "3" + suffix, sj.toString());
     }
 
+    @Test
     public void testDelimiterCombinations() {
         testCombos("", "", "");
         testCombos("", "<", "");
@@ -327,6 +349,7 @@ public void testDelimiterCombinations() {
         testCombos(",", "<", ">");
     }
 
+    @Test
     public void OOM1() {
         try {
             new StringJoiner(MAX_STRING, MAX_STRING, MAX_STRING).toString();
@@ -336,6 +359,7 @@ public void OOM1() {
         }
     }
 
+    @Test
     public void OOM2() {
         try {
             new StringJoiner(MAX_STRING, MAX_STRING, "").toString();
@@ -345,6 +369,7 @@ public void OOM2() {
         }
     }
 
+    @Test
     public void OOM3() {
         try {
             new StringJoiner(MAX_STRING, "", MAX_STRING).toString();
@@ -354,6 +379,7 @@ public void OOM3() {
         }
     }
 
+    @Test
     public void OOM4() {
         try {
             new StringJoiner("", MAX_STRING, MAX_STRING).toString();
diff --git a/test/jdk/java/util/Vector/ArrayManagement.java b/test/jdk/java/util/Vector/ArrayManagement.java
index ce4e695487c8..c1fa6d1c9bcb 100644
--- a/test/jdk/java/util/Vector/ArrayManagement.java
+++ b/test/jdk/java/util/Vector/ArrayManagement.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2016 Google, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -25,7 +26,7 @@
  * @test
  * @bug 8148174
  * @summary brittle white box test of internal array management
- * @run testng ArrayManagement
+ * @run junit ArrayManagement
  */
 
 import java.lang.reflect.Field;
@@ -35,8 +36,8 @@
 import java.util.List;
 import java.util.SplittableRandom;
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 public class ArrayManagement {
 
@@ -61,9 +62,9 @@ public void ensureCapacity(int minCapacity) {
             super.ensureCapacity(minCapacity);
             assertTrue(capacity() >= minCapacity);
             if (minCapacity <= oldCapacity)
-                assertEquals(capacity(), oldCapacity);
+                assertEquals(oldCapacity, capacity());
             if (minCapacity > 0)
-                assertEquals(modCount(), oldModCount + 1);
+                assertEquals(oldModCount + 1, modCount());
         }
     }
 
@@ -89,117 +90,117 @@ static void addOneElement(PublicVector list) {
         case 3: assertTrue(list.addAll(size, singletonList())); break;
         default: throw new AssertionError();
         }
-        assertEquals(list.modCount(), modCount + 1);
-        assertEquals(list.size(), size + 1);
+        assertEquals(modCount + 1, list.modCount());
+        assertEquals(size + 1, list.size());
     }
 
     @Test public void defaultCapacity() {
         PublicVector list = new PublicVector<>();
-        assertEquals(new PublicVector().capacity(), DEFAULT_CAPACITY);
+        assertEquals(DEFAULT_CAPACITY, new PublicVector().capacity());
         for (int i = 0; i < DEFAULT_CAPACITY; i++) {
             addOneElement(list);
-            assertEquals(list.capacity(), DEFAULT_CAPACITY);
+            assertEquals(DEFAULT_CAPACITY, list.capacity());
         }
         addOneElement(list);
-        assertEquals(list.capacity(), newCapacity(DEFAULT_CAPACITY));
+        assertEquals(newCapacity(DEFAULT_CAPACITY), list.capacity());
     }
 
     @Test public void defaultCapacityEnsureCapacity() {
         PublicVector list = new PublicVector<>();
         for (int i = 0; i <= DEFAULT_CAPACITY; i++) {
             list.ensureCapacity(i);     // no-op!
-            assertEquals(list.capacity(), DEFAULT_CAPACITY);
+            assertEquals(DEFAULT_CAPACITY, list.capacity());
         }
         for (int i = 0; i < DEFAULT_CAPACITY; i++) {
             addOneElement(list);
-            assertEquals(list.capacity(), DEFAULT_CAPACITY);
+            assertEquals(DEFAULT_CAPACITY, list.capacity());
         }
         addOneElement(list);
-        assertEquals(list.capacity(), newCapacity(DEFAULT_CAPACITY));
+        assertEquals(newCapacity(DEFAULT_CAPACITY), list.capacity());
         {
             int capacity = list.capacity();
             list.ensureCapacity(capacity + 1);
-            assertEquals(list.capacity(), newCapacity(capacity));
+            assertEquals(newCapacity(capacity), list.capacity());
         }
         {
             int capacity = list.capacity();
             list.ensureCapacity(3 * capacity);
-            assertEquals(list.capacity(), 3 * capacity);
+            assertEquals(3 * capacity, list.capacity());
         }
     }
 
     @Test public void ensureCapacityBeyondDefaultCapacity() {
         PublicVector list = new PublicVector<>();
         list.ensureCapacity(DEFAULT_CAPACITY + 1);
-        assertEquals(list.capacity(), newCapacity(DEFAULT_CAPACITY));
+        assertEquals(newCapacity(DEFAULT_CAPACITY), list.capacity());
     }
 
     @Test public void explicitZeroCapacity() {
         PublicVector list = new PublicVector<>(0);
-        assertEquals(list.capacity(), 0);
+        assertEquals(0, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 1);
+        assertEquals(1, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 2);
+        assertEquals(2, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 4);
+        assertEquals(4, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 4);
+        assertEquals(4, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 8);
+        assertEquals(8, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 8);
+        assertEquals(8, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 8);
+        assertEquals(8, list.capacity());
         list.clear();
-        assertEquals(list.capacity(), 8);
+        assertEquals(8, list.capacity());
     }
 
     @Test public void explicitZeroCapacityWithCapacityIncrement() {
         PublicVector list = new PublicVector<>(0, 2);
-        assertEquals(list.capacity(), 0);
+        assertEquals(0, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 2);
+        assertEquals(2, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 2);
+        assertEquals(2, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 4);
+        assertEquals(4, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 4);
+        assertEquals(4, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 6);
+        assertEquals(6, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 6);
+        assertEquals(6, list.capacity());
         addOneElement(list);
-        assertEquals(list.capacity(), 8);
+        assertEquals(8, list.capacity());
         list.clear();
-        assertEquals(list.capacity(), 8);
+        assertEquals(8, list.capacity());
     }
 
     @Test public void explicitLargeCapacity() {
         int n = DEFAULT_CAPACITY * 3;
         PublicVector list = new PublicVector<>(n);
-        assertEquals(list.capacity(), n);
+        assertEquals(n, list.capacity());
         list.ensureCapacity(0);
         list.ensureCapacity(n);
         for (int i = 0; i < n; i++) addOneElement(list);
-        assertEquals(list.capacity(), n);
+        assertEquals(n, list.capacity());
 
         addOneElement(list);
-        assertEquals(list.capacity(), newCapacity(n));
+        assertEquals(newCapacity(n), list.capacity());
     }
 
     @Test public void explicitLargeCapacityWithCapacityIncrement() {
         int n = DEFAULT_CAPACITY * 3;
         PublicVector list = new PublicVector<>(n, 2);
-        assertEquals(list.capacity(), n);
+        assertEquals(n, list.capacity());
         list.ensureCapacity(0);
         list.ensureCapacity(n);
         for (int i = 0; i < n; i++) addOneElement(list);
-        assertEquals(list.capacity(), n);
+        assertEquals(n, list.capacity());
 
         addOneElement(list);
-        assertEquals(list.capacity(), n + 2);
+        assertEquals(n + 2, list.capacity());
     }
 
     @Test public void emptyArraysAreNotShared() {

From 9e954c8592115973c2f79f6b603fc369d309e887 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:16:56 +0000
Subject: [PATCH 102/223] 8360160: ubuntu-22-04 machine is failing client tests

Backport-of: 317788ff12ee231bd3c9e8f1a0c9b38c8dad3feb
---
 test/jdk/java/awt/Frame/FrameVisualTest.java | 73 +++++++++++---------
 1 file changed, 41 insertions(+), 32 deletions(-)

diff --git a/test/jdk/java/awt/Frame/FrameVisualTest.java b/test/jdk/java/awt/Frame/FrameVisualTest.java
index 767eb0a18965..39853822c446 100644
--- a/test/jdk/java/awt/Frame/FrameVisualTest.java
+++ b/test/jdk/java/awt/Frame/FrameVisualTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2025, 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
@@ -46,62 +46,71 @@
 public class FrameVisualTest {
     private static GraphicsConfiguration[] gcs;
     private static volatile Frame[] frames;
-    private static volatile int index;
 
-    private static Frame f;
     private static Robot robot;
+    private static volatile int frameNum;
     private static volatile Point p;
     private static volatile Dimension d;
     private static final int TOLERANCE = 5;
+    private static final int MAX_FRAME_COUNT = 30;
 
     public static void main(String[] args) throws Exception {
-        gcs = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getConfigurations();
+        gcs = GraphicsEnvironment.getLocalGraphicsEnvironment()
+                .getDefaultScreenDevice().getConfigurations();
         robot = new Robot();
         robot.setAutoDelay(100);
-        try {
-            EventQueue.invokeAndWait(() -> {
-                createAndShowUI();
-            });
-            robot.delay(1000);
-            System.out.println("frames.length: "+frames.length);
-            for (index = 0; index < frames.length; index++) {
+
+        // Limit the number of frames tested if needed
+        if (gcs.length > MAX_FRAME_COUNT) {
+            frames = new Frame[MAX_FRAME_COUNT];
+        } else {
+            frames = new Frame[gcs.length];
+        }
+        System.out.println(gcs.length + " gcs found. Testing "
+                + frames.length + " frame(s).");
+
+        for (frameNum = 0; frameNum < frames.length; frameNum++) {
+            try {
+                EventQueue.invokeAndWait(() -> {
+                    frames[frameNum] = new Frame("Frame w/ gc "
+                            + frameNum, gcs[frameNum]);
+                    frames[frameNum].setSize(100, 100);
+                    frames[frameNum].setUndecorated(true);
+                    frames[frameNum].setBackground(Color.WHITE);
+                    frames[frameNum].setVisible(true);
+                    System.out.println("Frame " + frameNum + " created");
+                });
+
+                robot.delay(1000);
+
                 EventQueue.invokeAndWait(() -> {
-                    p = frames[index].getLocation();
-                    d = frames[index].getSize();
+                    p = frames[frameNum].getLocation();
+                    d = frames[frameNum].getSize();
                 });
+
                 Rectangle rect = new Rectangle(p, d);
                 BufferedImage img = robot.createScreenCapture(rect);
                 if (chkImgBackgroundColor(img)) {
                     try {
-                        ImageIO.write(img, "png", new File("Frame_" + index + ".png"));
+                        ImageIO.write(img, "png",
+                                new File("Frame_"
+                                        + frameNum + ".png"));
                     } catch (IOException ignored) {}
-                    throw new RuntimeException("Frame visual test failed with non-white background color");
+                    throw new RuntimeException("Frame visual test " +
+                            "failed with non-white background color");
                 }
-            }
-        } finally {
-            for (index = 0; index < frames.length; index++) {
+            } finally {
                 EventQueue.invokeAndWait(() -> {
-                    if (frames[index] != null) {
-                        frames[index].dispose();
+                    if (frames[frameNum] != null) {
+                        frames[frameNum].dispose();
+                        System.out.println("Frame " + frameNum + " disposed");
                     }
                 });
             }
         }
     }
 
-    private static void createAndShowUI() {
-        frames = new Frame[gcs.length];
-        for (int i = 0; i < frames.length; i++) {
-            frames[i] = new Frame("Frame w/ gc " + i, gcs[i]);
-            frames[i].setSize(100, 100);
-            frames[i].setUndecorated(true);
-            frames[i].setBackground(Color.WHITE);
-            frames[i].setVisible(true);
-        }
-    }
-
     private static boolean chkImgBackgroundColor(BufferedImage img) {
-
         // scan for mid-line and if it is non-white color then return true.
         for (int x = 1; x < img.getWidth() - 1; ++x) {
             Color c = new Color(img.getRGB(x, img.getHeight() / 2));

From 0d05000b629d8cbb4995765c87cce948e117be9d Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:17:31 +0000
Subject: [PATCH 103/223] 8373796: Refactor
 java/net/httpclient/ThrowingPublishers*.java tests to use JUnit5

Backport-of: ca9bd2851854a1dc73b51b86bae837fb563f9042
---
 .../AbstractThrowingPublishers.java           | 177 ++++++++----------
 .../ThrowingPublishersCustomAfterCancel.java  |  10 +-
 .../ThrowingPublishersCustomBeforeCancel.java |  10 +-
 .../ThrowingPublishersIOAfterCancel.java      |  10 +-
 .../ThrowingPublishersIOBeforeCancel.java     |  10 +-
 .../ThrowingPublishersInNextRequest.java      |  10 +-
 .../ThrowingPublishersInRequest.java          |  10 +-
 .../ThrowingPublishersInSubscribe.java        |  10 +-
 .../httpclient/ThrowingPublishersSanity.java  |  10 +-
 9 files changed, 125 insertions(+), 132 deletions(-)

diff --git a/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java b/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java
index 4079bd81e3e1..265c661b81b6 100644
--- a/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java
+++ b/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java
@@ -25,15 +25,6 @@
 import com.sun.net.httpserver.HttpsConfigurator;
 import com.sun.net.httpserver.HttpsServer;
 import jdk.test.lib.net.SimpleSSLContext;
-import org.testng.ITestContext;
-import org.testng.ITestResult;
-import org.testng.SkipException;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 
 import javax.net.ssl.SSLContext;
 import java.io.IOException;
@@ -52,7 +43,6 @@
 import java.net.http.HttpResponse.BodyHandlers;
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Set;
@@ -80,24 +70,31 @@
 import static java.net.http.HttpClient.Version.HTTP_1_1;
 import static java.net.http.HttpClient.Version.HTTP_2;
 import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+import org.junit.jupiter.api.AfterAll;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.extension.TestWatcher;
 
 public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
 
-    SSLContext sslContext;
-    HttpTestServer httpTestServer;    // HTTP/1.1    [ 4 servers ]
-    HttpTestServer httpsTestServer;   // HTTPS/1.1
-    HttpTestServer http2TestServer;   // HTTP/2 ( h2c )
-    HttpTestServer https2TestServer;  // HTTP/2 ( h2  )
-    String httpURI_fixed;
-    String httpURI_chunk;
-    String httpsURI_fixed;
-    String httpsURI_chunk;
-    String http2URI_fixed;
-    String http2URI_chunk;
-    String https2URI_fixed;
-    String https2URI_chunk;
+    static SSLContext sslContext;
+    static HttpTestServer httpTestServer;    // HTTP/1.1    [ 4 servers ]
+    static HttpTestServer httpsTestServer;   // HTTPS/1.1
+    static HttpTestServer http2TestServer;   // HTTP/2 ( h2c )
+    static HttpTestServer https2TestServer;  // HTTP/2 ( h2  )
+    static String httpURI_fixed;
+    static String httpURI_chunk;
+    static String httpsURI_fixed;
+    static String httpsURI_chunk;
+    static String http2URI_fixed;
+    static String http2URI_chunk;
+    static String https2URI_fixed;
+    static String https2URI_chunk;
 
     static final int ITERATION_COUNT = 1;
     // a shared executor helps reduce the amount of threads created by the test
@@ -115,8 +112,34 @@ public static String now() {
         return String.format("[%d s, %d ms, %d ns] ", secs, mill, nan);
     }
 
-    final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE;
-    private volatile HttpClient sharedClient;
+    final static class TestStopper implements TestWatcher, BeforeEachCallback {
+        final AtomicReference failed = new AtomicReference<>();
+        TestStopper() { }
+        @Override
+        public void testFailed(ExtensionContext context, Throwable cause) {
+            if (stopAfterFirstFailure()) {
+                String msg = "Aborting due to: " + cause;
+                failed.compareAndSet(null, msg);
+                FAILURES.putIfAbsent(context.getDisplayName(), cause);
+                System.out.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n",
+                        now(), context.getDisplayName(), cause);
+                System.err.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n",
+                        now(), context.getDisplayName(), cause);
+            }
+        }
+
+        @Override
+        public void beforeEach(ExtensionContext context) {
+            String msg = failed.get();
+            Assumptions.assumeTrue(msg == null, msg);
+        }
+    }
+
+    @RegisterExtension
+    static final TestStopper stopper = new TestStopper();
+
+    static final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE;
+    private static volatile HttpClient sharedClient;
 
     static class TestExecutor implements Executor {
         final AtomicLong tasks = new AtomicLong();
@@ -142,34 +165,12 @@ public void execute(Runnable command) {
         }
     }
 
-    protected boolean stopAfterFirstFailure() {
+    protected static boolean stopAfterFirstFailure() {
         return Boolean.getBoolean("jdk.internal.httpclient.debug");
     }
 
-    final AtomicReference skiptests = new AtomicReference<>();
-    void checkSkip() {
-        var skip = skiptests.get();
-        if (skip != null) throw skip;
-    }
-    static String name(ITestResult result) {
-        var params = result.getParameters();
-        return result.getName()
-                + (params == null ? "()" : Arrays.toString(result.getParameters()));
-    }
-
-    @BeforeMethod
-    void beforeMethod(ITestContext context) {
-        if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
-            if (skiptests.get() == null) {
-                SkipException skip = new SkipException("some tests failed");
-                skip.setStackTrace(new StackTraceElement[0]);
-                skiptests.compareAndSet(null, skip);
-            }
-        }
-    }
-
-    @AfterClass
-    static final void printFailedTests(ITestContext context) {
+    @AfterAll
+    static final void printFailedTests() {
         out.println("\n=========================");
         try {
             // Exceptions should already have been added to FAILURES
@@ -193,7 +194,7 @@ static final void printFailedTests(ITestContext context) {
         }
     }
 
-    private String[] uris() {
+    private static String[] uris() {
         return new String[] {
                 httpURI_fixed,
                 httpURI_chunk,
@@ -206,8 +207,7 @@ private String[] uris() {
         };
     }
 
-    @DataProvider(name = "sanity")
-    public Object[][] sanity() {
+    public static Object[][] sanity() {
         String[] uris = uris();
         Object[][] result = new Object[uris.length * 2][];
         //Object[][] result = new Object[uris.length][];
@@ -238,7 +238,7 @@ public void accept(Where where) {
         }
     }
 
-    private Object[][] variants(List throwers, Set whereValues) {
+    private static Object[][] variants(List throwers, Set whereValues) {
         String[] uris = uris();
         Object[][] result = new Object[uris.length * 2 * throwers.size()][];
         //Object[][] result = new Object[(uris.length/2) * 2 * 2][];
@@ -257,80 +257,52 @@ private Object[][] variants(List throwers, Set whereValues) {
         return result;
     }
 
-    @DataProvider(name = "subscribeProvider")
-    public Object[][] subscribeProvider(ITestContext context) {
-        if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
-            return new Object[0][];
-        }
+    public static Object[][] subscribeProvider() {
         return  variants(List.of(
                 new UncheckedCustomExceptionThrower(),
                 new UncheckedIOExceptionThrower()),
                 EnumSet.of(Where.BEFORE_SUBSCRIBE, Where.AFTER_SUBSCRIBE));
     }
 
-    @DataProvider(name = "requestProvider")
-    public Object[][] requestProvider(ITestContext context) {
-        if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
-            return new Object[0][];
-        }
+    public static Object[][] requestProvider() {
         return  variants(List.of(
                 new UncheckedCustomExceptionThrower(),
                 new UncheckedIOExceptionThrower()),
                 EnumSet.of(Where.BEFORE_REQUEST, Where.AFTER_REQUEST));
     }
 
-    @DataProvider(name = "nextRequestProvider")
-    public Object[][] nextRequestProvider(ITestContext context) {
-        if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
-            return new Object[0][];
-        }
+    public static Object[][] nextRequestProvider() {
         return  variants(List.of(
                 new UncheckedCustomExceptionThrower(),
                 new UncheckedIOExceptionThrower()),
                 EnumSet.of(Where.BEFORE_NEXT_REQUEST, Where.AFTER_NEXT_REQUEST));
     }
 
-    @DataProvider(name = "beforeCancelProviderIO")
-    public Object[][] beforeCancelProviderIO(ITestContext context) {
-        if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
-            return new Object[0][];
-        }
+    public static Object[][] beforeCancelProviderIO() {
         return  variants(List.of(
                 new UncheckedIOExceptionThrower()),
                 EnumSet.of(Where.BEFORE_CANCEL));
     }
 
-    @DataProvider(name = "afterCancelProviderIO")
-    public Object[][] afterCancelProviderIO(ITestContext context) {
-        if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
-            return new Object[0][];
-        }
+    public static Object[][] afterCancelProviderIO() {
         return  variants(List.of(
                 new UncheckedIOExceptionThrower()),
                 EnumSet.of(Where.AFTER_CANCEL));
     }
 
-    @DataProvider(name = "beforeCancelProviderCustom")
-    public Object[][] beforeCancelProviderCustom(ITestContext context) {
-        if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
-            return new Object[0][];
-        }
+    public static Object[][] beforeCancelProviderCustom() {
         return  variants(List.of(
                 new UncheckedCustomExceptionThrower()),
                 EnumSet.of(Where.BEFORE_CANCEL));
     }
 
-    @DataProvider(name = "afterCancelProviderCustom")
-    public Object[][] afterCancelProvider(ITestContext context) {
-        if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
-            return new Object[0][];
-        }
+    public static Object[][] afterCancelProviderCustom() {
         return  variants(List.of(
                 new UncheckedCustomExceptionThrower()),
                 EnumSet.of(Where.AFTER_CANCEL));
     }
 
-    private HttpClient makeNewClient() {
+    private static HttpClient makeNewClient() {
         clientCount.incrementAndGet();
         return TRACKER.track(HttpClient.newBuilder()
                 .proxy(HttpClient.Builder.NO_PROXY)
@@ -339,11 +311,11 @@ private HttpClient makeNewClient() {
                 .build());
     }
 
-    HttpClient newHttpClient(boolean share) {
+    static HttpClient newHttpClient(boolean share) {
         if (!share) return makeNewClient();
         HttpClient shared = sharedClient;
         if (shared != null) return shared;
-        synchronized (this) {
+        synchronized (AbstractThrowingPublishers.class) {
             shared = sharedClient;
             if (shared == null) {
                 shared = sharedClient = makeNewClient();
@@ -387,7 +359,7 @@ protected void testSanityImpl(String uri, boolean sameClient)
             CompletableFuture> response = client.sendAsync(req, handler);
 
             String body = response.join().body();
-            assertEquals(body, Stream.of(BODY.split("\\|")).collect(Collectors.joining()));
+            assertEquals(Stream.of(BODY.split("\\|")).collect(Collectors.joining()), body);
             if (!sameClient) {
                 // Wait for the client to be garbage collected.
                 // we use the ReferenceTracker API rather than HttpClient::close here,
@@ -431,7 +403,6 @@ private  void testThrowing(String name, String uri, boolean sameClient,
                                     boolean async, Set whereValues)
             throws Exception
     {
-        checkSkip();
         out.printf("%n%s%s%n", now(), name);
         try {
             testThrowing(uri, sameClient, publishers, finisher, thrower, async, whereValues);
@@ -721,8 +692,11 @@ public void onError(Throwable throwable) {
     }
 
 
-    @BeforeTest
-    public void setup() throws Exception {
+    @BeforeAll
+    public static void setup() throws Exception {
+        System.out.println(now() + "setup");
+        System.err.println(now() + "setup");
+
         sslContext = new SimpleSSLContext().get();
         if (sslContext == null)
             throw new AssertionError("Unexpected null sslContext");
@@ -765,8 +739,11 @@ public void setup() throws Exception {
         https2TestServer.start();
     }
 
-    @AfterTest
-    public void teardown() throws Exception {
+    @AfterAll
+    public static void teardown() throws Exception {
+        System.out.println(now() + "teardown");
+        System.err.println(now() + "teardown");
+
         String sharedClientName =
                 sharedClient == null ? null : sharedClient.toString();
         sharedClient = null;
diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java b/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java
index 796c0b8df024..2c1aa2fd9b48 100644
--- a/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,18 +29,20 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker AbstractThrowingPublishers ThrowingPublishersCustomAfterCancel
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true
  *                     -Djdk.httpclient.enableAllMethodRetry=true
  *                     ThrowingPublishersCustomAfterCancel
  */
 
-import org.testng.annotations.Test;
 
 import java.util.Set;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingPublishersCustomAfterCancel extends AbstractThrowingPublishers {
 
-    @Test(dataProvider = "afterCancelProviderCustom")
+    @ParameterizedTest
+    @MethodSource("afterCancelProviderCustom")
     public void testThrowingAsString(String uri, boolean sameClient,
                                             Thrower thrower, Set whereValues)
             throws Exception
diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java b/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java
index 06343d222b8e..ba7341854647 100644
--- a/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,18 +29,20 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker AbstractThrowingPublishers ThrowingPublishersCustomBeforeCancel
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true
  *                     -Djdk.httpclient.enableAllMethodRetry=true
  *                     ThrowingPublishersCustomBeforeCancel
  */
 
-import org.testng.annotations.Test;
 
 import java.util.Set;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingPublishersCustomBeforeCancel extends AbstractThrowingPublishers {
 
-    @Test(dataProvider = "beforeCancelProviderCustom")
+    @ParameterizedTest
+    @MethodSource("beforeCancelProviderCustom")
     public void testThrowingAsString(String uri, boolean sameClient,
                                             Thrower thrower, Set whereValues)
             throws Exception
diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java b/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java
index 7ed649b25463..a5e819942b44 100644
--- a/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,18 +29,20 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker AbstractThrowingPublishers ThrowingPublishersIOAfterCancel
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true
  *                     -Djdk.httpclient.enableAllMethodRetry=true
  *                     ThrowingPublishersIOAfterCancel
  */
 
-import org.testng.annotations.Test;
 
 import java.util.Set;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingPublishersIOAfterCancel extends AbstractThrowingPublishers {
 
-    @Test(dataProvider = "afterCancelProviderIO")
+    @ParameterizedTest
+    @MethodSource("afterCancelProviderIO")
     public void testThrowingAsString(String uri, boolean sameClient,
                                             Thrower thrower, Set whereValues)
             throws Exception
diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java b/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java
index 3be2eb061cc4..e68f83052bde 100644
--- a/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,18 +29,20 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker AbstractThrowingPublishers ThrowingPublishersIOBeforeCancel
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true
  *                     -Djdk.httpclient.enableAllMethodRetry=true
  *                     ThrowingPublishersIOBeforeCancel
  */
 
-import org.testng.annotations.Test;
 
 import java.util.Set;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingPublishersIOBeforeCancel extends AbstractThrowingPublishers {
 
-    @Test(dataProvider = "beforeCancelProviderIO")
+    @ParameterizedTest
+    @MethodSource("beforeCancelProviderIO")
     public void testThrowingAsString(String uri, boolean sameClient,
                                             Thrower thrower, Set whereValues)
             throws Exception
diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java b/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java
index eb07b359fc96..62d06fd60191 100644
--- a/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,18 +29,20 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInNextRequest
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true
  *                     -Djdk.httpclient.enableAllMethodRetry=true
  *                     ThrowingPublishersInNextRequest
  */
 
-import org.testng.annotations.Test;
 
 import java.util.Set;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingPublishersInNextRequest extends AbstractThrowingPublishers {
 
-    @Test(dataProvider = "nextRequestProvider")
+    @ParameterizedTest
+    @MethodSource("nextRequestProvider")
     public void testThrowingAsString(String uri, boolean sameClient,
                                             Thrower thrower, Set whereValues)
             throws Exception
diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java b/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java
index ef05e4e0da6f..f863f3598edf 100644
--- a/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,18 +29,20 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInRequest
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true
  *                     -Djdk.httpclient.enableAllMethodRetry=true
  *                     ThrowingPublishersInRequest
  */
 
-import org.testng.annotations.Test;
 
 import java.util.Set;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingPublishersInRequest extends AbstractThrowingPublishers {
 
-    @Test(dataProvider = "requestProvider")
+    @ParameterizedTest
+    @MethodSource("requestProvider")
     public void testThrowingAsString(String uri, boolean sameClient,
                                             Thrower thrower, Set whereValues)
             throws Exception
diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java b/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java
index f14c51670247..ce1ad89dc056 100644
--- a/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,18 +29,20 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInSubscribe
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true
  *                     -Djdk.httpclient.enableAllMethodRetry=true
  *                     ThrowingPublishersInSubscribe
  */
 
-import org.testng.annotations.Test;
 
 import java.util.Set;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingPublishersInSubscribe extends AbstractThrowingPublishers {
 
-    @Test(dataProvider = "subscribeProvider")
+    @ParameterizedTest
+    @MethodSource("subscribeProvider")
     public void testThrowingAsString(String uri, boolean sameClient,
                                             Thrower thrower, Set whereValues)
             throws Exception
diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java b/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java
index 305490833104..eee2f9ab7fb7 100644
--- a/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,16 +29,18 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker AbstractThrowingPublishers ThrowingPublishersSanity
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true
  *                     -Djdk.httpclient.enableAllMethodRetry=true
  *                     ThrowingPublishersSanity
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingPublishersSanity extends AbstractThrowingPublishers {
 
-    @Test(dataProvider = "sanity")
+    @ParameterizedTest
+    @MethodSource("sanity")
     public void testSanity(String uri, boolean sameClient)
             throws Exception {
         super.testSanityImpl(uri,sameClient);

From 842f3ebeb4c398d46e706a6c8da2b98872589be1 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:18:06 +0000
Subject: [PATCH 104/223] 8225787:
 java/awt/Window/GetScreenLocation/GetScreenLocationTest.java fails on Ubuntu
 8203004: UnixMultiResolutionSplashTest.java fails on Ubuntu16.04

Backport-of: 9c0f41e9973726df0544bf0c7f06a7eb214b849f
---
 test/jdk/ProblemList.txt | 2 --
 1 file changed, 2 deletions(-)

diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
index 6ecac6445f1d..19d99f23c0db 100644
--- a/test/jdk/ProblemList.txt
+++ b/test/jdk/ProblemList.txt
@@ -454,7 +454,6 @@ java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java 71
 java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java 6848810 macosx-all,linux-all
 java/awt/FileDialog/ModalFocus/FileDialogModalFocusTest.java 8194751 linux-all
 java/awt/image/VolatileImage/BitmaskVolatileImage.java 8133102 linux-all
-java/awt/SplashScreen/MultiResolutionSplash/unix/UnixMultiResolutionSplashTest.java 8203004 linux-all
 java/awt/ScrollPane/ScrollPaneEventType.java 8296516 macosx-all
 java/awt/Robot/AcceptExtraMouseButtons/AcceptExtraMouseButtons.java 7107528 linux-all,macosx-all
 java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java 8080676 linux-all
@@ -493,7 +492,6 @@ java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.
 java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeForModalDialogTest/ConsumeForModalDialogTest.java 8302787 windows-all
 java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedTest.java 8302787 windows-all
 
-java/awt/Window/GetScreenLocation/GetScreenLocationTest.java 8225787 linux-x64
 java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java 8266243 macosx-aarch64
 java/awt/Dialog/ChoiceModalDialogTest.java 8161475 macosx-all
 java/awt/Dialog/FileDialogUserFilterTest.java 8001142 generic-all

From 1fb29b497ca6b510606f5e09de10fea77a019855 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:18:37 +0000
Subject: [PATCH 105/223] 8274082: Wrong test name in jtreg run tag for
 java/awt/print/PrinterJob/SwingUIText.java

Backport-of: 13adcd99db4f14caf90de7f59e341380cfa354b0
---
 .../awt/print/PrinterJob/SwingUIText.java     | 216 +++++-------------
 1 file changed, 56 insertions(+), 160 deletions(-)

diff --git a/test/jdk/java/awt/print/PrinterJob/SwingUIText.java b/test/jdk/java/awt/print/PrinterJob/SwingUIText.java
index 5fcd5e391581..6ef5064fc306 100644
--- a/test/jdk/java/awt/print/PrinterJob/SwingUIText.java
+++ b/test/jdk/java/awt/print/PrinterJob/SwingUIText.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2025, 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
@@ -21,44 +21,70 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6488219 6560738 7158350 8017469
  * @key printer
  * @summary Test that text printed in Swing UI measures and looks OK.
- * @run main/manual=yesno PrintTextTest
+ * @library /java/awt/regtesthelpers /test/lib
+ * @build PassFailJFrame jtreg.SkippedException
+ * @run main/manual SwingUIText
  */
 
-import java.awt.*;
-import javax.swing.*;
-import java.awt.print.*;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterJob;
+import javax.swing.JButton;
+import javax.swing.JEditorPane;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import jtreg.SkippedException;
 
 public class SwingUIText implements Printable {
+    private static JFrame frame;
+    private static final String INSTRUCTIONS = """
+            This test checks that when a Swing UI is printed,
+            the text in each component aligns with the component’s length as seen on-screen.
+            It also ensures the text spacing is reasonably even, though this is subjective.
+            The comparison should be made with JDK 1.5 GA or JDK 1.6 GA.
+
+            Steps:
+            1. Press the "Print" or "OK" button on the Print dialog.
+                This will print the content of the "Swing UI Text Printing Test" JFrame.
+            2. Compare the printout with the content of the JFrame.
+            3. If they match, press Pass; otherwise, press Fail.
+            """;
+
+    public static void main(String args[])  throws Exception {
+        PrinterJob job = PrinterJob.getPrinterJob();
+        if (job.getPrintService() == null) {
+            throw new SkippedException("Printer not configured or available.");
+        }
 
-    static String[] instructions = {
-        "This tests that when a Swing UI is printed, that the text",
-        "in each component properly matches the length of the component",
-        "as seen on-screen, and that the spacing of the text is of",
-        "reasonable even-ness. This latter part is very subjective and",
-        "the comparison has to be with JDK1.5 GA, or JDK 1.6 GA",
-    };
+        PassFailJFrame passFailJFrame = PassFailJFrame.builder()
+                .instructions(INSTRUCTIONS)
+                .columns(45)
+                .testUI(SwingUIText::createTestUI)
+                .build();
 
-    static JFrame frame;
+        job.setPrintable(new SwingUIText());
+        if (job.printDialog()) {
+            job.print();
+        }
 
-    public static void main(String args[]) {
-        SwingUtilities.invokeLater(new Runnable() {
-          public void run() {
-              createUI();
-          }
-      });
+        passFailJFrame.awaitAndCheck();
     }
 
-    public static void createUI() {
-
-        Sysout.createDialogWithInstructions(instructions);
-
+    public static JFrame createTestUI() {
+        frame = new JFrame();
         JPanel panel = new JPanel();
-        panel.setLayout(new GridLayout(4,1));
+        panel.setLayout(new GridLayout(4, 1));
 
         String text = "marvelous suspicious solving";
         displayText(panel, text);
@@ -89,24 +115,12 @@ public static void createUI() {
         frame = new JFrame("Swing UI Text Printing Test");
         frame.getContentPane().add(panel);
         frame.pack();
-        frame.setVisible(true);
-
-        PrinterJob job = PrinterJob.getPrinterJob();
-        PageFormat pf = job.defaultPage();
-        job.setPrintable(new SwingUIText(), pf);
-        if (job.printDialog()) {
-            try { job.print(); }
-            catch (Exception e) {
-              e.printStackTrace();
-              throw new RuntimeException(e);
-            }
-        }
+        return frame;
     }
 
-
     static void displayText(JPanel p, String text) {
         JPanel panel = new JPanel();
-        panel.setLayout(new GridLayout(2,1));
+        panel.setLayout(new GridLayout(2, 1));
         JPanel row = new JPanel();
         Font font = new Font("Dialog", Font.PLAIN, 12);
 
@@ -114,7 +128,7 @@ static void displayText(JPanel p, String text) {
         label.setFont(font);
         row.add(label);
 
-        JButton button = new JButton("Print "+text);
+        JButton button = new JButton("Print " + text);
         button.setMnemonic('P');
         button.setFont(font);
         row.add(button);
@@ -133,132 +147,14 @@ static void displayText(JPanel p, String text) {
         p.add(panel);
     }
 
-    public int print(Graphics g, PageFormat pf, int pageIndex)
-        throws PrinterException {
-
+    public int print(Graphics g, PageFormat pf, int pageIndex) {
         if (pageIndex >= 1) {
             return Printable.NO_SUCH_PAGE;
         }
+
         g.translate((int)pf.getImageableX(), (int)pf.getImageableY());
         frame.printAll(g);
-
         return Printable.PAGE_EXISTS;
     }
 
 }
-
-class Sysout
- {
-   private static TestDialog dialog;
-
-   public static void createDialogWithInstructions( String[] instructions )
-    {
-      dialog = new TestDialog( new Frame(), "Instructions" );
-      dialog.printInstructions( instructions );
-      dialog.show();
-      println( "Any messages for the tester will display here." );
-    }
-
-   public static void createDialog( )
-    {
-      dialog = new TestDialog( new Frame(), "Instructions" );
-      String[] defInstr = { "Instructions will appear here. ", "" } ;
-      dialog.printInstructions( defInstr );
-      dialog.show();
-      println( "Any messages for the tester will display here." );
-    }
-
-
-   public static void printInstructions( String[] instructions )
-    {
-      dialog.printInstructions( instructions );
-    }
-
-
-   public static void println( String messageIn )
-    {
-      dialog.displayMessage( messageIn );
-    }
-
- }// Sysout  class
-
-/**
-  This is part of the standard test machinery.  It provides a place for the
-   test instructions to be displayed, and a place for interactive messages
-   to the user to be displayed.
-  To have the test instructions displayed, see Sysout.
-  To have a message to the user be displayed, see Sysout.
-  Do not call anything in this dialog directly.
-  */
-class TestDialog extends Dialog
- {
-
-   TextArea instructionsText;
-   TextArea messageText;
-   int maxStringLength = 80;
-
-   //DO NOT call this directly, go through Sysout
-   public TestDialog( Frame frame, String name )
-    {
-      super( frame, name );
-      int scrollBoth = TextArea.SCROLLBARS_BOTH;
-      instructionsText = new TextArea( "", 10, maxStringLength, scrollBoth );
-      add( "North", instructionsText );
-
-      messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
-      add("South", messageText);
-
-      pack();
-
-      show();
-    }// TestDialog()
-
-   //DO NOT call this directly, go through Sysout
-   public void printInstructions( String[] instructions )
-    {
-      //Clear out any current instructions
-      instructionsText.setText( "" );
-
-      //Go down array of instruction strings
-
-      String printStr, remainingStr;
-      for( int i=0; i < instructions.length; i++ )
-       {
-     //chop up each into pieces maxSringLength long
-     remainingStr = instructions[ i ];
-     while( remainingStr.length() > 0 )
-      {
-        //if longer than max then chop off first max chars to print
-        if( remainingStr.length() >= maxStringLength )
-         {
-           //Try to chop on a word boundary
-           int posOfSpace = remainingStr.
-          lastIndexOf( ' ', maxStringLength - 1 );
-
-           if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
-
-           printStr = remainingStr.substring( 0, posOfSpace + 1 );
-           remainingStr = remainingStr.substring( posOfSpace + 1 );
-         }
-        //else just print
-        else
-         {
-           printStr = remainingStr;
-           remainingStr = "";
-         }
-
-            instructionsText.append( printStr + "\n" );
-
-      }// while
-
-       }// for
-
-    }//printInstructions()
-
-   //DO NOT call this directly, go through Sysout
-   public void displayMessage( String messageIn )
-    {
-      messageText.append( messageIn + "\n" );
-    }
-
-}// TestDialog  class

From cb34c94fa5c8c2587d005e52ab758205dafdc820 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:19:12 +0000
Subject: [PATCH 106/223] 8373866: Refactor
 java/net/httpclient/ThrowingSubscribers*.java tests to use JUnit5

Reviewed-by: phh
Backport-of: c6d47ed1e1d512b4025ae2dba75a57c1f2fd2cec
---
 .../AbstractThrowingSubscribers.java          | 143 +++++++++---------
 .../ThrowingSubscribersAsInputStream.java     |  10 +-
 ...ThrowingSubscribersAsInputStreamAsync.java |  10 +-
 .../ThrowingSubscribersAsLines.java           |  10 +-
 .../ThrowingSubscribersAsLinesAsync.java      |  10 +-
 .../ThrowingSubscribersAsString.java          |  10 +-
 .../ThrowingSubscribersAsStringAsync.java     |  10 +-
 .../httpclient/ThrowingSubscribersSanity.java |  10 +-
 8 files changed, 115 insertions(+), 98 deletions(-)

diff --git a/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java b/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java
index dc7ca3fe9d54..6ae8f3a90f67 100644
--- a/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java
+++ b/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java
@@ -22,14 +22,6 @@
  */
 
 import jdk.test.lib.net.SimpleSSLContext;
-import org.testng.ITestContext;
-import org.testng.ITestResult;
-import org.testng.SkipException;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.DataProvider;
 
 import javax.net.ssl.SSLContext;
 import java.io.BufferedReader;
@@ -47,7 +39,6 @@
 import java.net.http.HttpResponse.BodySubscriber;
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
@@ -71,24 +62,33 @@
 import static java.net.http.HttpClient.Version.HTTP_1_1;
 import static java.net.http.HttpClient.Version.HTTP_2;
 import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+import org.junit.jupiter.api.AfterAll;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.extension.TestWatcher;
 
 public abstract class AbstractThrowingSubscribers implements HttpServerAdapters {
 
-    SSLContext sslContext;
-    HttpTestServer httpTestServer;    // HTTP/1.1    [ 4 servers ]
-    HttpTestServer httpsTestServer;   // HTTPS/1.1
-    HttpTestServer http2TestServer;   // HTTP/2 ( h2c )
-    HttpTestServer https2TestServer;  // HTTP/2 ( h2  )
-    String httpURI_fixed;
-    String httpURI_chunk;
-    String httpsURI_fixed;
-    String httpsURI_chunk;
-    String http2URI_fixed;
-    String http2URI_chunk;
-    String https2URI_fixed;
-    String https2URI_chunk;
+    static SSLContext sslContext;
+    static HttpTestServer httpTestServer;    // HTTP/1.1    [ 4 servers ]
+    static HttpTestServer httpsTestServer;   // HTTPS/1.1
+    static HttpTestServer http2TestServer;   // HTTP/2 ( h2c )
+    static HttpTestServer https2TestServer;  // HTTP/2 ( h2  )
+    static String httpURI_fixed;
+    static String httpURI_chunk;
+    static String httpsURI_fixed;
+    static String httpsURI_chunk;
+    static String http2URI_fixed;
+    static String http2URI_chunk;
+    static String https2URI_fixed;
+    static String https2URI_chunk;
 
     static final int ITERATION_COUNT = 1;
     static final int REPEAT_RESPONSE = 3;
@@ -107,8 +107,34 @@ public static String now() {
         return String.format("[%d s, %d ms, %d ns] ", secs, mill, nan);
     }
 
-    final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE;
-    private volatile HttpClient sharedClient;
+    static final class TestStopper implements TestWatcher, BeforeEachCallback {
+        final AtomicReference failed = new AtomicReference<>();
+        TestStopper() { }
+        @Override
+        public void testFailed(ExtensionContext context, Throwable cause) {
+            if (stopAfterFirstFailure()) {
+                String msg = "Aborting due to: " + cause;
+                failed.compareAndSet(null, msg);
+                FAILURES.putIfAbsent(context.getDisplayName(), cause);
+                System.out.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n",
+                        now(), context.getDisplayName(), cause);
+                System.err.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n",
+                        now(), context.getDisplayName(), cause);
+            }
+        }
+
+        @Override
+        public void beforeEach(ExtensionContext context) {
+            String msg = failed.get();
+            Assumptions.assumeTrue(msg == null, msg);
+        }
+    }
+
+    @RegisterExtension
+    static final TestStopper stopper = new TestStopper();
+
+    static final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE;
+    private static volatile HttpClient sharedClient;
 
     static class TestExecutor implements Executor {
         final AtomicLong tasks = new AtomicLong();
@@ -134,34 +160,12 @@ public void execute(Runnable command) {
         }
     }
 
-    protected boolean stopAfterFirstFailure() {
+    protected static boolean stopAfterFirstFailure() {
         return Boolean.getBoolean("jdk.internal.httpclient.debug");
     }
 
-    final AtomicReference skiptests = new AtomicReference<>();
-    void checkSkip() {
-        var skip = skiptests.get();
-        if (skip != null) throw skip;
-    }
-    static String name(ITestResult result) {
-        var params = result.getParameters();
-        return result.getName()
-                + (params == null ? "()" : Arrays.toString(result.getParameters()));
-    }
-
-    @BeforeMethod
-    void beforeMethod(ITestContext context) {
-        if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
-            if (skiptests.get() == null) {
-                SkipException skip = new SkipException("some tests failed");
-                skip.setStackTrace(new StackTraceElement[0]);
-                skiptests.compareAndSet(null, skip);
-            }
-        }
-    }
-
-    @AfterClass
-    static final void printFailedTests(ITestContext context) {
+    @AfterAll
+    static final void printFailedTests() {
         out.println("\n=========================");
         try {
             // Exceptions should already have been added to FAILURES
@@ -186,7 +190,7 @@ static final void printFailedTests(ITestContext context) {
         }
     }
 
-    private String[] uris() {
+    private static String[] uris() {
         return new String[] {
                 httpURI_fixed,
                 httpURI_chunk,
@@ -199,10 +203,9 @@ private String[] uris() {
         };
     }
 
-    static AtomicLong URICOUNT = new AtomicLong();
+    static final AtomicLong URICOUNT = new AtomicLong();
 
-    @DataProvider(name = "sanity")
-    public Object[][] sanity() {
+    public static Object[][] sanity() {
         String[] uris = uris();
         Object[][] result = new Object[uris.length * 2][];
         int i = 0;
@@ -215,11 +218,7 @@ public Object[][] sanity() {
         return result;
     }
 
-    @DataProvider(name = "variants")
-    public Object[][] variants(ITestContext context) {
-        if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
-            return new Object[0][];
-        }
+    public static Object[][] variants() {
         String[] uris = uris();
         Object[][] result = new Object[uris.length * 2 * 2][];
         int i = 0;
@@ -236,7 +235,7 @@ public Object[][] variants(ITestContext context) {
         return result;
     }
 
-    private HttpClient makeNewClient() {
+    private static HttpClient makeNewClient() {
         clientCount.incrementAndGet();
         HttpClient client =  HttpClient.newBuilder()
                 .proxy(HttpClient.Builder.NO_PROXY)
@@ -246,11 +245,11 @@ private HttpClient makeNewClient() {
         return TRACKER.track(client);
     }
 
-    HttpClient newHttpClient(boolean share) {
+    static HttpClient newHttpClient(boolean share) {
         if (!share) return makeNewClient();
         HttpClient shared = sharedClient;
         if (shared != null) return shared;
-        synchronized (this) {
+        synchronized (AbstractThrowingSubscribers.class) {
             shared = sharedClient;
             if (shared == null) {
                 shared = sharedClient = makeNewClient();
@@ -307,7 +306,7 @@ protected void testSanityImpl(String uri, boolean sameClient)
             HttpResponse response = client.send(req, handler);
             String body = response.body();
             Stream.of(body.split("\n")).forEach(u ->
-                assertEquals(URI.create(u).getPath(), URI.create(uri2).getPath()));
+                assertEquals(URI.create(uri2).getPath(), URI.create(u).getPath()));
             if (!sameClient) {
                 // Wait for the client to be garbage collected.
                 // we use the ReferenceTracker API rather than HttpClient::close here,
@@ -419,7 +418,6 @@ private  void testThrowing(String name, String uri, boolean sameClient,
                                     boolean async, EnumSet excludes)
             throws Exception
     {
-        checkSkip();
         out.printf("%n%s%s%n", now(), name);
         try {
             testThrowing(uri, sameClient, handlers, finisher, thrower, async, excludes);
@@ -498,7 +496,6 @@ private  void testThrowing(String uri, boolean sameClient,
                 if (error != null) throw error;
                 System.out.println(now() + "operation finished normally: " + tracker.getName());
                 System.err.println(now() + "operation finished normally: " + tracker.getName());
-
             }
         }
     }
@@ -758,8 +755,11 @@ public CompletionStage getBody() {
     }
 
 
-    @BeforeTest
-    public void setup() throws Exception {
+    @BeforeAll
+    public static void setup() throws Exception {
+        System.out.println(now() + "setup");
+        System.err.println(now() + "setup");
+
         sslContext = new SimpleSSLContext().get();
         if (sslContext == null)
             throw new AssertionError("Unexpected null sslContext");
@@ -802,8 +802,11 @@ public void setup() throws Exception {
         https2TestServer.start();
     }
 
-    @AfterTest
-    public void teardown() throws Exception {
+    @AfterAll
+    public static void teardown() throws Exception {
+        System.out.println(now() + "teardown");
+        System.err.println(now() + "teardown");
+
         String sharedClientName =
                 sharedClient == null ? null : sharedClient.toString();
         sharedClient = null;
diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java
index 35ac1fd3f9c3..a4c0fc72004b 100644
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,14 +29,16 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker ThrowingSubscribersAsInputStream AbstractThrowingSubscribers
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsInputStream
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsInputStream
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingSubscribersAsInputStream extends AbstractThrowingSubscribers {
 
-    @Test(dataProvider = "variants")
+    @ParameterizedTest
+    @MethodSource("variants")
     public void testThrowingAsInputStream(String uri, boolean sameClient, Thrower thrower)
             throws Exception {
         super.testThrowingAsInputStreamImpl(uri, sameClient, thrower);
diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java
index db25ebaca3e8..aec4641917cd 100644
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,14 +29,16 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker ThrowingSubscribersAsInputStreamAsync AbstractThrowingSubscribers
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsInputStreamAsync
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsInputStreamAsync
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingSubscribersAsInputStreamAsync extends AbstractThrowingSubscribers {
 
-    @Test(dataProvider = "variants")
+    @ParameterizedTest
+    @MethodSource("variants")
     public void testThrowingAsInputStreamAsync(String uri, boolean sameClient, Thrower thrower)
             throws Exception {
         super.testThrowingAsInputStreamAsyncImpl(uri, sameClient, thrower);
diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java
index f303ef12b54b..ba594166b725 100644
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,14 +29,16 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker ThrowingSubscribersAsLines AbstractThrowingSubscribers
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsLines
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsLines
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingSubscribersAsLines extends AbstractThrowingSubscribers {
 
-    @Test(dataProvider = "variants")
+    @ParameterizedTest
+    @MethodSource("variants")
     public void testThrowingAsLines(String uri, boolean sameClient, Thrower thrower)
             throws Exception {
         super.testThrowingAsLinesImpl(uri, sameClient, thrower);
diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java
index 2e1fc942a736..a76ff8824630 100644
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,14 +29,16 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker ThrowingSubscribersAsLinesAsync AbstractThrowingSubscribers
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsLinesAsync
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsLinesAsync
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingSubscribersAsLinesAsync extends AbstractThrowingSubscribers {
 
-    @Test(dataProvider = "variants")
+    @ParameterizedTest
+    @MethodSource("variants")
     public void testThrowingAsLinesAsync(String uri, boolean sameClient, Thrower thrower)
             throws Exception {
         super.testThrowingAsLinesAsyncImpl(uri, sameClient, thrower);
diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java
index 56e444f09c2b..ba5506750964 100644
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,14 +29,16 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker ThrowingSubscribersAsString AbstractThrowingSubscribers
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsString
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsString
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingSubscribersAsString extends AbstractThrowingSubscribers {
 
-    @Test(dataProvider = "variants")
+    @ParameterizedTest
+    @MethodSource("variants")
     public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower)
             throws Exception {
         super.testThrowingAsStringImpl(uri, sameClient, thrower);
diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java
index 563fe39bd69b..304d98e69392 100644
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,14 +29,16 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker ThrowingSubscribersAsStringAsync AbstractThrowingSubscribers
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsStringAsync
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsStringAsync
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingSubscribersAsStringAsync extends AbstractThrowingSubscribers {
 
-    @Test(dataProvider = "variants")
+    @ParameterizedTest
+    @MethodSource("variants")
     public void testThrowingAsStringAsync(String uri, boolean sameClient, Thrower thrower)
             throws Exception {
         super.testThrowingAsStringAsyncImpl(uri, sameClient, thrower);
diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java b/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java
index c480d55e1479..296e9151c9ee 100644
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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,14 +29,16 @@
  * @build jdk.test.lib.net.SimpleSSLContext
  *        ReferenceTracker ThrowingSubscribersSanity AbstractThrowingSubscribers
  *        jdk.httpclient.test.lib.common.HttpServerAdapters
- * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersSanity
+ * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersSanity
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ThrowingSubscribersSanity extends AbstractThrowingSubscribers {
 
-    @Test(dataProvider = "sanity")
+    @ParameterizedTest
+    @MethodSource("sanity")
     public void testSanity(String uri, boolean sameClient)
             throws Exception {
         super.testSanityImpl(uri, sameClient);

From 331958b1fc26e459ef5e6684c4b74189403d469a Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:19:33 +0000
Subject: [PATCH 107/223] 8278102: containers/docker/TestJcmd.java failed with
 "RuntimeException: Could not find specified process"

Backport-of: 9ef2e8dc1c993a875eb7e47525df277d96066fe1
---
 test/hotspot/jtreg/ProblemList.txt                 | 1 -
 test/hotspot/jtreg/containers/docker/TestJcmd.java | 8 ++------
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt
index ad537efa2714..23e2757fe463 100644
--- a/test/hotspot/jtreg/ProblemList.txt
+++ b/test/hotspot/jtreg/ProblemList.txt
@@ -129,7 +129,6 @@ runtime/NMT/VirtualAllocCommitMerge.java 8309698 linux-s390x
 
 applications/jcstress/copy.java 8229852 linux-all
 
-containers/docker/TestJcmd.java 8278102 linux-all
 containers/docker/TestMemoryAwareness.java 8303470 linux-all
 containers/docker/TestJcmdWithSideCar.java 8341518 linux-all
 
diff --git a/test/hotspot/jtreg/containers/docker/TestJcmd.java b/test/hotspot/jtreg/containers/docker/TestJcmd.java
index 8c210544bb68..3f5afd31801f 100644
--- a/test/hotspot/jtreg/containers/docker/TestJcmd.java
+++ b/test/hotspot/jtreg/containers/docker/TestJcmd.java
@@ -168,14 +168,10 @@ private static Process startObservedContainer() throws Exception {
         opts.addDockerOpts("--volume", Utils.TEST_CLASSES + ":/test-classes/:z")
             .addJavaOpts("-cp", "/test-classes/")
             .addDockerOpts("--cap-add=SYS_PTRACE")
+            .addDockerOpts("--pull=never")
             .addDockerOpts("--name", CONTAINER_NAME)
             .addClassOptions("" + TIME_TO_RUN_CONTAINER_PROCESS);
 
-        if (IS_PODMAN && !ROOT_UID.equals(getId("-u"))) {
-            // map the current userid to the one in the target namespace
-            opts.addDockerOpts("--userns=keep-id");
-        }
-
         // avoid large Xmx
         opts.appendTestJavaOptions = false;
 
@@ -184,7 +180,7 @@ private static Process startObservedContainer() throws Exception {
         return ProcessTools.startProcess("main-container-process",
                                       pb,
                                       line -> line.contains(EventGeneratorLoop.MAIN_METHOD_STARTED),
-                                      5, TimeUnit.SECONDS);
+                                      15, TimeUnit.SECONDS);
     }
 
 

From 22ee9f535dfd3e23045e38a786b71405a7459e59 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:19:57 +0000
Subject: [PATCH 108/223] 8373101: JdkClient and JdkServer test classes ignore
 namedGroups field

Backport-of: 1ae4a6c43ea21d4b147bcfcfaf1484c6e618dce5
---
 .../javax/net/ssl/TLSCommon/interop/JdkClient.java | 13 ++++++++++++-
 .../javax/net/ssl/TLSCommon/interop/JdkServer.java | 14 ++++++++++++--
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/test/jdk/javax/net/ssl/TLSCommon/interop/JdkClient.java b/test/jdk/javax/net/ssl/TLSCommon/interop/JdkClient.java
index 79476cbb81eb..eb6ecbb12b82 100644
--- a/test/jdk/javax/net/ssl/TLSCommon/interop/JdkClient.java
+++ b/test/jdk/javax/net/ssl/TLSCommon/interop/JdkClient.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, 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
@@ -25,6 +25,7 @@
 import java.net.InetSocketAddress;
 import java.net.SocketException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import javax.net.ssl.SNIHostName;
@@ -86,6 +87,16 @@ protected void configClientSocket(Builder builder) throws SocketException {
         if (builder.getAppProtocols() != null) {
             sslParams.setApplicationProtocols(builder.getAppProtocols());
         }
+
+        NamedGroup[] namedGroups = builder.getNamedGroups();
+        if (namedGroups != null
+                && namedGroups.length > 0) {
+            String[] namedGroupStrs = Arrays.stream(namedGroups)
+                    .map(NamedGroup::name)
+                    .toArray(String[]::new);
+            sslParams.setNamedGroups(namedGroupStrs);
+        }
+
         socket.setSSLParameters(sslParams);
     }
 
diff --git a/test/jdk/javax/net/ssl/TLSCommon/interop/JdkServer.java b/test/jdk/javax/net/ssl/TLSCommon/interop/JdkServer.java
index 1521325b65ac..20bfffbac7d9 100644
--- a/test/jdk/javax/net/ssl/TLSCommon/interop/JdkServer.java
+++ b/test/jdk/javax/net/ssl/TLSCommon/interop/JdkServer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, 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
@@ -22,9 +22,9 @@
  */
 
 import java.io.IOException;
-import java.net.InetAddress;
 import java.net.SocketException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import javax.net.ssl.SNIHostName;
@@ -85,6 +85,16 @@ protected void configServerSocket(Builder builder) throws SocketException {
                 System.out.println("appProtocol: " + appProtocol);
             }
         }
+
+        NamedGroup[] namedGroups = builder.getNamedGroups();
+        if (namedGroups != null
+                && namedGroups.length > 0) {
+            String[] namedGroupStrs = Arrays.stream(namedGroups)
+                    .map(NamedGroup::name)
+                    .toArray(String[]::new);
+            sslParams.setNamedGroups(namedGroupStrs);
+        }
+
         serverSocket.setSSLParameters(sslParams);
     }
 

From 003f5dc32c695cd75526867ae4570664a4b26f6e Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:20:15 +0000
Subject: [PATCH 109/223] 8373716: Refactor further java/util tests from TestNG
 to JUnit

Reviewed-by: phh
Backport-of: 4e05748f0899cabb235c71ecdf4256d4ad137a0d
---
 .../Calendar/CalendarDisplayNamesTest.java    | 12 +++---
 .../util/Calendar/JapaneseLenientEraTest.java | 21 +++++-----
 .../SupplementalJapaneseEraTestRun.java       | 16 ++++----
 .../util/Properties/CompatibilityTest.java    | 19 +++++-----
 .../java/util/Properties/EncodingTest.java    | 18 +++++----
 .../java/util/Properties/InitialCapacity.java | 14 ++++---
 .../Properties/PropertiesEntrySetTest.java    | 38 +++++++++----------
 .../util/Properties/PropertiesStoreTest.java  | 38 ++++++++++---------
 .../modules/basic/BasicTest.java              | 18 +++++----
 .../modules/cache/CacheTest.java              | 15 ++++----
 .../CaseInsensitiveNameClash.java             | 14 ++++---
 .../modules/visibility/VisibilityTest.java    | 36 +++++++++---------
 .../java/util/TimeZone/NegativeDSTTest.java   | 23 +++++------
 .../util/TimeZone/ZoneIdRoundTripTest.java    | 21 +++++-----
 14 files changed, 162 insertions(+), 141 deletions(-)

diff --git a/test/jdk/java/util/Calendar/CalendarDisplayNamesTest.java b/test/jdk/java/util/Calendar/CalendarDisplayNamesTest.java
index d5293a296bb1..61a32c67bb23 100644
--- a/test/jdk/java/util/Calendar/CalendarDisplayNamesTest.java
+++ b/test/jdk/java/util/Calendar/CalendarDisplayNamesTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -21,21 +21,21 @@
  * questions.
  */
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
 
 import java.util.Calendar;
 import java.util.Locale;
 import java.util.Map;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 /**
  * @test
  * @bug 8262108
  * @summary Verify the results returned by Calendar.getDisplayNames() API
  * @comment Locale providers: COMPAT,SPI
- * @run testng/othervm -Djava.locale.providers=COMPAT,SPI CalendarDisplayNamesTest
+ * @run junit/othervm -Djava.locale.providers=COMPAT,SPI CalendarDisplayNamesTest
  * @comment Locale providers: CLDR
- * @run testng/othervm -Djava.locale.providers=CLDR CalendarDisplayNamesTest
+ * @run junit/othervm -Djava.locale.providers=CLDR CalendarDisplayNamesTest
  */
 public class CalendarDisplayNamesTest {
 
@@ -55,7 +55,7 @@ public void testAM_PMDisplayNameValues() {
                     continue;
                 }
                 for (final Integer fieldValue : names.values()) {
-                    Assert.assertTrue(fieldValue == Calendar.AM || fieldValue == Calendar.PM,
+                    Assertions.assertTrue(fieldValue == Calendar.AM || fieldValue == Calendar.PM,
                             "Invalid field value " + fieldValue + " for calendar field AM_PM, in locale "
                                     + locale + " with style " + style);
                 }
diff --git a/test/jdk/java/util/Calendar/JapaneseLenientEraTest.java b/test/jdk/java/util/Calendar/JapaneseLenientEraTest.java
index 6a909a23a18a..ca726afc29b7 100644
--- a/test/jdk/java/util/Calendar/JapaneseLenientEraTest.java
+++ b/test/jdk/java/util/Calendar/JapaneseLenientEraTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8206120
  * @summary Test whether lenient era is accepted in JapaneseImperialCalendar
- * @run testng/othervm JapaneseLenientEraTest
+ * @run junit/othervm JapaneseLenientEraTest
  */
 
 import java.text.DateFormat;
@@ -34,15 +34,15 @@
 import java.util.Date;
 import java.util.Locale;
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-@Test
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class JapaneseLenientEraTest {
 
-    @DataProvider(name="lenientEra")
-    Object[][] names() {
+    Object[][] lenientEra() {
         return new Object[][] {
             // lenient era/year, strict era/year
             { "Meiji 123", "Heisei 2" },
@@ -51,7 +51,8 @@ Object[][] names() {
         };
     }
 
-    @Test(dataProvider="lenientEra")
+    @ParameterizedTest
+    @MethodSource("lenientEra")
     public void testLenientEra(String lenient, String strict) throws Exception {
         Calendar c = new Calendar.Builder()
             .setCalendarType("japanese")
@@ -61,6 +62,6 @@ public void testLenientEra(String lenient, String strict) throws Exception {
         Date lenDate = df.parse(lenient + "-01-01");
         df.setLenient(false);
         Date strDate = df.parse(strict + "-01-01");
-        assertEquals(lenDate, strDate);
+        assertEquals(strDate, lenDate);
     }
 }
diff --git a/test/jdk/java/util/Calendar/SupplementalJapaneseEraTestRun.java b/test/jdk/java/util/Calendar/SupplementalJapaneseEraTestRun.java
index 5383d0d12405..e8c0863157a5 100644
--- a/test/jdk/java/util/Calendar/SupplementalJapaneseEraTestRun.java
+++ b/test/jdk/java/util/Calendar/SupplementalJapaneseEraTestRun.java
@@ -27,7 +27,7 @@
  * @summary Test for jdk.calendar.japanese.supplemental.era support
  * @library /test/lib
  * @build SupplementalJapaneseEraTest
- * @run testng/othervm SupplementalJapaneseEraTestRun
+ * @run junit/othervm SupplementalJapaneseEraTestRun
  */
 
 import java.util.Calendar;
@@ -45,11 +45,12 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.Utils;
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class SupplementalJapaneseEraTestRun {
-    @DataProvider(name = "validprop")
     Object[][] validPropertyData() {
         return new Object[][] {
                 //Tests with valid property values
@@ -58,7 +59,6 @@ Object[][] validPropertyData() {
         };
     }
 
-    @DataProvider(name = "invalidprop")
     Object[][] invalidPropertyData() {
         return new Object[][] {
                 //Tests with invalid property values
@@ -76,7 +76,8 @@ Object[][] invalidPropertyData() {
         };
     }
 
-    @Test(dataProvider = "validprop")
+    @ParameterizedTest
+    @MethodSource("validPropertyData")
     public void ValidPropertyValuesTest(String prop)
             throws Throwable {
         //get the start time of the fictional next era
@@ -84,7 +85,8 @@ public void ValidPropertyValuesTest(String prop)
         testRun(prop + startTime, List.of("-t"));
     }
 
-    @Test(dataProvider = "invalidprop")
+    @ParameterizedTest
+    @MethodSource("invalidPropertyData")
     public void InvalidPropertyValuesTest(String prop)
             throws Throwable {
         //get the start time of the fictional next era
diff --git a/test/jdk/java/util/Properties/CompatibilityTest.java b/test/jdk/java/util/Properties/CompatibilityTest.java
index 29c7be6fbcd2..839680806c14 100644
--- a/test/jdk/java/util/Properties/CompatibilityTest.java
+++ b/test/jdk/java/util/Properties/CompatibilityTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, 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
@@ -24,19 +24,19 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.util.Properties;
-import org.testng.Assert;
-
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /*
  * @test
  * @bug 8252354
- * @run testng CompatibilityTest
+ * @run junit CompatibilityTest
  * @summary Verify compatibility.
  */
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class CompatibilityTest {
-    @DataProvider(name = "entries")
     public Object[][] getEntries() throws IOException {
         return new Object[][]{
             {8, 238923},
@@ -53,9 +53,10 @@ public Object[][] getEntries() throws IOException {
      * @param value the value
      * @throws IOException
      */
-    @Test(dataProvider = "entries")
+    @ParameterizedTest
+    @MethodSource("getEntries")
     void testThrows(Object key, Object value) throws IOException {
-        Assert.assertThrows(ClassCastException.class, () -> storeToXML(key, value));
+        Assertions.assertThrows(ClassCastException.class, () -> storeToXML(key, value));
     }
 
     void storeToXML(Object key, Object value) throws IOException {
diff --git a/test/jdk/java/util/Properties/EncodingTest.java b/test/jdk/java/util/Properties/EncodingTest.java
index d97730a37c7b..069d16155f0c 100644
--- a/test/jdk/java/util/Properties/EncodingTest.java
+++ b/test/jdk/java/util/Properties/EncodingTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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
@@ -27,19 +27,20 @@
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.util.Properties;
-import org.testng.Assert;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /**
  * @test
  * @bug 8183743
  * @summary Test to verify the new overload method with Charset functions the
  * same as the existing method that takes a charset name.
- * @run testng EncodingTest
+ * @run junit EncodingTest
  */
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class EncodingTest {
-    @DataProvider(name = "parameters")
     public Object[][] getParameters() throws IOException {
         return new Object[][]{
             {StandardCharsets.UTF_8.name(), null},
@@ -51,7 +52,8 @@ public Object[][] getParameters() throws IOException {
      * encoding name or a charset can be read with Properties#loadFromXML that
      * returns the same Properties object.
      */
-    @Test(dataProvider = "parameters")
+    @ParameterizedTest
+    @MethodSource("getParameters")
     void testLoadAndStore(String encoding, Charset charset) throws IOException {
         Properties props = new Properties();
         props.put("k0", "\u6C34");
@@ -74,6 +76,6 @@ void testLoadAndStore(String encoding, Charset charset) throws IOException {
             }
         }
 
-        Assert.assertEquals(props, p);
+        Assertions.assertEquals(p, props);
     }
 }
diff --git a/test/jdk/java/util/Properties/InitialCapacity.java b/test/jdk/java/util/Properties/InitialCapacity.java
index 81e5421bbef8..d684c37adf46 100644
--- a/test/jdk/java/util/Properties/InitialCapacity.java
+++ b/test/jdk/java/util/Properties/InitialCapacity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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
@@ -22,18 +22,22 @@
  */
 
 import java.util.Properties;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 /*
  * @test
  * @bug 8189319
  * @summary Test that Properties(int initialCapacity) throws exceptions (or
             doesn't) as expected
- * @run testng InitialCapacity
+ * @run junit InitialCapacity
  */
 public class InitialCapacity {
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void negativeInitCap() { Properties p = new Properties(-1); }
+    @Test
+    public void negativeInitCap() { Assertions.assertThrows(IllegalArgumentException.class, () -> {
+        Properties p = new Properties(-1);
+        });
+}
 
     @Test
     public void positiveInitCap() { Properties p = new Properties(10); }
diff --git a/test/jdk/java/util/Properties/PropertiesEntrySetTest.java b/test/jdk/java/util/Properties/PropertiesEntrySetTest.java
index d7d58be44dda..f3262f734e30 100644
--- a/test/jdk/java/util/Properties/PropertiesEntrySetTest.java
+++ b/test/jdk/java/util/Properties/PropertiesEntrySetTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, 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
@@ -26,17 +26,17 @@
  * @bug        8245694
  * @summary    tests the entrySet() method of Properties class
  * @author     Yu Li
- * @run testng PropertiesEntrySetTest
+ * @run junit PropertiesEntrySetTest
  */
 
-import org.testng.annotations.Test;
 
 import java.util.Properties;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertThrows;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
 public class PropertiesEntrySetTest {
 
@@ -99,13 +99,13 @@ public void testEquals() {
     public void testToString() {
         Properties a = new Properties();
         var aEntrySet = a.entrySet();
-        assertEquals(aEntrySet.toString(), "[]");
+        assertEquals("[]", aEntrySet.toString());
 
         a.setProperty("p1", "1");
-        assertEquals(aEntrySet.toString(), "[p1=1]");
+        assertEquals("[p1=1]", aEntrySet.toString());
 
         a.setProperty("p2", "2");
-        assertEquals(aEntrySet.size(), 2);
+        assertEquals(2, aEntrySet.size());
         assertTrue(aEntrySet.toString().trim().startsWith("["));
         assertTrue(aEntrySet.toString().contains("p1=1"));
         assertTrue(aEntrySet.toString().contains("p2=2"));
@@ -115,18 +115,18 @@ public void testToString() {
         b.setProperty("p2", "2");
         b.setProperty("p1", "1");
         var bEntrySet = b.entrySet();
-        assertEquals(bEntrySet.size(), 2);
+        assertEquals(2, bEntrySet.size());
         assertTrue(bEntrySet.toString().trim().startsWith("["));
         assertTrue(bEntrySet.toString().contains("p1=1"));
         assertTrue(bEntrySet.toString().contains("p2=2"));
         assertTrue(bEntrySet.toString().trim().endsWith("]"));
 
         b.setProperty("p0", "0");
-        assertEquals(bEntrySet.size(), 3);
+        assertEquals(3, bEntrySet.size());
         assertTrue(bEntrySet.toString().contains("p0=0"));
 
         b.remove("p1");
-        assertEquals(bEntrySet.size(), 2);
+        assertEquals(2, bEntrySet.size());
         assertFalse(bEntrySet.toString().contains("p1=1"));
         assertTrue(bEntrySet.toString().trim().startsWith("["));
         assertTrue(bEntrySet.toString().contains("p0=0"));
@@ -134,7 +134,7 @@ public void testToString() {
         assertTrue(bEntrySet.toString().trim().endsWith("]"));
 
         b.remove("p0", "0");
-        assertEquals(bEntrySet.size(), 1);
+        assertEquals(1, bEntrySet.size());
         assertFalse(bEntrySet.toString().contains("p0=0"));
         assertTrue(bEntrySet.toString().trim().startsWith("["));
         assertTrue(bEntrySet.toString().contains("p2=2"));
@@ -151,13 +151,13 @@ public void testEntrySetWithoutException() {
         a.setProperty("p1", "1");
         a.setProperty("p2", "2");
         var aEntrySet = a.entrySet();
-        assertEquals(aEntrySet.size(), 2);
+        assertEquals(2, aEntrySet.size());
 
         var i = aEntrySet.iterator();
         var e1 = i.next();
         i.remove();
         assertFalse(aEntrySet.contains(e1));
-        assertEquals(aEntrySet.size(), 1);
+        assertEquals(1, aEntrySet.size());
 
         var e2 = i.next();
         aEntrySet.remove(e2);
@@ -172,14 +172,14 @@ public void testEntrySetWithoutException() {
         var bEntrySet = b.entrySet();
 
         assertFalse(bEntrySet.containsAll(aEntrySet));
-        assertEquals(bEntrySet.size(), 2);
+        assertEquals(2, bEntrySet.size());
 
         assertTrue(bEntrySet.removeAll(aEntrySet));
-        assertEquals(bEntrySet.size(), 1);
+        assertEquals(1, bEntrySet.size());
 
         assertTrue(bEntrySet.retainAll(aEntrySet));
         assertTrue(bEntrySet.isEmpty());
-        assertEquals(aEntrySet.size(), 2);
+        assertEquals(2, aEntrySet.size());
 
         aEntrySet.clear();
         assertTrue(aEntrySet.isEmpty());
diff --git a/test/jdk/java/util/Properties/PropertiesStoreTest.java b/test/jdk/java/util/Properties/PropertiesStoreTest.java
index b5a5b5a45aa0..88c24698a144 100644
--- a/test/jdk/java/util/Properties/PropertiesStoreTest.java
+++ b/test/jdk/java/util/Properties/PropertiesStoreTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -21,9 +21,6 @@
  * questions.
  */
 
-import org.testng.Assert;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -45,13 +42,18 @@
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.stream.Collectors;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /*
  * @test
  * @summary tests the order in which the Properties.store() method writes out the properties
  * @bug 8231640 8282023
- * @run testng/othervm PropertiesStoreTest
+ * @run junit/othervm PropertiesStoreTest
  */
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class PropertiesStoreTest {
 
     private static final String DATE_FORMAT_PATTERN = "EEE MMM dd HH:mm:ss zzz uuuu";
@@ -60,7 +62,6 @@ public class PropertiesStoreTest {
     private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT_PATTERN, Locale.US);
     private static final Locale PREV_LOCALE = Locale.getDefault();
 
-    @DataProvider(name = "propsProvider")
     private Object[][] createProps() {
         final Properties simple = new Properties();
         simple.setProperty("1", "one");
@@ -101,7 +102,6 @@ private Object[][] createProps() {
     /**
      * Returns a {@link Locale} to use for testing
      */
-    @DataProvider(name = "localeProvider")
     private Object[][] provideLocales() {
         // pick a non-english locale for testing
         Set locales = Arrays.stream(Locale.getAvailableLocales())
@@ -122,7 +122,8 @@ private Object[][] provideLocales() {
      * Tests that the {@link Properties#store(Writer, String)} API writes out the properties
      * in the expected order
      */
-    @Test(dataProvider = "propsProvider")
+    @ParameterizedTest
+    @MethodSource("createProps")
     public void testStoreWriterKeyOrder(final Properties props, final String[] expectedOrder) throws Exception {
         // Properties.store(...) to a temp file
         final Path tmpFile = Files.createTempFile("8231640", "props");
@@ -136,7 +137,8 @@ public void testStoreWriterKeyOrder(final Properties props, final String[] expec
      * Tests that the {@link Properties#store(OutputStream, String)} API writes out the properties
      * in the expected order
      */
-    @Test(dataProvider = "propsProvider")
+    @ParameterizedTest
+    @MethodSource("createProps")
     public void testStoreOutputStreamKeyOrder(final Properties props, final String[] expectedOrder) throws Exception {
         // Properties.store(...) to a temp file
         final Path tmpFile = Files.createTempFile("8231640", "props");
@@ -161,7 +163,7 @@ private void testStoreKeyOrder(final Properties props, final Path storedProps,
         try (final InputStream is = Files.newInputStream(storedProps)) {
             loaded.load(is);
         }
-        Assert.assertEquals(loaded, props, "Unexpected properties loaded from stored state");
+        Assertions.assertEquals(props, loaded, "Unexpected properties loaded from stored state");
 
         // now read lines from the stored file and keep track of the order in which the keys were
         // found in that file. Compare that order with the expected store order of the keys.
@@ -169,10 +171,10 @@ private void testStoreKeyOrder(final Properties props, final Path storedProps,
         try (final BufferedReader reader = Files.newBufferedReader(storedProps)) {
             actualOrder = readInOrder(reader);
         }
-        Assert.assertEquals(actualOrder.size(), expectedOrder.length,
+        Assertions.assertEquals(expectedOrder.length, actualOrder.size(),
                 "Unexpected number of keys read from stored properties");
         if (!Arrays.equals(actualOrder.toArray(new String[0]), expectedOrder)) {
-            Assert.fail("Unexpected order of stored property keys. Expected order: " + Arrays.toString(expectedOrder)
+            Assertions.fail("Unexpected order of stored property keys. Expected order: " + Arrays.toString(expectedOrder)
                     + ", found order: " + actualOrder);
         }
     }
@@ -180,7 +182,8 @@ private void testStoreKeyOrder(final Properties props, final Path storedProps,
     /**
      * Tests that {@link Properties#store(Writer, String)} writes out a proper date comment
      */
-    @Test(dataProvider = "localeProvider")
+    @ParameterizedTest
+    @MethodSource("provideLocales")
     public void testStoreWriterDateComment(final Locale testLocale) throws Exception {
         // switch the default locale to the one being tested
         Locale.setDefault(testLocale);
@@ -202,7 +205,8 @@ public void testStoreWriterDateComment(final Locale testLocale) throws Exception
     /**
      * Tests that {@link Properties#store(OutputStream, String)} writes out a proper date comment
      */
-    @Test(dataProvider = "localeProvider")
+    @ParameterizedTest
+    @MethodSource("provideLocales")
     public void testStoreOutputStreamDateComment(final Locale testLocale) throws Exception {
         // switch the default locale to the one being tested
         Locale.setDefault(testLocale);
@@ -232,19 +236,19 @@ private void testDateComment(Path file) throws Exception {
             while ((line = reader.readLine()) != null) {
                 if (line.startsWith("#")) {
                     if (comment != null) {
-                        Assert.fail("More than one comment line found in the stored properties file " + file);
+                        Assertions.fail("More than one comment line found in the stored properties file " + file);
                     }
                     comment = line.substring(1);
                 }
             }
         }
         if (comment == null) {
-            Assert.fail("No comment line found in the stored properties file " + file);
+            Assertions.fail("No comment line found in the stored properties file " + file);
         }
         try {
             FORMATTER.parse(comment);
         } catch (DateTimeParseException pe) {
-            Assert.fail("Unexpected date comment: " + comment, pe);
+            Assertions.fail("Unexpected date comment: " + comment, pe);
         }
     }
 
diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java b/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java
index 69f0db832583..c17c4622ecbd 100644
--- a/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -43,7 +43,7 @@
  *        jdk.test.lib.compiler.CompilerUtils
  *        jdk.test.lib.process.ProcessTools
  *        ModuleTestUtil
- * @run testng BasicTest
+ * @run junit BasicTest
  */
 
 import java.nio.file.Path;
@@ -54,13 +54,15 @@
 import jdk.test.lib.Utils;
 import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.process.ProcessTools;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 
 import static jdk.test.lib.Asserts.assertEquals;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-@Test
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class BasicTest {
     private static final String SRC_DIR_APPBASIC = "srcAppbasic";
     private static final String SRC_DIR_APPBASIC2 = "srcAppbasic2";
@@ -92,7 +94,6 @@ public class BasicTest {
 
     private static final String MAIN = "test/jdk.test.Main";
 
-    @DataProvider(name = "basicTestData")
     Object[][] basicTestData() {
         return new Object[][] {
                 // Named module "test" contains resource bundles for root and en,
@@ -122,7 +123,8 @@ Object[][] basicTestData() {
         };
     }
 
-    @Test(dataProvider = "basicTestData")
+    @ParameterizedTest
+    @MethodSource("basicTestData")
     public void runBasicTest(String src, String mod, List moduleList,
             List localeList, String resFormat) throws Throwable {
         Path srcPath = Paths.get(Utils.TEST_SRC, src);
diff --git a/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java b/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java
index 5655eb5de2d0..df72af388552 100644
--- a/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java
+++ b/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -27,7 +27,7 @@
  * @library /test/lib
  * @modules jdk.compiler
  * @build CacheTest jdk.test.lib.compiler.CompilerUtils
- * @run testng CacheTest
+ * @run junit CacheTest
  */
 
 import java.nio.file.Files;
@@ -37,11 +37,12 @@
 import static jdk.test.lib.process.ProcessTools.*;
 import jdk.test.lib.compiler.CompilerUtils;
 
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
 
-@Test
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class CacheTest {
 
     private static final String TEST_SRC = System.getProperty("test.src");
@@ -55,7 +56,7 @@ public class CacheTest {
     private static final String MAIN = "test/jdk.test.Main";
     private static final String MAIN_CLASS = "jdk.test.Main";
 
-    @BeforeTest
+    @BeforeAll
     public void compileTestModules() throws Exception {
 
         for (String mn : new String[] {MAIN_BUNDLES_MODULE, TEST_MODULE}) {
diff --git a/test/jdk/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java b/test/jdk/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java
index 914ebf6bbf0b..45f52b512c8b 100644
--- a/test/jdk/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java
+++ b/test/jdk/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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
@@ -28,7 +28,7 @@
  * @modules jdk.compiler
  * @build jdk.test.lib.compiler.CompilerUtils
  *        jdk.test.lib.process.ProcessTools CaseInsensitiveNameClash
- * @run testng CaseInsensitiveNameClash
+ * @run junit CaseInsensitiveNameClash
  */
 
 import java.nio.file.Files;
@@ -37,10 +37,12 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.compiler.CompilerUtils;
 
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class CaseInsensitiveNameClash {
 
     private static final String TEST_SRC = System.getProperty("test.src");
@@ -54,7 +56,7 @@ public class CaseInsensitiveNameClash {
     /**
      * Compiles the module used by the test
      */
-    @BeforeTest
+    @BeforeAll
     public void compileAll() throws Exception {
         Path msrc = SRC_DIR.resolve(MODULE);
         assertTrue(CompilerUtils.compile(msrc, MODS_DIR,
diff --git a/test/jdk/java/util/ResourceBundle/modules/visibility/VisibilityTest.java b/test/jdk/java/util/ResourceBundle/modules/visibility/VisibilityTest.java
index e0fdb9a93abb..ee9da88d705b 100644
--- a/test/jdk/java/util/ResourceBundle/modules/visibility/VisibilityTest.java
+++ b/test/jdk/java/util/ResourceBundle/modules/visibility/VisibilityTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -34,7 +34,7 @@
  *        jdk.test.lib.compiler.CompilerUtils
  *        jdk.test.lib.process.ProcessTools
  *        ModuleTestUtil
- * @run testng VisibilityTest
+ * @run junit VisibilityTest
  */
 
 import java.nio.file.Path;
@@ -46,13 +46,13 @@
 import jdk.test.lib.Utils;
 import jdk.test.lib.process.ProcessTools;
 
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-import static org.testng.Assert.assertEquals;
-
-@Test
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VisibilityTest {
     private static final Path SRC_DIR = Paths.get(Utils.TEST_SRC, "src");
     private static final Path MODS_DIR = Paths.get(Utils.TEST_CLASSES, "mods");
@@ -63,7 +63,7 @@ public class VisibilityTest {
     private static final List MODULE_LIST = List.of("embargo",
             "exported.named.bundles", "named.bundles", "test");
 
-    @BeforeTest
+    @BeforeAll
     public void prepareTestEnv() throws Throwable {
         MODULE_LIST.forEach(mn -> ModuleTestUtil.prepareModule(SRC_DIR,
                 MODS_DIR, mn, ".properties"));
@@ -93,7 +93,6 @@ public void prepareTestEnv() throws Throwable {
      * "exported.named.bundle" are exported to unnamed modules.
      */
 
-    @DataProvider(name = "RunWithTestResData")
     Object[][] RunWithTestResData() {
         return new Object[][] {
                 // Tests using jdk.test.TestWithNoModuleArg and jdk.embargo.TestWithNoModuleArg.
@@ -188,7 +187,6 @@ Object[][] RunWithTestResData() {
         };
     }
 
-    @DataProvider(name = "RunWithExportedResData")
     Object[][] RunWithExportedResData() {
         return new Object[][] {
                 // Tests using jdk.test.TestWithNoModuleArg and jdk.embargo.TestWithNoModuleArg
@@ -285,7 +283,6 @@ Object[][] RunWithExportedResData() {
         };
     }
 
-    @DataProvider(name = "RunWithPkgResData")
     Object[][] RunWithPkgResData() {
         return new Object[][] {
                 // jdk.pkg.resources.* are in an unnamed module.
@@ -300,10 +297,11 @@ Object[][] RunWithPkgResData() {
     /**
      * Test cases with jdk.test.resources.*
      */
-    @Test(dataProvider = "RunWithTestResData")
+    @ParameterizedTest
+    @MethodSource("RunWithTestResData")
     public void RunWithTestRes(List argsList) throws Throwable {
         int exitCode = runCmd(argsList);
-        assertEquals(exitCode, 0, "Execution of the tests with "
+        assertEquals(0, exitCode, "Execution of the tests with "
                 + "jdk.test.resources.* failed. "
                 + "Unexpected exit code: " + exitCode);
     }
@@ -311,10 +309,11 @@ public void RunWithTestRes(List argsList) throws Throwable {
     /**
      * Test cases with jdk.test.resources.exported.*
      */
-    @Test(dataProvider = "RunWithExportedResData")
+    @ParameterizedTest
+    @MethodSource("RunWithExportedResData")
     public void RunWithExportedRes(List argsList) throws Throwable {
         int exitCode = runCmd(argsList);
-        assertEquals(exitCode, 0, "Execution of the tests with "
+        assertEquals(0, exitCode, "Execution of the tests with "
                 + "jdk.test.resources.exported.* failed. "
                 + "Unexpected exit code: " + exitCode);
     }
@@ -322,10 +321,11 @@ public void RunWithExportedRes(List argsList) throws Throwable {
     /**
      * Test cases with jdk.pkg.resources.*
      */
-    @Test(dataProvider = "RunWithPkgResData")
+    @ParameterizedTest
+    @MethodSource("RunWithPkgResData")
     public void RunWithPkgRes(List argsList) throws Throwable {
         int exitCode = runCmd(argsList);
-        assertEquals(exitCode, 0, "Execution of the tests with "
+        assertEquals(0, exitCode, "Execution of the tests with "
                 + "jdk.pkg.resources.* failed. "
                 + "Unexpected exit code: " + exitCode);
     }
diff --git a/test/jdk/java/util/TimeZone/NegativeDSTTest.java b/test/jdk/java/util/TimeZone/NegativeDSTTest.java
index eb46b8d4b29f..ab9438f23887 100644
--- a/test/jdk/java/util/TimeZone/NegativeDSTTest.java
+++ b/test/jdk/java/util/TimeZone/NegativeDSTTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, 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
@@ -21,7 +21,7 @@
  * questions.
  */
 
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.time.Instant;
 import java.time.LocalDate;
@@ -31,18 +31,19 @@
 import java.util.Date;
 import java.util.TimeZone;
 
-import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /**
  * @test
  * @bug 8212970 8324065
  * @summary Test whether the savings are positive in time zones that have
  *      negative savings in the source TZ files.
- * @run testng NegativeDSTTest
+ * @run junit NegativeDSTTest
  */
-@Test
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class NegativeDSTTest {
 
     private static final TimeZone DUBLIN = TimeZone.getTimeZone("Europe/Dublin");
@@ -51,7 +52,6 @@ public class NegativeDSTTest {
     private static final TimeZone CASABLANCA = TimeZone.getTimeZone("Africa/Casablanca");
     private static final int ONE_HOUR = 3600_000;
 
-    @DataProvider
     private Object[][] negativeDST () {
         return new Object[][] {
             // TimeZone, localDate, offset, isDaylightSavings
@@ -88,10 +88,11 @@ private Object[][] negativeDST () {
         };
     }
 
-    @Test(dataProvider="negativeDST")
+    @ParameterizedTest
+    @MethodSource("negativeDST")
     public void test_NegativeDST(TimeZone tz, LocalDate ld, int offset, boolean isDST) {
         Date d = Date.from(Instant.from(ZonedDateTime.of(ld, LocalTime.MIN, tz.toZoneId())));
-        assertEquals(tz.getOffset(d.getTime()), offset);
-        assertEquals(tz.inDaylightTime(d), isDST);
+        assertEquals(offset, tz.getOffset(d.getTime()));
+        assertEquals(isDST, tz.inDaylightTime(d));
     }
 }
diff --git a/test/jdk/java/util/TimeZone/ZoneIdRoundTripTest.java b/test/jdk/java/util/TimeZone/ZoneIdRoundTripTest.java
index 0f1eeb883287..16e24f7cb276 100644
--- a/test/jdk/java/util/TimeZone/ZoneIdRoundTripTest.java
+++ b/test/jdk/java/util/TimeZone/ZoneIdRoundTripTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, 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
@@ -25,20 +25,20 @@
 import java.time.ZoneOffset;
 import java.util.TimeZone;
 
-import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /**
  * @test
  * @bug 8285844
  * @summary Checks round-trips between TimeZone and ZoneId are consistent
- * @run testng ZoneIdRoundTripTest
+ * @run junit ZoneIdRoundTripTest
  */
-@Test
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class ZoneIdRoundTripTest {
 
-    @DataProvider
     private Object[][] testZoneIds() {
         return new Object[][] {
                 {ZoneId.of("Z"), 0},
@@ -60,11 +60,12 @@ private Object[][] testZoneIds() {
         };
     }
 
-    @Test(dataProvider="testZoneIds")
+    @ParameterizedTest
+    @MethodSource("testZoneIds")
     public void test_ZoneIdRoundTrip(ZoneId zid, int offset) {
         var tz = TimeZone.getTimeZone(zid);
-        assertEquals(tz.getRawOffset(), offset);
-        assertEquals(tz.toZoneId().normalized(), zid.normalized());
+        assertEquals(offset, tz.getRawOffset());
+        assertEquals(zid.normalized(), tz.toZoneId().normalized());
     }
 }
 

From fecdcde29f0c5d8c9ba0f3d77e25d9121ae5da22 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Mon, 30 Mar 2026 17:20:42 +0000
Subject: [PATCH 110/223] 8377910: Minor cleanup of
 java/io/FileDescriptor/Sharing.java

Backport-of: 7489f75dbdb1358b7f905aad2d1510b7ffc173bf
---
 test/jdk/java/io/FileDescriptor/Sharing.java | 76 +++++++++++---------
 1 file changed, 42 insertions(+), 34 deletions(-)

diff --git a/test/jdk/java/io/FileDescriptor/Sharing.java b/test/jdk/java/io/FileDescriptor/Sharing.java
index 24f4fb70b02b..e4ceb2d69065 100644
--- a/test/jdk/java/io/FileDescriptor/Sharing.java
+++ b/test/jdk/java/io/FileDescriptor/Sharing.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, 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
@@ -28,7 +28,14 @@
  * @run main/othervm Sharing
  */
 
-import java.io.*;
+import java.io.File;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.io.Writer;
 import java.nio.channels.FileChannel;
 import java.nio.channels.FileLock;
 import java.util.concurrent.CountDownLatch;
@@ -71,7 +78,7 @@ private static void TestFinalizer() throws Exception {
                 // encourage gc
                 System.gc();
                 // read from fis2 - when fis1 is gc'ed and finalizer is run, read will fail
-                System.out.print(".");
+                System.err.print(".");
                 ret = fis2.read();
             }
         }
@@ -93,7 +100,7 @@ private static void TestFinalizer() throws Exception {
                  * read from fis3 - when raf is gc'ed and finalizer is run,
                  * fd should still be valid.
                  */
-                System.out.print(".");
+                System.err.print(".");
                 ret = fis3.read();
             }
         } finally {
@@ -290,7 +297,7 @@ private static void TestCloseAll() throws Exception {
         FileInputStream fis = new FileInputStream(raf.getFD());
         fis.close();
         if (raf.getFD().valid()) {
-             throw new RuntimeException("FD should not be valid.");
+            throw new RuntimeException("FD should not be valid.");
         }
 
         // Test the suppressed exception handling - FileInputStream
@@ -308,7 +315,7 @@ private static void TestCloseAll() throws Exception {
             ioe.printStackTrace();
             if (ioe.getSuppressed().length != 2) {
                 throw new RuntimeException("[FIS]Incorrect number of suppressed " +
-                          "exceptions received : " + ioe.getSuppressed().length);
+                                           "exceptions received : " + ioe.getSuppressed().length);
             }
         }
         if (raf.getFD().valid()) {
@@ -332,7 +339,7 @@ private static void TestCloseAll() throws Exception {
             ioe.printStackTrace();
             if (ioe.getSuppressed().length != 2) {
                 throw new RuntimeException("[FOS]Incorrect number of suppressed " +
-                          "exceptions received : " + ioe.getSuppressed().length);
+                                           "exceptions received : " + ioe.getSuppressed().length);
             }
         }
         if (raf.getFD().valid()) {
@@ -347,10 +354,8 @@ private static void TestCloseAll() throws Exception {
      * FileOutputStreams referencing the same native file descriptor.
      */
     private static class OpenClose extends Thread {
-        private FileDescriptor fd = null;
-        private CountDownLatch done;
-        FileInputStream[] fisArray = new FileInputStream[numFiles];
-        FileOutputStream[] fosArray = new FileOutputStream[numFiles];
+        private final FileDescriptor fd;
+        private final CountDownLatch done;
 
         OpenClose(FileDescriptor filedescriptor, CountDownLatch done) {
             this.fd = filedescriptor;
@@ -358,29 +363,32 @@ private static class OpenClose extends Thread {
         }
 
         public void run() {
-             try {
-                 for(int i=0;i
Date: Tue, 31 Mar 2026 07:29:48 +0000
Subject: [PATCH 111/223] 8323089: networkaddress.cache.ttl is not a system
 property

Backport-of: efa071dd06deca6f49a22ddde02d13401e583a46
---
 src/java.base/share/classes/java/net/InetAddress.java  |  6 +++---
 .../classes/java/net/doc-files/net-properties.html     | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/java.base/share/classes/java/net/InetAddress.java b/src/java.base/share/classes/java/net/InetAddress.java
index fcc2e2700269..9fd5f4e59c9c 100644
--- a/src/java.base/share/classes/java/net/InetAddress.java
+++ b/src/java.base/share/classes/java/net/InetAddress.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -194,8 +194,8 @@
  * caching. Likewise, a system admin can configure a different
  * negative caching TTL value when needed or extend the usage of the stale data.
  *
- * 

Three Java security properties control the TTL values used for - * positive and negative host name resolution caching: + *

Three Java {@linkplain java.security.Security security} properties control + * the TTL values used for positive and negative host name resolution caching: * *

*
networkaddress.cache.ttl
diff --git a/src/java.base/share/classes/java/net/doc-files/net-properties.html b/src/java.base/share/classes/java/net/doc-files/net-properties.html index fc401e90b6b0..24f7a12a07fd 100644 --- a/src/java.base/share/classes/java/net/doc-files/net-properties.html +++ b/src/java.base/share/classes/java/net/doc-files/net-properties.html @@ -1,6 +1,6 @@ - - - - PrintDialogsTest - - - - -Please select dialog modality type and parent; also select -the print auxiliary dialog to be displayed (Page Setup or Print dialog). -Then click "Start test" button. - -When the windows will appear check if modal blocking for Dialog works as expected. -Then push "Open" button on the Dialog to show the auxiliary dialog and check -if it blocks the rest of the application. Then close it and check correctness -of modal blocking behavior for the Dialog again. To close all the test -windows please push "Finish" button. - -To finish the overall test push "Pass" or "Fail" button depending on result. - - - diff --git a/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java b/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java index 989c48295b01..e2b2d8cac787 100644 --- a/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java +++ b/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -25,21 +25,76 @@ /* * @test * @bug 8055836 8057694 8055752 - * @summary Check if Print and Page Setup dialogs lock other windows; + * @summary Check if Print and Page Setup dialogs block other windows; * check also correctness of modal behavior for other dialogs. - * - * @run applet/manual=yesno PrintDialogsTest.html + * @library /java/awt/regtesthelpers + * @run main/manual PrintDialogsTest */ -import java.applet.Applet; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Checkbox; +import java.awt.CheckboxGroup; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.EventQueue; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -public class PrintDialogsTest extends Applet implements ActionListener { +public class PrintDialogsTest extends Panel implements ActionListener { + + static final String INSTRUCTIONS = """ + This test is free format, which means there is no enforced or guided sequence. + + Please select each of + (a) The dialog parent type. + (b) The dialog modality type + (c) The print dialog type (Print dialog or Page Setup dialog) + + Once the choices have been made click the "Start test" button. + + Three windows will appear + (1) A Frame or a Dialog - in the case you selected "Dialog" as the parent type + (2) a Window (ie an undecorated top-level) + (3) A dialog with two buttons "Open" and "Finish" + + Now check as follows whether modal blocking works as expected. + Windows (1) and (2) contain a button which you should be able to press + ONLY if you selected "Non-modal", or "Modeless" for modality type. + In other cases window (3) will block input to (1) and (2) + + Then push the "Open" button on the Dialog to show the printing dialog and check + if it blocks the rest of the application - ie all of windows (1), (2) and (3) + should ALWAYS be blocked when the print dialog is showing. + Now cancel the printing dialog and check the correctness of modal blocking + behavior for the Dialog again. + To close all the 3 test windows please push the "Finish" button. + + Repeat all the above for different combinations, which should include + using all of the Dialog parent choices and all of the Dialog Modality types. + + If any behave incorrectly, note the combination of choices and press Fail. + + If all behave correctly, press Pass. + """; + + public static void main(String[] args) throws Exception { + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .rows(35) + .columns(60) + .testUI(PrintDialogsTest::createUI) + .testTimeOut(10) + .build() + .awaitAndCheck(); + } private Button btnTest; private Checkbox cbPage, cbPrint, @@ -48,6 +103,14 @@ public class PrintDialogsTest extends Applet implements ActionListener { private CheckboxGroup groupDialog, groupParent, groupModType; + private static Frame createUI() { + Frame frame = new Frame("Dialog Modality Testing"); + PrintDialogsTest test = new PrintDialogsTest(); + test.createGUI(); + frame.add(test); + frame.pack(); + return frame; + } public void actionPerformed(ActionEvent e) { @@ -99,13 +162,13 @@ private void createGUI() { setLayout(new BorderLayout()); - setSize(350, 200); Panel panel = new Panel(); - panel.setLayout(new GridLayout(18, 1)); + panel.setLayout(new GridLayout(21, 1)); btnTest = new Button("Start test"); btnTest.addActionListener(this); panel.add(btnTest); + panel.add(new Label(" ")); // spacing panel.add(new Label("Dialog parent:")); @@ -123,6 +186,7 @@ private void createGUI() { panel.add(cbHiddFrm); panel.add(cbDlg); panel.add(cbFrm); + panel.add(new Label(" ")); // spacing panel.add(new Label("Dialog modality type:")); groupModType = new CheckboxGroup(); @@ -139,7 +203,7 @@ private void createGUI() { panel.add(cbDocModal); panel.add(cbTKModal); panel.add(cbModeless); - add(panel); + panel.add(new Label(" ")); // spacing panel.add(new Label("Print dialog type:")); groupDialog = new CheckboxGroup(); @@ -148,13 +212,6 @@ private void createGUI() { panel.add(cbPage); panel.add(cbPrint); - validate(); - setVisible(true); - } - - public void start() { - try { - EventQueue.invokeAndWait(this::createGUI); - } catch (Exception e) {} + add(panel); } } From c7ce97ca540baf1594fff2fd8724f1d95dd90754 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 7 Apr 2026 13:52:44 +0000 Subject: [PATCH 142/223] 8364927: Add @requires annotation to TestReclaimStringsLeaksMemory.java Backport-of: 78bbfd6362cdd15a2893df6d2e8b6c65ded3d025 --- .../stress/TestReclaimStringsLeaksMemory.java | 55 ++++++++++++++++--- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java b/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java index 0d7e26c91d8c..f55a6f5d8a07 100644 --- a/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java +++ b/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java @@ -24,17 +24,58 @@ package gc.stress; /* - * @test TestReclaimStringsLeaksMemory + * @test id=Serial * @bug 8180048 - * @summary Ensure that during a Full GC interned string memory is reclaimed completely. - * @requires vm.gc == "null" + * @summary Ensure that during a Full GC interned string memory is reclaimed completely with SerialGC. + * @requires vm.gc.Serial * @requires !vm.debug * @library /test/lib * @modules java.base/jdk.internal.misc - * @run driver gc.stress.TestReclaimStringsLeaksMemory - * @run driver gc.stress.TestReclaimStringsLeaksMemory -XX:+UseSerialGC - * @run driver gc.stress.TestReclaimStringsLeaksMemory -XX:+UseParallelGC - * @run driver gc.stress.TestReclaimStringsLeaksMemory -XX:+UseG1GC + * @run driver/timeout=480 gc.stress.TestReclaimStringsLeaksMemory -XX:+UseSerialGC + */ + +/* + * @test id=Parallel + * @bug 8180048 + * @summary Ensure that during a Full GC interned string memory is reclaimed completely with ParallelGC. + * @requires vm.gc.Parallel + * @requires !vm.debug + * @library /test/lib + * @modules java.base/jdk.internal.misc + * @run driver/timeout=480 gc.stress.TestReclaimStringsLeaksMemory -XX:+UseParallelGC + */ + +/* + * @test id=G1 + * @bug 8180048 + * @summary Ensure that during a Full GC interned string memory is reclaimed completely with G1GC. + * @requires vm.gc.G1 + * @requires !vm.debug + * @library /test/lib + * @modules java.base/jdk.internal.misc + * @run driver/timeout=480 gc.stress.TestReclaimStringsLeaksMemory -XX:+UseG1GC + */ + +/* + * @test id=Shenandoah + * @bug 8180048 + * @summary Ensure that during a Full GC interned string memory is reclaimed completely with ShenandoahGC. + * @requires vm.gc.Shenandoah + * @requires !vm.debug + * @library /test/lib + * @modules java.base/jdk.internal.misc + * @run driver/timeout=480 gc.stress.TestReclaimStringsLeaksMemory -XX:+UseShenandoahGC + */ + +/* + * @test id=Z + * @bug 8180048 + * @summary Ensure that during a Full GC interned string memory is reclaimed completely with ZGC. + * @requires vm.gc.Z + * @requires !vm.debug + * @library /test/lib + * @modules java.base/jdk.internal.misc + * @run driver/timeout=480 gc.stress.TestReclaimStringsLeaksMemory -XX:+UseZGC */ import java.util.Arrays; From bae9f661c8b3af3d9519da0e0d2145d32b9de0cd Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 7 Apr 2026 13:53:11 +0000 Subject: [PATCH 143/223] 8369516: Delete duplicate imaging test Backport-of: 5a32966d4255131cf0ac1273b603d994829596e2 --- .../awt/image/VolatileImage/DrawBufImgOp.java | 484 ------------------ 1 file changed, 484 deletions(-) delete mode 100644 test/jdk/java/awt/image/VolatileImage/DrawBufImgOp.java diff --git a/test/jdk/java/awt/image/VolatileImage/DrawBufImgOp.java b/test/jdk/java/awt/image/VolatileImage/DrawBufImgOp.java deleted file mode 100644 index 011b5e661678..000000000000 --- a/test/jdk/java/awt/image/VolatileImage/DrawBufImgOp.java +++ /dev/null @@ -1,484 +0,0 @@ -/* - * Copyright (c) 2007, 2018, 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 - * @key headful - * @bug 6514990 8198613 - * @summary Verifies that calling - * Graphics2D.drawImage(BufferedImage, BufferedImageOp, x, y) to an - * accelerated destination produces the same results when performed - * in software via BufferedImageOp.filter(). - * @run main/othervm DrawBufImgOp -ignore - * @author campbelc - */ - -import java.awt.*; -import java.awt.image.*; -import java.io.File; -import javax.imageio.ImageIO; - -/** - * REMIND: This testcase was originally intended to automatically compare - * the results of the software BufferedImageOp implementations against - * the OGL-accelerated codepaths. However, there are just too many open - * bugs in the mediaLib-based codepaths (see below), which means that - * creating the reference image may cause crashes or exceptions, - * and even if we work around those cases using the "-ignore" flag, - * the visual results of the reference image are often buggy as well - * (so the comparison will fail even though the OGL results are correct). - * Therefore, for now we will run the testcase with the "-ignore" flag - * but without the "-compare" flag, so at least it will be checking for - * any exceptions/crashes in the OGL code. When we fix all of the - * outstanding bugs with the software codepaths, we can remove the - * "-ignore" flag and maybe even restore the "-compare" flag. In the - * meantime, it stil functions well as a manual testcase (with either - * the "-show" or "-dump" options). - */ -public class DrawBufImgOp extends Canvas { - - private static final int TESTW = 600; - private static final int TESTH = 500; - private static boolean done; - - /* - * If true, skips tests that are known to trigger bugs (which in - * turn may cause crashes, exceptions, or other artifacts). - */ - private static boolean ignore; - - // Test both pow2 and non-pow2 sized images - private static final int[] srcSizes = { 32, 17 }; - private static final int[] srcTypes = { - BufferedImage.TYPE_INT_RGB, - BufferedImage.TYPE_INT_ARGB, - BufferedImage.TYPE_INT_ARGB_PRE, - BufferedImage.TYPE_INT_BGR, - BufferedImage.TYPE_3BYTE_BGR, - BufferedImage.TYPE_4BYTE_ABGR, - BufferedImage.TYPE_USHORT_565_RGB, - BufferedImage.TYPE_BYTE_GRAY, - BufferedImage.TYPE_USHORT_GRAY, - }; - - private static final RescaleOp - rescale1band, rescale3band, rescale4band; - private static final LookupOp - lookup1bandbyte, lookup3bandbyte, lookup4bandbyte; - private static final LookupOp - lookup1bandshort, lookup3bandshort, lookup4bandshort; - private static final ConvolveOp - convolve3x3zero, convolve5x5zero, convolve7x7zero; - private static final ConvolveOp - convolve3x3noop, convolve5x5noop, convolve7x7noop; - - static { - rescale1band = new RescaleOp(0.5f, 10.0f, null); - rescale3band = new RescaleOp( - new float[] { 0.6f, 0.4f, 0.6f }, - new float[] { 10.0f, -3.0f, 5.0f }, - null); - rescale4band = new RescaleOp( - new float[] { 0.6f, 0.4f, 0.6f, 0.9f }, - new float[] { -1.0f, 5.0f, 3.0f, 1.0f }, - null); - - // REMIND: we should probably test non-zero offsets, but that - // would require massaging the source image data to avoid going - // outside the lookup table array bounds - int offset = 0; - { - byte invert[] = new byte[256]; - byte halved[] = new byte[256]; - for (int j = 0; j < 256 ; j++) { - invert[j] = (byte) (255-j); - halved[j] = (byte) (j / 2); - } - ByteLookupTable lut1 = new ByteLookupTable(offset, invert); - lookup1bandbyte = new LookupOp(lut1, null); - ByteLookupTable lut3 = - new ByteLookupTable(offset, - new byte[][] {invert, halved, invert}); - lookup3bandbyte = new LookupOp(lut3, null); - ByteLookupTable lut4 = - new ByteLookupTable(offset, - new byte[][] {invert, halved, invert, halved}); - lookup4bandbyte = new LookupOp(lut4, null); - } - - { - short invert[] = new short[256]; - short halved[] = new short[256]; - for (int j = 0; j < 256 ; j++) { - invert[j] = (short) ((255-j) * 255); - halved[j] = (short) ((j / 2) * 255); - } - ShortLookupTable lut1 = new ShortLookupTable(offset, invert); - lookup1bandshort = new LookupOp(lut1, null); - ShortLookupTable lut3 = - new ShortLookupTable(offset, - new short[][] {invert, halved, invert}); - lookup3bandshort = new LookupOp(lut3, null); - ShortLookupTable lut4 = - new ShortLookupTable(offset, - new short[][] {invert, halved, invert, halved}); - lookup4bandshort = new LookupOp(lut4, null); - } - - // 3x3 blur - float[] data3 = { - 0.1f, 0.1f, 0.1f, - 0.1f, 0.2f, 0.1f, - 0.1f, 0.1f, 0.1f, - }; - Kernel k3 = new Kernel(3, 3, data3); - - // 5x5 edge - float[] data5 = { - -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, - -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, - -1.0f, -1.0f, 24.0f, -1.0f, -1.0f, - -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, - -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, - }; - Kernel k5 = new Kernel(5, 5, data5); - - // 7x7 blur - float[] data7 = { - 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, - 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, - 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, - 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, - 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, - 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, - 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, - }; - Kernel k7 = new Kernel(7, 7, data7); - - convolve3x3zero = new ConvolveOp(k3, ConvolveOp.EDGE_ZERO_FILL, null); - convolve5x5zero = new ConvolveOp(k5, ConvolveOp.EDGE_ZERO_FILL, null); - convolve7x7zero = new ConvolveOp(k7, ConvolveOp.EDGE_ZERO_FILL, null); - - convolve3x3noop = new ConvolveOp(k3, ConvolveOp.EDGE_NO_OP, null); - convolve5x5noop = new ConvolveOp(k5, ConvolveOp.EDGE_NO_OP, null); - convolve7x7noop = new ConvolveOp(k7, ConvolveOp.EDGE_NO_OP, null); - } - - public void paint(Graphics g) { - synchronized (this) { - if (done) { - return; - } - } - - VolatileImage vimg = createVolatileImage(TESTW, TESTH); - vimg.validate(getGraphicsConfiguration()); - - Graphics2D g2d = vimg.createGraphics(); - renderTest(g2d); - g2d.dispose(); - - g.drawImage(vimg, 0, 0, null); - - Toolkit.getDefaultToolkit().sync(); - - synchronized (this) { - done = true; - notifyAll(); - } - } - - /* - * foreach source image size (once with pow2, once with non-pow2) - * - * foreach BufferedImage type - * - * RescaleOp (1 band) - * RescaleOp (3 bands, if src has 3 bands) - * RescaleOp (4 bands, if src has 4 bands) - * - * foreach LookupTable type (once with ByteLUT, once with ShortLUT) - * LookupOp (1 band) - * LookupOp (3 bands, if src has 3 bands) - * LookupOp (4 bands, if src has 4 bands) - * - * foreach edge condition (once with ZERO_FILL, once with EDGE_NO_OP) - * ConvolveOp (3x3) - * ConvolveOp (5x5) - * ConvolveOp (7x7) - */ - private void renderTest(Graphics2D g2d) { - g2d.setColor(Color.white); - g2d.fillRect(0, 0, TESTW, TESTH); - - int yorig = 2; - int xinc = 34; - int yinc = srcSizes[0] + srcSizes[1] + 2 + 2; - - for (int srcType : srcTypes) { - int y = yorig; - - for (int srcSize : srcSizes) { - int x = 2; - System.out.printf("type=%d size=%d\n", srcType, srcSize); - - BufferedImage srcImg = makeSourceImage(srcSize, srcType); - ColorModel srcCM = srcImg.getColorModel(); - - // RescaleOp - g2d.drawImage(srcImg, rescale1band, x, y); - x += xinc; - // REMIND: 3-band RescaleOp.filter() throws IAE for images - // that contain an alpha channel (bug to be filed) - if (srcCM.getNumColorComponents() == 3 && - !(ignore && srcCM.hasAlpha())) - { - g2d.drawImage(srcImg, rescale3band, x, y); - } - x += xinc; - if (srcCM.getNumComponents() == 4) { - g2d.drawImage(srcImg, rescale4band, x, y); - } - x += xinc; - - // LookupOp - // REMIND: Our LUTs are only 256 elements long, so won't - // currently work with USHORT_GRAY data - if (srcType != BufferedImage.TYPE_USHORT_GRAY) { - g2d.drawImage(srcImg, lookup1bandbyte, x, y); - x += xinc; - if (srcCM.getNumColorComponents() == 3) { - g2d.drawImage(srcImg, lookup3bandbyte, x, y); - } - x += xinc; - if (srcCM.getNumComponents() == 4) { - g2d.drawImage(srcImg, lookup4bandbyte, x, y); - } - x += xinc; - - // REMIND: LookupOp.createCompatibleDestImage() throws - // IAE for 3BYTE_BGR/4BYTE_ABGR (bug to be filed) - if (!(ignore && - (srcType == BufferedImage.TYPE_3BYTE_BGR || - srcType == BufferedImage.TYPE_4BYTE_ABGR))) - { - g2d.drawImage(srcImg, lookup1bandshort, x, y); - x += xinc; - // REMIND: 3-band LookupOp.filter() throws IAE for - // images that contain an alpha channel - // (bug to be filed) - if (srcCM.getNumColorComponents() == 3 && - !(ignore && srcCM.hasAlpha())) - { - g2d.drawImage(srcImg, lookup3bandshort, x, y); - } - x += xinc; - if (srcCM.getNumComponents() == 4) { - g2d.drawImage(srcImg, lookup4bandshort, x, y); - } - x += xinc; - } else { - x += 3*xinc; - } - } else { - x += 6*xinc; - } - - // ConvolveOp - // REMIND: ConvolveOp.filter() throws ImagingOpException - // for 3BYTE_BGR (see 4957775) - if (srcType != BufferedImage.TYPE_3BYTE_BGR) { - g2d.drawImage(srcImg, convolve3x3zero, x, y); - x += xinc; - g2d.drawImage(srcImg, convolve5x5zero, x, y); - x += xinc; - g2d.drawImage(srcImg, convolve7x7zero, x, y); - x += xinc; - - g2d.drawImage(srcImg, convolve3x3noop, x, y); - x += xinc; - g2d.drawImage(srcImg, convolve5x5noop, x, y); - x += xinc; - g2d.drawImage(srcImg, convolve7x7noop, x, y); - x += xinc; - } else { - x += 6*xinc; - } - - y += srcSize + 2; - } - - yorig += yinc; - } - } - - private BufferedImage makeSourceImage(int size, int type) { - int s2 = size/2; - BufferedImage img = new BufferedImage(size, size, type); - Graphics2D g2d = img.createGraphics(); - g2d.setComposite(AlphaComposite.Src); - g2d.setColor(Color.orange); - g2d.fillRect(0, 0, size, size); - g2d.setColor(Color.red); - g2d.fillRect(0, 0, s2, s2); - g2d.setColor(Color.green); - g2d.fillRect(s2, 0, s2, s2); - g2d.setColor(Color.blue); - g2d.fillRect(0, s2, s2, s2); - g2d.setColor(new Color(255, 255, 0, 128)); - g2d.fillRect(s2, s2, s2, s2); - g2d.setColor(Color.pink); - g2d.fillOval(s2-3, s2-3, 6, 6); - g2d.dispose(); - return img; - } - - public BufferedImage makeReferenceImage() { - BufferedImage img = new BufferedImage(TESTW, TESTH, - BufferedImage.TYPE_INT_RGB); - Graphics2D g2d = img.createGraphics(); - renderTest(g2d); - g2d.dispose(); - return img; - } - - public Dimension getPreferredSize() { - return new Dimension(TESTW, TESTH); - } - - private static void compareImages(BufferedImage refImg, - BufferedImage testImg, - int tolerance) - { - int x1 = 0; - int y1 = 0; - int x2 = refImg.getWidth(); - int y2 = refImg.getHeight(); - - for (int y = y1; y < y2; y++) { - for (int x = x1; x < x2; x++) { - Color expected = new Color(refImg.getRGB(x, y)); - Color actual = new Color(testImg.getRGB(x, y)); - if (!isSameColor(expected, actual, tolerance)) { - throw new RuntimeException("Test failed at x="+x+" y="+y+ - " (expected="+expected+ - " actual="+actual+ - ")"); - } - } - } - } - - private static boolean isSameColor(Color c1, Color c2, int e) { - int r1 = c1.getRed(); - int g1 = c1.getGreen(); - int b1 = c1.getBlue(); - int r2 = c2.getRed(); - int g2 = c2.getGreen(); - int b2 = c2.getBlue(); - int rmin = Math.max(r2-e, 0); - int gmin = Math.max(g2-e, 0); - int bmin = Math.max(b2-e, 0); - int rmax = Math.min(r2+e, 255); - int gmax = Math.min(g2+e, 255); - int bmax = Math.min(b2+e, 255); - if (r1 >= rmin && r1 <= rmax && - g1 >= gmin && g1 <= gmax && - b1 >= bmin && b1 <= bmax) - { - return true; - } - return false; - } - - public static void main(String[] args) throws Exception { - boolean show = false; - boolean dump = false; - boolean compare = false; - - for (String arg : args) { - if (arg.equals("-show")) { - show = true; - } else if (arg.equals("-dump")) { - dump = true; - } else if (arg.equals("-compare")) { - compare = true; - } else if (arg.equals("-ignore")) { - ignore = true; - } - } - - DrawBufImgOp test = new DrawBufImgOp(); - Frame frame = new Frame(); - frame.add(test); - frame.pack(); - frame.setVisible(true); - - // Wait until the component's been painted - synchronized (test) { - while (!done) { - try { - test.wait(); - } catch (InterruptedException e) { - throw new RuntimeException("Failed: Interrupted"); - } - } - } - - GraphicsConfiguration gc = frame.getGraphicsConfiguration(); - if (gc.getColorModel() instanceof IndexColorModel) { - System.out.println("IndexColorModel detected: " + - "test considered PASSED"); - frame.dispose(); - return; - } - - // Grab the screen region - BufferedImage capture = null; - try { - Robot robot = new Robot(); - Point pt1 = test.getLocationOnScreen(); - Rectangle rect = new Rectangle(pt1.x, pt1.y, TESTW, TESTH); - capture = robot.createScreenCapture(rect); - } catch (Exception e) { - throw new RuntimeException("Problems creating Robot"); - } finally { - if (!show) { - frame.dispose(); - } - } - - // Compare the images (allow for +/- 1 bit differences in color comps) - if (dump || compare) { - BufferedImage ref = test.makeReferenceImage(); - if (dump) { - ImageIO.write(ref, "png", - new File("DrawBufImgOp.ref.png")); - ImageIO.write(capture, "png", - new File("DrawBufImgOp.cap.png")); - } - if (compare) { - test.compareImages(ref, capture, 1); - } - } - } -} From f3c319be28eec4b00e5bd77a171aeb5b92ef4ccb Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 7 Apr 2026 13:53:49 +0000 Subject: [PATCH 144/223] 8342401: [TESTBUG] javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java test fails in ubuntu 22.04 on SBR Hosts Backport-of: 55787fe5f52544ea902cac35f1f552e26d954167 --- .../8223788/JSpinnerButtonFocusTest.java | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/test/jdk/javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java b/test/jdk/javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java index 4060042ca4f7..994a03959b2b 100644 --- a/test/jdk/javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java +++ b/test/jdk/javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -63,7 +63,7 @@ public static void main(String args[]) throws Exception { robot.setAutoDelay(50); SwingUtilities.invokeAndWait(() -> { - frame = new JFrame(); + frame = new JFrame("JSpinnerButtonFocusTest"); spinner1 = new JSpinner(); spinner2 = new JSpinner(); @@ -72,6 +72,15 @@ public static void main(String args[]) throws Exception { frame.getContentPane().add(spinner2, BorderLayout.SOUTH); editor1 = ((DefaultEditor)spinner1.getEditor()); + editor1.getTextField().addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + super.focusGained(e); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + latch1.countDown(); + } + }); editor1.setFocusable(false); spinner1.setFocusable(false); @@ -84,26 +93,18 @@ public static void main(String args[]) throws Exception { frame.setFocusTraversalPolicyProvider(true); frame.setAlwaysOnTop(true); - frame.pack(); + frame.setSize(100, 100); + frame.setLocationRelativeTo(null); frame.setVisible(true); }); robot.waitForIdle(); - - editor1.getTextField().addFocusListener(new FocusAdapter() { - @Override - public void focusGained(FocusEvent e) { - super.focusGained(e); - robot.keyPress(KeyEvent.VK_TAB); - robot.keyRelease(KeyEvent.VK_TAB); - latch1.countDown(); - } - }); + robot.delay(1000); SwingUtilities.invokeAndWait(() -> { editor1.getTextField().requestFocusInWindow(); }); - if (!latch1.await(15, TimeUnit.MINUTES)) { + if (!latch1.await(1, TimeUnit.MINUTES)) { throw new RuntimeException(LF.getClassName() + ": Timeout waiting for editor1 to gain focus."); } From f4d9113f427d3ad45ef1c9634d2e7c6a02f2db3d Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 7 Apr 2026 13:54:18 +0000 Subject: [PATCH 145/223] 8319540: GC: Make TestSelectDefaultGC use createTestJavaProcessBuilder Backport-of: 5f5bf1971ca622b053c4eae146298090d6944473 --- test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java b/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java index fb4787f452fe..a5e144bcd151 100644 --- a/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java +++ b/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -44,7 +44,7 @@ public static void assertVMOption(OutputAnalyzer output, String option, boolean public static void testDefaultGC(boolean actAsServer) throws Exception { // Start VM without specifying GC - OutputAnalyzer output = GCArguments.executeLimitedTestJava( + OutputAnalyzer output = GCArguments.executeTestJava( "-XX:" + (actAsServer ? "+" : "-") + "AlwaysActAsServerClassMachine", "-XX:" + (actAsServer ? "-" : "+") + "NeverActAsServerClassMachine", "-XX:+PrintFlagsFinal", From 50f0cfbee4afe9f633509a473019d90c167b0b71 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Tue, 7 Apr 2026 14:00:10 +0000 Subject: [PATCH 146/223] 8332495: java/util/logging/LoggingDeadlock2.java fails with AssertionError: Some tests failed Backport-of: 9f7779305c4ccbb86bb0e6d0ed8bc92a4b8f3b9d --- test/jdk/java/util/logging/LoggingDeadlock2.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/jdk/java/util/logging/LoggingDeadlock2.java b/test/jdk/java/util/logging/LoggingDeadlock2.java index e8a0bb49d87d..dbb804940e2a 100644 --- a/test/jdk/java/util/logging/LoggingDeadlock2.java +++ b/test/jdk/java/util/logging/LoggingDeadlock2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -309,7 +309,7 @@ private static ProcessResults run(Process p) { errAccumulator.join(); out = outAccumulator.result(); - err = errAccumulator.result(); + err = errAccumulator.result().replaceAll(".* VM warning:.* deprecated.*\\R", ""); } catch (Throwable t) { throwable = t; } From 13c334791301661ede6d4d3e15d97b7c7be38e70 Mon Sep 17 00:00:00 2001 From: Satyen Subramaniam Date: Tue, 7 Apr 2026 18:47:29 +0000 Subject: [PATCH 147/223] 8355332: Fix failing semi-manual test EDT issue Backport-of: 53924882326d3756a4ec52f37a59c8a81059a069 --- .../HorizScrollers.java | 7 +++--- .../RTLScrollers.java | 24 ++++++++----------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/HorizScrollers.java b/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/HorizScrollers.java index b584fd66da3f..61124ea1e973 100644 --- a/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/HorizScrollers.java +++ b/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/HorizScrollers.java @@ -161,8 +161,9 @@ private void showFinalReminderIfNeeded(boolean isFailure) { if (scrollAmount != 3) { JOptionPane.showMessageDialog( ConfigPanel.this.getTopLevelAncestor(), - ("Test %s. please make sure you have restored " + - "the original speed value blah blah") + ("Test %s. Please make sure you have restored " + + "the original scrolling speed in the " + + "Mouse settings.") .formatted(isFailure ? "failed" : "passed"), @@ -231,4 +232,4 @@ public void mouseWheelMoved(MouseWheelEvent e) { } } } -} \ No newline at end of file +} diff --git a/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/RTLScrollers.java b/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/RTLScrollers.java index 24e8df6fad8e..da395282bf5b 100644 --- a/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/RTLScrollers.java +++ b/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/RTLScrollers.java @@ -265,22 +265,21 @@ public static boolean runTest(int scrollAmount) } } + robot.delay(1000); SwingUtilities.invokeAndWait(() -> { rtl = new RTLScrollers(scrollAmount); rtl.setVisible(true); }); robot.delay(100); - SwingUtilities.invokeAndWait(() -> { - try { - retVal = rtl.runTests(scrollAmount); - } catch (Exception e) { - e.printStackTrace(); - } finally { + try { + retVal = rtl.runTests(scrollAmount); + } finally { + SwingUtilities.invokeAndWait(() -> { rtl.setVisible(false); rtl.dispose(); - } - }); + }); + } robot.delay(100); System.out.println("RTLS.runTest(): " + retVal); @@ -312,9 +311,8 @@ private boolean runTests(int scrollAmount) System.out.println("Testing List"); testComp(list, scrollAmount); - SwingUtilities.invokeAndWait(() -> { - applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); - }); + SwingUtilities.invokeAndWait(() -> + applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT)); robot.delay(100); System.out.println("Testing RTL Table"); @@ -467,9 +465,7 @@ public boolean testComp(TestTools comp, int scrollAmount) // Test acceleration for max scrolling // (this part should still work for RTL JList) if (scrollAmount == 30) { - SwingUtilities.invokeAndWait(() -> { - hsb.setValue(hsb.getMinimum()); - }); + SwingUtilities.invokeAndWait(() -> hsb.setValue(hsb.getMinimum())); robot.delay(100); robot.mouseWheel(2); robot.mouseWheel(2); From 703788596fc9f27bd741b4ee3741c9c003aed905 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 8 Apr 2026 07:42:15 +0000 Subject: [PATCH 148/223] 8311538: CDS InternSharedString test fails on huge pages host - cannot find shared string Backport-of: 61cc4a011eeea1b4dcc2e3571fe534f962b77045 --- .../runtime/cds/appcds/sharedStrings/InternSharedString.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/InternSharedString.java b/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/InternSharedString.java index 9a3754f422ad..74610241660c 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/InternSharedString.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/InternSharedString.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -26,7 +26,7 @@ * @test * @summary Test shared strings together with string intern operation * @requires vm.cds.write.archived.java.heap - * @requires vm.gc == null + * @requires vm.gc == null & !vm.opt.UseLargePages * @library /test/hotspot/jtreg/runtime/cds/appcds /test/lib * @compile InternStringTest.java * @build jdk.test.whitebox.WhiteBox From e9ebf3bcf94e35a7922bc3bf99957b7794923316 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 8 Apr 2026 07:46:38 +0000 Subject: [PATCH 149/223] 8318365: Test runtime/cds/appcds/sharedStrings/InternSharedString.java fails after JDK-8311538 Backport-of: 9843c97695fab3fec1e319027b14974d0e84bf0a --- .../runtime/cds/appcds/sharedStrings/InternSharedString.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/InternSharedString.java b/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/InternSharedString.java index 74610241660c..6c12e1c4d715 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/InternSharedString.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/InternSharedString.java @@ -26,7 +26,9 @@ * @test * @summary Test shared strings together with string intern operation * @requires vm.cds.write.archived.java.heap - * @requires vm.gc == null & !vm.opt.UseLargePages + * @requires vm.gc == null + * @comment CDS archive heap mapping is not supported with large pages + * @requires vm.opt.UseLargePages == null | !vm.opt.UseLargePages * @library /test/hotspot/jtreg/runtime/cds/appcds /test/lib * @compile InternStringTest.java * @build jdk.test.whitebox.WhiteBox From 803114dc5f78be5e554a3b989cf9b128a2e55971 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 8 Apr 2026 07:48:50 +0000 Subject: [PATCH 150/223] 8345618: javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java leaves Caret is not complete Backport-of: 15e06b61867a65c2b554efa6caf464b39ff8375a --- .../text/Caret/8163124/CaretFloatingPointAPITest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java b/test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java index 19d6d6a86079..c02fcfcfb907 100644 --- a/test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java +++ b/test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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 @@ -222,11 +222,11 @@ public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.draw(new Line2D.Float(c, cy, c, cy + ch)); - g2d.draw(new Line2D.Float(cx, cy, cx + cw, cy)); - g2d.draw(new Line2D.Float(cx, cy + ch, cx + cw, cy + ch)); } void repaint(Rectangle r) { + r.width += 1; + r.height += 1; component.repaint(r); } @@ -424,6 +424,8 @@ protected void adjustVisibility(Rectangle nloc) { protected synchronized void damage(Rectangle r) { if (r != null && component != null) { + r.width += 1; + r.height += 1; component.repaint(r); } } From 5cd69385f64952617d9183446b87c1d07ec6f201 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 8 Apr 2026 07:51:20 +0000 Subject: [PATCH 151/223] 8357082: Stabilize and add debug logs to CopyAreaOOB.java Backport-of: e490b4f04dd094db996cdc4f664c2ed1a7ea2ade --- test/jdk/ProblemList.txt | 1 - test/jdk/java/awt/Graphics2D/CopyAreaOOB.java | 152 ++++++++++++------ 2 files changed, 103 insertions(+), 50 deletions(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 5a223b6f0d30..e8a93f5796ef 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -487,7 +487,6 @@ java/awt/MenuBar/TestNoScreenMenuBar.java 8265987 macosx-all java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java 8266283 generic-all java/awt/Graphics2D/DrawString/RotTransText.java 8316878 linux-all -java/awt/Graphics2D/CopyAreaOOB.java 8343106 macosx-aarch64 java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java 8257529 windows-x64 java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeForModalDialogTest/ConsumeForModalDialogTest.java 8302787 windows-all java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedTest.java 8302787 windows-all diff --git a/test/jdk/java/awt/Graphics2D/CopyAreaOOB.java b/test/jdk/java/awt/Graphics2D/CopyAreaOOB.java index 8d218d9f1891..27a1a3a868a9 100644 --- a/test/jdk/java/awt/Graphics2D/CopyAreaOOB.java +++ b/test/jdk/java/awt/Graphics2D/CopyAreaOOB.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -26,17 +26,75 @@ * @key headful * @bug 6430601 8198613 * @summary Verifies that copyArea() works properly when the - * destination parameters are outside the destination bounds. + * destination parameters are outside the destination bounds. * @run main/othervm CopyAreaOOB - * @author campbelc */ -import java.awt.*; -import java.awt.image.*; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.image.BufferedImage; +import java.awt.image.MultiResolutionImage; +import java.awt.image.RenderedImage; +import java.io.File; +import java.io.IOException; +import java.util.List; + +import javax.imageio.ImageIO; public class CopyAreaOOB extends Canvas { + private static Frame frame; + private static Robot robot; + private static BufferedImage captureImg; - private static Robot robot = null; + private static StringBuffer errorLog = new StringBuffer(); + + private static final Point OFF_FRAME_LOC = new Point(50, 50); + private static final int SIZE = 400; + + public static void main(String[] args) throws Exception { + try { + robot = new Robot(); + + // added to move mouse pointer away from test UI + // so that it is not captured in the screenshot + robot.mouseMove(OFF_FRAME_LOC.x, OFF_FRAME_LOC.y); + robot.waitForIdle(); + robot.delay(100); + + createTestUI(); + robot.delay(1000); + + if (!errorLog.isEmpty()) { + saveImages(); + throw new RuntimeException("Test failed: \n" + errorLog.toString()); + } + } finally { + if (frame != null) { + frame.dispose(); + } + } + } + + private static void createTestUI() { + CopyAreaOOB canvas = new CopyAreaOOB(); + frame = new Frame(); + frame.setUndecorated(true); + frame.add(canvas); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } public void paint(Graphics g) { int w = getWidth(); @@ -50,73 +108,69 @@ public void paint(Graphics g) { g2d.fillRect(0, 0, w, 10); g2d.setColor(Color.red); - g2d.fillRect(0, 10, 50, h-10); + g2d.fillRect(0, 10, 50, h - 10); // copy the region such that part of it goes below the bottom of the // destination surface - g2d.copyArea(0, 10, 50, h-10, 60, 10); + g2d.copyArea(0, 10, 50, h - 10, 60, 10); Toolkit.getDefaultToolkit().sync(); - BufferedImage capture = null; - try { - Thread.sleep(500); - if (robot == null) robot = new Robot(); - Point pt1 = getLocationOnScreen(); - Rectangle rect = new Rectangle(pt1.x, pt1.y, 400, 400); - capture = robot.createScreenCapture(rect); - } catch (Exception e) { - throw new RuntimeException("Problems handling Robot"); - } + robot.delay(500); + + Point pt1 = this.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, SIZE, SIZE); + captureImg = robot.createScreenCapture(rect); + // Test pixels - testRegion(capture, "green", 0, 0, 400, 10, 0xff00ff00); - testRegion(capture, "original red", 0, 10, 50, 400, 0xffff0000); - testRegion(capture, "background", 50, 10, 60, 400, 0xff000000); - testRegion(capture, "in-between", 60, 10, 110, 20, 0xff000000); - testRegion(capture, "copied red", 60, 20, 110, 400, 0xffff0000); - testRegion(capture, "background", 110, 10, 400, 400, 0xff000000); + testRegion("green", 0, 0, 400, 10, 0xff00ff00); + testRegion("original-red", 0, 10, 50, 400, 0xffff0000); + testRegion("background", 50, 10, 60, 400, 0xff000000); + testRegion("in-between", 60, 10, 110, 20, 0xff000000); + testRegion("copied-red", 60, 20, 110, 400, 0xffff0000); + testRegion("background", 110, 10, 400, 400, 0xff000000); } public Dimension getPreferredSize() { - return new Dimension(400, 400); + return new Dimension(SIZE, SIZE); } - private static void testRegion(BufferedImage bi, String name, + private static void testRegion(String region, int x1, int y1, int x2, int y2, - int expected) - { + int expected) { + System.out.print("Test region: " + region); for (int y = y1; y < y2; y++) { for (int x = x1; x < x2; x++) { - int actual = bi.getRGB(x, y); + int actual = captureImg.getRGB(x, y); if (actual != expected) { - throw new RuntimeException("Test failed for " + name + - " region at x="+x+" y="+y+ - " (expected="+ - Integer.toHexString(expected) + - " actual="+ - Integer.toHexString(actual) + - ")"); + System.out.print(" Status: FAILED\n"); + errorLog.append("Test failed for " + region + + " region at x: " + x + " y: " + y + + " (expected: " + + Integer.toHexString(expected) + + " actual: " + + Integer.toHexString(actual) + ")\n"); + return; } } } + System.out.print(" Status: PASSED\n"); } - public static void main(String[] args) { - boolean show = (args.length == 1) && ("-show".equals(args[0])); + private static void saveImages() { + GraphicsConfiguration ge = GraphicsEnvironment.getLocalGraphicsEnvironment() + .getDefaultScreenDevice() + .getDefaultConfiguration(); - CopyAreaOOB test = new CopyAreaOOB(); - Frame frame = new Frame(); - frame.setUndecorated(true); - frame.add(test); - frame.pack(); - frame.setLocationRelativeTo(null); - frame.setVisible(true); + MultiResolutionImage mrImage = robot.createMultiResolutionScreenCapture(ge.getBounds()); + List variants = mrImage.getResolutionVariants(); + RenderedImage screenCapture = (RenderedImage) variants.get(variants.size() - 1); try { - Thread.sleep(3000); - } catch (InterruptedException ex) {} - if (!show) { - frame.dispose(); + ImageIO.write(screenCapture, "png", new File("fullscreen.png")); + ImageIO.write(captureImg, "png", new File("canvas.png")); + } catch (IOException e) { + System.err.println("Can't write image " + e); } } } From 593d15fe6b74a380ccb9b2288e6eea4c2bf0c768 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 8 Apr 2026 07:53:32 +0000 Subject: [PATCH 152/223] 8015444: java/awt/Focus/KeyStrokeTest.java sometimes fails Backport-of: de43a34b0e9056dfead8b4a5dfb48c7b7271d2ee --- test/jdk/java/awt/Focus/KeyStrokeTest.java | 79 +++++++++++----------- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/test/jdk/java/awt/Focus/KeyStrokeTest.java b/test/jdk/java/awt/Focus/KeyStrokeTest.java index 7c462ce8f22d..668bc1216c89 100644 --- a/test/jdk/java/awt/Focus/KeyStrokeTest.java +++ b/test/jdk/java/awt/Focus/KeyStrokeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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,9 +29,9 @@ * @run main KeyStrokeTest */ -import java.awt.BorderLayout; import java.awt.Button; import java.awt.Dialog; +import java.awt.EventQueue; import java.awt.Frame; import java.awt.Robot; import java.awt.TextField; @@ -39,25 +39,53 @@ import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; public class KeyStrokeTest { static boolean keyTyped; static Frame frame; + static Robot robot; + static final CountDownLatch latch = new CountDownLatch(1); public static void main(String[] args) throws Exception { + robot = new Robot(); try { - KeyStrokeTest test = new KeyStrokeTest(); - test.doTest(); - } finally { - if (frame != null) { - frame.dispose(); + EventQueue.invokeAndWait(() -> { + KeyStrokeTest test = new KeyStrokeTest(); + test.initTest(); + }); + robot.waitForIdle(); + robot.delay(1000); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + + robot.delay(1000); + robot.keyPress(KeyEvent.VK_SPACE); + robot.keyRelease(KeyEvent.VK_SPACE); + + robot.delay(1000); + robot.keyPress(KeyEvent.VK_A); + robot.keyRelease(KeyEvent.VK_A); + try { + latch.await(3, TimeUnit.SECONDS); + } catch (InterruptedException e) {} + if (!keyTyped) { + throw new + RuntimeException("First keystroke after JDialog is closed is lost"); } + System.out.println("Test passed"); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); } } - private static void doTest() throws Exception { - final Object monitor = new Object(); - frame = new Frame(); + private static void initTest() { + frame = new Frame("KeyStrokeTest"); TextField textField = new TextField() { public void transferFocus() { System.err.println("transferFocus()"); @@ -71,6 +99,7 @@ public void actionPerformed(ActionEvent e) { }); dialog.add(btn); dialog.setSize(200, 200); + dialog.setLocationRelativeTo(null); dialog.setVisible(true); } }; @@ -81,38 +110,12 @@ public void keyTyped(KeyEvent e) { if (e.getKeyChar() == 'a') { keyTyped = true; } - - synchronized (monitor) { - monitor.notifyAll(); - } + latch.countDown(); } }); frame.add(textField); frame.setSize(400, 400); + frame.setLocationRelativeTo(null); frame.setVisible(true); - - Robot robot = new Robot(); - robot.waitForIdle(); - robot.delay(1000); - robot.keyPress(KeyEvent.VK_TAB); - robot.keyRelease(KeyEvent.VK_TAB); - - robot.delay(1000); - robot.keyPress(KeyEvent.VK_SPACE); - robot.keyRelease(KeyEvent.VK_SPACE); - - robot.delay(1000); - synchronized (monitor) { - robot.keyPress(KeyEvent.VK_A); - robot.keyRelease(KeyEvent.VK_A); - monitor.wait(3000); - } - - if (!keyTyped) { - throw new RuntimeException("TEST FAILED"); - } - - System.out.println("Test passed"); } - } From bd8e64ea3be19dcccc2bfbdda3b8b9186fa63ff6 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 8 Apr 2026 07:55:49 +0000 Subject: [PATCH 153/223] 8318662: Refactor some jdk/java/net/httpclient/http2 tests to JUnit Reviewed-by: mbaesken Backport-of: 3d5b0d70cba26e6a666214fcc86d370638b73fe5 --- .../net/httpclient/http2/BadHeadersTest.java | 47 +++++----- .../java/net/httpclient/http2/BasicTest.java | 7 +- .../http2/ConnectionFlowControlTest.java | 91 +++++++------------ .../http2/ContinuationFrameTest.java | 57 ++++++------ 4 files changed, 89 insertions(+), 113 deletions(-) diff --git a/test/jdk/java/net/httpclient/http2/BadHeadersTest.java b/test/jdk/java/net/httpclient/http2/BadHeadersTest.java index 062b4c89e09b..12270d41818a 100644 --- a/test/jdk/java/net/httpclient/http2/BadHeadersTest.java +++ b/test/jdk/java/net/httpclient/http2/BadHeadersTest.java @@ -26,7 +26,7 @@ * @bug 8303965 * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext - * @run testng/othervm -Djdk.internal.httpclient.debug=true BadHeadersTest + * @run junit/othervm -Djdk.internal.httpclient.debug=true BadHeadersTest */ import jdk.internal.net.http.common.HttpHeadersBuilder; @@ -35,10 +35,10 @@ import jdk.internal.net.http.frame.HeadersFrame; import jdk.internal.net.http.frame.Http2Frame; import jdk.test.lib.net.SimpleSSLContext; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import java.io.IOException; @@ -57,6 +57,7 @@ import java.util.Map.Entry; import java.util.concurrent.ExecutionException; import java.util.function.BiFunction; + import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.httpclient.test.lib.http2.Http2TestExchange; import jdk.httpclient.test.lib.http2.Http2TestExchangeImpl; @@ -65,8 +66,9 @@ import jdk.httpclient.test.lib.http2.Http2TestServerConnection; import static java.util.List.of; import static java.util.Map.entry; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; // Code copied from ContinuationFrameTest public class BadHeadersTest { @@ -79,11 +81,11 @@ public class BadHeadersTest { of(entry("hello", "world!"), entry(":status", "200")) // Pseudo header is not the first one ); - SSLContext sslContext; - Http2TestServer http2TestServer; // HTTP/2 ( h2c ) - Http2TestServer https2TestServer; // HTTP/2 ( h2 ) - String http2URI; - String https2URI; + private static SSLContext sslContext; + private static Http2TestServer http2TestServer; // HTTP/2 ( h2c ) + private static Http2TestServer https2TestServer; // HTTP/2 ( h2 ) + private static String http2URI; + private static String https2URI; /** * A function that returns a list of 1) a HEADERS frame ( with an empty @@ -121,8 +123,7 @@ public class BadHeadersTest { return frames; }; - @DataProvider(name = "variants") - public Object[][] variants() { + static Object[][] variants() { return new Object[][] { { http2URI, false, oneContinuation }, { https2URI, false, oneContinuation }, @@ -136,8 +137,8 @@ public Object[][] variants() { }; } - - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") void test(String uri, boolean sameClient, BiFunction,List> headerFramesSupplier) @@ -166,7 +167,8 @@ void test(String uri, } } - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") void testAsync(String uri, boolean sameClient, BiFunction,List> headerFramesSupplier) @@ -204,8 +206,7 @@ void testAsync(String uri, // sync with implementation. static void assertDetailMessage(Throwable throwable, int iterationIndex) { try { - assertTrue(throwable instanceof IOException, - "Expected IOException, got, " + throwable); + assertInstanceOf(IOException.class, throwable, "Expected IOException, got " + throwable); assertTrue(throwable.getMessage().contains("malformed response"), "Expected \"malformed response\" in: " + throwable.getMessage()); @@ -226,8 +227,8 @@ static void assertDetailMessage(Throwable throwable, int iterationIndex) { } } - @BeforeTest - public void setup() throws Exception { + @BeforeAll + static void setup() throws Exception { sslContext = new SimpleSSLContext().get(); if (sslContext == null) throw new AssertionError("Unexpected null sslContext"); @@ -251,8 +252,8 @@ public void setup() throws Exception { https2TestServer.start(); } - @AfterTest - public void teardown() throws Exception { + @AfterAll + static void teardown() throws Exception { http2TestServer.stop(); https2TestServer.stop(); } diff --git a/test/jdk/java/net/httpclient/http2/BasicTest.java b/test/jdk/java/net/httpclient/http2/BasicTest.java index 9d54c8c39e0b..0c64be84926c 100644 --- a/test/jdk/java/net/httpclient/http2/BasicTest.java +++ b/test/jdk/java/net/httpclient/http2/BasicTest.java @@ -32,7 +32,7 @@ * jdk.test.lib.Asserts * jdk.test.lib.Utils * jdk.test.lib.net.SimpleSSLContext - * @run testng/othervm -Djdk.httpclient.HttpClient.log=ssl,requests,responses,errors BasicTest + * @run junit/othervm -Djdk.httpclient.HttpClient.log=ssl,requests,responses,errors BasicTest */ import java.io.IOException; @@ -53,14 +53,13 @@ import jdk.httpclient.test.lib.http2.Http2TestExchange; import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.test.lib.net.SimpleSSLContext; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import static java.net.http.HttpClient.Version.HTTP_2; import static jdk.test.lib.Asserts.assertFileContentsEqual; import static jdk.test.lib.Utils.createTempFile; import static jdk.test.lib.Utils.createTempFileOfSize; -@Test public class BasicTest { private static final String TEMP_FILE_PREFIX = @@ -127,7 +126,7 @@ public void handle(Http2TestExchange exchange) throws IOException { } @Test - public static void test() throws Exception { + void test() throws Exception { try { initialize(); warmup(false); diff --git a/test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java b/test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java index 30cc9122d9dc..1eaf331c2610 100644 --- a/test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java +++ b/test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -27,7 +27,7 @@ * @summary checks connection flow control * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext - * @run testng/othervm -Djdk.internal.httpclient.debug=true + * @run junit/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.connectionWindowSize=65535 * -Djdk.httpclient.windowsize=16384 * ConnectionFlowControlTest @@ -43,23 +43,13 @@ import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; -import java.net.http.HttpResponse.BodyHandler; import java.net.http.HttpResponse.BodyHandlers; -import java.net.http.HttpResponse.BodySubscriber; -import java.net.http.HttpResponse.ResponseInfo; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; -import java.util.Map.Entry; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionStage; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; -import java.util.concurrent.Flow.Subscription; import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.BiFunction; import java.util.function.Consumer; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; @@ -72,44 +62,34 @@ import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.httpclient.test.lib.http2.Http2TestServerConnection; import jdk.internal.net.http.common.HttpHeadersBuilder; -import jdk.internal.net.http.frame.ContinuationFrame; -import jdk.internal.net.http.frame.HeaderFrame; -import jdk.internal.net.http.frame.HeadersFrame; -import jdk.internal.net.http.frame.Http2Frame; import jdk.internal.net.http.frame.SettingsFrame; import jdk.test.lib.Utils; import jdk.test.lib.net.SimpleSSLContext; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; -import static java.util.List.of; -import static java.util.Map.entry; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; public class ConnectionFlowControlTest { - SSLContext sslContext; - HttpTestServer http2TestServer; // HTTP/2 ( h2c ) - HttpTestServer https2TestServer; // HTTP/2 ( h2 ) - String http2URI; - String https2URI; - final AtomicInteger reqid = new AtomicInteger(); + private static SSLContext sslContext; + private static HttpTestServer http2TestServer; // HTTP/2 ( h2c ) + private static HttpTestServer https2TestServer; // HTTP/2 ( h2 ) + private static String http2URI; + private static String https2URI; + private final AtomicInteger reqid = new AtomicInteger(); - - @DataProvider(name = "variants") - public Object[][] variants() { + static Object[][] variants() { return new Object[][] { { http2URI }, { https2URI }, }; } - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") void test(String uri) throws Exception { System.out.printf("%ntesting %s%n", uri); ConcurrentHashMap> responseSent = new ConcurrentHashMap<>(); @@ -148,7 +128,7 @@ void test(String uri) throws Exception { if (i < max - 1) { // the connection window might be exceeded at i == max - 2, which // means that the last request could go on a new connection. - assertEquals(ckey, label, "Unexpected key for " + query); + assertEquals(label, ckey, "Unexpected key for " + query); } } catch (AssertionError ass) { // since we won't pull all responses, the client @@ -174,7 +154,7 @@ void test(String uri) throws Exception { if (i < max - 1) { // the connection window might be exceeded at i == max - 2, which // means that the last request could go on a new connection. - assertEquals(ckey, label, "Unexpected key for " + query); + assertEquals(label, ckey, "Unexpected key for " + query); } int wait = uri.startsWith("https://") ? 500 : 250; try (InputStream is = response.body()) { @@ -227,7 +207,7 @@ void test(String uri) throws Exception { var response = client.send(request, BodyHandlers.ofString()); if (label != null) { String ckey = response.headers().firstValue("X-Connection-Key").get(); - assertNotEquals(ckey, label); + assertNotEquals(label, ckey); System.out.printf("last request %s sent on different connection as expected:" + "\n\tlast: %s\n\tprevious: %s%n", query, ckey, label); } @@ -258,33 +238,33 @@ static void assertDetailMessage(Throwable throwable, int iterationIndex) { } } - @BeforeTest - public void setup() throws Exception { + @BeforeAll + static void setup() throws Exception { sslContext = new SimpleSSLContext().get(); if (sslContext == null) throw new AssertionError("Unexpected null sslContext"); - var http2TestServer = new Http2TestServer("localhost", false, 0); - http2TestServer.addHandler(new Http2TestHandler(), "/http2/"); - this.http2TestServer = HttpTestServer.of(http2TestServer); - http2URI = "http://" + this.http2TestServer.serverAuthority() + "/http2/x"; + var http2TestServerLocal = new Http2TestServer("localhost", false, 0); + http2TestServerLocal.addHandler(new Http2TestHandler(), "/http2/"); + http2TestServer = HttpTestServer.of(http2TestServerLocal); + http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/x"; - var https2TestServer = new Http2TestServer("localhost", true, sslContext); - https2TestServer.addHandler(new Http2TestHandler(), "/https2/"); - this.https2TestServer = HttpTestServer.of(https2TestServer); - https2URI = "https://" + this.https2TestServer.serverAuthority() + "/https2/x"; + var https2TestServerLocal = new Http2TestServer("localhost", true, sslContext); + https2TestServerLocal.addHandler(new Http2TestHandler(), "/https2/"); + https2TestServer = HttpTestServer.of(https2TestServerLocal); + https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/x"; // Override the default exchange supplier with a custom one to enable // particular test scenarios - http2TestServer.setExchangeSupplier(FCHttp2TestExchange::new); - https2TestServer.setExchangeSupplier(FCHttp2TestExchange::new); + http2TestServerLocal.setExchangeSupplier(FCHttp2TestExchange::new); + https2TestServerLocal.setExchangeSupplier(FCHttp2TestExchange::new); - this.http2TestServer.start(); - this.https2TestServer.start(); + http2TestServer.start(); + https2TestServer.start(); } - @AfterTest - public void teardown() throws Exception { + @AfterAll + static void teardown() throws Exception { http2TestServer.stop(); https2TestServer.stop(); } @@ -364,6 +344,5 @@ public void responseSent(String query) { System.out.println("Server: response sent for " + query); responseSentCB.accept(query); } - } } diff --git a/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java b/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java index 04ce8f4f4a41..22b7f414126d 100644 --- a/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java +++ b/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -27,7 +27,7 @@ * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @compile ../ReferenceTracker.java - * @run testng/othervm ContinuationFrameTest + * @run junit/othervm ContinuationFrameTest */ import java.io.IOException; @@ -59,25 +59,24 @@ import jdk.httpclient.test.lib.http2.Http2TestServerConnection; import jdk.test.lib.net.SimpleSSLContext; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import static java.lang.System.out; import static java.net.http.HttpClient.Version.HTTP_2; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ContinuationFrameTest { - SSLContext sslContext; - Http2TestServer http2TestServer; // HTTP/2 ( h2c ) - Http2TestServer https2TestServer; // HTTP/2 ( h2 ) - String http2URI; - String https2URI; - String noBodyhttp2URI; - String noBodyhttps2URI; - final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; + private static SSLContext sslContext; + private static Http2TestServer http2TestServer; // HTTP/2 ( h2c ) + private static Http2TestServer https2TestServer; // HTTP/2 ( h2 ) + private static String http2URI; + private static String https2URI; + private static String noBodyhttp2URI; + private static String noBodyhttps2URI; + private final static ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; /** * A function that returns a list of 1) a HEADERS frame ( with an empty @@ -132,8 +131,7 @@ public class ContinuationFrameTest { return frames; }; - @DataProvider(name = "variants") - public Object[][] variants() { + static Object[][] variants() { return new Object[][] { { http2URI, false, oneContinuation }, { https2URI, false, oneContinuation }, @@ -154,7 +152,8 @@ public Object[][] variants() { static final int ITERATION_COUNT = 20; - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") void test(String uri, boolean sameClient, BiFunction,List> headerFramesSupplier) @@ -184,22 +183,20 @@ void test(String uri, if(uri.contains("nobody")) { out.println("Got response: " + resp); - assertTrue(resp.statusCode() == 204, - "Expected 204, got:" + resp.statusCode()); - assertEquals(resp.version(), HTTP_2); + assertEquals(204, resp.statusCode(), "Expected 204, got:" + resp.statusCode()); + assertEquals(HTTP_2, resp.version()); continue; } out.println("Got response: " + resp); out.println("Got body: " + resp.body()); - assertTrue(resp.statusCode() == 200, - "Expected 200, got:" + resp.statusCode()); - assertEquals(resp.body(), "Hello there!"); - assertEquals(resp.version(), HTTP_2); + assertEquals(200, resp.statusCode(), "Expected 200, got:" + resp.statusCode()); + assertEquals("Hello there!", resp.body()); + assertEquals(HTTP_2, resp.version()); } } - @BeforeTest - public void setup() throws Exception { + @BeforeAll + static void setup() throws Exception { sslContext = new SimpleSSLContext().get(); if (sslContext == null) throw new AssertionError("Unexpected null sslContext"); @@ -227,8 +224,8 @@ public void setup() throws Exception { https2TestServer.start(); } - @AfterTest - public void teardown() throws Exception { + @AfterAll + static void teardown() throws Exception { AssertionError fail = TRACKER.check(500); try { http2TestServer.stop(); From 9f63b49938221fc5a3b8b0ef88d21414066929bd Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 8 Apr 2026 07:57:57 +0000 Subject: [PATCH 154/223] 8368335: Refactor the rest of Locale TestNG based tests to JUnit Reviewed-by: mbaesken Backport-of: 5d93242028dfc68b838a8efb0fbc4de3fea7fa0d --- .../java/util/Locale/LocaleMatchingTest.java | 186 ++++++++++-------- .../Locale/RequiredAvailableLocalesTest.java | 35 ++-- test/jdk/java/util/Locale/TestOf.java | 50 ++--- .../util/Locale/bcp47u/CalendarTests.java | 63 +++--- .../Locale/bcp47u/CurrencyFormatTests.java | 19 +- .../util/Locale/bcp47u/CurrencyTests.java | 31 ++- .../util/Locale/bcp47u/DisplayNameTests.java | 19 +- .../java/util/Locale/bcp47u/FormatTests.java | 49 +++-- .../java/util/Locale/bcp47u/SymbolsTests.java | 33 ++-- .../Locale/bcp47u/SystemPropertyTests.java | 25 ++- 10 files changed, 263 insertions(+), 247 deletions(-) diff --git a/test/jdk/java/util/Locale/LocaleMatchingTest.java b/test/jdk/java/util/Locale/LocaleMatchingTest.java index 975e4567e18b..4509968b4e48 100644 --- a/test/jdk/java/util/Locale/LocaleMatchingTest.java +++ b/test/jdk/java/util/Locale/LocaleMatchingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -25,9 +25,13 @@ * @test * @bug 7069824 8042360 8032842 8175539 8210443 8242010 8276302 * @summary Verify implementation for Locale matching. - * @run testng/othervm LocaleMatchingTest + * @run junit/othervm LocaleMatchingTest */ +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -40,15 +44,14 @@ import static java.util.Locale.FilteringMode.*; import static java.util.Locale.LanguageRange.*; -import static org.testng.Assert.*; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; public class LocaleMatchingTest { - @DataProvider(name = "LRConstructorData") - Object[][] LRConstructorData() { + static Object[][] LRConstructorData() { return new Object[][] { // Range, Weight {"elvish", MAX_WEIGHT}, @@ -62,8 +65,7 @@ Object[][] LRConstructorData() { }; } - @DataProvider(name = "LRConstructorNPEData") - Object[][] LRConstructorNPEData() { + static Object[][] LRConstructorNPEData() { return new Object[][] { // Range, Weight {null, MAX_WEIGHT}, @@ -71,8 +73,7 @@ Object[][] LRConstructorNPEData() { }; } - @DataProvider(name = "LRConstructorIAEData") - Object[][] LRConstructorIAEData() { + static Object[][] LRConstructorIAEData() { return new Object[][] { // Range, Weight {"ja", -0.8}, @@ -93,8 +94,7 @@ Object[][] LRConstructorIAEData() { }; } - @DataProvider(name = "LRParseData") - Object[][] LRParseData() { + static Object[][] LRParseData() { return new Object[][] { // Ranges, Expected result {"Accept-Language: fr-FX, de-DE;q=0.5, fr-tp-x-FOO;q=0.1, " @@ -139,8 +139,7 @@ Object[][] LRParseData() { }; } - @DataProvider(name = "LRParseIAEData") - Object[][] LRParseIAEData() { + static Object[][] LRParseIAEData() { return new Object[][] { // Ranges {""}, @@ -148,8 +147,7 @@ Object[][] LRParseIAEData() { }; } - @DataProvider(name = "LRMapEquivalentsData") - Object[][] LRMapEquivalentsData() { + static Object[][] LRMapEquivalentsData() { return new Object[][] { // Ranges, Map, Expected result {LanguageRange.parse("zh, zh-TW;q=0.8, ar;q=0.9, EN, zh-HK, ja-JP;q=0.2, es;q=0.4"), @@ -181,8 +179,7 @@ Object[][] LRMapEquivalentsData() { }; } - @DataProvider(name = "LFilterData") - Object[][] LFilterData() { + static Object[][] LFilterData() { return new Object[][] { // Range, LanguageTags, FilteringMode, Expected locales {"ja-JP, fr-FR", "de-DE, en, ja-JP-hepburn, fr, he, ja-Latn-JP", @@ -203,8 +200,7 @@ Object[][] LFilterData() { }; } - @DataProvider(name = "LFilterNPEData") - Object[][] LFilterNPEData() { + static Object[][] LFilterNPEData() { return new Object[][] { // Range, LanguageTags, FilteringMode {"en;q=0.2, ja-*-JP, fr-JP", null, REJECT_EXTENDED_RANGES}, @@ -212,8 +208,7 @@ Object[][] LFilterNPEData() { }; } - @DataProvider(name = "LFilterTagsData") - Object[][] LFilterTagsData() { + static Object[][] LFilterTagsData() { return new Object[][] { // Range, LanguageTags, FilteringMode, Expected language tags {"fr-FR, fr-BG;q=0.8, *;q=0.5, en;q=0", "en-US, fr-FR, fr-CA, fr-BG", @@ -274,8 +269,7 @@ Object[][] LFilterTagsData() { }; } - @DataProvider(name = "LLookupData") - Object[][] LLookupData() { + static Object[][] LLookupData() { return new Object[][] { // Range, LanguageTags, Expected locale {"en;q=0.2, *-JP;q=0.6, iw", "de-DE, en, ja-JP-hepburn, fr-JP, he", "he"}, @@ -284,8 +278,7 @@ Object[][] LLookupData() { }; } - @DataProvider(name = "LLookupTagData") - Object[][] LLookupTagData() { + static Object[][] LLookupTagData() { return new Object[][] { // Range, LanguageTags, Expected language tag {"en, *", "es, de, ja-JP", null}, @@ -298,117 +291,135 @@ Object[][] LLookupTagData() { } @Test - public void testLRConstants() { - assertEquals(MIN_WEIGHT, 0.0, " MIN_WEIGHT should be 0.0 but got " + void testLRConstants() { + assertEquals(0.0, MIN_WEIGHT, " MIN_WEIGHT should be 0.0 but got " + MIN_WEIGHT); - assertEquals(MAX_WEIGHT, 1.0, " MAX_WEIGHT should be 1.0 but got " + assertEquals(1.0, MAX_WEIGHT, " MAX_WEIGHT should be 1.0 but got " + MAX_WEIGHT); } - @Test(dataProvider = "LRConstructorData") - public void testLRConstructors(String range, double weight) { + @MethodSource("LRConstructorData") + @ParameterizedTest + void testLRConstructors(String range, double weight) { LanguageRange lr; if (weight == MAX_WEIGHT) { lr = new LanguageRange(range); } else { lr = new LanguageRange(range, weight); } - assertEquals(lr.getRange(), range.toLowerCase(Locale.ROOT), + assertEquals(range.toLowerCase(Locale.ROOT), lr.getRange(), " LR.getRange() returned unexpected value. Expected: " + range.toLowerCase(Locale.ROOT) + ", got: " + lr.getRange()); - assertEquals(lr.getWeight(), weight, + assertEquals(weight, lr.getWeight(), " LR.getWeight() returned unexpected value. Expected: " + weight + ", got: " + lr.getWeight()); } - @Test(dataProvider = "LRConstructorNPEData", expectedExceptions = NullPointerException.class) - public void testLRConstructorNPE(String range, double weight) { + @MethodSource("LRConstructorNPEData") + @ParameterizedTest + void testLRConstructorNPE(String range, double weight) { if (weight == MAX_WEIGHT) { - new LanguageRange(range); + assertThrows(NullPointerException.class, () -> new LanguageRange(range)); } else { - new LanguageRange(range, weight); + assertThrows(NullPointerException.class, () -> new LanguageRange(range, weight)); } } - @Test(dataProvider = "LRConstructorIAEData", expectedExceptions = IllegalArgumentException.class) - public void testLRConstructorIAE(String range, double weight) { + @MethodSource("LRConstructorIAEData") + @ParameterizedTest + void testLRConstructorIAE(String range, double weight) { if (weight == MAX_WEIGHT) { - new LanguageRange(range); + assertThrows(IllegalArgumentException.class, () -> new LanguageRange(range)); } else { - new LanguageRange(range, weight); + assertThrows(IllegalArgumentException.class, () -> new LanguageRange(range, weight)); } } @Test - public void testLREquals() { + void testLREquals() { LanguageRange lr1 = new LanguageRange("ja", 1.0); LanguageRange lr2 = new LanguageRange("ja"); LanguageRange lr3 = new LanguageRange("ja", 0.1); LanguageRange lr4 = new LanguageRange("en", 1.0); - assertEquals(lr1, lr2, " LR(ja, 1.0).equals(LR(ja)) should return true."); - assertNotEquals(lr1, lr3, " LR(ja, 1.0).equals(LR(ja, 0.1)) should return false."); - assertNotEquals(lr1, lr4, " LR(ja, 1.0).equals(LR(en, 1.0)) should return false."); + assertEquals(lr2, lr1, " LR(ja, 1.0).equals(LR(ja)) should return true."); + assertNotEquals(lr3, lr1, " LR(ja, 1.0).equals(LR(ja, 0.1)) should return false."); + assertNotEquals(lr4, lr1, " LR(ja, 1.0).equals(LR(en, 1.0)) should return false."); assertNotNull(lr1, " LR(ja, 1.0).equals(null) should return false."); - assertNotEquals(lr1, "", " LR(ja, 1.0).equals(\"\") should return false."); + assertNotEquals("", lr1, " LR(ja, 1.0).equals(\"\") should return false."); } - @Test(dataProvider = "LRParseData") - public void testLRParse(String ranges, List expected) { - assertEquals(LanguageRange.parse(ranges), expected, + @MethodSource("LRParseData") + @ParameterizedTest + void testLRParse(String ranges, List expected) { + assertEquals(expected, LanguageRange.parse(ranges), " LR.parse(" + ranges + ") test failed."); } - @Test(expectedExceptions = NullPointerException.class) - public void testLRParseNPE() { - LanguageRange.parse(null); + @Test + void testLRParseNPE() { + assertThrows(NullPointerException.class, () -> LanguageRange.parse(null)); } - @Test(dataProvider = "LRParseIAEData", expectedExceptions = IllegalArgumentException.class) - public void testLRParseIAE(String ranges) { - LanguageRange.parse(ranges); + @MethodSource("LRParseIAEData") + @ParameterizedTest + void testLRParseIAE(String ranges) { + assertThrows(IllegalArgumentException.class, () -> LanguageRange.parse(ranges)); } - @Test(dataProvider = "LRMapEquivalentsData") - public void testLRMapEquivalents(List priorityList, + @MethodSource("LRMapEquivalentsData") + @ParameterizedTest + void testLRMapEquivalents(List priorityList, Map> map, List expected) { - assertEquals(LanguageRange.mapEquivalents(priorityList, map), expected, + assertEquals(expected, LanguageRange.mapEquivalents(priorityList, map), " LR.mapEquivalents() test failed."); } - @Test(expectedExceptions = NullPointerException.class) - public void testLRMapEquivalentsNPE() { - LanguageRange.mapEquivalents(null, Map.of("ja", List.of("ja", "ja-Hira"))); + @Test + void testLRMapEquivalentsNPE() { + assertThrows(NullPointerException.class, + () -> LanguageRange.mapEquivalents(null, Map.of("ja", List.of("ja", "ja-Hira")))); } - @Test(dataProvider = "LFilterData") - public void testLFilter(String ranges, String tags, FilteringMode mode, String expectedLocales) { + @MethodSource("LFilterData") + @ParameterizedTest + void testLFilter(String ranges, String tags, FilteringMode mode, String expectedLocales) { List priorityList = LanguageRange.parse(ranges); List tagList = generateLocales(tags); String actualLocales = showLocales(Locale.filter(priorityList, tagList, mode)); - assertEquals(actualLocales, expectedLocales, showErrorMessage(" L.Filter(" + mode + ")", + assertEquals(expectedLocales, actualLocales, showErrorMessage(" L.Filter(" + mode + ")", ranges, tags, expectedLocales, actualLocales)); } - @Test(dataProvider = "LFilterNPEData", expectedExceptions = NullPointerException.class) - public void testLFilterNPE(String ranges, String tags, FilteringMode mode) { - List priorityList = LanguageRange.parse(ranges); - List tagList = generateLocales(tags); - showLocales(Locale.filter(priorityList, tagList, mode)); + @MethodSource("LFilterNPEData") + @ParameterizedTest + void testLFilterNPE(String ranges, String tags, FilteringMode mode) { + if (ranges == null) { + // Ranges are null + assertThrows(NullPointerException.class, () -> LanguageRange.parse(ranges)); + } else { + // Tags are null + List priorityList = LanguageRange.parse(ranges); + List tagList = generateLocales(tags); + assertThrows(NullPointerException.class, + () -> showLocales(Locale.filter(priorityList, tagList, mode))); + } } - @Test(expectedExceptions = IllegalArgumentException.class) - public void testLFilterIAE() { + @Test + void testLFilterIAE() { String ranges = "en;q=0.2, ja-*-JP, fr-JP"; String tags = "de-DE, en, ja-JP-hepburn, fr, he, ja-Latn-JP"; List priorityList = LanguageRange.parse(ranges); List tagList = generateLocales(tags); - showLocales(Locale.filter(priorityList, tagList, REJECT_EXTENDED_RANGES)); + assertThrows(IllegalArgumentException.class, + () -> showLocales(Locale.filter(priorityList, tagList, REJECT_EXTENDED_RANGES))); } - @Test(dataProvider = "LFilterTagsData") - public void testLFilterTags(String ranges, String tags, FilteringMode mode, String expectedTags) { + @MethodSource("LFilterTagsData") + @ParameterizedTest + void testLFilterTags(String ranges, String tags, FilteringMode mode, String expectedTags) { List priorityList = LanguageRange.parse(ranges); List tagList = generateLanguageTags(tags); String actualTags; @@ -417,36 +428,39 @@ public void testLFilterTags(String ranges, String tags, FilteringMode mode, Stri } else { actualTags = showLanguageTags(Locale.filterTags(priorityList, tagList, mode)); } - assertEquals(actualTags, expectedTags, + assertEquals(expectedTags, actualTags, showErrorMessage(" L.FilterTags(" + (mode != null ? mode : "") + ")", ranges, tags, expectedTags, actualTags)); } - @Test(expectedExceptions = IllegalArgumentException.class) - public void testLFilterTagsIAE() { + @Test + void testLFilterTagsIAE() { String ranges = "de-*-DE"; String tags = "de-DE, de-de, de-Latn-DE, de-Latf-DE, de-DE-x-goethe, " + "de-Latn-DE-1996, de-Deva-DE, de, de-x-DE, de-Deva"; List priorityList = LanguageRange.parse(ranges); - showLanguageTags(Locale.filterTags(priorityList, generateLanguageTags(tags), REJECT_EXTENDED_RANGES)); + assertThrows(IllegalArgumentException.class, + () -> showLanguageTags(Locale.filterTags(priorityList, generateLanguageTags(tags), REJECT_EXTENDED_RANGES))); } - @Test(dataProvider = "LLookupData") - public void testLLookup(String ranges, String tags, String expectedLocale) { + @MethodSource("LLookupData") + @ParameterizedTest + void testLLookup(String ranges, String tags, String expectedLocale) { List priorityList = LanguageRange.parse(ranges); List localeList = generateLocales(tags); String actualLocale = Locale.lookup(priorityList, localeList).toLanguageTag(); - assertEquals(actualLocale, expectedLocale, showErrorMessage(" L.Lookup()", + assertEquals(expectedLocale, actualLocale, showErrorMessage(" L.Lookup()", ranges, tags, expectedLocale, actualLocale)); } - @Test(dataProvider = "LLookupTagData") - public void testLLookupTag(String ranges, String tags, String expectedTag) { + @MethodSource("LLookupTagData") + @ParameterizedTest + void testLLookupTag(String ranges, String tags, String expectedTag) { List priorityList = LanguageRange.parse(ranges); List tagList = generateLanguageTags(tags); String actualTag = Locale.lookupTag(priorityList, tagList); - assertEquals(actualTag, expectedTag, showErrorMessage(" L.LookupTag()", + assertEquals(expectedTag, actualTag, showErrorMessage(" L.LookupTag()", ranges, tags, expectedTag, actualTag)); } diff --git a/test/jdk/java/util/Locale/RequiredAvailableLocalesTest.java b/test/jdk/java/util/Locale/RequiredAvailableLocalesTest.java index 2fcba9b9366b..7d229913a844 100644 --- a/test/jdk/java/util/Locale/RequiredAvailableLocalesTest.java +++ b/test/jdk/java/util/Locale/RequiredAvailableLocalesTest.java @@ -20,34 +20,42 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -/** + +/* * @test * @bug 8276186 * @summary Checks whether getAvailableLocales() returns at least Locale.ROOT and * Locale.US instances. - * @run testng/othervm -Djava.locale.providers=COMPAT RequiredAvailableLocalesTest - * @run testng/othervm -Djava.locale.providers=CLDR RequiredAvailableLocalesTest + * @run junit/othervm -Djava.locale.providers=COMPAT RequiredAvailableLocalesTest + * @run junit/othervm -Djava.locale.providers=CLDR RequiredAvailableLocalesTest */ import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; -import java.text.*; +import java.text.BreakIterator; +import java.text.Collator; +import java.text.DateFormat; +import java.text.DateFormatSymbols; +import java.text.DecimalFormatSymbols; +import java.text.NumberFormat; import java.time.format.DecimalStyle; -import java.util.*; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Locale; +import java.util.Set; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; -@Test public class RequiredAvailableLocalesTest { private static final Set REQUIRED_LOCALES = Set.of(Locale.ROOT, Locale.US); private static final MethodType ARRAY_RETURN_TYPE = MethodType.methodType(Locale.class.arrayType()); private static final MethodType SET_RETURN_TYPE = MethodType.methodType(Set.class); - @DataProvider - public Object[][] availableLocalesClasses() { + static Object[][] availableLocalesClasses() { return new Object[][] { {BreakIterator.class, ARRAY_RETURN_TYPE}, {Calendar.class, ARRAY_RETURN_TYPE}, @@ -61,8 +69,9 @@ public Object[][] availableLocalesClasses() { }; } - @Test (dataProvider = "availableLocalesClasses") - public void checkRequiredLocales(Class c, MethodType mt) throws Throwable { + @MethodSource("availableLocalesClasses") + @ParameterizedTest + void checkRequiredLocales(Class c, MethodType mt) throws Throwable { var ret = MethodHandles.lookup().findStatic(c, "getAvailableLocales", mt).invoke(); if (ret instanceof Locale[] a) { diff --git a/test/jdk/java/util/Locale/TestOf.java b/test/jdk/java/util/Locale/TestOf.java index c923da832bf0..3e0e5e742075 100644 --- a/test/jdk/java/util/Locale/TestOf.java +++ b/test/jdk/java/util/Locale/TestOf.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -20,29 +20,30 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -/** + +/* * @test * @bug 8282819 * @summary Unit tests for Locale.of() method. Those tests check the equality * of obtained objects with ones that are gotten from other means with both * well-formed and ill-formed arguments. Also checks the possible NPEs * for error cases. - * @run testng TestOf + * @run junit TestOf */ -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertThrows; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.util.Locale; -import org.testng.annotations.Test; -import org.testng.annotations.DataProvider; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; @SuppressWarnings("deprecation") -@Test public class TestOf { - @DataProvider - public Object[][] data_1Arg() { + static Object[][] data_1Arg() { return new Object[][]{ // well-formed {Locale.ENGLISH, "en"}, @@ -55,8 +56,7 @@ public Object[][] data_1Arg() { }; } - @DataProvider - public Object[][] data_2Args() { + static Object[][] data_2Args() { return new Object[][]{ // well-formed {Locale.US, "en", "US"}, @@ -69,8 +69,7 @@ public Object[][] data_2Args() { }; } - @DataProvider - public Object[][] data_3Args() { + static Object[][] data_3Args() { return new Object[][]{ // well-formed {Locale.forLanguageTag("en-US-POSIX"), "en", "US", "POSIX"}, @@ -87,23 +86,26 @@ public Object[][] data_3Args() { }; } - @Test (dataProvider = "data_1Arg") - public void test_1Arg(Locale expected, String lang) { - assertEquals(Locale.of(lang), expected); + @MethodSource("data_1Arg") + @ParameterizedTest + void test_1Arg(Locale expected, String lang) { + assertEquals(expected, Locale.of(lang)); } - @Test (dataProvider = "data_2Args") - public void test_2Args(Locale expected, String lang, String ctry) { - assertEquals(Locale.of(lang, ctry), expected); + @MethodSource("data_2Args") + @ParameterizedTest + void test_2Args(Locale expected, String lang, String ctry) { + assertEquals(expected, Locale.of(lang, ctry)); } - @Test (dataProvider = "data_3Args") - public void test_3Args(Locale expected, String lang, String ctry, String vrnt) { - assertEquals(Locale.of(lang, ctry, vrnt), expected); + @MethodSource("data_3Args") + @ParameterizedTest + void test_3Args(Locale expected, String lang, String ctry, String vrnt) { + assertEquals(expected, Locale.of(lang, ctry, vrnt)); } @Test - public void test_NPE() { + void test_NPE() { assertThrows(NullPointerException.class, () -> Locale.of(null)); assertThrows(NullPointerException.class, () -> Locale.of("", null)); assertThrows(NullPointerException.class, () -> Locale.of("", "", null)); diff --git a/test/jdk/java/util/Locale/bcp47u/CalendarTests.java b/test/jdk/java/util/Locale/bcp47u/CalendarTests.java index 92cfc6581c5f..f04c4a4b1ff4 100644 --- a/test/jdk/java/util/Locale/bcp47u/CalendarTests.java +++ b/test/jdk/java/util/Locale/bcp47u/CalendarTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -28,25 +28,24 @@ * @summary Tests Calendar class deals with Unicode extensions * correctly. * @modules jdk.localedata - * @run testng/othervm CalendarTests + * @run junit/othervm CalendarTests */ -import static org.testng.Assert.assertEquals; - import java.text.DateFormat; import java.util.Calendar; import java.util.Locale; import java.util.TimeZone; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test Calendar with BCP47 U extensions */ -@Test public class CalendarTests { private static TimeZone defaultTZ; @@ -64,19 +63,18 @@ public class CalendarTests { private static final Locale FW_FRI = Locale.forLanguageTag("en-US-u-fw-fri"); private static final Locale FW_SAT = Locale.forLanguageTag("en-US-u-fw-sat"); - @BeforeTest - public void beforeTest() { + @BeforeAll + static void beforeTest() { defaultTZ = TimeZone.getDefault(); TimeZone.setDefault(AMLA); } - @AfterTest - public void afterTest() { + @AfterAll + static void afterTest() { TimeZone.setDefault(defaultTZ); } - @DataProvider(name="tz") - Object[][] tz() { + static Object[][] tz() { return new Object[][] { // Locale, Expected Zone, {JPTYO, ASIATOKYO}, @@ -87,8 +85,7 @@ Object[][] tz() { }; } - @DataProvider(name="firstDayOfWeek") - Object[][] firstDayOfWeek () { + static Object[][] firstDayOfWeek () { return new Object[][] { // Locale, Expected DayOfWeek, {Locale.US, Calendar.SUNDAY}, @@ -114,8 +111,7 @@ Object[][] firstDayOfWeek () { }; } - @DataProvider(name="minDaysInFirstWeek") - Object[][] minDaysInFrstWeek () { + static Object[][] minDaysInFirstWeek () { return new Object[][] { // Locale, Expected minDay, {Locale.US, 1}, @@ -126,33 +122,36 @@ Object[][] minDaysInFrstWeek () { }; } - @Test(dataProvider="tz") - public void test_tz(Locale locale, TimeZone zoneExpected) { + @MethodSource("tz") + @ParameterizedTest + void test_tz(Locale locale, TimeZone zoneExpected) { DateFormat df = DateFormat.getTimeInstance(DateFormat.FULL, locale); - assertEquals(df.getTimeZone(), zoneExpected); + assertEquals(zoneExpected, df.getTimeZone()); Calendar c = Calendar.getInstance(locale); - assertEquals(c.getTimeZone(), zoneExpected); + assertEquals(zoneExpected, c.getTimeZone()); c = new Calendar.Builder().setLocale(locale).build(); - assertEquals(c.getTimeZone(), zoneExpected); + assertEquals(zoneExpected, c.getTimeZone()); } - @Test(dataProvider="firstDayOfWeek") - public void test_firstDayOfWeek(Locale locale, int dowExpected) { + @MethodSource("firstDayOfWeek") + @ParameterizedTest + void test_firstDayOfWeek(Locale locale, int dowExpected) { Calendar c = Calendar.getInstance(locale); - assertEquals(c.getFirstDayOfWeek(), dowExpected); + assertEquals(dowExpected, c.getFirstDayOfWeek()); c = new Calendar.Builder().setLocale(locale).build(); - assertEquals(c.getFirstDayOfWeek(), dowExpected); + assertEquals(dowExpected, c.getFirstDayOfWeek()); } - @Test(dataProvider="minDaysInFirstWeek") - public void test_minDaysInFirstWeek(Locale locale, int minDaysExpected) { + @MethodSource("minDaysInFirstWeek") + @ParameterizedTest + void test_minDaysInFirstWeek(Locale locale, int minDaysExpected) { Calendar c = Calendar.getInstance(locale); - assertEquals(c.getMinimalDaysInFirstWeek(), minDaysExpected); + assertEquals(minDaysExpected, c.getMinimalDaysInFirstWeek()); c = new Calendar.Builder().setLocale(locale).build(); - assertEquals(c.getMinimalDaysInFirstWeek(), minDaysExpected); + assertEquals(minDaysExpected, c.getMinimalDaysInFirstWeek()); } } diff --git a/test/jdk/java/util/Locale/bcp47u/CurrencyFormatTests.java b/test/jdk/java/util/Locale/bcp47u/CurrencyFormatTests.java index d3e14fb0d5a6..1ca251b6add5 100644 --- a/test/jdk/java/util/Locale/bcp47u/CurrencyFormatTests.java +++ b/test/jdk/java/util/Locale/bcp47u/CurrencyFormatTests.java @@ -27,26 +27,24 @@ * @bug 8215181 8230284 8231273 8284840 * @summary Tests the "u-cf" extension * @modules jdk.localedata - * @run testng/othervm -Djava.locale.providers=CLDR CurrencyFormatTests + * @run junit/othervm -Djava.locale.providers=CLDR CurrencyFormatTests */ -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.text.NumberFormat; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test NumberFormat with BCP47 u-cf extensions. Note that this test depends * on the particular CLDR release. Results may vary on other CLDR releases. */ -@Test public class CurrencyFormatTests { - @DataProvider(name="getInstanceData") - Object[][] getInstanceData() { + static Object[][] getInstanceData() { return new Object[][] { // Locale, amount, expected // US dollar @@ -97,8 +95,9 @@ Object[][] getInstanceData() { }; } - @Test(dataProvider="getInstanceData") - public void test_getInstance(Locale locale, int amount, String expected) { - assertEquals(NumberFormat.getCurrencyInstance(locale).format(amount), expected); + @MethodSource("getInstanceData") + @ParameterizedTest + void test_getInstance(Locale locale, int amount, String expected) { + assertEquals(expected, NumberFormat.getCurrencyInstance(locale).format(amount)); } } diff --git a/test/jdk/java/util/Locale/bcp47u/CurrencyTests.java b/test/jdk/java/util/Locale/bcp47u/CurrencyTests.java index d807a0e4da3c..a89aed4b0c55 100644 --- a/test/jdk/java/util/Locale/bcp47u/CurrencyTests.java +++ b/test/jdk/java/util/Locale/bcp47u/CurrencyTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -28,28 +28,26 @@ * @summary Tests Currency class instantiates correctly with Unicode * extensions * @modules jdk.localedata - * @run testng/othervm CurrencyTests + * @run junit/othervm CurrencyTests */ -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.util.Currency; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test Currency with BCP47 U extensions */ -@Test public class CurrencyTests { private static final Currency USD = Currency.getInstance("USD"); private static final Currency CAD = Currency.getInstance("CAD"); private static final Currency JPY = Currency.getInstance("JPY"); - @DataProvider(name="getInstanceData") - Object[][] getInstanceData() { + static Object[][] getInstanceData() { return new Object[][] { // Locale, Expected Currency // "cu" @@ -76,8 +74,7 @@ Object[][] getInstanceData() { }; } - @DataProvider(name="getSymbolData") - Object[][] getSymbolData() { + static Object[][] getSymbolData() { return new Object[][] { // Currency, DisplayLocale, expected Symbol {USD, Locale.forLanguageTag("en-US-u-rg-jpzzzz"), "$"}, @@ -94,13 +91,15 @@ Object[][] getSymbolData() { }; } - @Test(dataProvider="getInstanceData") - public void test_getInstance(Locale locale, Currency currencyExpected) { - assertEquals(Currency.getInstance(locale), currencyExpected); + @MethodSource("getInstanceData") + @ParameterizedTest + void test_getInstance(Locale locale, Currency currencyExpected) { + assertEquals(currencyExpected, Currency.getInstance(locale)); } - @Test(dataProvider="getSymbolData") - public void test_getSymbol(Currency c, Locale locale, String expected) { - assertEquals(c.getSymbol(locale), expected); + @MethodSource("getSymbolData") + @ParameterizedTest + void test_getSymbol(Currency c, Locale locale, String expected) { + assertEquals(expected, c.getSymbol(locale)); } } diff --git a/test/jdk/java/util/Locale/bcp47u/DisplayNameTests.java b/test/jdk/java/util/Locale/bcp47u/DisplayNameTests.java index 11c4272f1609..bf35fe152a77 100644 --- a/test/jdk/java/util/Locale/bcp47u/DisplayNameTests.java +++ b/test/jdk/java/util/Locale/bcp47u/DisplayNameTests.java @@ -27,21 +27,20 @@ * @bug 8176841 8202537 * @summary Tests the display names for BCP 47 U extensions * @modules jdk.localedata - * @run testng/othervm -Djava.locale.providers=CLDR DisplayNameTests + * @run junit/othervm -Djava.locale.providers=CLDR DisplayNameTests */ -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test Locale.getDisplayName() with BCP47 U extensions. Note that the * result may change depending on the CLDR releases. */ -@Test public class DisplayNameTests { private static final Locale loc1 = Locale.forLanguageTag("en-Latn-US-u" + "-ca-japanese" + @@ -75,8 +74,7 @@ public class DisplayNameTests { .build(); private static final Locale loc6 = Locale.forLanguageTag( "zh-CN-u-ca-dddd-nu-ddd-cu-ddd-fw-moq-tz-unknown-rg-twzz"); - @DataProvider(name="locales") - Object[][] tz() { + static Object[][] locales() { return new Object[][] { // Locale for display, Test Locale, Expected output, {Locale.US, loc1, @@ -101,9 +99,10 @@ Object[][] tz() { }; } - @Test(dataProvider="locales") - public void test_locales(Locale inLocale, Locale testLocale, String expected) { + @MethodSource("locales") + @ParameterizedTest + void test_locales(Locale inLocale, Locale testLocale, String expected) { String result = testLocale.getDisplayName(inLocale); - assertEquals(result, expected); + assertEquals(expected, result); } } diff --git a/test/jdk/java/util/Locale/bcp47u/FormatTests.java b/test/jdk/java/util/Locale/bcp47u/FormatTests.java index c23c1cb81807..977010ee27f5 100644 --- a/test/jdk/java/util/Locale/bcp47u/FormatTests.java +++ b/test/jdk/java/util/Locale/bcp47u/FormatTests.java @@ -28,10 +28,13 @@ * @summary Tests *Format class deals with Unicode extensions * correctly. * @modules jdk.localedata - * @run testng/othervm -Djava.locale.providers=CLDR FormatTests + * @run junit/othervm -Djava.locale.providers=CLDR FormatTests */ -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.text.DateFormat; import java.text.NumberFormat; @@ -40,15 +43,11 @@ import java.util.Locale; import java.util.TimeZone; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test *Format classes with BCP47 U extensions */ -@Test public class FormatTests { private static TimeZone defaultTZ; @@ -80,19 +79,18 @@ public class FormatTests { .build() .getTime(); - @BeforeTest - public void beforeTest() { + @BeforeAll + static void beforeTest() { defaultTZ = TimeZone.getDefault(); TimeZone.setDefault(AMLA); } - @AfterTest - public void afterTest() { + @AfterAll + static void afterTest() { TimeZone.setDefault(defaultTZ); } - @DataProvider(name="dateFormatData") - Object[][] dateFormatData() { + static Object[][] dateFormatData() { return new Object[][] { // Locale, Expected calendar, Expected timezone, Expected formatted string @@ -116,8 +114,7 @@ Object[][] dateFormatData() { }; } - @DataProvider(name="numberFormatData") - Object[][] numberFormatData() { + static Object[][] numberFormatData() { return new Object[][] { // Locale, number, expected format @@ -136,33 +133,35 @@ Object[][] numberFormatData() { }; } - @Test(dataProvider="dateFormatData") - public void test_DateFormat(Locale locale, String calClass, TimeZone tz, + @MethodSource("dateFormatData") + @ParameterizedTest + void test_DateFormat(Locale locale, String calClass, TimeZone tz, String formatExpected) throws Exception { DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, locale); if (calClass != null) { try { Class expected = Class.forName(calClass); - assertEquals(df.getCalendar().getClass(), expected); + assertEquals(expected, df.getCalendar().getClass()); } catch (Exception e) { throw e; } } if (tz != null) { - assertEquals(df.getTimeZone(), tz); + assertEquals(tz, df.getTimeZone()); } String formatted = df.format(testDate); - assertEquals(formatted, formatExpected); - assertEquals(df.parse(formatted), testDate); + assertEquals(formatExpected, formatted); + assertEquals(testDate, df.parse(formatted)); } - @Test(dataProvider="numberFormatData") - public void test_NumberFormat(Locale locale, double num, + @MethodSource("numberFormatData") + @ParameterizedTest + void test_NumberFormat(Locale locale, double num, String formatExpected) throws Exception { NumberFormat nf = NumberFormat.getNumberInstance(locale); nf.setMaximumFractionDigits(4); String formatted = nf.format(num); - assertEquals(nf.format(num), formatExpected); - assertEquals(nf.parse(formatted), num); + assertEquals(formatExpected, nf.format(num)); + assertEquals(num, nf.parse(formatted)); } } diff --git a/test/jdk/java/util/Locale/bcp47u/SymbolsTests.java b/test/jdk/java/util/Locale/bcp47u/SymbolsTests.java index 2a8e8bf8e1eb..9baf61b24040 100644 --- a/test/jdk/java/util/Locale/bcp47u/SymbolsTests.java +++ b/test/jdk/java/util/Locale/bcp47u/SymbolsTests.java @@ -28,30 +28,28 @@ * @summary Tests *FormatSymbols class deals with Unicode extensions * correctly. * @modules jdk.localedata - * @run testng/othervm -Djava.locale.providers=CLDR SymbolsTests + * @run junit/othervm -Djava.locale.providers=CLDR SymbolsTests */ -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.text.DateFormatSymbols; import java.text.DecimalFormatSymbols; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test *FormatSymbols classes with BCP47 U extensions */ -@Test public class SymbolsTests { private static final Locale RG_GB = Locale.forLanguageTag("en-US-u-rg-gbzzzz"); private static final Locale RG_IE = Locale.forLanguageTag("en-US-u-rg-iezzzz"); private static final Locale RG_AT = Locale.forLanguageTag("en-US-u-rg-atzzzz"); - @DataProvider(name="dateFormatSymbolsData") - Object[][] dateFormatSymbolsData() { + static Object[][] dateFormatSymbolsData() { return new Object[][] { // Locale, expected AM string, expected PM string @@ -61,8 +59,7 @@ Object[][] dateFormatSymbolsData() { }; } - @DataProvider(name="decimalFormatSymbolsData") - Object[][] decimalFormatSymbolsData() { + static Object[][] decimalFormatSymbolsData() { return new Object[][] { // Locale, expected decimal separator, expected grouping separator @@ -74,18 +71,20 @@ Object[][] decimalFormatSymbolsData() { }; } - @Test(dataProvider="dateFormatSymbolsData") - public void test_DateFormatSymbols(Locale locale, String amExpected, String pmExpected) { + @MethodSource("dateFormatSymbolsData") + @ParameterizedTest + void test_DateFormatSymbols(Locale locale, String amExpected, String pmExpected) { DateFormatSymbols dfs = DateFormatSymbols.getInstance(locale); String[] ampm = dfs.getAmPmStrings(); - assertEquals(ampm[0], amExpected); - assertEquals(ampm[1], pmExpected); + assertEquals(amExpected, ampm[0]); + assertEquals(pmExpected, ampm[1]); } - @Test(dataProvider="decimalFormatSymbolsData") - public void test_DecimalFormatSymbols(Locale locale, char decimal, char grouping) { + @MethodSource("decimalFormatSymbolsData") + @ParameterizedTest + void test_DecimalFormatSymbols(Locale locale, char decimal, char grouping) { DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(locale); - assertEquals(dfs.getDecimalSeparator(), decimal); - assertEquals(dfs.getGroupingSeparator(), grouping); + assertEquals(decimal, dfs.getDecimalSeparator()); + assertEquals(grouping, dfs.getGroupingSeparator()); } } diff --git a/test/jdk/java/util/Locale/bcp47u/SystemPropertyTests.java b/test/jdk/java/util/Locale/bcp47u/SystemPropertyTests.java index 905fc9a79c8e..3c34d74337d9 100644 --- a/test/jdk/java/util/Locale/bcp47u/SystemPropertyTests.java +++ b/test/jdk/java/util/Locale/bcp47u/SystemPropertyTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -28,30 +28,26 @@ * @summary Tests the system properties * @modules jdk.localedata * @build DefaultLocaleTest - * @run testng/othervm SystemPropertyTests + * @run junit/othervm SystemPropertyTests */ -import static jdk.test.lib.process.ProcessTools.executeTestJava; -import static org.testng.Assert.assertTrue; - -import java.util.Locale; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static jdk.test.lib.process.ProcessTools.executeTestJava; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test Locale.getDefault() reflects the system property. Note that the * result may change depending on the CLDR releases. */ -@Test public class SystemPropertyTests { private static String LANGPROP = "-Duser.language=en"; private static String SCPTPROP = "-Duser.script="; private static String CTRYPROP = "-Duser.country=US"; - @DataProvider(name="data") - Object[][] data() { + static Object[][] data() { return new Object[][] { // system property, expected default, expected format, expected display {"-Duser.extensions=u-ca-japanese", @@ -86,8 +82,9 @@ Object[][] data() { }; } - @Test(dataProvider="data") - public void runTest(String extprop, String defLoc, + @MethodSource("data") + @ParameterizedTest + void runTest(String extprop, String defLoc, String defFmtLoc, String defDspLoc) throws Exception { int exitValue = executeTestJava(LANGPROP, SCPTPROP, CTRYPROP, extprop, "DefaultLocaleTest", defLoc, defFmtLoc, defDspLoc) @@ -95,6 +92,6 @@ public void runTest(String extprop, String defLoc, .errorTo(System.out) .getExitValue(); - assertTrue(exitValue == 0); + assertEquals(0, exitValue); } } From 985581a4b427ee9c3730bfa1096882d85a8f27c6 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Wed, 8 Apr 2026 09:01:00 +0000 Subject: [PATCH 155/223] 8368524: Tests are skipped and shown as passed in test/jdk/sun/security/pkcs11/Cipher/KeyWrap Backport-of: 9292244aef5b24d37105dbef9768db7ac423f366 --- .../pkcs11/Cipher/KeyWrap/NISTWrapKAT.java | 18 ++++++++++-------- .../pkcs11/Cipher/KeyWrap/TestGeneral.java | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java index e8f637e0b0c7..b570a0dd0301 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java +++ b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java @@ -83,7 +83,7 @@ public class NISTWrapKAT extends PKCS11Test { private static String KEK2 = "5840DF6E29B02AF1AB493B705BF16EA1AE8338F4DCC176A8"; - private static final List skippedList = new ArrayList <>(); + private static final List skippedAlgoList = new ArrayList <>(); private static byte[] toBytes(String hex, int hexLen) { if (hexLen < hex.length()) { @@ -274,8 +274,8 @@ public void testKeyWrap(String algo, String key, int keyLen, dataLen + "-byte key with " + 8*keyLen + "-bit KEK"); int allowed = Cipher.getMaxAllowedKeyLength("AES"); if (keyLen > allowed) { - System.out.println("=> skip, exceeds max allowed size " + allowed); - skippedList.add(algo + " Cipher with wrapping " + + System.err.println("Skip, exceeds max allowed size " + allowed); + skippedAlgoList.add(algo + " Cipher with wrapping " + dataLen + "-byte key with " + 8 * keyLen + "-bit KEK exceeds max allowed size " + allowed); return; @@ -344,8 +344,8 @@ public void testEnc(String algo, String key, int keyLen, String data, dataLen + "-byte data with " + 8*keyLen + "-bit KEK"); int allowed = Cipher.getMaxAllowedKeyLength("AES"); if (keyLen > allowed) { - System.out.println("=> skip, exceeds max allowed size " + allowed); - skippedList.add(algo + " Cipher with enc " + + System.err.println("Skip, exceeds max allowed size " + allowed); + skippedAlgoList.add(algo + " Cipher with enc " + dataLen + "-byte data with " + 8 * keyLen + "-bit KEK exceeds max allowed size " + allowed); return; @@ -416,7 +416,9 @@ public void main(Provider p) throws Exception { for (Object[] td : testDatum) { String algo = (String) td[0]; if (p.getService("Cipher", algo) == null) { - skippedList.add("No support for " + algo); + System.err.println("Skip, due to no support: " + algo); + skippedAlgoList.add("No support for " + algo); + continue; } testKeyWrap(algo, (String) td[1], (int) td[2], (String) td[3], (int) td[4], (String) td[5], p); @@ -424,9 +426,9 @@ public void main(Provider p) throws Exception { (int) td[4], (String) td[5], p); } - if (!skippedList.isEmpty()) { + if (!skippedAlgoList.isEmpty()) { throw new SkippedException("One or more tests skipped " - + skippedList); + + skippedAlgoList); } else { System.out.println("All Tests Passed"); } diff --git a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java index f5e4494fc59b..d7cdfc6c04c5 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java +++ b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java @@ -273,6 +273,7 @@ public void main(Provider p) throws Exception { for (String a : algos) { if (p.getService("Cipher", a) == null) { skippedList.add(a); + continue; } System.out.println("Testing " + a); From b25b62358d70a8923c04020d46e61ff98fedb42e Mon Sep 17 00:00:00 2001 From: Satyen Subramaniam Date: Thu, 9 Apr 2026 17:34:52 +0000 Subject: [PATCH 156/223] 8353552: Opensource Several Font related tests - Batch 3 8355048: ProblemList TestGlyphVectorLayout.java on all platforms Backport-of: f8f1be3de56986c06f368334b7c64ef50f0117cf --- test/jdk/ProblemList.txt | 1 + .../jdk/java/awt/font/BoldItalicFontTest.java | 73 +++++++ .../GlyphVector/TestGlyphVectorLayout.java | 121 +++++++++++ .../GlyphVector/TestSetGlyphPositions.java | 96 +++++++++ .../jdk/java/awt/font/Rotate/RotateTest1.java | 97 +++++++++ .../java/awt/font/TestGraphicPlacement.java | 199 ++++++++++++++++++ 6 files changed, 587 insertions(+) create mode 100644 test/jdk/java/awt/font/BoldItalicFontTest.java create mode 100644 test/jdk/java/awt/font/GlyphVector/TestGlyphVectorLayout.java create mode 100644 test/jdk/java/awt/font/GlyphVector/TestSetGlyphPositions.java create mode 100644 test/jdk/java/awt/font/Rotate/RotateTest1.java create mode 100644 test/jdk/java/awt/font/TestGraphicPlacement.java diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index e8a93f5796ef..06f66808f262 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -809,6 +809,7 @@ java/awt/Modal/InvisibleParentTest/InvisibleParentTest.java 8172245 linux-all java/awt/Frame/FrameStateTest/FrameStateTest.java 8203920 macosx-all,linux-all java/awt/print/PrinterJob/ScaledText/ScaledText.java 8231226 macosx-all java/awt/print/PrinterJob/PrintTextTest.java 8148334 generic-all +java/awt/font/GlyphVector/TestGlyphVectorLayout.java 8354987 generic-all java/awt/font/TextLayout/TestJustification.java 8250791 macosx-all java/awt/TrayIcon/DragEventSource/DragEventSource.java 8252242 macosx-all java/awt/FileDialog/DefaultFocusOwner/DefaultFocusOwner.java 7187728 macosx-all,linux-all diff --git a/test/jdk/java/awt/font/BoldItalicFontTest.java b/test/jdk/java/awt/font/BoldItalicFontTest.java new file mode 100644 index 000000000000..7fdefcfe2b52 --- /dev/null +++ b/test/jdk/java/awt/font/BoldItalicFontTest.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2004, 2025, 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.awt.Font; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Label; + +/* + * @test + * @bug 4935871 + * @summary Check that correct type faces are used regardless of bold/italic styles + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual/othervm -Duser.language=ja -Duser.country=JP BoldItalicFontTest + */ + +public class BoldItalicFontTest { + + public static void main(String[] args) throws Exception { + final String INSTRUCTIONS = """ + This test is reproduced with a non-English user locale only. + All the letters "X" in the first line should be in serif font. + All the letters "X" in the second line should be in sans-serif font. + + If so, press Pass, else press Fail."""; + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(BoldItalicFontTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + String[] faces = { Font.SERIF, Font.SANS_SERIF }; + int[] styles = { 0, Font.BOLD, Font.ITALIC, Font.BOLD | Font.ITALIC }; + + Frame f = new Frame("BoldItalicFontTest Test UI"); + f.setLayout(new GridLayout(faces.length, styles.length)); + for (int fn = 0; fn < faces.length; fn++) { + for (int sn = 0; sn < styles.length; sn++) { + Label l = new Label("X"); + Font f1 = new Font(faces[fn], styles[sn], 36); + l.setFont(f1); + f.add(l); + } + } + f.setSize(300, 300); + return f; + } +} diff --git a/test/jdk/java/awt/font/GlyphVector/TestGlyphVectorLayout.java b/test/jdk/java/awt/font/GlyphVector/TestGlyphVectorLayout.java new file mode 100644 index 000000000000..b183b6526421 --- /dev/null +++ b/test/jdk/java/awt/font/GlyphVector/TestGlyphVectorLayout.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2002, 2025, 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.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.font.GlyphVector; +import java.awt.font.FontRenderContext; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; + +import javax.swing.JPanel; + +/* + * @test + * @bug 4615017 + * @summary Display two GlyphVectors, and ensure they are of the same length. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestGlyphVectorLayout + */ + +public class TestGlyphVectorLayout extends JPanel { + private final Font font; + private final FontRenderContext frc; + private final String text; + + private GlyphVector aftergv; + private Rectangle pbounds; + private Rectangle2D vbounds; + + public static void main(String[] args) throws Exception { + final String INSTRUCTIONS = """ + Two lines of text should appear, the top one with boxes + (red and blue) around it. + The two lines should be of the same length, and the boxes around the + top line should 'fit' the text with no empty space between the end + of the text and the box. + + Pass the test if this is true."""; + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(TestGlyphVectorLayout::new) + .build() + .awaitAndCheck(); + } + + private TestGlyphVectorLayout() { + setBackground(Color.WHITE); + font = new Font(Font.DIALOG, Font.PLAIN, 24); + frc = new FontRenderContext(null, false, false); + text = "this is a test of glyph vector"; + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(550, 150); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g; + + float x = 50; + float y = 50; + AffineTransform oldtx = g2d.getTransform(); + g2d.translate(x, y); + g2d.scale(1.5, 1.5); + + g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, + RenderingHints.VALUE_FRACTIONALMETRICS_OFF); + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + + g2d.setColor(Color.BLACK); + + GlyphVector gv = font.createGlyphVector(frc, text); // new each time + g2d.drawGlyphVector(gv, 0, 0); + + if (vbounds == null) { + vbounds = gv.getVisualBounds(); + pbounds = gv.getPixelBounds(g2d.getFontRenderContext(), 0, 0); + aftergv = gv; + } + g2d.drawGlyphVector(aftergv, 0, 30); + + g2d.setColor(Color.BLUE); + g2d.draw(vbounds); + + g2d.setTransform(oldtx); + g2d.setColor(Color.RED); + g2d.draw(pbounds); + } +} diff --git a/test/jdk/java/awt/font/GlyphVector/TestSetGlyphPositions.java b/test/jdk/java/awt/font/GlyphVector/TestSetGlyphPositions.java new file mode 100644 index 000000000000..f56d82143950 --- /dev/null +++ b/test/jdk/java/awt/font/GlyphVector/TestSetGlyphPositions.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 1999, 2025, 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.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.font.GlyphVector; +import java.awt.font.FontRenderContext; +import java.awt.geom.Point2D; + +import javax.swing.JPanel; + +/* + * @test + * @bug 4180379 + * @summary set the positions of glyphs in the GlyphVector to other than + * their default x, y positions, and verify that the rendered glyphs are + * in the new positions, not the default positions. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestSetGlyphPositions + */ + +public class TestSetGlyphPositions extends JPanel { + GlyphVector gv = null; + + public static void main(String[] args) throws Exception { + final String INSTRUCTIONS = """ + 'TopLeft text and >' should appear towards the top left of the frame, + and '< and BottomRight text' should appear towards the bottom right. + + There should be some space between the '>' and '<' symbols, both vertically + and horizontally. + + Pass the test if this is true."""; + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(TestSetGlyphPositions::new) + .build() + .awaitAndCheck(); + } + + public TestSetGlyphPositions() { + setBackground(Color.WHITE); + setSize(550, 150); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(550, 150); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g; + + if (gv == null) { + Font font = new Font(Font.DIALOG, Font.PLAIN, 36); + FontRenderContext frc = g2d.getFontRenderContext(); + String str = "TopLeft> Date: Mon, 13 Apr 2026 07:43:48 +0000 Subject: [PATCH 157/223] 8330704: Clean up non-standard use of /** comments in some langtools tests Backport-of: 1d52234e199c7a38c059c0aa88aea2910f749d48 --- test/langtools/jdk/javadoc/tool/EnablePreviewOption.java | 4 ++-- test/langtools/jdk/javadoc/tool/ReleaseOption.java | 4 ++-- test/langtools/jdk/javadoc/tool/T4696488.java | 4 ++-- test/langtools/jdk/javadoc/tool/T4994049/T4994049.java | 4 ++-- test/langtools/jdk/javadoc/tool/T6551367.java | 4 ++-- test/langtools/jdk/javadoc/tool/TestScriptInComment.java | 4 ++-- test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java | 4 ++-- test/langtools/jdk/javadoc/tool/modules/FilterOptions.java | 4 ++-- test/langtools/jdk/javadoc/tool/modules/PackageOptions.java | 4 ++-- test/langtools/jdk/javadoc/tool/modules/PatchModules.java | 4 ++-- test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java | 4 ++-- test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java | 4 ++-- test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java | 4 ++-- test/langtools/jdk/jshell/HighlightUITest.java | 4 ++-- test/langtools/jdk/jshell/HistoryUITest.java | 4 ++-- test/langtools/jdk/jshell/IndentUITest.java | 4 ++-- test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java | 4 ++-- .../langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java | 4 ++-- test/langtools/jdk/jshell/ToolShiftTabTest.java | 4 ++-- test/langtools/jdk/jshell/ToolTabCommandTest.java | 4 ++-- test/langtools/jdk/jshell/ToolTabSnippetTest.java | 4 ++-- test/langtools/jdk/jshell/UndefinedClassTest.java | 4 ++-- 22 files changed, 44 insertions(+), 44 deletions(-) diff --git a/test/langtools/jdk/javadoc/tool/EnablePreviewOption.java b/test/langtools/jdk/javadoc/tool/EnablePreviewOption.java index 971a2dd546fb..5b01f5077231 100644 --- a/test/langtools/jdk/javadoc/tool/EnablePreviewOption.java +++ b/test/langtools/jdk/javadoc/tool/EnablePreviewOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8199196 * @summary Test --enable-preview option in javadoc diff --git a/test/langtools/jdk/javadoc/tool/ReleaseOption.java b/test/langtools/jdk/javadoc/tool/ReleaseOption.java index dfee8726f30b..5a7955099ca0 100644 --- a/test/langtools/jdk/javadoc/tool/ReleaseOption.java +++ b/test/langtools/jdk/javadoc/tool/ReleaseOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -34,7 +34,7 @@ import static jdk.javadoc.internal.tool.Main.Result.*; -/** +/* * @test * @bug 8086737 * @summary Test --release option in javadoc diff --git a/test/langtools/jdk/javadoc/tool/T4696488.java b/test/langtools/jdk/javadoc/tool/T4696488.java index b48c7fac93d2..715f738f53b7 100644 --- a/test/langtools/jdk/javadoc/tool/T4696488.java +++ b/test/langtools/jdk/javadoc/tool/T4696488.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4696488 * @summary javadoc doesn't handle UNC paths for destination directory diff --git a/test/langtools/jdk/javadoc/tool/T4994049/T4994049.java b/test/langtools/jdk/javadoc/tool/T4994049/T4994049.java index 47fb2aa179ed..247db2732cc4 100644 --- a/test/langtools/jdk/javadoc/tool/T4994049/T4994049.java +++ b/test/langtools/jdk/javadoc/tool/T4994049/T4994049.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4994049 * @summary Unit test for SourcePosition.column with respect to tab expansion diff --git a/test/langtools/jdk/javadoc/tool/T6551367.java b/test/langtools/jdk/javadoc/tool/T6551367.java index 875c91a1cf15..815b0b121e4e 100644 --- a/test/langtools/jdk/javadoc/tool/T6551367.java +++ b/test/langtools/jdk/javadoc/tool/T6551367.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 6551367 * @summary javadoc throws ClassCastException when an link tag tries to reference constructor. diff --git a/test/langtools/jdk/javadoc/tool/TestScriptInComment.java b/test/langtools/jdk/javadoc/tool/TestScriptInComment.java index 3eaa47a36d56..638e4c180597 100644 --- a/test/langtools/jdk/javadoc/tool/TestScriptInComment.java +++ b/test/langtools/jdk/javadoc/tool/TestScriptInComment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8138725 8226765 * @summary test --allow-script-in-comments diff --git a/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java b/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java index 006a6489f8d3..229d729bf402 100644 --- a/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java +++ b/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8176539 * @summary Test use case when all java files are listed diff --git a/test/langtools/jdk/javadoc/tool/modules/FilterOptions.java b/test/langtools/jdk/javadoc/tool/modules/FilterOptions.java index 8fd9b26cc12e..e510ea83bc41 100644 --- a/test/langtools/jdk/javadoc/tool/modules/FilterOptions.java +++ b/test/langtools/jdk/javadoc/tool/modules/FilterOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8159305 8167383 * @summary Tests elements filtering options diff --git a/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java b/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java index b6e16dc592d4..2c6624ca19aa 100644 --- a/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java +++ b/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8159305 * @summary Test modules with packages and subpackages filtering diff --git a/test/langtools/jdk/javadoc/tool/modules/PatchModules.java b/test/langtools/jdk/javadoc/tool/modules/PatchModules.java index 10101a33ec64..ec9e6b3b8940 100644 --- a/test/langtools/jdk/javadoc/tool/modules/PatchModules.java +++ b/test/langtools/jdk/javadoc/tool/modules/PatchModules.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8175346 * @summary Test patch module options diff --git a/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java b/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java index 2e0d4778401e..ce86d073e330 100644 --- a/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java +++ b/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8175346 8175277 * @summary Test release option interactions diff --git a/test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java b/test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java index 889945b236d0..cba4792f1660 100644 --- a/test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java +++ b/test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8010310 * @summary Error processing sources with -private diff --git a/test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java b/test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java index 39a726e3261c..598b1b63c022 100644 --- a/test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java +++ b/test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 7091528 8029145 8037484 * @summary ensures javadoc parses unique source files and ignores all class files diff --git a/test/langtools/jdk/jshell/HighlightUITest.java b/test/langtools/jdk/jshell/HighlightUITest.java index ede22e8f0107..954cb33117ab 100644 --- a/test/langtools/jdk/jshell/HighlightUITest.java +++ b/test/langtools/jdk/jshell/HighlightUITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8274148 * @summary Check the UI behavior of snippet highligting diff --git a/test/langtools/jdk/jshell/HistoryUITest.java b/test/langtools/jdk/jshell/HistoryUITest.java index 42e242fe1e6e..3083fe46688c 100644 --- a/test/langtools/jdk/jshell/HistoryUITest.java +++ b/test/langtools/jdk/jshell/HistoryUITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8178077 8232856 * @summary Check the UI behavior of editing history. diff --git a/test/langtools/jdk/jshell/IndentUITest.java b/test/langtools/jdk/jshell/IndentUITest.java index 6858277a179f..d7534b3e6b92 100644 --- a/test/langtools/jdk/jshell/IndentUITest.java +++ b/test/langtools/jdk/jshell/IndentUITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8241950 8247932 * @summary Check the UI behavior of indentation diff --git a/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java b/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java index 409965e2e682..8ec8ded1741c 100644 --- a/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java +++ b/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8182297 8242919 8267459 * @summary Verify that pasting multi-line snippets works properly. diff --git a/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java b/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java index 8a7b46fc1c77..1850f6c36395 100644 --- a/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java +++ b/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8182489 * @summary test history with multiline snippets diff --git a/test/langtools/jdk/jshell/ToolShiftTabTest.java b/test/langtools/jdk/jshell/ToolShiftTabTest.java index 4c36d79c16a4..87f616678cb9 100644 --- a/test/langtools/jdk/jshell/ToolShiftTabTest.java +++ b/test/langtools/jdk/jshell/ToolShiftTabTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8166334 8188894 * @summary test shift-tab shortcuts "fixes" diff --git a/test/langtools/jdk/jshell/ToolTabCommandTest.java b/test/langtools/jdk/jshell/ToolTabCommandTest.java index 9a429bb72530..f2f3111c4faa 100644 --- a/test/langtools/jdk/jshell/ToolTabCommandTest.java +++ b/test/langtools/jdk/jshell/ToolTabCommandTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8177076 8185840 8178109 8192863 * @modules diff --git a/test/langtools/jdk/jshell/ToolTabSnippetTest.java b/test/langtools/jdk/jshell/ToolTabSnippetTest.java index 86338938c2cd..252d57f4a6f6 100644 --- a/test/langtools/jdk/jshell/ToolTabSnippetTest.java +++ b/test/langtools/jdk/jshell/ToolTabSnippetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8177076 8185426 8189595 8188072 8221759 8255273 * @modules diff --git a/test/langtools/jdk/jshell/UndefinedClassTest.java b/test/langtools/jdk/jshell/UndefinedClassTest.java index 5c509252bd6f..eb0cf3699cff 100644 --- a/test/langtools/jdk/jshell/UndefinedClassTest.java +++ b/test/langtools/jdk/jshell/UndefinedClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8292755 * @summary InternalError seen while throwing undefined exception From 9798422c4b34ef94e8446782b1f3e9a0a976eb55 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 13 Apr 2026 07:46:25 +0000 Subject: [PATCH 158/223] 8129418: JShell: better highlighting of errors in imports on demand Backport-of: ae999eae7e61072ad964a43f622fa930ce1179f7 --- .../share/classes/com/sun/tools/javac/comp/Check.java | 2 +- test/langtools/jdk/jshell/ImportTest.java | 5 ++--- test/langtools/tools/javac/7129225/NegTest.out | 2 +- test/langtools/tools/javac/7129225/TestImportStar.out | 2 +- .../tools/javac/importChecks/ImportIsFullyQualified.out | 2 +- .../tools/javac/importChecks/ImportsObservable.out | 2 +- .../tools/javac/modules/ConvenientAccessErrorsTest.java | 6 +++--- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index f35c847b98e6..cdf08cd4aa75 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -4295,7 +4295,7 @@ public void checkImportedPackagesObservable(final JCCompilationUnit toplevel) { TypeSymbol tsym = imp.qualid.selected.type.tsym; if (tsym.kind == PCK && tsym.members().isEmpty() && !(Feature.IMPORT_ON_DEMAND_OBSERVABLE_PACKAGES.allowedInSource(source) && tsym.exists())) { - log.error(DiagnosticFlag.RESOLVE_ERROR, imp.pos, Errors.DoesntExist(tsym)); + log.error(DiagnosticFlag.RESOLVE_ERROR, imp.qualid.selected.pos(), Errors.DoesntExist(tsym)); } } } diff --git a/test/langtools/jdk/jshell/ImportTest.java b/test/langtools/jdk/jshell/ImportTest.java index e09490052cff..80b28deed360 100644 --- a/test/langtools/jdk/jshell/ImportTest.java +++ b/test/langtools/jdk/jshell/ImportTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8141415 + * @bug 8141415 8129418 * @summary Test imports * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main @@ -76,12 +76,11 @@ public void testImportStaticOnDemand() { assertEval("abs(cos(PI / 2)) < 0.00001;", "true"); } - @Test(enabled = false) // TODO 8129418 public void testUnknownPackage() { assertDeclareFail("import unknown.qqq;", new ExpectedDiagnostic("compiler.err.doesnt.exist", 7, 18, 14, -1, -1, Diagnostic.Kind.ERROR)); assertDeclareFail("import unknown.*;", - new ExpectedDiagnostic("compiler.err.doesnt.exist", 7, 15, 7, -1, -1, Diagnostic.Kind.ERROR)); + new ExpectedDiagnostic("compiler.err.doesnt.exist", 7, 14, 7, -1, -1, Diagnostic.Kind.ERROR)); } public void testBogusImportIgnoredInFuture() { diff --git a/test/langtools/tools/javac/7129225/NegTest.out b/test/langtools/tools/javac/7129225/NegTest.out index d6fbd22adc39..53ceaa4cb9a1 100644 --- a/test/langtools/tools/javac/7129225/NegTest.out +++ b/test/langtools/tools/javac/7129225/NegTest.out @@ -1,2 +1,2 @@ -TestImportStar.java:16:1: compiler.err.doesnt.exist: xxx +TestImportStar.java:16:8: compiler.err.doesnt.exist: xxx 1 error diff --git a/test/langtools/tools/javac/7129225/TestImportStar.out b/test/langtools/tools/javac/7129225/TestImportStar.out index 86ff89331387..352c0848392a 100644 --- a/test/langtools/tools/javac/7129225/TestImportStar.out +++ b/test/langtools/tools/javac/7129225/TestImportStar.out @@ -1,4 +1,4 @@ - compiler.note.proc.messager: RUNNING - lastRound = false -TestImportStar.java:16:1: compiler.err.doesnt.exist: xxx +TestImportStar.java:16:8: compiler.err.doesnt.exist: xxx - compiler.note.proc.messager: RUNNING - lastRound = true 1 error diff --git a/test/langtools/tools/javac/importChecks/ImportIsFullyQualified.out b/test/langtools/tools/javac/importChecks/ImportIsFullyQualified.out index 33e7d2f71c39..89495c2b93dc 100644 --- a/test/langtools/tools/javac/importChecks/ImportIsFullyQualified.out +++ b/test/langtools/tools/javac/importChecks/ImportIsFullyQualified.out @@ -1,2 +1,2 @@ -ImportIsFullyQualified.java:11:1: compiler.err.doesnt.exist: JobAttributes +ImportIsFullyQualified.java:11:8: compiler.err.doesnt.exist: JobAttributes 1 error diff --git a/test/langtools/tools/javac/importChecks/ImportsObservable.out b/test/langtools/tools/javac/importChecks/ImportsObservable.out index e6b6e51e4bb3..28ba84c6aa45 100644 --- a/test/langtools/tools/javac/importChecks/ImportsObservable.out +++ b/test/langtools/tools/javac/importChecks/ImportsObservable.out @@ -1,2 +1,2 @@ -ImportsObservable.java:9:1: compiler.err.doesnt.exist: javax +ImportsObservable.java:9:8: compiler.err.doesnt.exist: javax 1 error diff --git a/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java b/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java index cf06bd06dfe5..24c2b0458008 100644 --- a/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java +++ b/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java @@ -799,7 +799,7 @@ public void testPackagesUniquelyVisibleInImportOnDemandNoPrefixes(Path base) thr .getOutputLines(Task.OutputKind.DIRECT); List expected = Arrays.asList( - "Test.java:1:31: compiler.err.doesnt.exist: ma", + "Test.java:1:38: compiler.err.doesnt.exist: ma", "1 error"); if (!expected.equals(log)) @@ -827,7 +827,7 @@ public void testPackagesUniquelyVisibleInImportOnDemandThisModule(Path base) thr .getOutputLines(Task.OutputKind.DIRECT); List expected = Arrays.asList( - "Test.java:1:15: compiler.err.doesnt.exist: ma", + "Test.java:1:22: compiler.err.doesnt.exist: ma", "1 error"); if (!expected.equals(log)) @@ -861,7 +861,7 @@ public void testPackagesUniquelyVisibleInImportOnDemandThisModuleUnnamed(Path ba .getOutputLines(Task.OutputKind.DIRECT); List expected = Arrays.asList( - "Test.java:1:15: compiler.err.doesnt.exist: ma", + "Test.java:1:22: compiler.err.doesnt.exist: ma", "1 error"); if (!expected.equals(log)) From b64ec692533e5df0e8adee23ca9bc4f61e7c3c86 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 13 Apr 2026 07:48:40 +0000 Subject: [PATCH 159/223] 8355371: NegativeArraySizeException in print methods in IO or System.console() in JShell 8354910: Output by java.io.IO or System.console() corrupted for some non-ASCII characters Backport-of: c8ce61c8cadaf0371dc490c76b753f98bbaa118a --- .../jshell/execution/impl/ConsoleImpl.java | 6 +++-- test/langtools/jdk/jshell/ConsoleTest.java | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/jdk.jshell/share/classes/jdk/jshell/execution/impl/ConsoleImpl.java b/src/jdk.jshell/share/classes/jdk/jshell/execution/impl/ConsoleImpl.java index 202f29e3140a..fb171f232ba5 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/execution/impl/ConsoleImpl.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/execution/impl/ConsoleImpl.java @@ -329,7 +329,9 @@ public synchronized void write(int b) throws IOException { buffer = Arrays.copyOf(buffer, 2 * buffer.length); } - buffer[bp++] = b; + // Can be negative because widening from byte in write(byte[], int, int). + // java.io.OutputStream.write(int b) stipulates "The 24 high-order bits of b are ignored." + buffer[bp++] = b & 0xff; switch (Task.values()[buffer[0]]) { case WRITE_CHARS -> { @@ -346,7 +348,7 @@ public synchronized void write(int b) throws IOException { } case READ_CHARS -> { if (bp >= 5) { - int len = readInt(b); + int len = readInt(1); int c = console.reader().read(); //XXX: EOF handling! sendChars(sinkOutput, new char[] {(char) c}, 0, 1); diff --git a/test/langtools/jdk/jshell/ConsoleTest.java b/test/langtools/jdk/jshell/ConsoleTest.java index c6ddddac44b0..0ee19c557c02 100644 --- a/test/langtools/jdk/jshell/ConsoleTest.java +++ b/test/langtools/jdk/jshell/ConsoleTest.java @@ -147,6 +147,31 @@ public void close() throws IOException {} assertEquals(sb.toString(), expected); } + @Test + public void testConsoleUnicodeWritingTest() { + StringBuilder sb = new StringBuilder(); + console = new ThrowingJShellConsole() { + @Override + public PrintWriter writer() { + return new PrintWriter(new Writer() { + @Override + public void write(char[] cbuf, int off, int len) throws IOException { + sb.append(cbuf, off, len); + } + @Override + public void flush() throws IOException {} + @Override + public void close() throws IOException {} + }); + } + }; + int count = 384; // 128-255, 384-511, 640-767, ... (JDK-8355371) + String testStr = "\u30A2"; // Japanese katakana (A2 >= 80) (JDK-8354910) + assertEval("System.console().writer().write(\"" + testStr + "\".repeat(" + count + "))"); + String expected = testStr.repeat(count); + assertEquals(sb.toString(), expected); + } + @Test public void testConsoleMultiThreading() { StringBuilder sb = new StringBuilder(); From fbff9a39b6b79dfbff6759b28d54412c62aea0a0 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 13 Apr 2026 07:50:47 +0000 Subject: [PATCH 160/223] 8370378: Some compiler tests inadvertently exclude particular platforms Reviewed-by: mbaesken Backport-of: 60104575b221eb3d78a4d56839d55953d4036c21 --- test/hotspot/jtreg/compiler/c2/TestBit.java | 2 +- .../c2/irTests/RotateLeftNodeIntIdealizationTests.java | 4 ++-- .../c2/irTests/RotateLeftNodeLongIdealizationTests.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/hotspot/jtreg/compiler/c2/TestBit.java b/test/hotspot/jtreg/compiler/c2/TestBit.java index b1186a85cae1..01769470d78c 100644 --- a/test/hotspot/jtreg/compiler/c2/TestBit.java +++ b/test/hotspot/jtreg/compiler/c2/TestBit.java @@ -33,7 +33,7 @@ * @library /test/lib / * * @requires vm.flagless - * @requires os.arch=="aarch64" | os.arch=="amd64" | os.arch == "ppc64" | os.arch == "ppc64le" | os.arch == "riscv64" + * @requires os.arch == "aarch64" | os.arch == "amd64" | os.arch == "x86_64" | os.arch == "ppc64" | os.arch == "ppc64le" | os.arch == "riscv64" * @requires vm.debug == true & vm.compiler2.enabled * * @run driver compiler.c2.TestBit diff --git a/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeIntIdealizationTests.java b/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeIntIdealizationTests.java index 7ec9d98aae00..a21df9ccfc4b 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeIntIdealizationTests.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeIntIdealizationTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -31,7 +31,7 @@ * @summary Test that Ideal transformations of RotateLeftNode* are being performed as expected. * @library /test/lib / * @run driver compiler.c2.irTests.RotateLeftNodeIntIdealizationTests - * @requires os.arch == "x86_64" | os.arch == "aarch64" | (os.arch == "riscv64" & vm.opt.UseZbb == true) + * @requires os.arch == "amd64" | os.arch == "x86_64" | os.arch == "aarch64" | (os.arch == "riscv64" & vm.opt.UseZbb == true) */ public class RotateLeftNodeIntIdealizationTests { diff --git a/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeLongIdealizationTests.java b/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeLongIdealizationTests.java index dcc69d5721a7..4c8f15b40989 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeLongIdealizationTests.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeLongIdealizationTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -31,7 +31,7 @@ * @summary Test that Ideal transformations of RotateLeftNode* are being performed as expected. * @library /test/lib / * @run driver compiler.c2.irTests.RotateLeftNodeLongIdealizationTests - * @requires os.arch == "x86_64" | os.arch == "aarch64" | (os.arch == "riscv64" & vm.opt.UseZbb == true) + * @requires os.arch == "amd64" | os.arch == "x86_64" | os.arch == "aarch64" | (os.arch == "riscv64" & vm.opt.UseZbb == true) */ public class RotateLeftNodeLongIdealizationTests { From c55f6aead079059f7dd8ad287cf50a1d49da34f4 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 13 Apr 2026 07:53:10 +0000 Subject: [PATCH 161/223] 8367096: jdk/open/test/jdk/sun/security/pkcs11/ rsa, ec, config, secmod and sslecc tests are skipping but showing as pass Reviewed-by: mbaesken Backport-of: 7b35fc8ae584129290c91f6960e19ec087c54315 --- .../pkcs11/Config/ReadConfInUTF16Env.java | 6 +++--- test/jdk/sun/security/pkcs11/PKCS11Test.java | 2 +- .../security/pkcs11/Secmod/AddPrivateKey.java | 6 ++---- .../pkcs11/Secmod/AddTrustedCert.java | 4 +--- .../sun/security/pkcs11/Secmod/Crypto.java | 6 ++---- .../security/pkcs11/Secmod/GetPrivateKey.java | 6 ++---- .../pkcs11/Secmod/JksSetPrivateKey.java | 6 ++---- .../security/pkcs11/Secmod/LoadKeystore.java | 6 ++---- .../pkcs11/Secmod/TestNssDbSqlite.java | 20 +++++-------------- .../security/pkcs11/Secmod/TrustAnchors.java | 6 ++---- test/jdk/sun/security/pkcs11/SecmodTest.java | 5 ++--- .../security/pkcs11/ec/ReadCertificates.java | 4 ++-- .../sun/security/pkcs11/ec/ReadPKCS12.java | 4 ++-- .../security/pkcs11/ec/TestKeyFactory.java | 7 ++++--- test/jdk/sun/security/pkcs11/rsa/KeyWrap.java | 10 +++++----- .../pkcs11/sslecc/ClientJSSEServerJSSE.java | 4 ++-- .../pkcs11/tls/tls12/FipsModeTLS12.java | 4 +--- 17 files changed, 40 insertions(+), 66 deletions(-) diff --git a/test/jdk/sun/security/pkcs11/Config/ReadConfInUTF16Env.java b/test/jdk/sun/security/pkcs11/Config/ReadConfInUTF16Env.java index 11a6a781e01d..23f5fc3d6a1c 100644 --- a/test/jdk/sun/security/pkcs11/Config/ReadConfInUTF16Env.java +++ b/test/jdk/sun/security/pkcs11/Config/ReadConfInUTF16Env.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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,6 +29,7 @@ */ import jdk.test.lib.process.ProcessTools; +import jtreg.SkippedException; import org.testng.annotations.Test; import java.security.Provider; @@ -47,8 +48,7 @@ static class TestSunPKCS11Provider { public static void main(String[] args) throws Exception { Provider p = Security.getProvider("SunPKCS11"); if (p == null) { - System.out.println("Skipping test - no PKCS11 provider available"); - return; + throw new SkippedException("No PKCS11 provider available"); } System.out.println(p.getName()); } diff --git a/test/jdk/sun/security/pkcs11/PKCS11Test.java b/test/jdk/sun/security/pkcs11/PKCS11Test.java index f72a2e07b0d6..21324922c70c 100644 --- a/test/jdk/sun/security/pkcs11/PKCS11Test.java +++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java @@ -796,7 +796,7 @@ protected boolean skipTest(Provider p) { private void premain(Provider p) throws Exception { if (skipTest(p)) { - return; + throw new SkippedException("See logs for details"); } // set a security manager and policy before a test case runs, diff --git a/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java b/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java index ab74358fb0f7..91226f4a2280 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java +++ b/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -68,9 +68,7 @@ public static void main(String[] args) throws Exception { BASE + File.separator + args[1]); } - if (initSecmod() == false) { - return; - } + initSecmod(); String configName = BASE + SEP + "nss.cfg"; Provider p = getSunPKCS11(configName); diff --git a/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java b/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java index d8619ef87675..9c33c70e8952 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java +++ b/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java @@ -53,9 +53,7 @@ public static void main(String[] args) throws Exception { BASE + File.separator + args[1]); } - if (initSecmod() == false) { - return; - } + initSecmod(); X509Certificate cert; try (InputStream in = new FileInputStream(BASE + SEP + "anchor.cer")) { diff --git a/test/jdk/sun/security/pkcs11/Secmod/Crypto.java b/test/jdk/sun/security/pkcs11/Secmod/Crypto.java index d57794f1199f..57479db6bf5c 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/Crypto.java +++ b/test/jdk/sun/security/pkcs11/Secmod/Crypto.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -41,9 +41,7 @@ public class Crypto extends SecmodTest { public static void main(String[] args) throws Exception { - if (initSecmod() == false) { - return; - } + initSecmod(); String configName = BASE + SEP + "nsscrypto.cfg"; Provider p = getSunPKCS11(configName); diff --git a/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java b/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java index f9f809f0d28f..00fbe7325d83 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java +++ b/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -52,9 +52,7 @@ public static void main(String[] args) throws Exception { BASE + File.separator + args[1]); } - if (initSecmod() == false) { - return; - } + initSecmod(); String configName = BASE + SEP + "nss.cfg"; Provider p = getSunPKCS11(configName); diff --git a/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java b/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java index 1689d4c4ed99..65693963347e 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java +++ b/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -51,9 +51,7 @@ public static void main(String[] args) throws Exception { BASE + File.separator + args[1]); } - if (initSecmod() == false) { - return; - } + initSecmod(); String configName = BASE + SEP + "nss.cfg"; Provider p = getSunPKCS11(configName); diff --git a/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java b/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java index ce9f8e9bb638..4bd800a49838 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java +++ b/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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,9 +48,7 @@ public static void main(String[] args) throws Exception { BASE + File.separator + args[1]); } - if (!initSecmod()) { - return; - } + initSecmod(); String configName = BASE + SEP + "nss.cfg"; Provider p = getSunPKCS11(configName); diff --git a/test/jdk/sun/security/pkcs11/Secmod/TestNssDbSqlite.java b/test/jdk/sun/security/pkcs11/Secmod/TestNssDbSqlite.java index 7b22a4abfc6c..57309749e93a 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/TestNssDbSqlite.java +++ b/test/jdk/sun/security/pkcs11/Secmod/TestNssDbSqlite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. and/or its affiliates. + * Copyright (c) 2017, 2025, Red Hat, Inc. and/or its affiliates. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -46,6 +46,7 @@ import java.security.Provider; import java.security.Signature; +import jtreg.SkippedException; import sun.security.rsa.SunRsaSign; import sun.security.jca.ProviderList; import sun.security.jca.Providers; @@ -66,9 +67,7 @@ public final class TestNssDbSqlite extends SecmodTest { public static void main(String[] args) throws Exception { - if (!initialize()) { - return; - } + initializeProvider(); if (enableDebug) { System.out.println("SunPKCS11 provider: " + @@ -110,16 +109,9 @@ private static void testRetrieveKeysFromKeystore() throws Exception { } } - private static boolean initialize() throws Exception { - return initializeProvider(); - } - - private static boolean initializeProvider() throws Exception { + private static void initializeProvider() throws Exception { useSqlite(true); - if (!initSecmod()) { - System.out.println("Cannot init security module database, skipping"); - return false; - } + initSecmod(); sunPKCS11NSSProvider = getSunPKCS11(BASE + SEP + "nss-sqlite.cfg"); sunJCEProvider = new com.sun.crypto.provider.SunJCE(); @@ -135,7 +127,5 @@ private static boolean initializeProvider() throws Exception { gen.generate(2048); privateKey = gen.getPrivateKey(); certificate = gen.getSelfCertificate(new X500Name("CN=Me"), 365); - - return true; } } diff --git a/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java b/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java index 81863f028f9b..5b1d69ca90fa 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java +++ b/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -44,9 +44,7 @@ public class TrustAnchors extends SecmodTest { public static void main(String[] args) throws Exception { - if (initSecmod() == false) { - return; - } + initSecmod(); // our secmod.db file says nssckbi.*so*, so NSS does not find the // *DLL* on Windows nor the *DYLIB* on Mac OSX. diff --git a/test/jdk/sun/security/pkcs11/SecmodTest.java b/test/jdk/sun/security/pkcs11/SecmodTest.java index 8201548bf9da..1979066e26ad 100644 --- a/test/jdk/sun/security/pkcs11/SecmodTest.java +++ b/test/jdk/sun/security/pkcs11/SecmodTest.java @@ -42,7 +42,7 @@ static void useSqlite(boolean b) { useSqlite = b; } - static boolean initSecmod() throws Exception { + static void initSecmod() throws Exception { useNSS(); LIBPATH = getNSSLibDir(); // load all the libraries except libnss3 into memory @@ -60,7 +60,7 @@ static boolean initSecmod() throws Exception { System.setProperty("pkcs11test.nss.db", DBDIR); } File dbdirFile = new File(DBDIR); - if (dbdirFile.exists() == false) { + if (!dbdirFile.exists()) { dbdirFile.mkdir(); } @@ -73,7 +73,6 @@ static boolean initSecmod() throws Exception { copyFile("key3.db", BASE, DBDIR); copyFile("cert8.db", BASE, DBDIR); } - return true; } private static void copyFile(String name, String srcDir, String dstDir) throws IOException { diff --git a/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java b/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java index e0700a45553a..13d857b0aedf 100644 --- a/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java +++ b/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java @@ -56,6 +56,7 @@ import java.util.Map; import javax.security.auth.x500.X500Principal; import jdk.test.lib.security.Providers; +import jtreg.SkippedException; public class ReadCertificates extends PKCS11Test { @@ -79,8 +80,7 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { if (p.getService("Signature", "SHA1withECDSA") == null) { - System.out.println("Provider does not support ECDSA, skipping..."); - return; + throw new SkippedException("Provider does not support ECDSA"); } /* diff --git a/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java b/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java index 7acd4c2dc691..46b665526b9f 100644 --- a/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java +++ b/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java @@ -55,6 +55,7 @@ import java.util.Map; import java.util.Random; import jdk.test.lib.security.Providers; +import jtreg.SkippedException; public class ReadPKCS12 extends PKCS11Test { @@ -67,8 +68,7 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { if (p.getService("Signature", "SHA1withECDSA") == null) { - System.out.println("Provider does not support ECDSA, skipping..."); - return; + throw new SkippedException("Provider does not support ECDSA"); } /* diff --git a/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java b/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java index 60066f118af0..eb65be21a51d 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java +++ b/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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 @@ -32,6 +32,8 @@ * @run main/othervm -Djava.security.manager=allow TestKeyFactory sm */ +import jtreg.SkippedException; + import java.security.Key; import java.security.KeyFactory; import java.security.KeyPair; @@ -127,8 +129,7 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { if (p.getService("KeyFactory", "EC") == null) { - System.out.println("Provider does not support EC, skipping"); - return; + throw new SkippedException("Provider does not support EC, skipping"); } int[] keyLengths = {256, 521}; KeyFactory kf = KeyFactory.getInstance("EC", p); diff --git a/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java b/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java index 9a44d8ff0360..301d374646ca 100644 --- a/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java +++ b/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -33,6 +33,8 @@ * @run main/othervm -Djava.security.manager=allow KeyWrap sm */ +import jtreg.SkippedException; + import java.security.GeneralSecurityException; import java.security.InvalidKeyException; import java.security.Key; @@ -55,8 +57,7 @@ public void main(Provider p) throws Exception { try { Cipher.getInstance("RSA/ECB/PKCS1Padding", p); } catch (GeneralSecurityException e) { - System.out.println("Not supported by provider, skipping"); - return; + throw new SkippedException("Not supported by provider, skipping"); } KeyPair kp; try { @@ -75,8 +76,7 @@ public void main(Provider p) throws Exception { kp = new KeyPair(pub, priv); } catch (NoSuchAlgorithmException | InvalidKeyException ee) { ee.printStackTrace(); - System.out.println("Provider does not support RSA, skipping"); - return; + throw new SkippedException("Provider does not support RSA, skipping"); } } System.out.println(kp); diff --git a/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java b/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java index e57ba07741c9..d6354e81e779 100644 --- a/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java +++ b/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java @@ -42,6 +42,7 @@ import java.security.Provider; import java.security.Security; import jdk.test.lib.security.Providers; +import jtreg.SkippedException; public class ClientJSSEServerJSSE extends PKCS11Test { @@ -60,8 +61,7 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { if (p.getService("KeyFactory", "EC") == null) { - System.out.println("Provider does not support EC, skipping"); - return; + throw new SkippedException("Provider does not support EC, skipping"); } Providers.setAt(p, 1); CipherTest.main(new JSSEFactory(), cmdArgs); diff --git a/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java b/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java index a91bbac46519..eff712024d5c 100644 --- a/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java +++ b/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java @@ -454,9 +454,7 @@ private static void initialize() throws Exception { disabledAlgorithms += "RSASSA-PSS"; Security.setProperty("jdk.tls.disabledAlgorithms", disabledAlgorithms); - if (initSecmod() == false) { - return; - } + initSecmod(); String configName = BASE + SEP + "nss.cfg"; sunPKCS11NSSProvider = getSunPKCS11(configName); System.out.println("SunPKCS11 provider: " + sunPKCS11NSSProvider); From 22931534363be4e2c43d997fa6afeb549ef9e1aa Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 13 Apr 2026 07:57:42 +0000 Subject: [PATCH 162/223] 8323792: ThreadSnapshot::initialize can cause assert in Thread::check_for_dangling_thread_pointer (possibility of dangling Thread pointer) Backport-of: eaecaf8031a0f441a8cd00067e777ba213d00f9c --- src/hotspot/share/runtime/threadSMR.cpp | 7 +- src/hotspot/share/runtime/threads.cpp | 2 +- src/hotspot/share/services/management.cpp | 3 +- src/hotspot/share/services/threadIdTable.cpp | 22 ++- src/hotspot/share/services/threadIdTable.hpp | 7 +- .../threads/ThreadInfoTest.java | 187 ++++++++++++++++++ 6 files changed, 211 insertions(+), 17 deletions(-) create mode 100644 test/hotspot/jtreg/serviceability/threads/ThreadInfoTest.java diff --git a/src/hotspot/share/runtime/threadSMR.cpp b/src/hotspot/share/runtime/threadSMR.cpp index 1469c7a42aa6..a15bb1710618 100644 --- a/src/hotspot/share/runtime/threadSMR.cpp +++ b/src/hotspot/share/runtime/threadSMR.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, 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 @@ -727,7 +727,8 @@ JavaThread* ThreadsList::find_JavaThread_from_java_tid(jlong java_tid) const { } } } - } else if (!thread->is_exiting()) { + } else if (includes(thread) && !thread->is_exiting()) { + // The thread is protected by this list and has not yet exited return thread; } return nullptr; @@ -866,7 +867,7 @@ void ThreadsSMRSupport::add_thread(JavaThread *thread){ ThreadsList *old_list = xchg_java_thread_list(new_list); free_list(old_list); - if (ThreadIdTable::is_initialized()) { + if (ThreadIdTable::is_initialized_acquire()) { jlong tid = SharedRuntime::get_java_tid(thread); ThreadIdTable::add_thread(tid, thread); } diff --git a/src/hotspot/share/runtime/threads.cpp b/src/hotspot/share/runtime/threads.cpp index 618bf77768d3..90514b737bcc 100644 --- a/src/hotspot/share/runtime/threads.cpp +++ b/src/hotspot/share/runtime/threads.cpp @@ -1044,7 +1044,7 @@ void Threads::remove(JavaThread* p, bool is_daemon) { MutexLocker throttle_ml(UseThreadsLockThrottleLock ? ThreadsLockThrottle_lock : nullptr); MonitorLocker ml(Threads_lock); - if (ThreadIdTable::is_initialized()) { + if (ThreadIdTable::is_initialized_acquire()) { // This cleanup must be done before the current thread's GC barrier // is detached since we need to touch the threadObj oop. jlong tid = SharedRuntime::get_java_tid(p); diff --git a/src/hotspot/share/services/management.cpp b/src/hotspot/share/services/management.cpp index a8690743ef62..5de75840f3d3 100644 --- a/src/hotspot/share/services/management.cpp +++ b/src/hotspot/share/services/management.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, 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 @@ -1130,6 +1130,7 @@ JVM_ENTRY(jint, jmm_GetThreadInfo(JNIEnv *env, jlongArray ids, jint maxDepth, jo // create dummy snapshot dump_result.add_thread_snapshot(); } else { + assert(dump_result.t_list()->includes(jt), "Must be protected"); dump_result.add_thread_snapshot(jt); } } diff --git a/src/hotspot/share/services/threadIdTable.cpp b/src/hotspot/share/services/threadIdTable.cpp index 168b2e085adf..fb9ce13c6224 100644 --- a/src/hotspot/share/services/threadIdTable.cpp +++ b/src/hotspot/share/services/threadIdTable.cpp @@ -1,6 +1,6 @@ /* -* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2019, 2026, 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 @@ -25,7 +25,6 @@ #include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" -#include "runtime/atomic.hpp" #include "runtime/interfaceSupport.inline.hpp" #include "runtime/javaThread.inline.hpp" #include "runtime/threadSMR.hpp" @@ -83,24 +82,25 @@ class ThreadIdTableConfig : public AllStatic { // Lazily creates the table and populates it with the given // thread list void ThreadIdTable::lazy_initialize(const ThreadsList *threads) { - if (!_is_initialized) { + if (!Atomic::load_acquire(&_is_initialized)) { { // There is no obvious benefit in allowing the thread table // to be concurrently populated during initialization. MutexLocker ml(ThreadIdTableCreate_lock); - if (_is_initialized) { + if (Atomic::load(&_is_initialized)) { return; } create_table(threads->length()); - _is_initialized = true; + Atomic::release_store(&_is_initialized, true); } + for (uint i = 0; i < threads->length(); i++) { JavaThread* thread = threads->thread_at(i); oop tobj = thread->threadObj(); if (tobj != nullptr) { - jlong java_tid = java_lang_Thread::thread_id(tobj); MutexLocker ml(Threads_lock); if (!thread->is_exiting()) { + jlong java_tid = java_lang_Thread::thread_id(tobj); // Must be inside the lock to ensure that we don't add a thread to the table // that has just passed the removal point in Threads::remove(). add_thread(java_tid, thread); @@ -213,7 +213,7 @@ class ThreadGet : public StackObj { }; void ThreadIdTable::do_concurrent_work(JavaThread* jt) { - assert(_is_initialized, "Thread table is not initialized"); + assert(Atomic::load(&_is_initialized), "Thread table is not initialized"); _has_work = false; double load_factor = get_load_factor(); log_debug(thread, table)("Concurrent work, load factor: %g", load_factor); @@ -223,7 +223,8 @@ void ThreadIdTable::do_concurrent_work(JavaThread* jt) { } JavaThread* ThreadIdTable::add_thread(jlong tid, JavaThread* java_thread) { - assert(_is_initialized, "Thread table is not initialized"); + assert(Threads_lock->owned_by_self(), "Must hold Threads_lock"); + assert(Atomic::load(&_is_initialized), "Thread table is not initialized"); Thread* thread = Thread::current(); ThreadIdTableLookup lookup(tid); ThreadGet tg; @@ -242,7 +243,7 @@ JavaThread* ThreadIdTable::add_thread(jlong tid, JavaThread* java_thread) { } JavaThread* ThreadIdTable::find_thread_by_tid(jlong tid) { - assert(_is_initialized, "Thread table is not initialized"); + assert(Atomic::load(&_is_initialized), "Thread table is not initialized"); Thread* thread = Thread::current(); ThreadIdTableLookup lookup(tid); ThreadGet tg; @@ -251,7 +252,8 @@ JavaThread* ThreadIdTable::find_thread_by_tid(jlong tid) { } bool ThreadIdTable::remove_thread(jlong tid) { - assert(_is_initialized, "Thread table is not initialized"); + assert(Threads_lock->owned_by_self(), "Must hold Threads_lock"); + assert(Atomic::load(&_is_initialized), "Thread table is not initialized"); Thread* thread = Thread::current(); ThreadIdTableLookup lookup(tid); return _local_table->remove(thread, lookup); diff --git a/src/hotspot/share/services/threadIdTable.hpp b/src/hotspot/share/services/threadIdTable.hpp index 12772aed88c0..a292d04452a2 100644 --- a/src/hotspot/share/services/threadIdTable.hpp +++ b/src/hotspot/share/services/threadIdTable.hpp @@ -1,6 +1,6 @@ /* -* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2019, 2026, 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 @@ -27,6 +27,7 @@ #define SHARE_SERVICES_THREADIDTABLE_HPP #include "memory/allStatic.hpp" +#include "runtime/atomic.hpp" class JavaThread; class ThreadsList; @@ -41,7 +42,9 @@ class ThreadIdTable : public AllStatic { public: // Initialization static void lazy_initialize(const ThreadsList* threads); - static bool is_initialized() { return _is_initialized; } + static bool is_initialized_acquire() { + return Atomic::load_acquire(&_is_initialized); + } // Lookup and list management static JavaThread* find_thread_by_tid(jlong tid); diff --git a/test/hotspot/jtreg/serviceability/threads/ThreadInfoTest.java b/test/hotspot/jtreg/serviceability/threads/ThreadInfoTest.java new file mode 100644 index 000000000000..b5db455cc201 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/threads/ThreadInfoTest.java @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2026, 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 jdk.test.lib.Utils; + +import java.lang.management.ManagementFactory; +import java.lang.management.ThreadInfo; +import java.lang.management.ThreadMXBean; + +import java.util.ArrayList; +import java.util.List; + +/* + * @test + * @bug 8323792 + * @summary Make sure that jmm_GetThreadInfo() call does not crash JVM + * @library /test/lib + * @modules java.management + * @run main/othervm ThreadInfoTest + * + * @comment Exercise getThreadInfo(ids, 0). Depth parameter of zero means + * no VM operation, which could crash with Threads starting and ending. + */ + +public class ThreadInfoTest { + private static com.sun.management.ThreadMXBean mbean = + (com.sun.management.ThreadMXBean)ManagementFactory.getThreadMXBean(); + + private static final int NUM_THREADS = 2; + static long[] ids = new long[NUM_THREADS]; + static ThreadInfo[] infos = new ThreadInfo[NUM_THREADS]; + static volatile int count = 0; + static int ITERATIONS = 4; + + public static void main(String[] argv) throws Exception { + boolean replacing = false; + + startThreads(ids, NUM_THREADS); + new MyGetThreadInfoThread(ids).start(); + new MyReplacerThread(ids).start(); + for (int i = 0; i < ITERATIONS; i++) { + do { + count = countInfo(infos); + System.out.println("Iteration " + i + ": ThreadInfos found (Threads alive): " + count); + goSleep(100); + } while (count > 0); + } + } + + private static Thread newThread(int i) { + Thread thread = new MyThread(i); + thread.setDaemon(true); + return thread; + } + + private static void startThreads(long[] ids, int count) { + System.out.println("Starting " + count + " Threads..."); + Thread[] threads = new Thread[count]; + for (int i = 0; i < count; i++) { + threads[i] = newThread(i); + threads[i].start(); + ids[i] = threads[i].getId(); + } + System.out.println(ids); + } + + // Count ThreadInfo from array, return how many are non-null. + private static int countInfo(ThreadInfo[] info) { + int count = 0; + if (info != null) { + int i = 0; + for (ThreadInfo ti: info) { + if (ti != null) { + count++; + } + i++; + } + } + return count; + } + + private static int replaceThreads(long[] ids, ThreadInfo[] info) { + int replaced = 0; + if (info != null) { + for (int i = 0; i < info.length; i++) { + ThreadInfo ti = info[i]; + if (ti == null) { + Thread thread = newThread(i); + thread.start(); + ids[i] = thread.getId(); + replaced++; + } + } + } + return replaced; + } + + private static void goSleep(long ms) { + try { + Thread.sleep(ms); + } catch (InterruptedException e) { + System.out.println("Unexpected exception is thrown: " + e); + } + } + + // A Thread which replaces Threads in the shared array of threads. + static class MyReplacerThread extends Thread { + long[] ids; + + public MyReplacerThread(long[] ids) { + this.ids = ids; + this.setDaemon(true); + } + + public void run() { + boolean replacing = false; + while (true) { + if (replacing) { + replaceThreads(ids, infos); + } + if (count < 10) { + replacing = true; + } + if (count > 20) { + replacing = false; + } + goSleep(1); + } + } + } + + // A Thread which lives for a short while. + static class MyThread extends Thread { + long endTimeMs; + + public MyThread(long n) { + super("MyThread-" + n); + endTimeMs = (n * n * 10) + System.currentTimeMillis(); + } + + public void run() { + try { + long sleep = Math.max(1, endTimeMs - System.currentTimeMillis()); + goSleep(sleep); + } catch (Exception e) { + System.out.println(Thread.currentThread().getName() + ": " + e); + } + } + } + + // A Thread to continually call getThreadInfo on a shared array of thread ids. + static class MyGetThreadInfoThread extends Thread { + long[] ids; + + public MyGetThreadInfoThread(long[] ids) { + this.ids = ids; + this.setDaemon(true); + } + + public void run() { + while (true) { + infos = mbean.getThreadInfo(ids, 0); + goSleep(10); + } + } + } +} From 8e97de5076fa3e3a191601744271222960dcf208 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 13 Apr 2026 08:02:15 +0000 Subject: [PATCH 163/223] 8380474: Crash SEGV in ThreadIdTable::lazy_initialize after JDK-8323792 Backport-of: 7e943e7d41ee8175660e236c4b7fe39604fdae2f --- src/hotspot/share/services/threadIdTable.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/services/threadIdTable.cpp b/src/hotspot/share/services/threadIdTable.cpp index fb9ce13c6224..3355fc26eaaf 100644 --- a/src/hotspot/share/services/threadIdTable.cpp +++ b/src/hotspot/share/services/threadIdTable.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" +#include "runtime/handles.hpp" #include "runtime/interfaceSupport.inline.hpp" #include "runtime/javaThread.inline.hpp" #include "runtime/threadSMR.hpp" @@ -96,11 +97,11 @@ void ThreadIdTable::lazy_initialize(const ThreadsList *threads) { for (uint i = 0; i < threads->length(); i++) { JavaThread* thread = threads->thread_at(i); - oop tobj = thread->threadObj(); + Handle tobj = Handle(JavaThread::current(), thread->threadObj()); if (tobj != nullptr) { MutexLocker ml(Threads_lock); if (!thread->is_exiting()) { - jlong java_tid = java_lang_Thread::thread_id(tobj); + jlong java_tid = java_lang_Thread::thread_id(tobj()); // Must be inside the lock to ensure that we don't add a thread to the table // that has just passed the removal point in Threads::remove(). add_thread(java_tid, thread); From c756e26a974bbd193547f7ada44aed2cecc2ec26 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Mon, 13 Apr 2026 16:46:46 +0000 Subject: [PATCH 164/223] 8068378: [TEST_BUG]The java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java instruction need to update Backport-of: 6e2ab84154e7cc11a31026c588a7dc3ceb446cc2 --- test/jdk/ProblemList.txt | 1 - .../PrintDialogsTest/PrintDialogsTest.java | 63 +++++++++---------- .../java/awt/Modal/PrintDialogsTest/Test.java | 1 + 3 files changed, 30 insertions(+), 35 deletions(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 06f66808f262..e3cd6204a4c5 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -803,7 +803,6 @@ java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_1.java 7131438,802 java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_2.java 7131438,8022539 generic-all java/awt/Modal/WsDisabledStyle/CloseBlocker/CloseBlocker.java 7187741 linux-all,macosx-all java/awt/xembed/server/TestXEmbedServerJava.java 8001150,8004031 generic-all -java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java 8068378 generic-all java/awt/image/VolatileImage/VolatileImageConfigurationTest.java 8171069 macosx-all,linux-all java/awt/Modal/InvisibleParentTest/InvisibleParentTest.java 8172245 linux-all java/awt/Frame/FrameStateTest/FrameStateTest.java 8203920 macosx-all,linux-all diff --git a/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java b/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java index e2b2d8cac787..3e191fa0c4c0 100644 --- a/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java +++ b/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java @@ -49,40 +49,35 @@ public class PrintDialogsTest extends Panel implements ActionListener { - static final String INSTRUCTIONS = """ - This test is free format, which means there is no enforced or guided sequence. - - Please select each of - (a) The dialog parent type. - (b) The dialog modality type - (c) The print dialog type (Print dialog or Page Setup dialog) - - Once the choices have been made click the "Start test" button. - - Three windows will appear - (1) A Frame or a Dialog - in the case you selected "Dialog" as the parent type - (2) a Window (ie an undecorated top-level) - (3) A dialog with two buttons "Open" and "Finish" - - Now check as follows whether modal blocking works as expected. - Windows (1) and (2) contain a button which you should be able to press - ONLY if you selected "Non-modal", or "Modeless" for modality type. - In other cases window (3) will block input to (1) and (2) - - Then push the "Open" button on the Dialog to show the printing dialog and check - if it blocks the rest of the application - ie all of windows (1), (2) and (3) - should ALWAYS be blocked when the print dialog is showing. - Now cancel the printing dialog and check the correctness of modal blocking - behavior for the Dialog again. - To close all the 3 test windows please push the "Finish" button. - - Repeat all the above for different combinations, which should include - using all of the Dialog parent choices and all of the Dialog Modality types. - - If any behave incorrectly, note the combination of choices and press Fail. - - If all behave correctly, press Pass. - """; + static final String INSTRUCTIONS = + "1. On the Test UI Select:\n" + + "\tThe dialog parent type. (e.g. Frame, Dialog, Hidden, Null)\n" + + "\tThe dialog modality type. (e.g. Modal, Non-Modal, Toolkit modal).\n" + + "\tThe print dialog type. (Print dialog or Page Setup dialog).\n\n" + + "2. Next, click on 'Start test' - Three windows will appear:\n" + + "\tWindow (1) -a Frame or Dialog (depending on selected parent type).\n" + + "\tWindow (2) -an undecorated top-level Window.\n" + + "\tWindow (3) -a Dialog containing two buttons: 'Open' and 'Finish'.\n" + + "\tWindows (1) & (2) have a Dummy button.\n\n" + + "3. Press the button on Window (1) & Window (2) \n" + + "Verification step:\n" + + "\tIf Modality is 'Non-modal' or 'Modeless', Button is pressed \n" + + "\tIf Modality is 'Document' & parent is not Frame/Dialog, Button is pressed \n" + + "\tIn all other cases, button is not pressed & Window (3) should \n" + + "\tblock input to Windows (1) & (2).\n\n" + + "4. Next, press the 'Open' button in Window (3) to open print dialog.\n\n" + + "5. Press the button on Window (1) & Window (2)\n" + + "Verification step:\n" + + "\tThe print dialog should block all three windows (1, 2, and 3).\n\n" + + "6. Cancel the print dialog, Check again if Window (3) " + + "blocks Windows (1) and (2) correctly.\n" + + "Verification step:\n" + + "\tConditions as seen in Verification step 3 " + + "should be seen, as before.\n" + + "To close all test windows, press 'Finish'.\n\n" + + "7. Repeat the steps for different combinations of Dialog Parent, Dialog Modality Type, Print Dialg Type.\n" + + "Try every dialog parent type and every dialog modality type.\n\n" + + "If any of the Verification step fails, note the combination and press 'Fail'.\n"; public static void main(String[] args) throws Exception { diff --git a/test/jdk/java/awt/Modal/PrintDialogsTest/Test.java b/test/jdk/java/awt/Modal/PrintDialogsTest/Test.java index 3c8faceb3a9a..0f1909711862 100644 --- a/test/jdk/java/awt/Modal/PrintDialogsTest/Test.java +++ b/test/jdk/java/awt/Modal/PrintDialogsTest/Test.java @@ -191,6 +191,7 @@ private void createGUI() { break; case DIALOG: dialog = new CustomDialog(parent); + break; case FRAME: dialog = new CustomDialog(frame); break; From e66f0e4d0a5a5388d6c77ca68c0cf4066f81e8cf Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Mon, 13 Apr 2026 16:47:13 +0000 Subject: [PATCH 165/223] 8319326: GC: Make TestParallelRefProc use createTestJavaProcessBuilder Backport-of: 3a8a6e07f2a2cffa467815df55e746e92765903d --- .../gc/arguments/TestParallelRefProc.java | 85 +++++++++++++------ 1 file changed, 57 insertions(+), 28 deletions(-) diff --git a/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java b/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java index 40dfc4dc7fbe..2cd9e9cd60b2 100644 --- a/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java +++ b/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -24,13 +24,30 @@ package gc.arguments; /* - * @test TestParallelRefProc - * @summary Test defaults processing for -XX:+ParallelRefProcEnabled. + * @test id=Serial + * @summary Test defaults processing for -XX:+ParallelRefProcEnabled with Serial GC. * @library /test/lib * @library / - * @build jdk.test.whitebox.WhiteBox - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.arguments.TestParallelRefProc + * @requires vm.gc.Serial + * @run driver gc.arguments.TestParallelRefProc Serial + */ + +/* + * @test id=Parallel + * @summary Test defaults processing for -XX:+ParallelRefProcEnabled with Parallel GC. + * @library /test/lib + * @library / + * @requires vm.gc.Parallel + * @run driver gc.arguments.TestParallelRefProc Parallel + */ + +/* + * @test id=G1 + * @summary Test defaults processing for -XX:+ParallelRefProcEnabled with G1 GC. + * @library /test/lib + * @library / + * @requires vm.gc.G1 + * @run driver gc.arguments.TestParallelRefProc G1 */ import java.util.Arrays; @@ -38,34 +55,46 @@ import jdk.test.lib.process.OutputAnalyzer; -import jtreg.SkippedException; -import jdk.test.whitebox.gc.GC; - public class TestParallelRefProc { public static void main(String args[]) throws Exception { - boolean noneGCSupported = true; - if (GC.Serial.isSupported()) { - noneGCSupported = false; - testFlag(new String[] { "-XX:+UseSerialGC" }, false); + if (args.length == 0) { + throw new IllegalArgumentException("Test type must be specified as argument"); } - if (GC.Parallel.isSupported()) { - noneGCSupported = false; - testFlag(new String[] { "-XX:+UseParallelGC", "-XX:ParallelGCThreads=1" }, false); - testFlag(new String[] { "-XX:+UseParallelGC", "-XX:ParallelGCThreads=2" }, true); - testFlag(new String[] { "-XX:+UseParallelGC", "-XX:-ParallelRefProcEnabled", "-XX:ParallelGCThreads=2" }, false); - } - if (GC.G1.isSupported()) { - noneGCSupported = false; - testFlag(new String[] { "-XX:+UseG1GC", "-XX:ParallelGCThreads=1" }, false); - testFlag(new String[] { "-XX:+UseG1GC", "-XX:ParallelGCThreads=2" }, true); - testFlag(new String[] { "-XX:+UseG1GC", "-XX:-ParallelRefProcEnabled", "-XX:ParallelGCThreads=2" }, false); - } - if (noneGCSupported) { - throw new SkippedException("Skipping test because none of Serial/Parallel/G1 is supported."); + + String testType = args[0]; + + switch (testType) { + case "Serial": + testSerial(); + break; + case "Parallel": + testParallel(); + break; + case "G1": + testG1(); + break; + default: + throw new IllegalArgumentException("Unknown test type \"" + testType + "\""); } } + private static void testSerial() throws Exception { + testFlag(new String[] { "-XX:+UseSerialGC" }, false); + } + + private static void testParallel() throws Exception { + testFlag(new String[] { "-XX:+UseParallelGC", "-XX:ParallelGCThreads=1" }, false); + testFlag(new String[] { "-XX:+UseParallelGC", "-XX:ParallelGCThreads=2" }, true); + testFlag(new String[] { "-XX:+UseParallelGC", "-XX:-ParallelRefProcEnabled", "-XX:ParallelGCThreads=2" }, false); + } + + private static void testG1() throws Exception { + testFlag(new String[] { "-XX:+UseG1GC", "-XX:ParallelGCThreads=1" }, false); + testFlag(new String[] { "-XX:+UseG1GC", "-XX:ParallelGCThreads=2" }, true); + testFlag(new String[] { "-XX:+UseG1GC", "-XX:-ParallelRefProcEnabled", "-XX:ParallelGCThreads=2" }, false); + } + private static final String parallelRefProcEnabledPattern = " *bool +ParallelRefProcEnabled *= *true +\\{product\\}"; @@ -77,7 +106,7 @@ private static void testFlag(String[] args, boolean expectedTrue) throws Excepti result.addAll(Arrays.asList(args)); result.add("-XX:+PrintFlagsFinal"); result.add("-version"); - OutputAnalyzer output = GCArguments.executeLimitedTestJava(result); + OutputAnalyzer output = GCArguments.executeTestJava(result); output.shouldHaveExitValue(0); From a783d0f31f9b7059b963c3ded8dc37e9d1b83639 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Mon, 13 Apr 2026 16:50:57 +0000 Subject: [PATCH 166/223] 8368498: Use JUnit instead of TestNG for jdk_text tests Reviewed-by: phh Backport-of: 12c0f29b97f0ccd03dee6850a3a9a7117124016e --- .../text/Collator/RuleBasedCollatorTest.java | 95 +++++++------- .../CompactFormatAndParseHelper.java | 11 +- .../CompactNumberFormat/TestCNFRounding.java | 55 ++++---- .../TestCompactNumber.java | 84 ++++++------ .../TestCompactPatternsValidity.java | 50 ++++---- .../CompactNumberFormat/TestEquality.java | 15 ++- .../TestFormatToCharacterIterator.java | 34 +++-- .../TestMutatingInstance.java | 31 +++-- .../TestParseBigDecimal.java | 23 ++-- .../CompactNumberFormat/TestPlurals.java | 55 ++++---- .../TestSpecialValues.java | 25 ++-- .../TestUExtensionOverride.java | 25 ++-- .../TestWithCompatProvider.java | 17 ++- .../serialization/TestDeserializeCNF.java | 23 ++-- .../serialization/TestSerialization.java | 24 ++-- .../text/Format/DateFormat/Bug8193444.java | 22 ++-- .../DateFormat/CaseInsensitiveParseTest.java | 32 +++-- .../Format/DateFormat/LocaleDateFormats.java | 24 ++-- .../SimpleDateFormatPatternTest.java | 120 ++++++++++-------- .../DecimalFormat/SetGroupingSizeTest.java | 38 +++--- .../NumberFormat/DFSMinusPerCentMill.java | 53 ++++---- .../Normalizer/SquareEraCharacterTest.java | 24 ++-- 22 files changed, 498 insertions(+), 382 deletions(-) diff --git a/test/jdk/java/text/Collator/RuleBasedCollatorTest.java b/test/jdk/java/text/Collator/RuleBasedCollatorTest.java index 429768b6bf1b..cd1e8ca69c00 100644 --- a/test/jdk/java/text/Collator/RuleBasedCollatorTest.java +++ b/test/jdk/java/text/Collator/RuleBasedCollatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -26,40 +26,45 @@ * @bug 4406815 8222969 8266784 * @summary RuleBasedCollatorTest uses very limited but selected test data * to test basic functionalities provided by RuleBasedCollator. - * @run testng/othervm RuleBasedCollatorTest + * @run junit/othervm RuleBasedCollatorTest */ +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.CollationElementIterator; import java.text.CollationKey; -import java.text.RuleBasedCollator; import java.text.Collator; import java.text.ParseException; +import java.text.RuleBasedCollator; import java.util.Arrays; import java.util.Locale; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import org.testng.SkipException; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeFalse; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class RuleBasedCollatorTest { - static RuleBasedCollator USC; - static String US_RULES; + private static RuleBasedCollator USC; + private static String US_RULES; - @BeforeClass - public void setup() { + @BeforeAll + void setup() { Collator c = Collator.getInstance(Locale.US); - if (!(c instanceof RuleBasedCollator)) { - throw new SkipException("skip tests."); - } + assumeFalse(!(c instanceof RuleBasedCollator), "skip tests."); USC = (RuleBasedCollator) c; US_RULES = USC.getRules(); } - @DataProvider(name = "rulesData") Object[][] rulesData() { //Basic Tailor String BASIC_TAILOR_RULES = "< b=c<\u00e6;A,a"; @@ -91,15 +96,15 @@ Object[][] rulesData() { }; } - @Test(dataProvider = "rulesData") - public void testRules(String rules, String[] testData, String[] expected) + @ParameterizedTest + @MethodSource("rulesData") + void testRules(String rules, String[] testData, String[] expected) throws ParseException { Arrays.sort(testData, new RuleBasedCollator(rules)); - assertEquals(testData, expected); + assertArrayEquals(expected, testData); } - @DataProvider(name = "FrenchSecondarySort") Object[][] FrenchSecondarySort() { return new Object[][] { { "\u0061\u00e1\u0061", "\u00e1\u0061\u0061", 1 }, @@ -111,8 +116,9 @@ Object[][] FrenchSecondarySort() { { "a", "\u1ea1", -1 } }; } - @Test(dataProvider = "FrenchSecondarySort") - public void testFrenchSecondarySort(String sData, String tData, + @ParameterizedTest + @MethodSource("FrenchSecondarySort") + void testFrenchSecondarySort(String sData, String tData, int expected) throws ParseException { String french_rule = "@"; String rules = US_RULES + french_rule; @@ -121,7 +127,6 @@ public void testFrenchSecondarySort(String sData, String tData, assertEquals(expected, result); } - @DataProvider(name = "ThaiLaoVowelConsonantSwapping") Object[][] ThaiLaoVowelConsonantSwapping() { return new Object[][] {{"\u0e44\u0e01", "\u0e40\u0e2e", -1},//swap {"\u0e2e\u0e40", "\u0e01\u0e44", 1},//no swap @@ -129,8 +134,9 @@ Object[][] ThaiLaoVowelConsonantSwapping() { }; } - @Test(dataProvider = "ThaiLaoVowelConsonantSwapping") - public void testThaiLaoVowelConsonantSwapping(String sData, String tData, + @ParameterizedTest + @MethodSource("ThaiLaoVowelConsonantSwapping") + void testThaiLaoVowelConsonantSwapping(String sData, String tData, int expected) throws ParseException { String thai_rule = "& Z < \u0e01 < \u0e2e <\u0e40 < \u0e44!"; String rules = US_RULES + thai_rule; @@ -140,16 +146,15 @@ public void testThaiLaoVowelConsonantSwapping(String sData, String tData, } @Test - public void testIgnorableCharacter() throws ParseException { + void testIgnorableCharacter() throws ParseException { String rule = "=f new RuleBasedCollator(rule)); } - @Test(expectedExceptions = NullPointerException.class) - public void testNullParseException() throws ParseException{ - new RuleBasedCollator(null); + @Test + void testNullParseException() { + assertThrows(NullPointerException.class, () -> new RuleBasedCollator(null)); } } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/CompactFormatAndParseHelper.java b/test/jdk/java/text/Format/CompactNumberFormat/CompactFormatAndParseHelper.java index 3f3f1932e51e..4d410f97b5d9 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/CompactFormatAndParseHelper.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/CompactFormatAndParseHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -24,14 +24,15 @@ import java.text.NumberFormat; import java.text.ParseException; import java.text.ParsePosition; -import static org.testng.Assert.assertEquals; + +import static org.junit.jupiter.api.Assertions.assertEquals; class CompactFormatAndParseHelper { static void testFormat(NumberFormat cnf, Object number, String expected) { String result = cnf.format(number); - assertEquals(result, expected, "Incorrect formatting of the number '" + assertEquals(expected, result, "Incorrect formatting of the number '" + number + "'"); } @@ -46,11 +47,11 @@ static void testParse(NumberFormat cnf, String parseString, } if (returnType != null) { - assertEquals(number.getClass(), returnType, + assertEquals(returnType, number.getClass(), "Incorrect return type for string '" + parseString + "'"); } - assertEquals(number, expected, "Incorrect parsing of the string '" + assertEquals(expected, number, "Incorrect parsing of the string '" + parseString + "'"); } } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestCNFRounding.java b/test/jdk/java/text/Format/CompactNumberFormat/TestCNFRounding.java index b4dddfa1df77..0ba9587a3443 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestCNFRounding.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestCNFRounding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -20,21 +20,28 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 * @summary Checks the rounding of formatted number in compact number formatting - * @run testng/othervm TestCNFRounding + * @run junit/othervm TestCNFRounding */ +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.math.RoundingMode; import java.text.NumberFormat; import java.util.List; import java.util.Locale; -import static org.testng.Assert.*; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestCNFRounding { private static final List MODES = List.of( @@ -46,7 +53,6 @@ public class TestCNFRounding { RoundingMode.CEILING, RoundingMode.FLOOR); - @DataProvider(name = "roundingData") Object[][] roundingData() { return new Object[][]{ // Number, half_even, half_up, half_down, up, down, ceiling, floor @@ -70,7 +76,6 @@ Object[][] roundingData() { {-4500, new String[]{"-4K", "-5K", "-4K", "-5K", "-4K", "-4K", "-5K"}},}; } - @DataProvider(name = "roundingFract") Object[][] roundingFract() { return new Object[][]{ // Number, half_even, half_up, half_down, up, down, ceiling, floor @@ -94,7 +99,6 @@ Object[][] roundingFract() { {-4500, new String[]{"-4.5K", "-4.5K", "-4.5K", "-4.5K", "-4.5K", "-4.5K", "-4.5K"}},}; } - @DataProvider(name = "rounding2Fract") Object[][] rounding2Fract() { return new Object[][]{ // Number, half_even, half_up, half_down @@ -118,37 +122,42 @@ Object[][] rounding2Fract() { {4686, new String[]{"4.69K", "4.69K", "4.69K"}},}; } - @Test(expectedExceptions = NullPointerException.class) - public void testNullMode() { - NumberFormat fmt = NumberFormat - .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); - fmt.setRoundingMode(null); + @Test + void testNullMode() { + assertThrows(NullPointerException.class, () -> { + NumberFormat fmt = NumberFormat + .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); + fmt.setRoundingMode(null); + }); } @Test - public void testDefaultRoundingMode() { + void testDefaultRoundingMode() { NumberFormat fmt = NumberFormat .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); - assertEquals(fmt.getRoundingMode(), RoundingMode.HALF_EVEN, + assertEquals(RoundingMode.HALF_EVEN, fmt.getRoundingMode(), "Default RoundingMode should be " + RoundingMode.HALF_EVEN); } - @Test(dataProvider = "roundingData") - public void testRounding(Object number, String[] expected) { + @ParameterizedTest + @MethodSource("roundingData") + void testRounding(Object number, String[] expected) { for (int index = 0; index < MODES.size(); index++) { testRoundingMode(number, expected[index], 0, MODES.get(index)); } } - @Test(dataProvider = "roundingFract") - public void testRoundingFract(Object number, String[] expected) { + @ParameterizedTest + @MethodSource("roundingFract") + void testRoundingFract(Object number, String[] expected) { for (int index = 0; index < MODES.size(); index++) { testRoundingMode(number, expected[index], 1, MODES.get(index)); } } - @Test(dataProvider = "rounding2Fract") - public void testRounding2Fract(Object number, String[] expected) { + @ParameterizedTest + @MethodSource("rounding2Fract") + void testRounding2Fract(Object number, String[] expected) { List rModes = List.of(RoundingMode.HALF_EVEN, RoundingMode.HALF_UP, RoundingMode.HALF_DOWN); for (int index = 0; index < rModes.size(); index++) { @@ -161,12 +170,12 @@ private void testRoundingMode(Object number, String expected, NumberFormat fmt = NumberFormat .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); fmt.setRoundingMode(rounding); - assertEquals(fmt.getRoundingMode(), rounding, + assertEquals(rounding, fmt.getRoundingMode(), "RoundingMode set is not returned by getRoundingMode"); fmt.setMinimumFractionDigits(fraction); String result = fmt.format(number); - assertEquals(result, expected, "Incorrect formatting of number " + assertEquals(expected, result, "Incorrect formatting of number " + number + " using rounding mode: " + rounding); } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestCompactNumber.java b/test/jdk/java/text/Format/CompactNumberFormat/TestCompactNumber.java index 82577c26fc1a..03f0e9c2faeb 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestCompactNumber.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestCompactNumber.java @@ -25,8 +25,14 @@ * @bug 8177552 8217721 8222756 8295372 * @summary Checks the functioning of compact number format * @modules jdk.localedata - * @run testng/othervm TestCompactNumber + * @run junit/othervm TestCompactNumber */ + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.math.BigDecimal; import java.math.BigInteger; import java.text.FieldPosition; @@ -36,10 +42,11 @@ import java.text.ParsePosition; import java.util.Locale; import java.util.stream.Stream; -import static org.testng.Assert.*; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestCompactNumber { private static final NumberFormat FORMAT_DZ_LONG = NumberFormat @@ -96,7 +103,6 @@ public class TestCompactNumber { FORMAT_PT_LONG_FD4.setMaximumFractionDigits(4); } - @DataProvider(name = "format") Object[][] compactFormatData() { return new Object[][]{ // compact number format instance, number to format, formatted output @@ -362,7 +368,6 @@ Object[][] compactFormatData() { }; } - @DataProvider(name = "parse") Object[][] compactParseData() { return new Object[][]{ // compact number format instance, string to parse, parsed number, return type @@ -469,7 +474,6 @@ Object[][] compactParseData() { }; } - @DataProvider(name = "exceptionParse") Object[][] exceptionParseData() { return new Object[][]{ // compact number instance, string to parse, null (no o/p; must throw exception) @@ -487,7 +491,6 @@ Object[][] exceptionParseData() { {FORMAT_SE_SHORT, "-8\u00a0mn", null},}; } - @DataProvider(name = "invalidParse") Object[][] invalidParseData() { return new Object[][]{ // compact number instance, string to parse, parsed number @@ -517,7 +520,6 @@ Object[][] invalidParseData() { }; } - @DataProvider(name = "fieldPosition") Object[][] formatFieldPositionData() { return new Object[][]{ //compact number instance, number to format, field, start position, end position, formatted string @@ -563,7 +565,6 @@ Object[][] formatFieldPositionData() { {FORMAT_SE_SHORT, new BigDecimal("-48982865901234567890.98"), NumberFormat.Field.INTEGER, 1, 9, "\u221248982866\u00a0bn"},}; } - @DataProvider(name = "varParsePosition") Object[][] varParsePosition() { return new Object[][]{ // compact number instance, parse string, parsed number, @@ -591,73 +592,82 @@ Object[][] varParsePosition() { } @Test - public void testInstanceCreation() { + void testInstanceCreation() { Stream.of(NumberFormat.getAvailableLocales()).forEach(l -> NumberFormat .getCompactNumberInstance(l, NumberFormat.Style.SHORT).format(10000)); Stream.of(NumberFormat.getAvailableLocales()).forEach(l -> NumberFormat .getCompactNumberInstance(l, NumberFormat.Style.LONG).format(10000)); } - @Test(expectedExceptions = IllegalArgumentException.class) - public void testFormatWithNullParam() { - FORMAT_EN_US_SHORT.format(null); + @Test + void testFormatWithNullParam() { + assertThrows(IllegalArgumentException.class, () -> { + FORMAT_EN_US_SHORT.format(null); + }); } - @Test(dataProvider = "format") - public void testFormat(NumberFormat cnf, Object number, + @ParameterizedTest + @MethodSource("compactFormatData") + void testFormat(NumberFormat cnf, Object number, String expected) { CompactFormatAndParseHelper.testFormat(cnf, number, expected); } - @Test(dataProvider = "parse") - public void testParse(NumberFormat cnf, String parseString, + @ParameterizedTest + @MethodSource("compactParseData") + void testParse(NumberFormat cnf, String parseString, Number expected, Class returnType) throws ParseException { CompactFormatAndParseHelper.testParse(cnf, parseString, expected, null, returnType); } - @Test(dataProvider = "parse") - public void testParsePosition(NumberFormat cnf, String parseString, + @ParameterizedTest + @MethodSource("compactParseData") + void testParsePosition(NumberFormat cnf, String parseString, Number expected, Class returnType) throws ParseException { ParsePosition pos = new ParsePosition(0); CompactFormatAndParseHelper.testParse(cnf, parseString, expected, pos, returnType); - assertEquals(pos.getIndex(), parseString.length()); - assertEquals(pos.getErrorIndex(), -1); + assertEquals(parseString.length(), pos.getIndex()); + assertEquals(-1, pos.getErrorIndex()); } - @Test(dataProvider = "varParsePosition") - public void testVarParsePosition(NumberFormat cnf, String parseString, + @ParameterizedTest + @MethodSource("varParsePosition") + void testVarParsePosition(NumberFormat cnf, String parseString, Number expected, int startPosition, int indexPosition, int errPosition) throws ParseException { ParsePosition pos = new ParsePosition(startPosition); CompactFormatAndParseHelper.testParse(cnf, parseString, expected, pos, null); - assertEquals(pos.getIndex(), indexPosition); - assertEquals(pos.getErrorIndex(), errPosition); + assertEquals(indexPosition, pos.getIndex()); + assertEquals(errPosition, pos.getErrorIndex()); } - @Test(dataProvider = "exceptionParse", expectedExceptions = ParseException.class) - public void throwsParseException(NumberFormat cnf, String parseString, - Number expected) throws ParseException { - CompactFormatAndParseHelper.testParse(cnf, parseString, expected, null, null); + @ParameterizedTest + @MethodSource("exceptionParseData") + void throwsParseException(NumberFormat cnf, String parseString, + Number expected) { + assertThrows(ParseException.class, () -> CompactFormatAndParseHelper.testParse(cnf, parseString, expected, null, null)); } - @Test(dataProvider = "invalidParse") - public void testInvalidParse(NumberFormat cnf, String parseString, + @ParameterizedTest + @MethodSource("invalidParseData") + void testInvalidParse(NumberFormat cnf, String parseString, Number expected) throws ParseException { CompactFormatAndParseHelper.testParse(cnf, parseString, expected, null, null); } - @Test(dataProvider = "fieldPosition") - public void testFormatWithFieldPosition(NumberFormat nf, + @ParameterizedTest + @MethodSource("formatFieldPositionData") + void testFormatWithFieldPosition(NumberFormat nf, Object number, Format.Field field, int posStartExpected, int posEndExpected, String expected) { FieldPosition pos = new FieldPosition(field); StringBuffer buf = new StringBuffer(); StringBuffer result = nf.format(number, buf, pos); - assertEquals(result.toString(), expected, "Incorrect formatting of the number '" + assertEquals(expected, result.toString(), "Incorrect formatting of the number '" + number + "'"); - assertEquals(pos.getBeginIndex(), posStartExpected, "Incorrect start position" + assertEquals(posStartExpected, pos.getBeginIndex(), "Incorrect start position" + " while formatting the number '" + number + "', for the field " + field); - assertEquals(pos.getEndIndex(), posEndExpected, "Incorrect end position" + assertEquals(posEndExpected, pos.getEndIndex(), "Incorrect end position" + " while formatting the number '" + number + "', for the field " + field); } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestCompactPatternsValidity.java b/test/jdk/java/text/Format/CompactNumberFormat/TestCompactPatternsValidity.java index 8476b568ba01..1f8f1041e9e1 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestCompactPatternsValidity.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestCompactPatternsValidity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -25,9 +25,13 @@ * @bug 8177552 8217254 8251499 8281317 * @summary Checks the validity of compact number patterns specified through * CompactNumberFormat constructor - * @run testng/othervm TestCompactPatternsValidity + * @run junit/othervm TestCompactPatternsValidity */ +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.math.BigDecimal; import java.math.BigInteger; import java.text.CompactNumberFormat; @@ -35,9 +39,10 @@ import java.text.ParseException; import java.util.List; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestCompactPatternsValidity { // Max range 10^4 @@ -74,7 +79,6 @@ public class TestCompactPatternsValidity { private static final String[] COMPACT_PATTERN14 = new String[]{"", "", "", "{one:Kun other:0' 'Kun}"}; // from Somali in CLDR 38 - @DataProvider(name = "invalidPatterns") Object[][] invalidCompactPatterns() { return new Object[][] { // compact patterns @@ -90,7 +94,6 @@ Object[][] invalidCompactPatterns() { }; } - @DataProvider(name = "validPatternsFormat") Object[][] validPatternsFormat() { return new Object[][] { // compact patterns, numbers, expected output @@ -116,7 +119,6 @@ Object[][] validPatternsFormat() { }; } - @DataProvider(name = "validPatternsParse") Object[][] validPatternsParse() { return new Object[][] { // compact patterns, parse string, expected output @@ -136,7 +138,6 @@ Object[][] validPatternsParse() { }; } - @DataProvider(name = "validPatternsFormatWithPluralRules") Object[][] validPatternsFormatWithPluralRules() { return new Object[][] { // compact patterns, plural rules, numbers, expected output @@ -144,7 +145,6 @@ Object[][] validPatternsFormatWithPluralRules() { }; } - @DataProvider(name = "validPatternsParseWithPluralRules") Object[][] validPatternsParseWithPluralRules() { return new Object[][] { // compact patterns, plural rules, parse string, expected output @@ -152,15 +152,18 @@ Object[][] validPatternsParseWithPluralRules() { }; } - @Test(dataProvider = "invalidPatterns", - expectedExceptions = IllegalArgumentException.class) - public void testInvalidCompactPatterns(String[] compactPatterns) { - new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols - .getInstance(Locale.US), compactPatterns); + @ParameterizedTest + @MethodSource("invalidCompactPatterns") + void testInvalidCompactPatterns(String[] compactPatterns) { + assertThrows(IllegalArgumentException.class, () -> { + new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols + .getInstance(Locale.US), compactPatterns); + }); } - @Test(dataProvider = "validPatternsFormat") - public void testValidPatternsFormat(String[] compactPatterns, + @ParameterizedTest + @MethodSource("validPatternsFormat") + void testValidPatternsFormat(String[] compactPatterns, List numbers, List expected) { CompactNumberFormat fmt = new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols.getInstance(Locale.US), compactPatterns); @@ -170,8 +173,9 @@ public void testValidPatternsFormat(String[] compactPatterns, } } - @Test(dataProvider = "validPatternsParse") - public void testValidPatternsParse(String[] compactPatterns, + @ParameterizedTest + @MethodSource("validPatternsParse") + void testValidPatternsParse(String[] compactPatterns, List parseString, List numbers) throws ParseException { CompactNumberFormat fmt = new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols.getInstance(Locale.US), compactPatterns); @@ -181,8 +185,9 @@ public void testValidPatternsParse(String[] compactPatterns, } } - @Test(dataProvider = "validPatternsFormatWithPluralRules") - public void testValidPatternsFormatWithPluralRules(String[] compactPatterns, String pluralRules, + @ParameterizedTest + @MethodSource("validPatternsFormatWithPluralRules") + void testValidPatternsFormatWithPluralRules(String[] compactPatterns, String pluralRules, List numbers, List expected) { CompactNumberFormat fmt = new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols.getInstance(Locale.US), compactPatterns, pluralRules); @@ -192,8 +197,9 @@ public void testValidPatternsFormatWithPluralRules(String[] compactPatterns, Str } } - @Test(dataProvider = "validPatternsParseWithPluralRules") - public void testValidPatternsParsewithPluralRules(String[] compactPatterns, String pluralRules, + @ParameterizedTest + @MethodSource("validPatternsParseWithPluralRules") + void testValidPatternsParsewithPluralRules(String[] compactPatterns, String pluralRules, List parseString, List numbers) throws ParseException { CompactNumberFormat fmt = new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols.getInstance(Locale.US), compactPatterns, pluralRules); diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestEquality.java b/test/jdk/java/text/Format/CompactNumberFormat/TestEquality.java index b5d0ae860ed9..2c889656ce0f 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestEquality.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestEquality.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -20,25 +20,26 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 8222756 * @summary Checks the equals and hashCode method of CompactNumberFormat * @modules jdk.localedata - * @run testng/othervm TestEquality - * + * @run junit/othervm TestEquality */ +import org.junit.jupiter.api.Test; + import java.text.CompactNumberFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.util.Locale; -import org.testng.annotations.Test; public class TestEquality { @Test - public void testEquality() { + void testEquality() { CompactNumberFormat cnf1 = (CompactNumberFormat) NumberFormat .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); @@ -148,7 +149,7 @@ private void checkEquals(CompactNumberFormat cnf1, CompactNumberFormat cnf2, } @Test - public void testHashCode() { + void testHashCode() { NumberFormat cnf1 = NumberFormat .getCompactNumberInstance(Locale.JAPAN, NumberFormat.Style.SHORT); NumberFormat cnf2 = NumberFormat @@ -163,7 +164,7 @@ public void testHashCode() { // Test the property of equals and hashCode i.e. two equal object must // always have the same hashCode @Test - public void testEqualsAndHashCode() { + void testEqualsAndHashCode() { NumberFormat cnf1 = NumberFormat .getCompactNumberInstance(Locale.of("hi", "IN"), NumberFormat.Style.SHORT); cnf1.setMinimumIntegerDigits(5); diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestFormatToCharacterIterator.java b/test/jdk/java/text/Format/CompactNumberFormat/TestFormatToCharacterIterator.java index fb18fa256ab8..beb6c38aca88 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestFormatToCharacterIterator.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestFormatToCharacterIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -20,14 +20,20 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 * @summary Checks the functioning of * CompactNumberFormat.formatToCharacterIterator method * @modules jdk.localedata - * @run testng/othervm TestFormatToCharacterIterator + * @run junit/othervm TestFormatToCharacterIterator */ + +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.math.BigDecimal; import java.math.BigInteger; import java.text.AttributedCharacterIterator; @@ -36,10 +42,10 @@ import java.text.NumberFormat; import java.util.Locale; import java.util.Set; -import static org.testng.Assert.assertEquals; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestFormatToCharacterIterator { private static final NumberFormat FORMAT_DZ = NumberFormat @@ -54,7 +60,6 @@ public class TestFormatToCharacterIterator { .getCompactNumberInstance(Locale.ENGLISH, NumberFormat.Style.LONG); - @DataProvider(name = "fieldPositions") Object[][] compactFieldPositionData() { return new Object[][]{ // compact format instance, number, resulted string, attributes/fields, attribute positions @@ -149,22 +154,23 @@ Object[][] compactFieldPositionData() { }; } - @Test(dataProvider = "fieldPositions") - public void testFormatToCharacterIterator(NumberFormat fmt, Object number, + @ParameterizedTest + @MethodSource("compactFieldPositionData") + void testFormatToCharacterIterator(NumberFormat fmt, Object number, String expected, Format.Field[] expectedFields, int[] positions) { AttributedCharacterIterator iterator = fmt.formatToCharacterIterator(number); - assertEquals(getText(iterator), expected, "Incorrect formatting of the number '" + assertEquals(expected, getText(iterator), "Incorrect formatting of the number '" + number + "'"); iterator.first(); // Check start and end index of the formatted string - assertEquals(iterator.getBeginIndex(), 0, "Incorrect start index: " + assertEquals(0, iterator.getBeginIndex(), "Incorrect start index: " + iterator.getBeginIndex() + " of the formatted string: " + expected); - assertEquals(iterator.getEndIndex(), expected.length(), "Incorrect end index: " + assertEquals(expected.length(), iterator.getEndIndex(), "Incorrect end index: " + iterator.getEndIndex() + " of the formatted string: " + expected); // Check the attributes returned by the formatToCharacterIterator - assertEquals(iterator.getAllAttributeKeys(), Set.of(expectedFields), + assertEquals(Set.of(expectedFields), iterator.getAllAttributeKeys(), "Attributes do not match while formatting number: " + number); // Check the begin and end index for attributes @@ -173,10 +179,10 @@ public void testFormatToCharacterIterator(NumberFormat fmt, Object number, do { int start = iterator.getRunStart(); int end = iterator.getRunLimit(); - assertEquals(start, positions[currentPosition], + assertEquals(positions[currentPosition], start, "Incorrect start position for the attribute(s): " + iterator.getAttributes().keySet()); - assertEquals(end, positions[currentPosition + 1], + assertEquals(positions[currentPosition + 1], end, "Incorrect end position for the attribute(s): " + iterator.getAttributes().keySet()); currentPosition = currentPosition + 2; diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestMutatingInstance.java b/test/jdk/java/text/Format/CompactNumberFormat/TestMutatingInstance.java index 47b176692fd1..4cf5ce12f161 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestMutatingInstance.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestMutatingInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -20,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 @@ -27,8 +28,14 @@ * formatting parameters. For example, min fraction digits, grouping * size etc. * @modules jdk.localedata - * @run testng/othervm TestMutatingInstance + * @run junit/othervm TestMutatingInstance */ + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.math.BigDecimal; import java.math.BigInteger; import java.text.CompactNumberFormat; @@ -36,10 +43,8 @@ import java.text.NumberFormat; import java.text.ParseException; import java.util.Locale; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestMutatingInstance { private static final NumberFormat FORMAT_FRACTION = NumberFormat @@ -61,8 +66,8 @@ public class TestMutatingInstance { "#,##0.0#", DecimalFormatSymbols.getInstance(Locale.US), new String[]{"", "", "", "", "00K", "", "", "", "", "", "", "", "", "", ""}); - @BeforeTest - public void mutateInstances() { + @BeforeAll + void mutateInstances() { FORMAT_FRACTION.setMinimumFractionDigits(2); FORMAT_GROUPING.setGroupingSize(3); FORMAT_GROUPING.setGroupingUsed(true); @@ -75,7 +80,6 @@ public void mutateInstances() { FORMAT_NO_PATTERNS.setMinimumFractionDigits(2); } - @DataProvider(name = "format") Object[][] compactFormatData() { return new Object[][]{ {FORMAT_FRACTION, 1900, "1.90 thousand"}, @@ -95,7 +99,6 @@ Object[][] compactFormatData() { {FORMAT_NO_PATTERNS, new BigDecimal(12346567890987654.32), "12,346,567,890,987,654"},}; } - @DataProvider(name = "parse") Object[][] compactParseData() { return new Object[][]{ {FORMAT_FRACTION, "190 thousand", 190000L}, @@ -106,14 +109,16 @@ Object[][] compactParseData() { {FORMAT_PARSEINTONLY, "12.345 thousand", 12000L},}; } - @Test(dataProvider = "format") - public void formatCompactNumber(NumberFormat nf, + @ParameterizedTest + @MethodSource("compactFormatData") + void formatCompactNumber(NumberFormat nf, Object number, String expected) { CompactFormatAndParseHelper.testFormat(nf, number, expected); } - @Test(dataProvider = "parse") - public void parseCompactNumber(NumberFormat nf, + @ParameterizedTest + @MethodSource("compactParseData") + void parseCompactNumber(NumberFormat nf, String parseString, Number expected) throws ParseException { CompactFormatAndParseHelper.testParse(nf, parseString, expected, null, null); } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestParseBigDecimal.java b/test/jdk/java/text/Format/CompactNumberFormat/TestParseBigDecimal.java index 1a3c429470a6..e8cc11f68769 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestParseBigDecimal.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestParseBigDecimal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -20,17 +20,19 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 * @summary Checks CNF.parse() when parseBigDecimal is set to true * @modules jdk.localedata - * @run testng/othervm TestParseBigDecimal + * @run junit/othervm TestParseBigDecimal */ -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.math.BigDecimal; import java.text.CompactNumberFormat; @@ -38,6 +40,7 @@ import java.text.ParseException; import java.util.Locale; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestParseBigDecimal { private static final CompactNumberFormat FORMAT_DZ_LONG = (CompactNumberFormat) NumberFormat @@ -64,8 +67,8 @@ public class TestParseBigDecimal { private static final CompactNumberFormat FORMAT_SE_SHORT = (CompactNumberFormat) NumberFormat .getCompactNumberInstance(Locale.of("se"), NumberFormat.Style.SHORT); - @BeforeTest - public void mutateInstances() { + @BeforeAll + void mutateInstances() { FORMAT_DZ_LONG.setParseBigDecimal(true); FORMAT_EN_US_SHORT.setParseBigDecimal(true); FORMAT_EN_LONG.setParseBigDecimal(true); @@ -76,7 +79,6 @@ public void mutateInstances() { FORMAT_SE_SHORT.setParseBigDecimal(true); } - @DataProvider(name = "parse") Object[][] compactParseData() { return new Object[][]{ // compact number format instance, string to parse, parsed number @@ -165,8 +167,9 @@ Object[][] compactParseData() { {FORMAT_SE_SHORT, "\u221212345679,89\u00a0bn", new BigDecimal("-12345679890000000000.00")},}; } - @Test(dataProvider = "parse") - public void testParse(NumberFormat cnf, String parseString, + @ParameterizedTest + @MethodSource("compactParseData") + void testParse(NumberFormat cnf, String parseString, Number expected) throws ParseException { CompactFormatAndParseHelper.testParse(cnf, parseString, expected, null, BigDecimal.class); } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestPlurals.java b/test/jdk/java/text/Format/CompactNumberFormat/TestPlurals.java index bbaaa701d234..b8beb6135dd9 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestPlurals.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestPlurals.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -20,21 +20,27 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8222756 * @summary Tests plurals support in CompactNumberFormat - * @run testng/othervm TestPlurals + * @run junit/othervm TestPlurals */ +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.CompactNumberFormat; import java.text.DecimalFormatSymbols; import java.util.Locale; -import static org.testng.Assert.*; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestPlurals { private final static DecimalFormatSymbols DFS = DecimalFormatSymbols.getInstance(Locale.ROOT); @@ -45,7 +51,6 @@ public class TestPlurals { private final static String RULE_3 = "one:n%2=0andn/3=2;"; - @DataProvider Object[][] pluralRules() { return new Object[][]{ // rules, number, expected @@ -78,7 +83,6 @@ Object[][] pluralRules() { }; } - @DataProvider Object[][] invalidRules() { return new Object [][] { {"one:a = 1"}, @@ -92,27 +96,34 @@ Object[][] invalidRules() { }; } - @Test(expectedExceptions = NullPointerException.class) - public void testNullPluralRules() { - String[] pattern = {""}; - new CompactNumberFormat("#", DFS, PATTERN, null); + @Test + void testNullPluralRules() { + assertThrows(NullPointerException.class, () -> { + String[] pattern = {""}; + new CompactNumberFormat("#", DFS, PATTERN, null); + }); } - @Test(dataProvider = "pluralRules") - public void testPluralRules(String rules, Number n, String expected) { + @ParameterizedTest + @MethodSource("pluralRules") + void testPluralRules(String rules, Number n, String expected) { var cnp = new CompactNumberFormat("#", DFS, PATTERN, rules); - assertEquals(cnp.format(n), expected); + assertEquals(expected, cnp.format(n)); } - @Test(dataProvider = "invalidRules", expectedExceptions = IllegalArgumentException.class) - public void testInvalidRules(String rules) { - new CompactNumberFormat("#", DFS, PATTERN, rules); + @ParameterizedTest + @MethodSource("invalidRules") + void testInvalidRules(String rules) { + assertThrows(IllegalArgumentException.class, + () -> new CompactNumberFormat("#", DFS, PATTERN, rules)); } - @Test(expectedExceptions = IllegalArgumentException.class) - public void testLimitExceedingRules() { - String andCond = " and n = 1"; - String invalid = "one: n = 1" + andCond.repeat(2_048 / andCond.length()); - new CompactNumberFormat("#", DFS, PATTERN, invalid); + @Test + void testLimitExceedingRules() { + assertThrows(IllegalArgumentException.class, () -> { + String andCond = " and n = 1"; + String invalid = "one: n = 1" + andCond.repeat(2_048 / andCond.length()); + new CompactNumberFormat("#", DFS, PATTERN, invalid); + }); } } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestSpecialValues.java b/test/jdk/java/text/Format/CompactNumberFormat/TestSpecialValues.java index e8ac2489fafc..9bd0ef738309 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestSpecialValues.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestSpecialValues.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -20,25 +20,29 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 * @summary Checks the formatting and parsing of special values * @modules jdk.localedata - * @run testng/othervm TestSpecialValues + * @run junit/othervm TestSpecialValues */ + +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.NumberFormat; import java.text.ParseException; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestSpecialValues { private static final NumberFormat FORMAT = NumberFormat .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); - @DataProvider(name = "formatSpecialValues") Object[][] formatSpecialValues() { return new Object[][]{ // number , formatted ouput @@ -53,7 +57,6 @@ Object[][] formatSpecialValues() { {Long.MAX_VALUE, "9223372T"},}; } - @DataProvider(name = "parseSpecialValues") Object[][] parseSpecialValues() { return new Object[][]{ // parse string, parsed number @@ -65,13 +68,15 @@ Object[][] parseSpecialValues() { {"-\u221E", Double.NEGATIVE_INFINITY},}; } - @Test(dataProvider = "formatSpecialValues") - public void testFormatSpecialValues(Object number, String expected) { + @ParameterizedTest + @MethodSource("formatSpecialValues") + void testFormatSpecialValues(Object number, String expected) { CompactFormatAndParseHelper.testFormat(FORMAT, number, expected); } - @Test(dataProvider = "parseSpecialValues") - public void testParseSpecialValues(String parseString, Number expected) + @ParameterizedTest + @MethodSource("parseSpecialValues") + void testParseSpecialValues(String parseString, Number expected) throws ParseException { CompactFormatAndParseHelper.testParse(FORMAT, parseString, expected, null, null); } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestUExtensionOverride.java b/test/jdk/java/text/Format/CompactNumberFormat/TestUExtensionOverride.java index 099e6978b0b0..f77908d84c46 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestUExtensionOverride.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestUExtensionOverride.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -20,23 +20,27 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 8221432 * @summary Checks the behaviour of Unicode BCP 47 U Extension with * compact number format * @modules jdk.localedata - * @run testng/othervm TestUExtensionOverride + * @run junit/othervm TestUExtensionOverride */ + +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.NumberFormat; import java.text.ParseException; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestUExtensionOverride { - @DataProvider(name = "compactFormatData") Object[][] compactFormatData() { return new Object[][]{ // locale, number, formatted string @@ -61,7 +65,6 @@ Object[][] compactFormatData() { "\u0967\u0968\u00a0k"},}; } - @DataProvider(name = "compactParseData") Object[][] compactParseData() { return new Object[][]{ // locale, parse string, parsed number @@ -87,16 +90,18 @@ Object[][] compactParseData() { "\u0967\u0968\u00a0k", 12000L},}; } - @Test(dataProvider = "compactFormatData") - public void testFormat(Locale locale, double num, + @ParameterizedTest + @MethodSource("compactFormatData") + void testFormat(Locale locale, double num, String expected) { NumberFormat cnf = NumberFormat.getCompactNumberInstance(locale, NumberFormat.Style.SHORT); CompactFormatAndParseHelper.testFormat(cnf, num, expected); } - @Test(dataProvider = "compactParseData") - public void testParse(Locale locale, String parseString, + @ParameterizedTest + @MethodSource("compactParseData") + void testParse(Locale locale, String parseString, Number expected) throws ParseException { NumberFormat cnf = NumberFormat.getCompactNumberInstance(locale, NumberFormat.Style.SHORT); diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestWithCompatProvider.java b/test/jdk/java/text/Format/CompactNumberFormat/TestWithCompatProvider.java index 510d3d9062f4..884a973226a7 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestWithCompatProvider.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestWithCompatProvider.java @@ -28,16 +28,19 @@ * as a provider should always use the default patterns added in the * FormatData.java resource bundle * @modules jdk.localedata - * @run testng/othervm -Djava.locale.providers=COMPAT TestWithCompatProvider + * @run junit/othervm -Djava.locale.providers=COMPAT TestWithCompatProvider */ +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.math.BigDecimal; import java.math.BigInteger; import java.text.NumberFormat; import java.text.ParseException; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestWithCompatProvider { private static final NumberFormat FORMAT_DZ_SHORT = NumberFormat @@ -46,7 +49,6 @@ public class TestWithCompatProvider { private static final NumberFormat FORMAT_EN_US_SHORT = NumberFormat .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); - @DataProvider(name = "format") Object[][] compactFormatData() { return new Object[][]{ {FORMAT_DZ_SHORT, 1000.09, "1K"}, @@ -61,7 +63,6 @@ Object[][] compactFormatData() { {FORMAT_EN_US_SHORT, new BigDecimal("12345678901234567890.89"), "12345679T"},}; } - @DataProvider(name = "parse") Object[][] compactParseData() { return new Object[][]{ {FORMAT_DZ_SHORT, "1K", 1000L}, @@ -72,13 +73,15 @@ Object[][] compactParseData() { {FORMAT_EN_US_SHORT, "12345679T", 1.2345679E19},}; } - @Test(dataProvider = "format") + @ParameterizedTest + @MethodSource("compactFormatData") public void testFormat(NumberFormat cnf, Object number, String expected) { CompactFormatAndParseHelper.testFormat(cnf, number, expected); } - @Test(dataProvider = "parse") + @ParameterizedTest + @MethodSource("compactParseData") public void testParse(NumberFormat cnf, String parseString, Number expected) throws ParseException { CompactFormatAndParseHelper.testParse(cnf, parseString, expected, null, null); diff --git a/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestDeserializeCNF.java b/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestDeserializeCNF.java index 0b4710f0086c..563ae307762c 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestDeserializeCNF.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestDeserializeCNF.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -28,11 +28,12 @@ * @summary Checks deserialization of compact number format * @library /java/text/testlib * @build TestDeserializeCNF HexDumpReader - * @run testng/othervm TestDeserializeCNF + * @run junit/othervm TestDeserializeCNF */ -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; import java.io.IOException; import java.io.InputStream; @@ -41,8 +42,10 @@ import java.text.CompactNumberFormat; import java.text.DecimalFormatSymbols; import java.util.Locale; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestDeserializeCNF { // This object is serialized in cnf1.ser.txt with HALF_UP @@ -60,8 +63,8 @@ public class TestDeserializeCNF { private static final String FILE_COMPACT_FORMAT1 = "cnf1.ser.txt"; private static final String FILE_COMPACT_FORMAT2 = "cnf2.ser.txt"; - @BeforeTest - public void mutateInstances() { + @BeforeAll + void mutateInstances() { COMPACT_FORMAT1.setRoundingMode(RoundingMode.HALF_UP); COMPACT_FORMAT1.setGroupingSize(3); COMPACT_FORMAT1.setParseBigDecimal(true); @@ -71,18 +74,18 @@ public void mutateInstances() { } @Test - public void testDeserialization() throws IOException, ClassNotFoundException { + void testDeserialization() throws IOException, ClassNotFoundException { try (InputStream istream1 = HexDumpReader.getStreamFromHexDump(FILE_COMPACT_FORMAT1); ObjectInputStream ois1 = new ObjectInputStream(istream1); InputStream istream2 = HexDumpReader.getStreamFromHexDump(FILE_COMPACT_FORMAT2); ObjectInputStream ois2 = new ObjectInputStream(istream2);) { CompactNumberFormat obj1 = (CompactNumberFormat) ois1.readObject(); - assertEquals(obj1, COMPACT_FORMAT1, "Deserialized instance is not" + assertEquals(COMPACT_FORMAT1, obj1, "Deserialized instance is not" + " equal to the instance serialized in " + FILE_COMPACT_FORMAT1); CompactNumberFormat obj2 = (CompactNumberFormat) ois2.readObject(); - assertEquals(obj2, COMPACT_FORMAT2, "Deserialized instance is not" + assertEquals(COMPACT_FORMAT2, obj2, "Deserialized instance is not" + " equal to the instance serialized in " + FILE_COMPACT_FORMAT2); } } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestSerialization.java b/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestSerialization.java index 55f950bd6745..f2039deb2322 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestSerialization.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestSerialization.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -20,16 +20,18 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 * @modules jdk.localedata * @summary Checks the serialization feature of CompactNumberFormat - * @run testng/othervm TestSerialization + * @run junit/othervm TestSerialization */ -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -40,8 +42,10 @@ import java.text.CompactNumberFormat; import java.text.NumberFormat; import java.util.Locale; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestSerialization { private static final NumberFormat FORMAT_HI = NumberFormat.getCompactNumberInstance( @@ -57,8 +61,8 @@ public class TestSerialization { private static final NumberFormat FORMAT_KO_KR = NumberFormat.getCompactNumberInstance( Locale.KOREA, NumberFormat.Style.SHORT); - @BeforeTest - public void mutateInstances() { + @BeforeAll + void mutateInstances() { FORMAT_HI.setMinimumFractionDigits(2); FORMAT_HI.setMinimumIntegerDigits(5); @@ -80,7 +84,7 @@ public void mutateInstances() { } @Test - public void testSerialization() throws IOException, ClassNotFoundException { + void testSerialization() throws IOException, ClassNotFoundException { // Serialize serialize("cdf.ser", FORMAT_HI, FORMAT_EN_US, FORMAT_JA_JP, FORMAT_FR_FR, FORMAT_DE_DE, FORMAT_KO_KR); // Deserialize @@ -103,13 +107,13 @@ private static void deserialize(String fileName, NumberFormat... formats) new FileInputStream(fileName))) { for (NumberFormat fmt : formats) { NumberFormat obj = (NumberFormat) os.readObject(); - assertEquals(fmt, obj, "Serialized and deserialized" + assertEquals(obj, fmt, "Serialized and deserialized" + " objects do not match"); long number = 123456789789L; String expected = fmt.format(number); String actual = obj.format(number); - assertEquals(actual, expected, "Serialized and deserialized" + assertEquals(expected, actual, "Serialized and deserialized" + " objects are expected to return same formatted" + " output for number: " + number); } diff --git a/test/jdk/java/text/Format/DateFormat/Bug8193444.java b/test/jdk/java/text/Format/DateFormat/Bug8193444.java index 6c5007bc851e..b2fac85dd8a0 100644 --- a/test/jdk/java/text/Format/DateFormat/Bug8193444.java +++ b/test/jdk/java/text/Format/DateFormat/Bug8193444.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -20,29 +20,32 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8193444 * @summary Checks SimpleDateFormat.format/parse for the AIOOB exception when * formatting/parsing dates through a pattern string that contains a * sequence of 256 or more non-ASCII unicode characters. - * @run testng/othervm Bug8193444 + * @run junit/othervm Bug8193444 */ -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; + +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class Bug8193444 { private static final String NON_ASCII_CHAR = "\u263A"; - @DataProvider(name = "dateFormat") Object[][] dateFormatData() { return new Object[][]{ // short_length (between 0 and 254) @@ -53,8 +56,9 @@ Object[][] dateFormatData() { {257},}; } - @Test(dataProvider = "dateFormat") - public void testDateFormatAndParse(int length) + @ParameterizedTest + @MethodSource("dateFormatData") + void testDateFormatAndParse(int length) throws ParseException { String pattern = NON_ASCII_CHAR.repeat(length); @@ -66,7 +70,7 @@ public void testDateFormatAndParse(int length) // Since the tested format patterns do not contain any character // representing date/time field, those characters are not interpreted, // they are simply copied into the output string during formatting - assertEquals(result, pattern, "Failed to format the date using" + assertEquals(pattern, result, "Failed to format the date using" + " pattern of length: " + length); // The format pattern used by this SimpleDateFormat diff --git a/test/jdk/java/text/Format/DateFormat/CaseInsensitiveParseTest.java b/test/jdk/java/text/Format/DateFormat/CaseInsensitiveParseTest.java index 2331e36b2f9e..51473710dbbb 100644 --- a/test/jdk/java/text/Format/DateFormat/CaseInsensitiveParseTest.java +++ b/test/jdk/java/text/Format/DateFormat/CaseInsensitiveParseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -21,14 +21,18 @@ * questions. */ -/** +/* * @test * @bug 8248434 * @modules jdk.localedata - * @run testng/othervm CaseInsensitiveParseTest * @summary Checks format/parse round trip in case-insensitive manner. + * @run junit/othervm CaseInsensitiveParseTest */ +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -37,36 +41,36 @@ import java.util.Locale; import java.util.stream.Stream; -import static org.testng.Assert.assertEquals; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class CaseInsensitiveParseTest { private final static String PATTERN = "GGGG/yyyy/MMMM/dddd/hhhh/mmmm/ss/aaaa"; private final static Date EPOCH = new Date(0L); - @DataProvider - private Object[][] locales() { + Object[][] locales() { return (Object[][])Arrays.stream(DateFormat.getAvailableLocales()) .map(Stream::of) .map(Stream::toArray) .toArray(Object[][]::new); } - @Test(dataProvider = "locales") - public void testUpperCase(Locale loc) throws ParseException { + @ParameterizedTest + @MethodSource("locales") + void testUpperCase(Locale loc) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat(PATTERN, loc); String formatted = sdf.format(EPOCH); - assertEquals(sdf.parse(formatted.toUpperCase(Locale.ROOT)), EPOCH, + assertEquals(EPOCH, sdf.parse(formatted.toUpperCase(Locale.ROOT)), "roundtrip failed for string '" + formatted + "', locale: " + loc); } - @Test(dataProvider = "locales") - public void testLowerCase(Locale loc) throws ParseException { + @ParameterizedTest + @MethodSource("locales") + void testLowerCase(Locale loc) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat(PATTERN, loc); String formatted = sdf.format(EPOCH); - assertEquals(sdf.parse(formatted.toLowerCase(Locale.ROOT)), EPOCH, + assertEquals(EPOCH, sdf.parse(formatted.toLowerCase(Locale.ROOT)), "roundtrip failed for string '" + formatted + "', locale: " + loc); } } diff --git a/test/jdk/java/text/Format/DateFormat/LocaleDateFormats.java b/test/jdk/java/text/Format/DateFormat/LocaleDateFormats.java index 6e58cef5c4b4..a02dc4ecac67 100644 --- a/test/jdk/java/text/Format/DateFormat/LocaleDateFormats.java +++ b/test/jdk/java/text/Format/DateFormat/LocaleDateFormats.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -21,34 +21,38 @@ * questions. */ -/** +/* * @test * @bug 8080774 * @modules jdk.localedata - * @run testng/othervm -Djava.locale.providers=JRE,CLDR LocaleDateFormats * @summary This file contains tests for JRE locales date formats + * @run junit/othervm -Djava.locale.providers=JRE,CLDR LocaleDateFormats */ +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.DateFormat; import java.util.Calendar; import java.util.Locale; -import static org.testng.Assert.assertEquals; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class LocaleDateFormats { - @Test(dataProvider = "dateFormats") - public void testDateFormat(Locale loc, int style, int year, int month, int date, String expectedString) { + @ParameterizedTest + @MethodSource("dateFormats") + void testDateFormat(Locale loc, int style, int year, int month, int date, String expectedString) { Calendar cal = Calendar.getInstance(loc); cal.set(year, month-1, date); // Create date formatter based on requested style and test locale DateFormat df = DateFormat.getDateInstance(style, loc); // Test the date format - assertEquals(df.format(cal.getTime()), expectedString); + assertEquals(expectedString, df.format(cal.getTime())); } - @DataProvider(name = "dateFormats" ) private Object[][] dateFormats() { return new Object[][] { //8080774 diff --git a/test/jdk/java/text/Format/DateFormat/SimpleDateFormatPatternTest.java b/test/jdk/java/text/Format/DateFormat/SimpleDateFormatPatternTest.java index bcf0022b092f..e8ff262e0abd 100644 --- a/test/jdk/java/text/Format/DateFormat/SimpleDateFormatPatternTest.java +++ b/test/jdk/java/text/Format/DateFormat/SimpleDateFormatPatternTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -21,21 +21,25 @@ * questions. */ -/** +/* * @test * @bug 4326988 6990146 8231213 * @summary test SimpleDateFormat, check its pattern in the constructor - * @run testng/othervm SimpleDateFormatPatternTest + * @run junit/othervm SimpleDateFormatPatternTest */ -import java.lang.IllegalArgumentException; + +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.DateFormat; import java.text.DateFormatSymbols; import java.text.SimpleDateFormat; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertThrows; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class SimpleDateFormatPatternTest { private static String[] validPat = { "yyyy-MM-dd h.mm.ss.a z", @@ -136,90 +140,104 @@ private static Object[][] createPatternObj(String[] pattern){ return objArray; } - @DataProvider(name = "dfAllLocalesObj") Object[][] dfAllLocalesObj() { return dfAllLocalesObj; } - @DataProvider(name = "invalidPatternObj") Object[][] invalidPatternObj() { return invalidPatObj; } - @DataProvider(name = "validPatternObj") Object[][] validPatternObj() { return validPatObj; } //check Constructors for invalid pattern - @Test(dataProvider = "invalidPatternObj", - expectedExceptions = IllegalArgumentException.class) - public void testIllegalArgumentException1(String pattern, Locale loc) + @ParameterizedTest + @MethodSource("invalidPatternObj") + void testIllegalArgumentException1(String pattern, Locale loc) throws IllegalArgumentException { - Locale.setDefault(loc); - new SimpleDateFormat(pattern); + assertThrows(IllegalArgumentException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat(pattern); + }); } - @Test(dataProvider = "invalidPatternObj", - expectedExceptions = IllegalArgumentException.class) - public void testIllegalArgumentException2(String pattern, Locale loc) + @ParameterizedTest + @MethodSource("invalidPatternObj") + void testIllegalArgumentException2(String pattern, Locale loc) throws IllegalArgumentException { - Locale.setDefault(loc); - new SimpleDateFormat(pattern, new DateFormatSymbols()); + assertThrows(IllegalArgumentException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat(pattern, new DateFormatSymbols()); + }); } - @Test(dataProvider = "invalidPatternObj", - expectedExceptions = IllegalArgumentException.class) - public void testIllegalArgumentException3 (String pattern, Locale loc) + @ParameterizedTest + @MethodSource("invalidPatternObj") + void testIllegalArgumentException3 (String pattern, Locale loc) throws IllegalArgumentException { - Locale.setDefault(loc); - new SimpleDateFormat(pattern, Locale.getDefault()); + assertThrows(IllegalArgumentException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat(pattern, Locale.getDefault()); + }); } - @Test(dataProvider = "invalidPatternObj", - expectedExceptions = IllegalArgumentException.class) - public void testIllegalArgumentException4(String pattern, Locale loc) + @ParameterizedTest + @MethodSource("invalidPatternObj") + void testIllegalArgumentException4(String pattern, Locale loc) throws IllegalArgumentException { - Locale.setDefault(loc); - new SimpleDateFormat().applyPattern(pattern); + assertThrows(IllegalArgumentException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat().applyPattern(pattern); + }); } //check Constructors for null pattern - @Test(dataProvider = "dfAllLocalesObj", - expectedExceptions = NullPointerException.class) - public void testNullPointerException1(Locale loc) + @ParameterizedTest + @MethodSource("dfAllLocalesObj") + void testNullPointerException1(Locale loc) throws NullPointerException { - Locale.setDefault(loc); - new SimpleDateFormat(null); + assertThrows(NullPointerException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat(null); + }); } - @Test(dataProvider = "dfAllLocalesObj", - expectedExceptions = NullPointerException.class) - public void testNullPointerException2(Locale loc) + @ParameterizedTest + @MethodSource("dfAllLocalesObj") + void testNullPointerException2(Locale loc) throws NullPointerException { - Locale.setDefault(loc); - new SimpleDateFormat(null, new DateFormatSymbols()); + assertThrows(NullPointerException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat(null, new DateFormatSymbols()); + }); } - @Test(dataProvider = "dfAllLocalesObj", - expectedExceptions = NullPointerException.class) - public void testNullPointerException3(Locale loc) + @ParameterizedTest + @MethodSource("dfAllLocalesObj") + void testNullPointerException3(Locale loc) throws NullPointerException { - Locale.setDefault(loc); - new SimpleDateFormat(null, Locale.getDefault()); + assertThrows(NullPointerException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat(null, Locale.getDefault()); + }); } - @Test(dataProvider = "dfAllLocalesObj", - expectedExceptions = NullPointerException.class) - public void testNullPointerException4(Locale loc) + @ParameterizedTest + @MethodSource("dfAllLocalesObj") + void testNullPointerException4(Locale loc) throws NullPointerException { - Locale.setDefault(loc); - new SimpleDateFormat().applyPattern(null); + assertThrows(NullPointerException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat().applyPattern(null); + }); } - @Test(dataProvider = "validPatternObj") + @ParameterizedTest //check Constructors for valid pattern - public void testValidPattern(String pattern, Locale loc) { + @MethodSource("validPatternObj") + void testValidPattern(String pattern, Locale loc) { Locale.setDefault(loc); new SimpleDateFormat(pattern); new SimpleDateFormat(pattern, new DateFormatSymbols()); diff --git a/test/jdk/java/text/Format/DecimalFormat/SetGroupingSizeTest.java b/test/jdk/java/text/Format/DecimalFormat/SetGroupingSizeTest.java index 07982b453c90..950443412902 100644 --- a/test/jdk/java/text/Format/DecimalFormat/SetGroupingSizeTest.java +++ b/test/jdk/java/text/Format/DecimalFormat/SetGroupingSizeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -26,28 +26,27 @@ * @bug 8212749 * @summary test whether input value check for * DecimalFormat.setGroupingSize(int) works correctly. - * @run testng/othervm SetGroupingSizeTest + * @run junit/othervm SetGroupingSizeTest */ +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.DecimalFormat; -import static org.testng.Assert.assertEquals; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; -@Test public class SetGroupingSizeTest { - @DataProvider - public static Object[][] validGroupingSizes() { + static Object[][] validGroupingSizes() { return new Object[][] { { 0 }, { Byte.MAX_VALUE }, }; } - @DataProvider - public static Object[][] invalidGroupingSizes() { + static Object[][] invalidGroupingSizes() { return new Object[][] { { Byte.MIN_VALUE - 1 }, { Byte.MIN_VALUE }, @@ -58,17 +57,20 @@ public static Object[][] invalidGroupingSizes() { }; } - @Test(dataProvider = "validGroupingSizes") - public void test_validGroupingSize(int newVal) { + @ParameterizedTest + @MethodSource("validGroupingSizes") + void test_validGroupingSize(int newVal) { DecimalFormat df = new DecimalFormat(); df.setGroupingSize(newVal); - assertEquals(df.getGroupingSize(), newVal); + assertEquals(newVal, df.getGroupingSize()); } - @Test(dataProvider = "invalidGroupingSizes", - expectedExceptions = IllegalArgumentException.class) - public void test_invalidGroupingSize(int newVal) { - DecimalFormat df = new DecimalFormat(); - df.setGroupingSize(newVal); + @ParameterizedTest + @MethodSource("invalidGroupingSizes") + void test_invalidGroupingSize(int newVal) { + assertThrows(IllegalArgumentException.class, () -> { + DecimalFormat df = new DecimalFormat(); + df.setGroupingSize(newVal); + }); } } diff --git a/test/jdk/java/text/Format/NumberFormat/DFSMinusPerCentMill.java b/test/jdk/java/text/Format/NumberFormat/DFSMinusPerCentMill.java index a36eaf5f14fe..418802261ff4 100644 --- a/test/jdk/java/text/Format/NumberFormat/DFSMinusPerCentMill.java +++ b/test/jdk/java/text/Format/NumberFormat/DFSMinusPerCentMill.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8220309 8230284 * @library /java/text/testlib @@ -29,17 +29,26 @@ * This test assumes CLDR has numbering systems for "arab" and * "arabext", and their minus/percent representations include * BiDi formatting control characters. - * @run testng/othervm DFSMinusPerCentMill + * @run junit/othervm DFSMinusPerCentMill */ -import java.io.*; -import java.util.*; -import java.text.*; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.NumberFormat; +import java.util.Locale; -import static org.testng.Assert.*; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class DFSMinusPerCentMill { private enum Type { NUMBER, PERCENT, CURRENCY, INTEGER, COMPACT, PERMILL @@ -49,7 +58,6 @@ private enum Type { private static final Locale US_ARABEXT = Locale.forLanguageTag("en-US-u-nu-arabext"); private static final double SRC_NUM = -1234.56; - @DataProvider Object[][] formatData() { return new Object[][] { // Locale, FormatStyle, expected format, expected single char symbol @@ -69,7 +77,6 @@ Object[][] formatData() { }; } - @DataProvider Object[][] charSymbols() { return new Object[][]{ // Locale, percent, per mille, minus sign @@ -78,8 +85,9 @@ Object[][] charSymbols() { }; } - @Test(dataProvider="formatData") - public void testFormatData(Locale l, Type style, String expected) { + @ParameterizedTest + @MethodSource("formatData") + void testFormatData(Locale l, Type style, String expected) { NumberFormat nf = null; switch (style) { case NUMBER: @@ -102,19 +110,20 @@ public void testFormatData(Locale l, Type style, String expected) { break; } - assertEquals(nf.format(SRC_NUM), expected); + assertEquals(expected, nf.format(SRC_NUM)); } - @Test(dataProvider="charSymbols") - public void testCharSymbols(Locale l, char percent, char permill, char minus) { + @ParameterizedTest + @MethodSource("charSymbols") + void testCharSymbols(Locale l, char percent, char permill, char minus) { DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l); - assertEquals(dfs.getPercent(), percent); - assertEquals(dfs.getPerMill(), permill); - assertEquals(dfs.getMinusSign(), minus); + assertEquals(percent, dfs.getPercent()); + assertEquals(permill, dfs.getPerMill()); + assertEquals(minus, dfs.getMinusSign()); } @Test - public void testSerialization() throws Exception { + void testSerialization() throws Exception { DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); new ObjectOutputStream(bos).writeObject(dfs); @@ -122,7 +131,7 @@ public void testSerialization() throws Exception { new ByteArrayInputStream(bos.toByteArray()) ).readObject(); - assertEquals(dfs, dfsSerialized); + assertEquals(dfsSerialized, dfs); // set minus/percent/permille dfs.setMinusSign('a'); @@ -134,6 +143,6 @@ public void testSerialization() throws Exception { new ByteArrayInputStream(bos.toByteArray()) ).readObject(); - assertEquals(dfs, dfsSerialized); + assertEquals(dfsSerialized, dfs); } } diff --git a/test/jdk/java/text/Normalizer/SquareEraCharacterTest.java b/test/jdk/java/text/Normalizer/SquareEraCharacterTest.java index 7367badd811e..9b669880fe9b 100644 --- a/test/jdk/java/text/Normalizer/SquareEraCharacterTest.java +++ b/test/jdk/java/text/Normalizer/SquareEraCharacterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -25,20 +25,20 @@ * @test * @bug 8221431 * @summary Tests decomposition of Japanese square era characters. - * @run testng/othervm SquareEraCharacterTest + * @run junit/othervm SquareEraCharacterTest */ -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.text.Normalizer; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; -@Test +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class SquareEraCharacterTest { - @DataProvider Object[][] squareEras() { return new Object[][] { @@ -51,12 +51,10 @@ Object[][] squareEras() { }; } - @Test(dataProvider="squareEras") - public void test_normalize(char squareChar, String expected) { - - assertEquals( - Normalizer.normalize(Character.toString(squareChar), Normalizer.Form.NFKD), - expected, + @ParameterizedTest + @MethodSource("squareEras") + void test_normalize(char squareChar, String expected) { + assertEquals(expected, Normalizer.normalize(Character.toString(squareChar), Normalizer.Form.NFKD), "decomposing " + Character.getName(squareChar) + "."); } } From aec013723d276ac788bbe21a32c4fdc281c7eaf9 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Mon, 13 Apr 2026 16:51:20 +0000 Subject: [PATCH 167/223] 8221451: PIT: sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh fails 7184899: Test sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh fail Reviewed-by: phh Backport-of: f489598d43e786aabcf0e26e9f9b9a840c699654 --- test/jdk/ProblemList.txt | 1 - .../SharedMemoryPixmapsTest.java | 106 ++++++++---------- .../SharedMemoryPixmapsTest.sh | 3 +- 3 files changed, 47 insertions(+), 63 deletions(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index e3cd6204a4c5..9b674a8f86d4 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -255,7 +255,6 @@ sun/java2d/SunGraphics2D/PolyVertTest.java 6986565 generic-all sun/java2d/SunGraphics2D/SimplePrimQuality.java 6992007 generic-all sun/java2d/SunGraphics2D/SourceClippingBlitTest/SourceClippingBlitTest.java 8196185 generic-all -sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh 8221451 linux-all java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java 8169469,8273617 windows-all,macosx-aarch64 java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java 8273617 macosx-all java/awt/print/PrinterJob/PSQuestionMark.java 7003378 generic-all diff --git a/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.java b/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.java index efa938036706..9b109e954ebc 100644 --- a/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.java +++ b/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -21,10 +21,10 @@ * questions. */ -import java.awt.AWTException; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.EventQueue; import java.awt.Frame; import java.awt.Graphics; import java.awt.Point; @@ -42,18 +42,18 @@ * make sure the pixels on the screen are red. * * Note that we force the use of shared memory pixmaps in the shell script. - * - * @author Dmitri.Trembovetski */ public class SharedMemoryPixmapsTest { - static final int IMAGE_SIZE = 100; - static boolean show = false; - final Frame testFrame; - /** Creates a new instance of SharedMemoryPixmapsTest */ - public SharedMemoryPixmapsTest() { + static final int IMAGE_SIZE = 200; + static volatile boolean show = false; + static volatile Frame testFrame; + static volatile TestComponent testComponent; + + static void createUI() { testFrame = new Frame("SharedMemoryPixmapsTest"); - testFrame.add(new TestComponent()); + testComponent = new TestComponent(); + testFrame.add(testComponent); testFrame.setUndecorated(true); testFrame.setResizable(false); testFrame.pack(); @@ -62,7 +62,7 @@ public SharedMemoryPixmapsTest() { testFrame.toFront(); } - public static void main(String[] args) { + public static void main(String[] args) throws Exception { for (String s : args) { if ("-show".equals(s)) { show = true; @@ -70,12 +70,43 @@ public static void main(String[] args) { System.err.println("Usage: SharedMemoryPixmapsTest [-show]"); } } - new SharedMemoryPixmapsTest(); + EventQueue.invokeAndWait(SharedMemoryPixmapsTest::createUI); + if (testRendering()) { + System.err.println("Test Passed"); + } else { + System.err.println("Test Failed"); + } + if (!show && testFrame != null) { + EventQueue.invokeAndWait(testFrame::dispose); + } + } + + static boolean testRendering() throws Exception { + Robot r = new Robot(); + r.waitForIdle(); + r.delay(2000); + Point p = testComponent.getLocationOnScreen(); + BufferedImage b = + r.createScreenCapture(new Rectangle(p, testComponent.getPreferredSize())); + for (int y = 20; y < b.getHeight() - 40; y++) { + for (int x = 20; x < b.getWidth() - 40; x++) { + if (b.getRGB(x, y) != Color.red.getRGB()) { + System.err.println("Incorrect pixel at " + + x + "x" + y + " : " + + Integer.toHexString(b.getRGB(x, y))); + if (show) { + return false; + } + System.err.println("Test Failed"); + System.exit(1); + } + } + } + return true; } - private class TestComponent extends Component { + static class TestComponent extends Component { VolatileImage vi = null; - boolean tested = false; void initVI() { int res; @@ -104,54 +135,10 @@ public synchronized void paint(Graphics g) { g.setColor(Color.green); g.fillRect(0, 0, getWidth(), getHeight()); + vi = null; initVI(); g.drawImage(vi, 0, 0, null); } while (vi.contentsLost()); - - Toolkit.getDefaultToolkit().sync(); - if (!tested) { - if (testRendering()) { - System.err.println("Test Passed"); - } else { - System.err.println("Test Failed"); - } - tested = true; - } - if (!show) { - testFrame.setVisible(false); - testFrame.dispose(); - } - } - - private boolean testRendering() throws RuntimeException { - try { - Thread.sleep(2000); - } catch (InterruptedException ex) {} - Robot r = null; - try { - r = new Robot(); - } catch (AWTException ex) { - ex.printStackTrace(); - throw new RuntimeException("Can't create Robot"); - } - Point p = getLocationOnScreen(); - BufferedImage b = - r.createScreenCapture(new Rectangle(p, getPreferredSize())); - for (int y = 0; y < b.getHeight(); y++) { - for (int x = 0; x < b.getWidth(); x++) { - if (b.getRGB(x, y) != Color.red.getRGB()) { - System.err.println("Incorrect pixel" + " at " - + x + "x" + y + " : " + - Integer.toHexString(b.getRGB(x, y))); - if (show) { - return false; - } - System.err.println("Test Failed"); - System.exit(1); - } - } - } - return true; } @Override @@ -159,5 +146,4 @@ public Dimension getPreferredSize() { return new Dimension(IMAGE_SIZE, IMAGE_SIZE); } } - } diff --git a/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh b/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh index 10dd58d90de8..786957ca0ebc 100644 --- a/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh +++ b/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2025, 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 @@ # by filling a VolatileImage with red color and copying it # to the screen. # Note that we force the use of shared memory pixmaps. -# @author Dmitri.Trembovetski echo "TESTJAVA=${TESTJAVA}" echo "TESTSRC=${TESTSRC}" From 594afeacf31b53941071af6ac02c291b78078a43 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Mon, 13 Apr 2026 16:51:35 +0000 Subject: [PATCH 168/223] 8352733: Improve RotFontBoundsTest test Use PassFailJFrame framework for creating manual test UI. Provide check boxes for each degree of rotation which allow hiding and showing the specified rotation. Provide 'Select All' and 'Clear All' buttons. Display Java version at the bottom of the test. Backport-of: bf8a881f02da14a3d47b30eaf414dea76a1c231f --- .../font/TextLayout/RotFontBoundsTest.java | 257 ++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100644 test/jdk/java/awt/font/TextLayout/RotFontBoundsTest.java diff --git a/test/jdk/java/awt/font/TextLayout/RotFontBoundsTest.java b/test/jdk/java/awt/font/TextLayout/RotFontBoundsTest.java new file mode 100644 index 000000000000..c0d4e7e7ef33 --- /dev/null +++ b/test/jdk/java/awt/font/TextLayout/RotFontBoundsTest.java @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2002, 2025, 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.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.event.ActionEvent; +import java.awt.font.FontRenderContext; +import java.awt.font.TextLayout; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.Arrays; + +import javax.swing.AbstractAction; +import javax.swing.Box; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.UIManager; + +import static javax.swing.BorderFactory.createEmptyBorder; + +/* + * @test + * @bug 4650997 + * @summary rotate a TextLayout and verify that the bounds are correct + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual RotFontBoundsTest + */ +public final class RotFontBoundsTest { + private static final String TEXT = ".This is a STRINg."; + + private static final String INSTRUCTIONS = + "A string \u201C" + TEXT + "\u201D is drawn at eight different " + + "angles, and eight boxes that surround the bounds of the text " + + "layouts (give or take a pixel) are drawn in red. The boxes " + + "are always composed of horizontal and vertical lines \u2014 " + + "they are not rotated.\n" + + "\n" + + "By default, all the rotations are displayed. Select or clear " + + "a check box with an angle to show or hide a particular " + + "rotation. Click \"Select All\" or \"Clear All\" to show all " + + "the rotations or to hide them.\n" + + "\n" + + "Click the Pass button if each box encloses its corresponding " + + "text layout.\n" + + "Otherwise, click Screenshot to save a screenshot for failure " + + "analysis and then click Fail."; + + private static boolean verbose; + + public static void main(String[] args) throws Exception { + verbose = (args.length > 0 && args[0].equalsIgnoreCase("verbose")); + + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .rows(20) + .columns(50) + .testTimeOut(15) + .screenCapture() + .testUI(RotFontBoundsTest::createUI) + .build() + .awaitAndCheck(); + } + + private static final int ROTATIONS = 8; + + private static JComponent createUI() { + final RotatedTextBounds rotatedText = new RotatedTextBounds(); + + final JPanel checkBoxes = new JPanel(new FlowLayout(FlowLayout.CENTER, + 4, 4)); + checkBoxes.setBorder(createEmptyBorder(0, 8, 8, 8)); + for (int i = 0; i < ROTATIONS; i++) { + checkBoxes.add(new JCheckBox(new SelectRotationAction(i, rotatedText))); + } + + JButton selectAll = new JButton("Select All"); + selectAll.addActionListener( + e -> selectAllCheckBoxes(checkBoxes.getComponents(), true)); + selectAll.setMnemonic('S'); + + JButton clearAll = new JButton("Clear All"); + clearAll.addActionListener( + e -> selectAllCheckBoxes(checkBoxes.getComponents(), false)); + clearAll.setMnemonic('C'); + + Box controls = Box.createHorizontalBox(); + controls.add(new JLabel("Visible Rotations:")); + controls.add(Box.createHorizontalGlue()); + controls.add(selectAll); + controls.add(Box.createHorizontalStrut(4)); + controls.add(clearAll); + controls.setBorder(createEmptyBorder(8, 8, 0, 8)); + + Box controlPanel = Box.createVerticalBox(); + controlPanel.add(controls); + controlPanel.add(checkBoxes); + + Box javaVersion = Box.createHorizontalBox(); + javaVersion.setBorder(createEmptyBorder(8, 8, 8, 8)); + javaVersion.add(new JLabel("Java version: " + + System.getProperty("java.runtime.version"))); + javaVersion.add(Box.createHorizontalGlue()); + + Box main = Box.createVerticalBox(); + main.setName("Rotated TextLayout Test"); + main.add(controlPanel); + main.add(rotatedText); + main.add(javaVersion); + + return main; + } + + private static final class RotatedTextBounds extends JComponent { + private final Font font = new Font(Font.DIALOG, Font.PLAIN, 24); + + private final boolean[] rotationVisible = new boolean[ROTATIONS]; + + private RotatedTextBounds() { + setBackground(Color.WHITE); + setPreferredSize(new Dimension(400, 400)); + Arrays.fill(rotationVisible, true); + } + + public void setRotationVisible(int rotation, boolean visible) { + rotationVisible[rotation] = visible; + repaint(); + } + + // Counts the number of paints + private int counter = 0; + + @Override + public void paintComponent(Graphics _g) { + Graphics2D g = (Graphics2D) _g; + Dimension d = getSize(); + + g.setColor(getBackground()); + g.fillRect(0, 0, d.width, d.height); + + counter++; + int x = d.width / 2; + int y = d.height / 2; + FontRenderContext frc = g.getFontRenderContext(); + + for (int i = 0; i < ROTATIONS; i++) { + if (!rotationVisible[i]) { + continue; + } + + double angle = -Math.PI / 4.0 * i; + AffineTransform flip = AffineTransform.getRotateInstance(angle); + Font flippedFont = font.deriveFont(flip); + TextLayout tl = new TextLayout(TEXT, flippedFont, frc); + Rectangle2D bb = tl.getBounds(); + g.setPaint(Color.BLACK); + tl.draw(g, x, y); + g.setPaint(Color.RED); + g.drawRect(x + (int) bb.getX(), y + (int) bb.getY(), + (int) bb.getWidth(), (int) bb.getHeight()); + + if (verbose) { + if (counter == 1) { + printDetails(angle, tl); + } else if (i == 0) { + System.out.println("Paint, counter=" + counter); + } + } + } + } + + private static void printDetails(double angle, TextLayout tl) { + System.out.println("Angle: " + angle); + System.out.println("getAscent: " + tl.getAscent()); + System.out.println("getAdvance: " + tl.getAdvance()); + System.out.println("getBaseline: " + tl.getBaseline()); + System.out.println("getBounds: " + tl.getBounds()); + System.out.println("getDescent: " + tl.getDescent()); + System.out.println("getLeading: " + tl.getLeading()); + System.out.println("getVisibleAdvance: " + tl.getVisibleAdvance()); + System.out.println("."); + } + } + + private static final class SelectRotationAction + extends AbstractAction + implements PropertyChangeListener { + private final int rotation; + private final RotatedTextBounds rotatedText; + + private SelectRotationAction(int rotation, + RotatedTextBounds rotatedText) { + super(rotation * (360 / ROTATIONS) + "\u00B0"); + this.rotation = rotation; + this.rotatedText = rotatedText; + + putValue(SELECTED_KEY, true); + + addPropertyChangeListener(this); + } + + private void updateRotationVisible() { + rotatedText.setRotationVisible(rotation, + (Boolean) getValue(SELECTED_KEY)); + } + + @Override + public void actionPerformed(ActionEvent e) { + updateRotationVisible(); + } + + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getPropertyName().equals(SELECTED_KEY)) { + updateRotationVisible(); + } + } + } + + private static void selectAllCheckBoxes(Component[] checkBoxes, + boolean visible) { + Arrays.stream(checkBoxes) + .forEach(c -> ((JCheckBox) c).setSelected(visible)); + } +} From 14f22dab9c743f4981bcf4ff3ad2f3edf7faa8bf Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Mon, 13 Apr 2026 16:52:00 +0000 Subject: [PATCH 169/223] 8360702: runtime/Thread/AsyncExceptionTest.java timed out Reviewed-by: phh Backport-of: 78ae7bdc9728f68d03db60c0c3c5ff72c043970b --- .../Thread/AsyncExceptionOnMonitorEnter.java | 41 +++++++------ .../runtime/Thread/AsyncExceptionTest.java | 60 ++++++++----------- 2 files changed, 47 insertions(+), 54 deletions(-) diff --git a/test/hotspot/jtreg/runtime/Thread/AsyncExceptionOnMonitorEnter.java b/test/hotspot/jtreg/runtime/Thread/AsyncExceptionOnMonitorEnter.java index 8446ffb20fe2..409313b9626e 100644 --- a/test/hotspot/jtreg/runtime/Thread/AsyncExceptionOnMonitorEnter.java +++ b/test/hotspot/jtreg/runtime/Thread/AsyncExceptionOnMonitorEnter.java @@ -44,9 +44,13 @@ public class AsyncExceptionOnMonitorEnter extends Thread { public static native int exitRawMonitor(); public static native void destroyRawMonitor(); + // Avoid using CountDownLatch or similar objects that require unparking the + // main thread. Otherwise, if the main thread is run as a virtual thread, the + // async exception could be sent while the target is still executing FJP logic. + public volatile boolean started = false; + public volatile boolean gotMonitor = false; + private static Object o1 = new Object(); - private static boolean firstWorker = true; - private static Semaphore sem = new Semaphore(0); @Override public void run() { @@ -59,11 +63,9 @@ public void run() { public void testWithJavaMonitor() { try { + started = true; synchronized (o1) { - if (firstWorker) { - firstWorker = false; - sem.release(); - } + gotMonitor = true; Thread.sleep(1000); } } catch (ThreadDeath td) { @@ -74,20 +76,16 @@ public void testWithJavaMonitor() { public void testWithJVMTIRawMonitor() { - boolean savedFirst = false; try { + started = true; int retCode = enterRawMonitor(); - if (retCode != 0 && firstWorker) { + if (retCode != 0) { throw new RuntimeException("error in JVMTI RawMonitorEnter: retCode=" + retCode); } - if (firstWorker) { - firstWorker = false; - savedFirst = true; - sem.release(); - } - Thread.sleep(1000); + gotMonitor = true; + Thread.sleep(500); retCode = exitRawMonitor(); - if (retCode != 0 && savedFirst) { + if (retCode != 0) { throw new RuntimeException("error in JVMTI RawMonitorExit: retCode=" + retCode); } } catch (ThreadDeath td) { @@ -133,15 +131,18 @@ public static void main(String[] args) { AsyncExceptionOnMonitorEnter worker2 = new AsyncExceptionOnMonitorEnter(); try { - // Start firstWorker worker and wait until monitor is acquired - firstWorker = true; + // Start first worker and wait until monitor is acquired worker1.start(); - sem.acquire(); + while (!worker1.gotMonitor) { + Thread.sleep(1); + } // Start second worker and allow some time for target to block on monitorenter // before executing Thread.stop() worker2.start(); - Thread.sleep(300); + while (!worker2.started) { + Thread.sleep(10); + } while (true) { JVMTIUtils.stopThread(worker2); @@ -150,6 +151,8 @@ public static void main(String[] args) { // not released worker2 will deadlock on enter JVMTIUtils.stopThread(worker1); } + // Give time to throw exception + Thread.sleep(10); if (!worker1.isAlive() && !worker2.isAlive()) { // Done with Thread.stop() calls since diff --git a/test/hotspot/jtreg/runtime/Thread/AsyncExceptionTest.java b/test/hotspot/jtreg/runtime/Thread/AsyncExceptionTest.java index aa883ac7dbf3..34dbb3018a58 100644 --- a/test/hotspot/jtreg/runtime/Thread/AsyncExceptionTest.java +++ b/test/hotspot/jtreg/runtime/Thread/AsyncExceptionTest.java @@ -36,25 +36,25 @@ import jvmti.JVMTIUtils; -import java.util.concurrent.CountDownLatch; - public class AsyncExceptionTest extends Thread { private final static int DEF_TIME_MAX = 30; // default max # secs to test private final static String PROG_NAME = "AsyncExceptionTest"; - public CountDownLatch exitSyncObj = new CountDownLatch(1); - public CountDownLatch startSyncObj = new CountDownLatch(1); + // Avoid using CountDownLatch or similar objects that require unparking the + // main thread. Otherwise, if the main thread is run as a virtual thread, the + // async exception could be sent while the target is still executing FJP logic. + public volatile boolean started = false; - private boolean firstEntry = true; private boolean receivedThreadDeathinInternal1 = false; private boolean receivedThreadDeathinInternal2 = false; + private volatile RuntimeException error = null; @Override public void run() { try { internalRun1(); } catch (ThreadDeath td) { - throw new RuntimeException("Caught ThreadDeath in run() instead of internalRun2() or internalRun1().\n" + error = new RuntimeException("Caught ThreadDeath in run() instead of internalRun2() or internalRun1().\n" + "receivedThreadDeathinInternal1=" + receivedThreadDeathinInternal1 + "; receivedThreadDeathinInternal2=" + receivedThreadDeathinInternal2); } catch (NoClassDefFoundError ncdfe) { @@ -62,15 +62,15 @@ public void run() { } if (receivedThreadDeathinInternal2 == false && receivedThreadDeathinInternal1 == false) { - throw new RuntimeException("Didn't catch ThreadDeath in internalRun2() nor in internalRun1().\n" + error = new RuntimeException("Didn't catch ThreadDeath in internalRun2() nor in internalRun1().\n" + "receivedThreadDeathinInternal1=" + receivedThreadDeathinInternal1 + "; receivedThreadDeathinInternal2=" + receivedThreadDeathinInternal2); } - exitSyncObj.countDown(); } public void internalRun1() { try { + started = true; while (!receivedThreadDeathinInternal2) { internalRun2(); } @@ -81,16 +81,10 @@ public void internalRun1() { public void internalRun2() { try { - Integer myLocalCount = 1; - Integer myLocalCount2 = 1; - - if (firstEntry) { - // Tell main thread we have started. - startSyncObj.countDown(); - firstEntry = false; - } + int myLocalCount = 1; + int myLocalCount2 = 1; - while(myLocalCount > 0) { + while (myLocalCount > 0) { myLocalCount2 = (myLocalCount % 3) / 2; myLocalCount -= 1; } @@ -122,19 +116,12 @@ public static void main(String[] args) { thread.start(); try { // Wait for the worker thread to get going. - thread.startSyncObj.await(); - while (true) { - // Send async exception and wait until it is thrown - JVMTIUtils.stopThread(thread); - thread.exitSyncObj.await(); - Thread.sleep(100); - - if (!thread.isAlive()) { - // Done with Thread.stop() calls since - // thread is not alive. - break; - } + while (!thread.started) { + Thread.sleep(1); } + // Send async exception and wait until it is thrown + JVMTIUtils.stopThread(thread); + thread.join(); } catch (InterruptedException e) { throw new Error("Unexpected: " + e); } catch (NoClassDefFoundError ncdfe) { @@ -143,11 +130,14 @@ public static void main(String[] args) { // in a worker thread can subsequently be seen in the // main thread. } - - try { - thread.join(); - } catch (InterruptedException e) { - throw new Error("Unexpected: " + e); + if (thread.isAlive()) { + // Really shouldn't be possible after join() above... + throw new RuntimeException("Thread did not exit.\n" + + "receivedThreadDeathinInternal1=" + thread.receivedThreadDeathinInternal1 + + "; receivedThreadDeathinInternal2=" + thread.receivedThreadDeathinInternal2); + } + if (thread.error != null) { + throw thread.error; } } @@ -169,4 +159,4 @@ public static void usage() { " seconds)"); System.exit(1); } -} +} \ No newline at end of file From 55f60a068a4bdaa75b68c3853dd0bd1cedfc6716 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Mon, 13 Apr 2026 16:52:31 +0000 Subject: [PATCH 170/223] 8378878: Refactor java/nio/channels/AsynchronousSocketChannel test to use JUnit Backport-of: c52d7b7cbc89548c3e9cd68a29ff0cec04888b09 --- .../CompletionHandlerRelease.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/test/jdk/java/nio/channels/AsynchronousSocketChannel/CompletionHandlerRelease.java b/test/jdk/java/nio/channels/AsynchronousSocketChannel/CompletionHandlerRelease.java index 7abbf064b403..962d7728a551 100644 --- a/test/jdk/java/nio/channels/AsynchronousSocketChannel/CompletionHandlerRelease.java +++ b/test/jdk/java/nio/channels/AsynchronousSocketChannel/CompletionHandlerRelease.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, 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,7 +23,7 @@ /* @test * @bug 8202252 - * @run testng CompletionHandlerRelease + * @run junit CompletionHandlerRelease * @summary Verify that reference to CompletionHandler is cleared after use */ @@ -44,10 +44,12 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; -import static org.testng.Assert.*; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; public class CompletionHandlerRelease { @Test @@ -132,16 +134,16 @@ public void testRead() throws Exception { } } - private AsynchronousChannelGroup GROUP; + private static AsynchronousChannelGroup GROUP; - @BeforeTest - void setup() throws IOException { + @BeforeAll + static void setup() throws IOException { GROUP = AsynchronousChannelGroup.withFixedThreadPool(2, Executors.defaultThreadFactory()); } - @AfterTest - void cleanup() throws IOException { + @AfterAll + static void cleanup() throws IOException { GROUP.shutdownNow(); } @@ -199,13 +201,13 @@ public void failed(Throwable exc, A attachment) { } } - private void waitForRefToClear(Reference ref, ReferenceQueue queue) + private static void waitForRefToClear(Reference ref, ReferenceQueue queue) throws InterruptedException { Reference r; while ((r = queue.remove(20)) == null) { System.gc(); } - assertEquals(r, ref); + assertSame(ref, r); assertNull(r.get()); } } From 598aac962a02cec15cc2bd5a6fd0c2e5959d0976 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Mon, 13 Apr 2026 16:53:35 +0000 Subject: [PATCH 171/223] 8373623: Refactor Serialization tests for Records to JUnit Reviewed-by: phh Backport-of: 1e357e9e976bfb0abc9d4e14bfb1572693622af8 --- .../records/AbsentStreamValuesTest.java | 50 +++++----- .../records/BadCanonicalCtrTest.java | 28 +++--- .../io/Serializable/records/BadValues.java | 17 ++-- .../Serializable/records/BasicRecordSer.java | 58 ++++++----- .../records/ConstructorAccessTest.java | 21 ++-- .../io/Serializable/records/CycleTest.java | 35 +++---- .../records/DifferentStreamFieldsTest.java | 97 ++++++++++--------- .../records/ProhibitedMethods.java | 45 +++++---- .../Serializable/records/ReadResolveTest.java | 24 +++-- .../Serializable/records/RecordClassTest.java | 38 ++++---- .../records/SerialPersistentFieldsTest.java | 30 +++--- .../records/SerialVersionUIDTest.java | 39 ++++---- .../Serializable/records/StreamRefTest.java | 23 ++--- .../records/ThrowingConstructorTest.java | 35 ++++--- .../io/Serializable/records/UnsharedTest.java | 29 +++--- .../records/WriteReplaceTest.java | 26 ++--- .../records/migration/AbstractTest.java | 9 +- .../records/migration/AssignableFromTest.java | 25 ++--- .../records/migration/DefaultValuesTest.java | 23 +++-- .../migration/SuperStreamFieldsTest.java | 34 ++++--- 20 files changed, 377 insertions(+), 309 deletions(-) diff --git a/test/jdk/java/io/Serializable/records/AbsentStreamValuesTest.java b/test/jdk/java/io/Serializable/records/AbsentStreamValuesTest.java index 153d0a6e9958..c899ecebe02b 100644 --- a/test/jdk/java/io/Serializable/records/AbsentStreamValuesTest.java +++ b/test/jdk/java/io/Serializable/records/AbsentStreamValuesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Checks that the appropriate default value is given to the canonical ctr - * @run testng AbsentStreamValuesTest - * @run testng/othervm/java.security.policy=empty_security.policy AbsentStreamValuesTest + * @run junit AbsentStreamValuesTest + * @run junit/othervm/java.security.policy=empty_security.policy AbsentStreamValuesTest */ import java.io.ByteArrayInputStream; @@ -35,16 +35,20 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.io.ObjectStreamConstants.*; import static java.lang.System.out; -import static org.testng.Assert.*; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Basic test to check that default primitive / reference values are presented * to the record's canonical constructor, for fields not in the stream. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class AbsentStreamValuesTest { record R01(boolean x) implements Serializable { } @@ -62,7 +66,6 @@ record R12(Object[] x) implements Serializable { } record R13(R12 x) implements Serializable { } record R14(R13[] x) implements Serializable { } - @DataProvider(name = "recordTypeAndExpectedValue") public Object[][] recordTypeAndExpectedValue() { return new Object[][] { new Object[] { R01.class, false }, @@ -82,7 +85,8 @@ public Object[][] recordTypeAndExpectedValue() { }; } - @Test(dataProvider = "recordTypeAndExpectedValue") + @ParameterizedTest + @MethodSource("recordTypeAndExpectedValue") public void testWithDifferentTypes(Class clazz, Object expectedXValue) throws Exception { @@ -93,7 +97,7 @@ public void testWithDifferentTypes(Class clazz, Object expectedXValue) Object obj = deserialize(bytes); out.println("deserialized: " + obj); Object actualXValue = clazz.getDeclaredMethod("x").invoke(obj); - assertEquals(actualXValue, expectedXValue); + assertEquals(expectedXValue, actualXValue); } // --- all together @@ -108,18 +112,18 @@ public void testWithAllTogether() throws Exception { R15 obj = (R15)deserialize(bytes); out.println("deserialized: " + obj); - assertEquals(obj.a, false); - assertEquals(obj.b, 0); - assertEquals(obj.c, 0); - assertEquals(obj.d, '\u0000'); - assertEquals(obj.e, 0); - assertEquals(obj.f, 0l); - assertEquals(obj.g, 0f); - assertEquals(obj.h, 0d); - assertEquals(obj.i, null); - assertEquals(obj.j, null); - assertEquals(obj.k, null); - assertEquals(obj.l, null); + assertEquals(false, obj.a); + assertEquals(0, obj.b); + assertEquals(0, obj.c); + assertEquals('\u0000', obj.d); + assertEquals(0, obj.e); + assertEquals(0l, obj.f); + assertEquals(0f, obj.g); + assertEquals(0d, obj.h); + assertEquals(null, obj.i); + assertEquals(null, obj.j); + assertEquals(null, obj.k); + assertEquals(null, obj.l); } // --- generic type @@ -133,8 +137,8 @@ public void testGenericType() throws Exception { R16 obj = (R16)deserialize(bytes); out.println("deserialized: " + obj); - assertEquals(obj.t, null); - assertEquals(obj.u, null); + assertEquals(null, obj.t); + assertEquals(null, obj.u); } // --- infra diff --git a/test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java b/test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java index 8b0a1ae625bc..2d3ec8ce4ecf 100644 --- a/test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java +++ b/test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java @@ -28,7 +28,7 @@ * cannot be found during deserialization. * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm - * @run testng BadCanonicalCtrTest + * @run junit BadCanonicalCtrTest */ import java.io.ByteArrayInputStream; @@ -44,20 +44,23 @@ import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.ByteCodeLoader; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; import static jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_FRAMES; import static jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_MAXS; import static jdk.internal.org.objectweb.asm.Opcodes.*; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Checks that an InvalidClassException is thrown when the canonical * constructor cannot be found during deserialization. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class BadCanonicalCtrTest { // ClassLoader for creating instances of the records to test with. @@ -74,7 +77,7 @@ public class BadCanonicalCtrTest { * the initial bytecode for the record classes using javac, then removes or * modifies the generated canonical constructor. */ - @BeforeTest + @BeforeAll public void setup() { { byte[] byteCode = InMemoryJavaCompiler.compile("R1", @@ -131,7 +134,6 @@ Object newR3(long l) throws Exception { return c.getConstructor(long.class).newInstance(l); } - @DataProvider(name = "recordInstances") public Object[][] recordInstances() throws Exception { return new Object[][] { new Object[] { newR1() }, @@ -146,13 +148,14 @@ public Object[][] recordInstances() throws Exception { * Tests that InvalidClassException is thrown when no constructor is * present. */ - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void missingConstructorTest(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); byte[] bytes = serialize(objToSerialize); out.println("deserializing"); - InvalidClassException ice = expectThrows(ICE, () -> deserialize(bytes, missingCtrClassLoader)); + InvalidClassException ice = Assertions.assertThrows(ICE, () -> deserialize(bytes, missingCtrClassLoader)); out.println("caught expected ICE: " + ice); assertTrue(ice.getMessage().contains("record canonical constructor not found")); } @@ -162,13 +165,14 @@ public void missingConstructorTest(Object objToSerialize) throws Exception { * constructor is not present. ( a non-canonical constructor is * present ). */ - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void nonCanonicalConstructorTest(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); byte[] bytes = serialize(objToSerialize); out.println("deserializing"); - InvalidClassException ice = expectThrows(ICE, () -> deserialize(bytes, nonCanonicalCtrClassLoader)); + InvalidClassException ice = Assertions.assertThrows(ICE, () -> deserialize(bytes, nonCanonicalCtrClassLoader)); out.println("caught expected ICE: " + ice); assertTrue(ice.getMessage().contains("record canonical constructor not found")); } diff --git a/test/jdk/java/io/Serializable/records/BadValues.java b/test/jdk/java/io/Serializable/records/BadValues.java index 4e3dbaa200f8..9d5e0c7be827 100644 --- a/test/jdk/java/io/Serializable/records/BadValues.java +++ b/test/jdk/java/io/Serializable/records/BadValues.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -24,7 +24,7 @@ /* * @test * @summary Basic test for ClassNotFoundException - * @run testng BadValues + * @run junit BadValues */ import java.io.ByteArrayInputStream; @@ -32,10 +32,11 @@ import java.io.DataOutputStream; import java.io.IOException; import java.io.ObjectInputStream; -import org.testng.annotations.Test; import static java.io.ObjectStreamConstants.*; import static java.lang.System.out; -import static org.testng.Assert.*; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; /** * Not directly related to records but provokes surrounding code, and ensures @@ -73,7 +74,7 @@ static byte[] byteStreamFor(String className, long uid, byte flags) public void testNotFoundSer() throws Exception { out.println("\n---"); byte[] bytes = byteStreamFor("XxYyZz", 0L, (byte)SC_SERIALIZABLE); - Throwable t = expectThrows(CNFE, () -> deserialize(bytes)); + Throwable t = assertThrows(CNFE, () -> deserialize(bytes)); out.println("caught expected CNFE: " + t); } @@ -81,7 +82,7 @@ public void testNotFoundSer() throws Exception { public void testNotFoundSerWr() throws Exception { out.println("\n---"); byte[] bytes = byteStreamFor("XxYyZz", 0L, (byte)(SC_SERIALIZABLE | SC_WRITE_METHOD)); - Throwable t = expectThrows(CNFE, () -> deserialize(bytes)); + Throwable t = assertThrows(CNFE, () -> deserialize(bytes)); out.println("caught expected CNFE: " + t); } @@ -89,7 +90,7 @@ public void testNotFoundSerWr() throws Exception { public void testNotFoundExt() throws Exception { out.println("\n---"); byte[] bytes = byteStreamFor("AaBbCc", 0L, (byte)SC_EXTERNALIZABLE); - Throwable t = expectThrows(CNFE, () -> deserialize(bytes)); + Throwable t = assertThrows(CNFE, () -> deserialize(bytes)); out.println("caught expected CNFE: " + t); } @@ -97,7 +98,7 @@ public void testNotFoundExt() throws Exception { public void testNotFoundExtWr() throws Exception { out.println("\n---"); byte[] bytes = byteStreamFor("AaBbCc", 0L, (byte)(SC_SERIALIZABLE | SC_WRITE_METHOD)); - Throwable t = expectThrows(CNFE, () -> deserialize(bytes)); + Throwable t = assertThrows(CNFE, () -> deserialize(bytes)); out.println("caught expected CNFE: " + t); } diff --git a/test/jdk/java/io/Serializable/records/BasicRecordSer.java b/test/jdk/java/io/Serializable/records/BasicRecordSer.java index ee50f630351e..81e54b39c100 100644 --- a/test/jdk/java/io/Serializable/records/BasicRecordSer.java +++ b/test/jdk/java/io/Serializable/records/BasicRecordSer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Basic test that serializes and deserializes a number of records - * @run testng BasicRecordSer - * @run testng/othervm/java.security.policy=empty_security.policy BasicRecordSer + * @run junit BasicRecordSer + * @run junit/othervm/java.security.policy=empty_security.policy BasicRecordSer */ import java.io.ByteArrayInputStream; @@ -40,19 +40,24 @@ import java.io.ObjectOutputStream; import java.io.Serializable; import java.math.BigInteger; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.String.format; import static java.lang.System.out; import static java.net.InetAddress.getLoopbackAddress; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; -import static org.testng.Assert.fail; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Basic test that serializes and deserializes a number of simple records. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class BasicRecordSer { // a mix of a few record and non-record classes @@ -102,7 +107,6 @@ record Wobble (Foo foo) implements ThrowingExternalizable { } record Wubble (Wobble wobble, Wibble wibble, String s) implements ThrowingExternalizable { } - @DataProvider(name = "serializable") public Object[][] serializable() { Foo foo = new Foo(23); return new Object[][] { @@ -122,14 +126,20 @@ public Object[][] serializable() { } /** Tests serializing and deserializing a number of records. */ - @Test(dataProvider = "serializable") + @ParameterizedTest + @MethodSource("serializable") public void testSerializable(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); var objDeserialized = serializeDeserialize(objToSerialize); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize, objDeserialized); - assertEquals(objDeserialized, objToSerialize); + if (objToSerialize.getClass().isArray()) { + assertArrayEquals((Object[]) objDeserialized, (Object[]) objToSerialize); + assertArrayEquals((Object[]) objToSerialize, (Object[]) objDeserialized); + } else { + assertEquals(objDeserialized, objToSerialize); + assertEquals(objToSerialize, objDeserialized); + } } /** Tests serializing and deserializing of local records. */ @@ -155,8 +165,8 @@ public void testSerializableBackRefs() throws Exception { out.println("serializing : " + objToSerialize); Foo[] objDeserialized = (Foo[])serializeDeserialize(objToSerialize); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize, objDeserialized); - assertEquals(objDeserialized, objToSerialize); + Assertions.assertArrayEquals(objDeserialized, objToSerialize); + Assertions.assertArrayEquals(objToSerialize, objDeserialized); for (Foo f : objDeserialized) assertTrue(objDeserialized[0] == f); @@ -172,8 +182,8 @@ public void testExternalizableBackRefs() throws Exception { out.println("serializing : " + objToSerialize); Wobble[] objDeserialized = (Wobble[])serializeDeserialize(objToSerialize); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize, objDeserialized); - assertEquals(objDeserialized, objToSerialize); + Assertions.assertArrayEquals(objDeserialized, objToSerialize); + Assertions.assertArrayEquals(objToSerialize, objDeserialized); for (Wobble w : objDeserialized) { assertTrue(objDeserialized[0] == w); @@ -193,7 +203,6 @@ static class A implements Serializable { final NotSer notSer = new NotSer(7); } - @DataProvider(name = "notSerializable") public Object[][] notSerializable() { return new Object[][] { new Object[] { new NotSerEmpty() }, @@ -210,11 +219,12 @@ public Object[][] notSerializable() { static final Class NSE = NotSerializableException.class; /** Tests that non-Serializable record objects throw NotSerializableException. */ - @Test(dataProvider = "notSerializable") + @ParameterizedTest + @MethodSource("notSerializable") public void testNotSerializable(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); - NotSerializableException expected = expectThrows(NSE, () -> serialize(objToSerialize)); + NotSerializableException expected = Assertions.assertThrows(NSE, () -> serialize(objToSerialize)); out.println("caught expected NSE:" + expected); } @@ -236,9 +246,9 @@ public void testCtrCalledOnlyOnce() throws Exception { out.println("serializing : " + objToSerialize); var objDeserialized = serializeDeserialize(objToSerialize); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize, objDeserialized); assertEquals(objDeserialized, objToSerialize); - assertEquals(e_ctrInvocationCount, 1); + assertEquals(objToSerialize, objDeserialized); + assertEquals(1, e_ctrInvocationCount); } // --- @@ -259,9 +269,9 @@ public void testCtrNotCalled() { var objToSerialize = new G(); g_ctrInvocationCount = 0; // reset out.println("serializing : " + objToSerialize); - NotSerializableException expected = expectThrows(NSE, () -> serialize(objToSerialize)); + NotSerializableException expected = Assertions.assertThrows(NSE, () -> serialize(objToSerialize)); out.println("caught expected NSE:" + expected); - assertEquals(g_ctrInvocationCount, 0); + assertEquals(0, g_ctrInvocationCount); } // --- infra diff --git a/test/jdk/java/io/Serializable/records/ConstructorAccessTest.java b/test/jdk/java/io/Serializable/records/ConstructorAccessTest.java index c9f2be0e18f8..293489d845ec 100644 --- a/test/jdk/java/io/Serializable/records/ConstructorAccessTest.java +++ b/test/jdk/java/io/Serializable/records/ConstructorAccessTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -26,8 +26,8 @@ * @bug 8246774 * @summary Ensures that the serialization implementation can *always* access * the record constructor - * @run testng ConstructorAccessTest - * @run testng/othervm/java.security.policy=empty_security.policy ConstructorAccessTest + * @run junit ConstructorAccessTest + * @run junit/othervm/java.security.policy=empty_security.policy ConstructorAccessTest */ import java.io.ByteArrayInputStream; @@ -39,16 +39,19 @@ import java.io.ObjectOutputStream; import java.io.Externalizable; import java.io.Serializable; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /*implicit*/ record Aux1 (int x) implements Serializable { } /*implicit*/ record Aux2 (int x) implements Serializable { } +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ConstructorAccessTest { public record A (int x) implements Serializable { } @@ -76,7 +79,6 @@ protected static record F (long l) implements ThrowingExternalizable { } private record H (double d) implements ThrowingExternalizable { } - @DataProvider(name = "recordInstances") public Object[][] recordInstances() { return new Object[][] { new Object[] { new A(34) }, @@ -92,7 +94,8 @@ public Object[][] recordInstances() { }; } - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void roundTrip(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); diff --git a/test/jdk/java/io/Serializable/records/CycleTest.java b/test/jdk/java/io/Serializable/records/CycleTest.java index 9df703c3bc10..79db38707999 100644 --- a/test/jdk/java/io/Serializable/records/CycleTest.java +++ b/test/jdk/java/io/Serializable/records/CycleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Ensures basic behavior of cycles from record components - * @run testng CycleTest - * @run testng/othervm/java.security.policy=empty_security.policy CycleTest + * @run junit CycleTest + * @run junit/othervm/java.security.policy=empty_security.policy CycleTest */ import java.io.ByteArrayInputStream; @@ -35,10 +35,11 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; public class CycleTest { @@ -62,10 +63,10 @@ public void testCycle1() throws Exception { out.println("serializing : " + r); R deserializedObj = serializeDeserialize(r); out.println("deserialized: " + deserializedObj); - assertEquals(deserializedObj.x(), 1); // sanity - assertEquals(deserializedObj.y(), 2); // sanity + assertEquals(1, deserializedObj.x()); // sanity + assertEquals(2, deserializedObj.y()); // sanity assertTrue(deserializedObj.c() instanceof C); // sanity - assertEquals(deserializedObj.c().obj, null); // cycle, expect null + assertEquals(null, deserializedObj.c().obj); // cycle, expect null } /** @@ -85,8 +86,8 @@ public void testCycle2() throws Exception { out.println("deserialized: " + deserializedObj); assertTrue(deserializedObj instanceof C); // sanity assertTrue(deserializedObj.obj != null); // expect non-null, r - assertEquals(((R)deserializedObj.obj).x(), 3); // sanity - assertEquals(((R)deserializedObj.obj).y(), 4); // sanity + assertEquals(3, ((R)deserializedObj.obj).x()); // sanity + assertEquals(4, ((R)deserializedObj.obj).y()); // sanity } record R2 (int x, int y, C c1, C c2) implements Serializable { } @@ -106,8 +107,8 @@ public void testCycle3() throws Exception { out.println("serializing : " + r); R2 deserializedObj = serializeDeserialize(r); out.println("deserialized: " + deserializedObj); - assertEquals(deserializedObj.x(), 5); // sanity - assertEquals(deserializedObj.y(), 6); // sanity + assertEquals(5, deserializedObj.x()); // sanity + assertEquals(6, deserializedObj.y()); // sanity c1 = deserializedObj.c1(); c2 = deserializedObj.c2(); @@ -133,11 +134,11 @@ public void testCycle4() throws Exception { R3 deserializedObj = serializeDeserialize(r3); out.println("deserialized: " + deserializedObj); assertTrue(deserializedObj.r() != null); - assertEquals(deserializedObj.l(), 9); // sanity - assertEquals(deserializedObj.r().x(), 7); // sanity - assertEquals(deserializedObj.r().y(), 8); // sanity + assertEquals(9, deserializedObj.l()); // sanity + assertEquals(7, deserializedObj.r().x()); // sanity + assertEquals(8, deserializedObj.r().y()); // sanity assertTrue(deserializedObj.r().c() instanceof C); // sanity - assertEquals(deserializedObj.r().c().obj, null); // cycle, expect null + assertEquals(null, deserializedObj.r().c().obj); // cycle, expect null } // --- infra diff --git a/test/jdk/java/io/Serializable/records/DifferentStreamFieldsTest.java b/test/jdk/java/io/Serializable/records/DifferentStreamFieldsTest.java index d4101f9894b2..dc22b1def0a9 100644 --- a/test/jdk/java/io/Serializable/records/DifferentStreamFieldsTest.java +++ b/test/jdk/java/io/Serializable/records/DifferentStreamFieldsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -26,8 +26,8 @@ * @bug 8246774 * @summary Checks that the appropriate value is given to the canonical ctr * @library /test/lib - * @run testng DifferentStreamFieldsTest - * @run testng/othervm/java.security.policy=empty_security.policy DifferentStreamFieldsTest + * @run junit DifferentStreamFieldsTest + * @run junit/othervm/java.security.policy=empty_security.policy DifferentStreamFieldsTest */ import java.io.ByteArrayInputStream; @@ -39,14 +39,19 @@ import java.io.ObjectOutputStream; import java.io.Serializable; import jdk.test.lib.serial.SerialObjectBuilder; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Checks that the appropriate value is given to the canonical ctr. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class DifferentStreamFieldsTest { record R01(boolean x) implements Serializable {} @@ -77,7 +82,6 @@ record R13(R12 x) implements Serializable {} record R14(R13[]x) implements Serializable {} - @DataProvider(name = "recordTypeAndExpectedValue") public Object[][] recordTypeAndExpectedValue() { return new Object[][]{ new Object[]{R01.class, false}, @@ -97,7 +101,8 @@ public Object[][] recordTypeAndExpectedValue() { }; } - @Test(dataProvider = "recordTypeAndExpectedValue") + @ParameterizedTest + @MethodSource("recordTypeAndExpectedValue") public void testWithDifferentTypes(Class clazz, Object expectedXValue) throws Exception { out.println("\n---"); @@ -109,7 +114,7 @@ public void testWithDifferentTypes(Class clazz, Object expectedXValue) Object obj = deserialize(bytes); out.println("deserialized: " + obj); Object actualXValue = clazz.getDeclaredMethod("x").invoke(obj); - assertEquals(actualXValue, expectedXValue); + assertEquals(expectedXValue, actualXValue); bytes = SerialObjectBuilder .newBuilder(clazz.getName()) @@ -119,7 +124,7 @@ public void testWithDifferentTypes(Class clazz, Object expectedXValue) obj = deserialize(bytes); out.println("deserialized: " + obj); actualXValue = clazz.getDeclaredMethod("x").invoke(obj); - assertEquals(actualXValue, expectedXValue); + assertEquals(expectedXValue, actualXValue); } // --- all together @@ -138,18 +143,18 @@ record R15(boolean a, byte b, short c, char d, int e, long f, float g, R15 obj = deserialize(bytes); out.println("deserialized: " + obj); - assertEquals(obj.a, false); - assertEquals(obj.b, 0); - assertEquals(obj.c, 0); - assertEquals(obj.d, '\u0000'); - assertEquals(obj.e, 0); - assertEquals(obj.f, 0l); - assertEquals(obj.g, 0f); - assertEquals(obj.h, 0d); - assertEquals(obj.i, null); - assertEquals(obj.j, null); - assertEquals(obj.k, null); - assertEquals(obj.l, null); + assertEquals(false, obj.a); + assertEquals(0, obj.b); + assertEquals(0, obj.c); + assertEquals('\u0000', obj.d); + assertEquals(0, obj.e); + assertEquals(0l, obj.f); + assertEquals(0f, obj.g); + assertEquals(0d, obj.h); + assertEquals(null, obj.i); + assertEquals(null, obj.j); + assertEquals(null, obj.k); + assertEquals(null, obj.l); } @Test @@ -167,9 +172,9 @@ record R(int x) implements Serializable {} .build(); var deser1 = deserialize(OOSBytes); - assertEquals(deser1, r); + assertEquals(r, deser1); var deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); } { record R(int x, int y) implements Serializable {} @@ -177,7 +182,7 @@ record R(int x, int y) implements Serializable {} var r = new R(7, 8); byte[] OOSBytes = serialize(r); var deser1 = deserialize(OOSBytes); - assertEquals(deser1, r); + assertEquals(r, deser1); byte[] builderBytes = SerialObjectBuilder .newBuilder(R.class.getName()) @@ -186,7 +191,7 @@ record R(int x, int y) implements Serializable {} .build(); var deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); builderBytes = SerialObjectBuilder .newBuilder(R.class.getName()) @@ -194,7 +199,7 @@ record R(int x, int y) implements Serializable {} .addPrimitiveField("x", int.class, 7) .build(); deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); builderBytes = SerialObjectBuilder .newBuilder(R.class.getName()) @@ -204,12 +209,12 @@ record R(int x, int y) implements Serializable {} .addPrimitiveField("z", int.class, 9) // additional fields .build(); deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); r = new R(0, 0); OOSBytes = serialize(r); deser1 = deserialize(OOSBytes); - assertEquals(deser1, r); + assertEquals(r, deser1); builderBytes = SerialObjectBuilder .newBuilder(R.class.getName()) @@ -217,13 +222,13 @@ record R(int x, int y) implements Serializable {} .addPrimitiveField("x", int.class, 0) .build(); deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); builderBytes = SerialObjectBuilder .newBuilder(R.class.getName()) // no field values .build(); deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); } } @@ -235,7 +240,7 @@ record Str(String part1, String part2) implements Serializable {} var r = new Str("Hello", "World!"); var deser1 = deserialize(serialize(r)); - assertEquals(deser1, r); + assertEquals(r, deser1); byte[] builderBytes = SerialObjectBuilder .newBuilder(Str.class.getName()) @@ -244,7 +249,7 @@ record Str(String part1, String part2) implements Serializable {} .build(); var deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); builderBytes = SerialObjectBuilder .newBuilder(Str.class.getName()) @@ -255,7 +260,7 @@ record Str(String part1, String part2) implements Serializable {} .build(); var deser3 = deserialize(builderBytes); - assertEquals(deser3, deser1); + assertEquals(deser1, deser3); } @Test @@ -265,8 +270,8 @@ public void testArrays() throws Exception { record IntArray(int[]ints, long[]longs) implements Serializable {} IntArray r = new IntArray(new int[]{5, 4, 3, 2, 1}, new long[]{9L}); IntArray deser1 = deserialize(serialize(r)); - assertEquals(deser1.ints(), r.ints()); - assertEquals(deser1.longs(), r.longs()); + Assertions.assertArrayEquals(r.ints(), deser1.ints()); + Assertions.assertArrayEquals(r.longs(), deser1.longs()); byte[] builderBytes = SerialObjectBuilder .newBuilder(IntArray.class.getName()) @@ -275,14 +280,14 @@ record IntArray(int[]ints, long[]longs) implements Serializable {} .build(); IntArray deser2 = deserialize(builderBytes); - assertEquals(deser2.ints(), deser1.ints()); - assertEquals(deser2.longs(), deser1.longs()); + Assertions.assertArrayEquals(deser1.ints(), deser2.ints()); + Assertions.assertArrayEquals(deser1.longs(), deser2.longs()); } { record StrArray(String[]stringArray) implements Serializable {} StrArray r = new StrArray(new String[]{"foo", "bar"}); StrArray deser1 = deserialize(serialize(r)); - assertEquals(deser1.stringArray(), r.stringArray()); + Assertions.assertArrayEquals(r.stringArray(), deser1.stringArray()); byte[] builderBytes = SerialObjectBuilder .newBuilder(StrArray.class.getName()) @@ -290,7 +295,7 @@ record StrArray(String[]stringArray) implements Serializable {} .build(); StrArray deser2 = deserialize(builderBytes); - assertEquals(deser2.stringArray(), deser1.stringArray()); + Assertions.assertArrayEquals(deser1.stringArray(), deser2.stringArray()); } } @@ -303,7 +308,7 @@ record NumberHolder(Number n) implements Serializable {} var r = new NumberHolder(123); var deser1 = deserialize(serialize(r)); - assertEquals(deser1, r); + assertEquals(r, deser1); byte[] builderBytes = SerialObjectBuilder .newBuilder(NumberHolder.class.getName()) @@ -311,7 +316,7 @@ record NumberHolder(Number n) implements Serializable {} .build(); var deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); } { @@ -319,7 +324,7 @@ record IntegerHolder(Integer i) implements Serializable {} var r = new IntegerHolder(123); var deser1 = deserialize(serialize(r)); - assertEquals(deser1, r); + assertEquals(r, deser1); byte[] builderBytes = SerialObjectBuilder .newBuilder(IntegerHolder.class.getName()) @@ -327,7 +332,7 @@ record IntegerHolder(Integer i) implements Serializable {} .build(); var deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); } } @@ -339,7 +344,7 @@ record StringHolder(String s) implements Serializable {} var r = new StringHolder("123"); var deser1 = deserialize(serialize(r)); - assertEquals(deser1, r); + assertEquals(r, deser1); byte[] builderBytes = SerialObjectBuilder .newBuilder(StringHolder.class.getName()) @@ -363,7 +368,7 @@ record IntHolder(int i) implements Serializable {} var r = new IntHolder(123); var deser1 = deserialize(serialize(r)); - assertEquals(deser1, r); + assertEquals(r, deser1); byte[] builderBytes = SerialObjectBuilder .newBuilder(IntHolder.class.getName()) diff --git a/test/jdk/java/io/Serializable/records/ProhibitedMethods.java b/test/jdk/java/io/Serializable/records/ProhibitedMethods.java index 099008b4306e..7465c80e4533 100644 --- a/test/jdk/java/io/Serializable/records/ProhibitedMethods.java +++ b/test/jdk/java/io/Serializable/records/ProhibitedMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -27,7 +27,7 @@ * @summary Basic tests for prohibited magic serialization methods * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm - * @run testng ProhibitedMethods + * @run junit ProhibitedMethods */ import java.io.ByteArrayInputStream; @@ -51,23 +51,27 @@ import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.ByteCodeLoader; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; import static jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_FRAMES; import static jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_MAXS; import static jdk.internal.org.objectweb.asm.Opcodes.*; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; -import static org.testng.Assert.fail; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Checks that the various prohibited Serialization magic methods, and * Externalizable methods, are not invoked ( effectively ignored ) for * record objects. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ProhibitedMethods { public interface ThrowingExternalizable extends Externalizable { @@ -101,7 +105,7 @@ record Wubble (Wobble wobble, Wibble wibble, String s) implements ThrowingExtern * fail("readObjectNoData should not be invoked"); } * } */ - @BeforeTest + @BeforeAll public void setup() { { byte[] byteCode = InMemoryJavaCompiler.compile("Foo", @@ -166,7 +170,6 @@ Object newBaz(Object u, Object v) { } } - @DataProvider(name = "recordInstances") public Object[][] recordInstances() { return new Object[][] { new Object[] { newFoo() }, @@ -178,7 +181,8 @@ public Object[][] recordInstances() { }; } - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void roundTrip(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); @@ -271,7 +275,8 @@ public void visitEnd() { MethodVisitor mv = cv.visitMethod(ACC_PRIVATE, WRITE_OBJECT_NAME, WRITE_OBJECT_DESC, null, null); mv.visitCode(); mv.visitLdcInsn(WRITE_OBJECT_NAME + " should not be invoked"); - mv.visitMethodInsn(INVOKESTATIC, "org/testng/Assert", "fail", "(Ljava/lang/String;)V", false); + mv.visitMethodInsn(INVOKESTATIC, "org/junit/jupiter/api/Assertions", "fail", + "(Ljava/lang/String;)Ljava/lang/Object;", false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); @@ -332,38 +337,38 @@ public void wellFormedGeneratedClasses() throws Exception { Method m = obj.getClass().getDeclaredMethod("writeObject", ObjectOutputStream.class); assertTrue((m.getModifiers() & Modifier.PRIVATE) != 0); m.setAccessible(true); - ReflectiveOperationException t = expectThrows(ROE, () -> + ReflectiveOperationException t = Assertions.assertThrows(ROE, () -> m.invoke(obj, new ObjectOutputStream(OutputStream.nullOutputStream()))); Throwable assertionError = t.getCause(); out.println("caught expected AssertionError: " + assertionError); assertTrue(assertionError instanceof AssertionError, "Expected AssertionError, got:" + assertionError); - assertEquals(assertionError.getMessage(), "writeObject should not be invoked"); + assertEquals("writeObject should not be invoked", assertionError.getMessage()); } { // readObject Method m = obj.getClass().getDeclaredMethod("readObject", ObjectInputStream.class); assertTrue((m.getModifiers() & Modifier.PRIVATE) != 0); m.setAccessible(true); - ReflectiveOperationException t = expectThrows(ROE, () -> + ReflectiveOperationException t = Assertions.assertThrows(ROE, () -> m.invoke(obj, new ObjectInputStream() { })); Throwable assertionError = t.getCause(); out.println("caught expected AssertionError: " + assertionError); assertTrue(assertionError instanceof AssertionError, "Expected AssertionError, got:" + assertionError); - assertEquals(assertionError.getMessage(), "readObject should not be invoked"); + assertEquals("readObject should not be invoked", assertionError.getMessage()); } { // readObjectNoData Method m = obj.getClass().getDeclaredMethod("readObjectNoData"); assertTrue((m.getModifiers() & Modifier.PRIVATE) != 0); m.setAccessible(true); - ReflectiveOperationException t = expectThrows(ROE, () -> m.invoke(obj)); + ReflectiveOperationException t = Assertions.assertThrows(ROE, () -> m.invoke(obj)); Throwable assertionError = t.getCause(); out.println("caught expected AssertionError: " + assertionError); assertTrue(assertionError instanceof AssertionError, "Expected AssertionError, got:" + assertionError); - assertEquals(assertionError.getMessage(), "readObjectNoData should not be invoked"); + assertEquals("readObjectNoData should not be invoked", assertionError.getMessage()); } } } -} +} \ No newline at end of file diff --git a/test/jdk/java/io/Serializable/records/ReadResolveTest.java b/test/jdk/java/io/Serializable/records/ReadResolveTest.java index 725f2cb49eab..cb36e3821fea 100644 --- a/test/jdk/java/io/Serializable/records/ReadResolveTest.java +++ b/test/jdk/java/io/Serializable/records/ReadResolveTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Basic tests for readResolve - * @run testng ReadResolveTest - * @run testng/othervm/java.security.policy=empty_security.policy ReadResolveTest + * @run junit ReadResolveTest + * @run junit/othervm/java.security.policy=empty_security.policy ReadResolveTest */ import java.io.ByteArrayInputStream; @@ -36,15 +36,19 @@ import java.io.ObjectOutputStream; import java.io.Serial; import java.io.Serializable; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.String.format; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Tests records being used as a serial proxy. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ReadResolveTest { static class C1 implements Serializable { @@ -95,7 +99,6 @@ private Object writeReplace() { } } - @DataProvider(name = "objectsToSerialize") public Object[][] objectsToSerialize() { return new Object[][] { new Object[] { new C1(3,4) }, @@ -104,13 +107,14 @@ public Object[][] objectsToSerialize() { }; } - @Test(dataProvider = "objectsToSerialize") + @ParameterizedTest + @MethodSource("objectsToSerialize") public void testSerialize(Object objectToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objectToSerialize); Object deserializedObj = serializeDeserialize(objectToSerialize); out.println("deserialized: " + deserializedObj); - assertEquals(deserializedObj, objectToSerialize); + assertEquals(objectToSerialize, deserializedObj); } // -- null replacement @@ -129,7 +133,7 @@ public void testNull() throws Exception { out.println("serializing : " + objectToSerialize); Object deserializedObj = serializeDeserialize(objectToSerialize); out.println("deserialized: " + deserializedObj); - assertEquals(deserializedObj, null); + assertEquals(null, deserializedObj); } // --- infra diff --git a/test/jdk/java/io/Serializable/records/RecordClassTest.java b/test/jdk/java/io/Serializable/records/RecordClassTest.java index 6506f9f85e43..b6e35d13626e 100644 --- a/test/jdk/java/io/Serializable/records/RecordClassTest.java +++ b/test/jdk/java/io/Serializable/records/RecordClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Basic tests for serializing and deserializing record classes - * @run testng RecordClassTest - * @run testng/othervm/java.security.policy=empty_security.policy RecordClassTest + * @run junit RecordClassTest + * @run junit/othervm/java.security.policy=empty_security.policy RecordClassTest */ import java.io.ByteArrayInputStream; @@ -39,15 +39,18 @@ import java.io.ObjectOutputStream; import java.io.ObjectStreamClass; import java.io.Serializable; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Serializes and deserializes record classes. Ensures that the SUID is 0. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class RecordClassTest { record Foo () implements Serializable { } @@ -75,7 +78,6 @@ record Wobble (long l) implements ThrowingExternalizable { } record Wubble (Wobble wobble, Wibble wibble, String s) implements ThrowingExternalizable { } - @DataProvider(name = "recordClasses") public Object[][] recordClasses() { return new Object[][] { new Object[] { Foo.class , 0L }, @@ -88,7 +90,8 @@ public Object[][] recordClasses() { } /** Tests that the serialized and deserialized instances are equal. */ - @Test(dataProvider = "recordClasses") + @ParameterizedTest + @MethodSource("recordClasses") public void testClassSerialization(Class recordClass, long unused) throws Exception { @@ -96,21 +99,22 @@ public void testClassSerialization(Class recordClass, long unused) out.println("serializing : " + recordClass); var deserializedClass = serializeDeserialize(recordClass); out.println("deserialized: " + deserializedClass); - assertEquals(recordClass, deserializedClass); assertEquals(deserializedClass, recordClass); + assertEquals(recordClass, deserializedClass); } /** Tests that the SUID is always 0 unless explicitly declared. */ - @Test(dataProvider = "recordClasses") + @ParameterizedTest + @MethodSource("recordClasses") public void testSerialVersionUID(Class recordClass, long expectedUID) { out.println("\n---"); ObjectStreamClass osc = ObjectStreamClass.lookup(recordClass); out.println("ObjectStreamClass::lookup : " + osc); - assertEquals(osc.getSerialVersionUID(), expectedUID); + assertEquals(expectedUID, osc.getSerialVersionUID()); osc = ObjectStreamClass.lookupAny(recordClass); out.println("ObjectStreamClass::lookupAny: " + osc); - assertEquals(osc.getSerialVersionUID(), expectedUID); + assertEquals(expectedUID, osc.getSerialVersionUID()); } // --- not Serializable @@ -121,7 +125,6 @@ record NotSerializable2(int x) { } record NotSerializable3(T t) { } - @DataProvider(name = "notSerRecordClasses") public Object[][] notSerRecordClasses() { return new Object[][] { new Object[] { NotSerializable1.class }, @@ -131,16 +134,17 @@ public Object[][] notSerRecordClasses() { } /** Tests that the generated SUID is always 0 for all non-Serializable record classes. */ - @Test(dataProvider = "notSerRecordClasses") + @ParameterizedTest + @MethodSource("notSerRecordClasses") public void testSerialVersionUIDNonSer(Class recordClass) { out.println("\n---"); ObjectStreamClass osc = ObjectStreamClass.lookup(recordClass); out.println("ObjectStreamClass::lookup : " + osc); - assertEquals(osc, null); + assertEquals(null, osc); osc = ObjectStreamClass.lookupAny(recordClass); out.println("ObjectStreamClass::lookupAny: " + osc); - assertEquals(osc.getSerialVersionUID(), 0L); + assertEquals(0L, osc.getSerialVersionUID()); } // --- infra diff --git a/test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java b/test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java index 0d88074bdbcc..13d81ee3c49e 100644 --- a/test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java +++ b/test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -27,7 +27,7 @@ * @summary Basic tests for prohibited magic serialPersistentFields * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm - * @run testng SerialPersistentFieldsTest + * @run junit SerialPersistentFieldsTest */ import java.io.ByteArrayInputStream; @@ -49,18 +49,21 @@ import jdk.internal.org.objectweb.asm.Type; import jdk.test.lib.ByteCodeLoader; import jdk.test.lib.compiler.InMemoryJavaCompiler; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; import static jdk.internal.org.objectweb.asm.ClassWriter.*; import static jdk.internal.org.objectweb.asm.Opcodes.*; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Checks that the serialPersistentFields declaration is effectively ignored. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class SerialPersistentFieldsTest { ClassLoader serializableRecordLoader; @@ -78,7 +81,7 @@ public class SerialPersistentFieldsTest { * }; * } */ - @BeforeTest + @BeforeAll public void setup() { { // R1 byte[] byteCode = InMemoryJavaCompiler.compile("R1", @@ -164,7 +167,6 @@ Object newR5(int x) { return newRecord("R5", new Class[]{int.class}, new Object[]{x}); } - @DataProvider(name = "recordInstances") public Object[][] recordInstances() { return new Object[][] { new Object[] { newR1() }, @@ -175,14 +177,15 @@ public Object[][] recordInstances() { }; } - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void roundTrip(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); var objDeserialized = serializeDeserialize(objToSerialize); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize, objDeserialized); assertEquals(objDeserialized, objToSerialize); + assertEquals(objToSerialize, objDeserialized); } byte[] serialize(T obj) throws IOException { @@ -323,7 +326,8 @@ static String getPrimitiveBoxClass(final Class clazz) { // -- infra sanity -- /** Checks to ensure correct operation of the test's generation logic. */ - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void wellFormedGeneratedClasses(Object obj) throws Exception { out.println("\n---"); out.println(obj); @@ -336,4 +340,4 @@ public void wellFormedGeneratedClasses(Object obj) throws Exception { assertTrue(fv != null, "Unexpected null value"); assertTrue(fv.length >= 0, "Unexpected negative length:" + fv.length); } -} +} \ No newline at end of file diff --git a/test/jdk/java/io/Serializable/records/SerialVersionUIDTest.java b/test/jdk/java/io/Serializable/records/SerialVersionUIDTest.java index d1018c125542..ae0c3b9af14c 100644 --- a/test/jdk/java/io/Serializable/records/SerialVersionUIDTest.java +++ b/test/jdk/java/io/Serializable/records/SerialVersionUIDTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Basic tests for SUID in the serial stream - * @run testng SerialVersionUIDTest - * @run testng/othervm/java.security.policy=empty_security.policy SerialVersionUIDTest + * @run junit SerialVersionUIDTest + * @run junit/othervm/java.security.policy=empty_security.policy SerialVersionUIDTest */ import java.io.ByteArrayInputStream; @@ -40,13 +40,16 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.LongStream; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.io.ObjectStreamConstants.*; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class SerialVersionUIDTest { record R1 () implements Serializable { @@ -65,7 +68,6 @@ record R5 (long l) implements Serializable { private static final long serialVersionUID = 5678L; } - @DataProvider(name = "recordObjects") public Object[][] recordObjects() { return new Object[][] { new Object[] { new R1(), 1L }, @@ -79,7 +81,8 @@ public Object[][] recordObjects() { /** * Tests that a declared SUID for a record class is inserted into the stream. */ - @Test(dataProvider = "recordObjects") + @ParameterizedTest + @MethodSource("recordObjects") public void testSerialize(Object objectToSerialize, long expectedUID) throws Exception { @@ -91,17 +94,16 @@ public void testSerialize(Object objectToSerialize, long expectedUID) DataInputStream dis = new DataInputStream(bais); // sanity - assertEquals(dis.readShort(), STREAM_MAGIC); - assertEquals(dis.readShort(), STREAM_VERSION); - assertEquals(dis.readByte(), TC_OBJECT); - assertEquals(dis.readByte(), TC_CLASSDESC); - assertEquals(dis.readUTF(), objectToSerialize.getClass().getName()); + assertEquals(STREAM_MAGIC, dis.readShort()); + assertEquals(STREAM_VERSION, dis.readShort()); + assertEquals(TC_OBJECT, dis.readByte()); + assertEquals(TC_CLASSDESC, dis.readByte()); + assertEquals(objectToSerialize.getClass().getName(), dis.readUTF()); // verify that the UID is as expected - assertEquals(dis.readLong(), expectedUID); + assertEquals(expectedUID, dis.readLong()); } - @DataProvider(name = "recordClasses") public Object[][] recordClasses() { List list = new ArrayList<>(); List> recordClasses = List.of(R1.class, R2.class, R3.class, R4.class, R5.class); @@ -116,14 +118,15 @@ public Object[][] recordClasses() { * Tests that matching of the serialVersionUID values ( stream value * and runtime class value ) is waived for record classes. */ - @Test(dataProvider = "recordClasses") + @ParameterizedTest + @MethodSource("recordClasses") public void testSerializeFromClass(Class cl, long suid) throws Exception { out.println("\n---"); byte[] bytes = byteStreamFor(cl.getName(), suid); Object obj = deserialize(bytes); - assertEquals(obj.getClass(), cl); + assertEquals(cl, obj.getClass()); assertTrue(obj.getClass().isRecord()); } diff --git a/test/jdk/java/io/Serializable/records/StreamRefTest.java b/test/jdk/java/io/Serializable/records/StreamRefTest.java index b0c72ec8a966..d0d3e353bdb5 100644 --- a/test/jdk/java/io/Serializable/records/StreamRefTest.java +++ b/test/jdk/java/io/Serializable/records/StreamRefTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -25,7 +25,7 @@ * @test * @bug 8246774 * @summary Tests for stream references - * @run testng StreamRefTest + * @run junit StreamRefTest */ import java.io.ByteArrayInputStream; @@ -36,11 +36,12 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; /** * Tests for stream references. @@ -123,14 +124,14 @@ public void basicRefWithInvalidA() throws Exception { updateIntValue(3, -3, bytes, 40); var byteStream = new ObjectInputStream(new ByteArrayInputStream(bytes)); - InvalidObjectException ioe = expectThrows(IOE, () -> deserializeOne(byteStream)); + InvalidObjectException ioe = Assertions.assertThrows(IOE, () -> deserializeOne(byteStream)); out.println("caught expected IOE: " + ioe); Throwable t = ioe.getCause(); assertTrue(t instanceof IllegalArgumentException, "Expected IAE, got:" + t); out.println("expected cause IAE: " + t); B b1 = (B)deserializeOne(byteStream); - assertEquals(b1.a, null); + assertEquals(null, b1.a); } @Test @@ -144,14 +145,14 @@ public void reverseBasicRefWithInvalidA() throws Exception { updateIntValue(3, -3, bytes, 96); var byteStream = new ObjectInputStream(new ByteArrayInputStream(bytes)); - InvalidObjectException ioe = expectThrows(IOE, () -> deserializeOne(byteStream)); + InvalidObjectException ioe = Assertions.assertThrows(IOE, () -> deserializeOne(byteStream)); out.println("caught expected IOE: " + ioe); Throwable t = ioe.getCause(); assertTrue(t instanceof IllegalArgumentException, "Expected IAE, got:" + t); out.println("expected cause IAE: " + t); A a1 = (A)deserializeOne(byteStream); - assertEquals(a1, null); + assertEquals(null, a1); } // --- @@ -211,7 +212,7 @@ static void assertExpectedIntValue(int expectedValue, byte[] bytes, int offset) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(bytes, offset, 4); DataInputStream dis = new DataInputStream(bais); - assertEquals(dis.readInt(), expectedValue); + assertEquals(expectedValue, dis.readInt()); } static void updateIntValue(int expectedValue, int newValue, byte[] bytes, int offset) diff --git a/test/jdk/java/io/Serializable/records/ThrowingConstructorTest.java b/test/jdk/java/io/Serializable/records/ThrowingConstructorTest.java index feb148f5d5ce..247837bb963c 100644 --- a/test/jdk/java/io/Serializable/records/ThrowingConstructorTest.java +++ b/test/jdk/java/io/Serializable/records/ThrowingConstructorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Tests constructor invocation exceptions are handled appropriately - * @run testng ThrowingConstructorTest - * @run testng/othervm/java.security.policy=empty_security.policy ThrowingConstructorTest + * @run junit ThrowingConstructorTest + * @run junit/othervm/java.security.policy=empty_security.policy ThrowingConstructorTest */ import java.io.ByteArrayInputStream; @@ -36,17 +36,20 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * If the constructor invocation throws an exception, an * `InvalidObjectException` is thrown with that exception as its cause. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ThrowingConstructorTest { /** "big switch" that can be used to allow/disallow record construction @@ -85,7 +88,6 @@ static class C implements Serializable { static final Class IOE = InvalidObjectException.class; - @DataProvider(name = "exceptionInstances") public Object[][] exceptionInstances() { Object[][] objs = new Object[][] { new Object[] { new R1(), NullPointerException.class, "thrown from R1" }, @@ -99,7 +101,8 @@ public Object[][] exceptionInstances() { return objs; } - @Test(dataProvider = "exceptionInstances") + @ParameterizedTest + @MethodSource("exceptionInstances") public void testExceptions(Object objectToSerialize, Class expectedExType, String expectedExMessage) @@ -108,13 +111,13 @@ public void testExceptions(Object objectToSerialize, out.println("\n---"); out.println("serializing: " + objectToSerialize); byte[] bytes = serialize(objectToSerialize); - InvalidObjectException ioe = expectThrows(IOE, () -> deserialize(bytes)); + InvalidObjectException ioe = Assertions.assertThrows(IOE, () -> deserialize(bytes)); out.println("caught expected IOE: " + ioe); Throwable t = ioe.getCause(); assertTrue(t.getClass().equals(expectedExType), "Expected:" + expectedExType + ", got:" + t); out.println("expected cause " + expectedExType +" : " + t); - assertEquals(t.getMessage(), expectedExMessage); + assertEquals(expectedExMessage, t.getMessage()); } // -- errors ( pass through unwrapped ) @@ -144,7 +147,6 @@ public R6(int x, int y) { } } - @DataProvider(name = "errorInstances") public Object[][] errorInstances() { Object[][] objs = new Object[][] { new Object[] { new R4(), OutOfMemoryError.class, "thrown from R4" }, @@ -158,7 +160,8 @@ public Object[][] errorInstances() { return objs; } - @Test(dataProvider = "errorInstances") + @ParameterizedTest + @MethodSource("errorInstances") public void testErrors(Object objectToSerialize, Class expectedExType, String expectedExMessage) @@ -167,11 +170,11 @@ public void testErrors(Object objectToSerialize, out.println("\n---"); out.println("serializing: " + objectToSerialize); byte[] bytes = serialize(objectToSerialize); - Throwable t = expectThrows(expectedExType, () -> deserialize(bytes)); + Throwable t = Assertions.assertThrows(expectedExType, () -> deserialize(bytes)); assertTrue(t.getClass().equals(expectedExType), "Expected:" + expectedExType + ", got:" + t); out.println("caught expected " + expectedExType +" : " + t); - assertEquals(t.getMessage(), expectedExMessage); + assertEquals(expectedExMessage, t.getMessage()); } // --- infra diff --git a/test/jdk/java/io/Serializable/records/UnsharedTest.java b/test/jdk/java/io/Serializable/records/UnsharedTest.java index c96010c83ab9..114e2dc6e10d 100644 --- a/test/jdk/java/io/Serializable/records/UnsharedTest.java +++ b/test/jdk/java/io/Serializable/records/UnsharedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -25,7 +25,7 @@ * @test * @bug 8238763 8246774 * @summary ObjectInputStream readUnshared method handling of Records - * @run testng UnsharedTest + * @run junit UnsharedTest */ import java.io.ByteArrayInputStream; @@ -35,10 +35,11 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; +import org.junit.jupiter.api.Assertions; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; /** * Tests OOS::writeUnshared and OIS::readUnshared to verify that records @@ -56,16 +57,16 @@ public void testReadUnshared() throws Exception { { // shared - sanity to ensure the second foo is a ref var byteStream = serialize(foo, foo); var foo1 = (Foo) deserializeOne(byteStream); - assertEquals(foo1.x, foo.x); + assertEquals(foo.x, foo1.x); var foo2 = (Foo) deserializeOne(byteStream); - assertEquals(foo2.x, foo.x); + assertEquals(foo.x, foo2.x); assertTrue(foo2 == foo1); } { // unshared var byteStream = serialize(foo, foo); var foo1 = (Foo) deserializeOneUnshared(byteStream); - assertEquals(foo1.x, foo.x); - var expected = expectThrows(IOE, () -> deserializeOne(byteStream)); + assertEquals(foo.x, foo1.x); + var expected = Assertions.assertThrows(IOE, () -> deserializeOne(byteStream)); assertTrue(expected.getMessage().contains("cannot read back reference to unshared object")); } } @@ -76,17 +77,17 @@ public void testWriteUnshared() throws Exception { { // shared - sanity to ensure the second foo is NOT a ref var byteStream = serializeUnshared(foo, foo); var foo1 = (Foo) deserializeOne(byteStream); - assertEquals(foo1.x, foo.x); + assertEquals(foo.x, foo1.x); var foo2 = (Foo) deserializeOne(byteStream); - assertEquals(foo2.x, foo.x); + assertEquals(foo.x, foo2.x); assertTrue(foo2 != foo1); } { // unshared var byteStream = serializeUnshared(foo, foo); var foo1 = (Foo) deserializeOneUnshared(byteStream); - assertEquals(foo1.x, foo.x); + assertEquals(foo.x, foo1.x); var foo2 = (Foo) deserializeOneUnshared(byteStream); - assertEquals(foo2.x, foo.x); + assertEquals(foo.x, foo2.x); assertTrue(foo2 != foo1); } } diff --git a/test/jdk/java/io/Serializable/records/WriteReplaceTest.java b/test/jdk/java/io/Serializable/records/WriteReplaceTest.java index 8dda381e6713..1c3990078c21 100644 --- a/test/jdk/java/io/Serializable/records/WriteReplaceTest.java +++ b/test/jdk/java/io/Serializable/records/WriteReplaceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Basic tests for writeReplace - * @run testng WriteReplaceTest - * @run testng/othervm/java.security.policy=empty_security.policy WriteReplaceTest + * @run junit WriteReplaceTest + * @run junit/othervm/java.security.policy=empty_security.policy WriteReplaceTest */ import java.io.ByteArrayInputStream; @@ -35,11 +35,15 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class WriteReplaceTest { record R1 () implements Serializable { @@ -72,7 +76,6 @@ static class Replacement implements Serializable { } } - @DataProvider(name = "recordObjects") public Object[][] recordObjects() { return new Object[][] { new Object[] { new R1(), R1.class }, @@ -82,7 +85,8 @@ public Object[][] recordObjects() { }; } - @Test(dataProvider = "recordObjects") + @ParameterizedTest + @MethodSource("recordObjects") public void testSerialize(Object objectToSerialize, Class expectedType) throws Exception { @@ -91,9 +95,9 @@ public void testSerialize(Object objectToSerialize, Class expectedType) Object deserializedObj = serializeDeserialize(objectToSerialize); out.println("deserialized: " + deserializedObj); if (objectToSerialize.getClass().equals(expectedType)) - assertEquals(deserializedObj, objectToSerialize); + assertEquals(objectToSerialize, deserializedObj); else - assertEquals(deserializedObj.getClass(), expectedType); + assertEquals(expectedType, deserializedObj.getClass()); } // -- null replacement @@ -109,7 +113,7 @@ public void testNull() throws Exception { out.println("serializing : " + objectToSerialize); Object deserializedObj = serializeDeserialize(objectToSerialize); out.println("deserialized: " + deserializedObj); - assertEquals(deserializedObj, null); + assertEquals(null, deserializedObj); } // --- infra diff --git a/test/jdk/java/io/Serializable/records/migration/AbstractTest.java b/test/jdk/java/io/Serializable/records/migration/AbstractTest.java index e0bbc5745005..488f4a33acda 100644 --- a/test/jdk/java/io/Serializable/records/migration/AbstractTest.java +++ b/test/jdk/java/io/Serializable/records/migration/AbstractTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -34,8 +34,9 @@ import java.net.URLClassLoader; import java.nio.file.Path; import jdk.test.lib.compiler.CompilerUtils; -import org.testng.annotations.BeforeTest; -import static org.testng.Assert.*; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.BeforeAll; /** * An abstract superclass for tests that require to serialize and deserialize @@ -54,7 +55,7 @@ public class AbstractTest { static final Path RECORD_SRC_DIR = Path.of(TEST_SRC, "record"); static final Path RECORD_DEST_DIR = Path.of("record"); - @BeforeTest + @BeforeAll public void setup() throws IOException { assertTrue(CompilerUtils.compile(PLAIN_SRC_DIR, PLAIN_DEST_DIR, "--class-path", TEST_CLASSES_DIR.toString())); diff --git a/test/jdk/java/io/Serializable/records/migration/AssignableFromTest.java b/test/jdk/java/io/Serializable/records/migration/AssignableFromTest.java index 6097e2477df2..117a8474c678 100644 --- a/test/jdk/java/io/Serializable/records/migration/AssignableFromTest.java +++ b/test/jdk/java/io/Serializable/records/migration/AssignableFromTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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,24 +29,26 @@ * @modules jdk.compiler * @compile AssignableFrom.java Point.java * DefaultValues.java SuperStreamFields.java - * @run testng AssignableFromTest + * @run junit AssignableFromTest */ import java.math.BigDecimal; import java.math.BigInteger; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Basic test to check that stream field values that are not the exact * declared param/field type, but assignable to a declared supertype, * are bound/assigned correctly. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class AssignableFromTest extends AbstractTest { - @DataProvider(name = "plainInstances") public Object[][] plainInstances() { return new Object[][] { new Object[] { newPlainAssignableFrom(Byte.valueOf((byte)11)) }, @@ -59,7 +61,8 @@ public Object[][] plainInstances() { } /** Serialize non-record (plain) instances, deserialize as a record. */ - @Test(dataProvider = "plainInstances") + @ParameterizedTest + @MethodSource("plainInstances") public void testPlainToRecord(AssignableFrom objToSerialize) throws Exception { assert !objToSerialize.getClass().isRecord(); out.println("serialize : " + objToSerialize); @@ -68,13 +71,12 @@ public void testPlainToRecord(AssignableFrom objToSerialize) throws Exception { assert objDeserialized.getClass().isRecord(); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize.number(), objDeserialized.number()); assertEquals(objDeserialized.number(), objToSerialize.number()); + assertEquals(objToSerialize.number(), objDeserialized.number()); assertEquals(objDeserialized.number().getClass(), objDeserialized.number().getClass()); } - @DataProvider(name = "recordInstances") public Object[][] recordInstances() { return new Object[][] { new Object[] { newRecordAssignableFrom(Byte.valueOf((byte)21)) }, @@ -87,7 +89,8 @@ public Object[][] recordInstances() { } /** Serialize record instances, deserialize as non-record (plain). */ - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void testRecordToPlain(AssignableFrom objToSerialize) throws Exception { assert objToSerialize.getClass().isRecord(); out.println("serialize : " + objToSerialize); @@ -96,8 +99,8 @@ public void testRecordToPlain(AssignableFrom objToSerialize) throws Exception { assert !objDeserialized.getClass().isRecord(); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize.number(), objDeserialized.number()); assertEquals(objDeserialized.number(), objToSerialize.number()); + assertEquals(objToSerialize.number(), objDeserialized.number()); assertEquals(objDeserialized.number().getClass(), objDeserialized.number().getClass()); } diff --git a/test/jdk/java/io/Serializable/records/migration/DefaultValuesTest.java b/test/jdk/java/io/Serializable/records/migration/DefaultValuesTest.java index 4af684156c65..357c94007777 100644 --- a/test/jdk/java/io/Serializable/records/migration/DefaultValuesTest.java +++ b/test/jdk/java/io/Serializable/records/migration/DefaultValuesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -28,21 +28,24 @@ * @library /test/lib * @modules jdk.compiler * @compile AssignableFrom.java Point.java DefaultValues.java SuperStreamFields.java - * @run testng DefaultValuesTest + * @run junit DefaultValuesTest */ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; -import org.testng.annotations.Test; import static java.io.ObjectStreamConstants.*; import static java.lang.System.out; -import static org.testng.Assert.*; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; /** * Basic test to check that default primitive / reference values are * presented to the record's canonical constructor, for fields not in * the stream. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class DefaultValuesTest extends AbstractTest { /** @@ -77,13 +80,13 @@ public void testPoint() throws Exception { Point point = deserializeAsPlain(bytes); out.println("deserialized: " + point); - assertEquals(point.x(), 0); - assertEquals(point.y(), 0); + assertEquals(0, point.x()); + assertEquals(0, point.y()); point = deserializeAsRecord(bytes); out.println("deserialized: " + point); - assertEquals(point.x(), 0); - assertEquals(point.y(), 0); + assertEquals(0, point.x()); + assertEquals(0, point.y()); } // --- @@ -115,8 +118,8 @@ public void testAllDefaults() throws Exception { DefaultValues o1 = deserializeAsRecord(bytes); out.println("deserialized: " + o1); - assertEquals(o1.point().x(), point.x()); // sanity - assertEquals(o1.point().y(), point.y()); // sanity + assertEquals(point.x(), o1.point().x()); // sanity + assertEquals(point.y(), o1.point().y()); // sanity assertTrue(o1.bool() == Defaults.bool); assertTrue(o1.by() == Defaults.by); assertTrue(o1.ch() == Defaults.ch); diff --git a/test/jdk/java/io/Serializable/records/migration/SuperStreamFieldsTest.java b/test/jdk/java/io/Serializable/records/migration/SuperStreamFieldsTest.java index 6090d71003e6..35e75341dbff 100644 --- a/test/jdk/java/io/Serializable/records/migration/SuperStreamFieldsTest.java +++ b/test/jdk/java/io/Serializable/records/migration/SuperStreamFieldsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -28,20 +28,23 @@ * @library /test/lib * @modules jdk.compiler * @compile AssignableFrom.java Point.java DefaultValues.java SuperStreamFields.java - * @run testng SuperStreamFieldsTest + * @run junit SuperStreamFieldsTest */ -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Tests that superclass fields in the stream are discarded. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class SuperStreamFieldsTest extends AbstractTest { - @DataProvider(name = "plainInstances") public Object[][] plainInstances() { return new Object[][] { new Object[] { newPlainSuperStreamFields("cat", new int[] { 1 }, 1) }, @@ -51,7 +54,8 @@ public Object[][] plainInstances() { } /** Serializes non-record (plain) instance, deserializes as a record. */ - @Test(dataProvider = "plainInstances") + @ParameterizedTest + @MethodSource("plainInstances") public void testPlainToRecord(SuperStreamFields objToSerialize) throws Exception { assert !objToSerialize.getClass().isRecord(); out.println("serialize : " + objToSerialize); @@ -60,12 +64,11 @@ public void testPlainToRecord(SuperStreamFields objToSerialize) throws Exception assert objDeserialized.getClass().isRecord(); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize.str(), objDeserialized.str()); - assertEquals(objToSerialize.x(), objDeserialized.x()); - assertEquals(objToSerialize.y(), objDeserialized.y()); + assertEquals(objDeserialized.str(), objToSerialize.str()); + Assertions.assertArrayEquals(objDeserialized.x(), objToSerialize.x()); + assertEquals(objDeserialized.y(), objToSerialize.y()); } - @DataProvider(name = "recordInstances") public Object[][] recordInstances() { return new Object[][] { new Object[] { newRecordSuperStreamFields("goat", new int[] { 56 }, 66) }, @@ -75,7 +78,8 @@ public Object[][] recordInstances() { } /** Serializes record instance, deserializes as non-record (plain). */ - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void testRecordToPlain(SuperStreamFields objToSerialize) throws Exception { assert objToSerialize.getClass().isRecord(); out.println("serialize : " + objToSerialize); @@ -84,9 +88,9 @@ public void testRecordToPlain(SuperStreamFields objToSerialize) throws Exception assert !objDeserialized.getClass().isRecord(); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize.str(), objDeserialized.str()); - assertEquals(objToSerialize.x(), objDeserialized.x()); - assertEquals(objToSerialize.y(), objDeserialized.y()); + assertEquals(objDeserialized.str(), objToSerialize.str()); + Assertions.assertArrayEquals(objDeserialized.x(), objToSerialize.x()); + assertEquals(objDeserialized.y(), objToSerialize.y()); } From 1d4ebde5e38562feed802361ab28f009d27564a2 Mon Sep 17 00:00:00 2001 From: Satyen Subramaniam Date: Mon, 13 Apr 2026 18:35:06 +0000 Subject: [PATCH 172/223] 8354163: Open source Swing tests Batch 1 Backport-of: b78378437cf911a527331e6aaf36f968169c0574 --- .../swing/AbstractButton/bug4133768.java | 162 +++++++++++++++++ .../swing/AbstractButton/bug4391622.java | 142 +++++++++++++++ test/jdk/javax/swing/JList/bug4183379.java | 85 +++++++++ test/jdk/javax/swing/JList/bug4251306.java | 115 ++++++++++++ test/jdk/javax/swing/JMenu/bug4624845.java | 164 ++++++++++++++++++ 5 files changed, 668 insertions(+) create mode 100644 test/jdk/javax/swing/AbstractButton/bug4133768.java create mode 100644 test/jdk/javax/swing/AbstractButton/bug4391622.java create mode 100644 test/jdk/javax/swing/JList/bug4183379.java create mode 100644 test/jdk/javax/swing/JList/bug4251306.java create mode 100644 test/jdk/javax/swing/JMenu/bug4624845.java diff --git a/test/jdk/javax/swing/AbstractButton/bug4133768.java b/test/jdk/javax/swing/AbstractButton/bug4133768.java new file mode 100644 index 000000000000..ad5f56c01498 --- /dev/null +++ b/test/jdk/javax/swing/AbstractButton/bug4133768.java @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2000, 2025, 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 4133768 4363569 + * @summary Tests how button displays its icons + * @key headful + * @run main bug4133768 + */ + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.io.IOException; +import javax.swing.AbstractButton; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JToggleButton; +import javax.swing.SwingUtilities; + +public class bug4133768 { + private static Icon RED, GREEN; + private static JFrame f; + private static AbstractButton[] buttons; + private static volatile Point buttonLocation; + private static volatile int buttonWidth; + private static volatile int buttonHeight; + private static Robot robot; + + public static void main(String[] args) throws Exception { + try { + createTestImages(); + createUI(); + robot = new Robot(); + robot.delay(1000); + for (AbstractButton b : buttons) { + testEnabledButton(b); + } + for (AbstractButton b : buttons) { + b.setEnabled(false); + robot.delay(1000); + testDisabledButton(b); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + private static void createTestImages() throws IOException { + int imageWidth = 32; + int imageHeight = 32; + BufferedImage redImg = new BufferedImage(imageWidth, imageHeight, + BufferedImage.TYPE_INT_RGB); + Graphics2D g = redImg.createGraphics(); + g.setColor(Color.RED); + g.fillRect(0, 0, imageWidth, imageHeight); + g.dispose(); + RED = new ImageIcon(redImg); + BufferedImage greenImg = new BufferedImage(imageWidth, imageHeight, + BufferedImage.TYPE_INT_RGB); + g = greenImg.createGraphics(); + g.setColor(Color.GREEN); + g.fillRect(0, 0, imageWidth, imageHeight); + g.dispose(); + GREEN = new ImageIcon(greenImg); + } + + private static void createUI() throws Exception { + SwingUtilities.invokeAndWait(() -> { + f = new JFrame("ButtonIconsTest"); + buttons = new AbstractButton[] { + new JToggleButton(), + new JRadioButton(), + new JCheckBox() + }; + + JPanel buttonPanel = new JPanel(); + for (int i = 0; i < buttons.length; i++) { + AbstractButton b = buttons[i]; + b.setIcon(RED); + b.setSelected(true); + b.setRolloverSelectedIcon(GREEN); + buttonPanel.add(b); + } + f.setLayout(new GridLayout(2, 1)); + f.add(buttonPanel); + f.pack(); + f.setLocationRelativeTo(null); + f.setAlwaysOnTop(true); + f.setVisible(true); + }); + } + + private static void testEnabledButton(AbstractButton button) throws Exception { + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + buttonLocation = button.getLocationOnScreen(); + buttonWidth = button.getWidth(); + buttonHeight = button.getHeight(); + }); + robot.mouseMove(buttonLocation.x + buttonWidth / 2, + buttonLocation.y + buttonHeight / 2 ); + robot.delay(1000); + Color buttonColor = robot.getPixelColor(buttonLocation.x + + buttonWidth / 2, buttonLocation.y + buttonHeight / 2); + if (!buttonColor.equals(Color.GREEN)) { + throw new RuntimeException("Button roll over color is : " + + buttonColor + " but it should be : " + Color.GREEN); + } + } + + private static void testDisabledButton(AbstractButton button) throws Exception { + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + buttonLocation = button.getLocationOnScreen(); + buttonWidth = button.getWidth(); + buttonHeight = button.getHeight(); + }); + robot.mouseMove(buttonLocation.x + buttonWidth / 2, + buttonLocation.y + buttonHeight / 2 ); + robot.delay(1000); + Color buttonColor = robot.getPixelColor(buttonLocation.x + + buttonWidth / 2, buttonLocation.y + buttonHeight / 2); + if (buttonColor.equals(Color.GREEN) || + buttonColor.equals(Color.RED)) { + throw new RuntimeException("Disabled button color should not be : " + + buttonColor); + } + } +} diff --git a/test/jdk/javax/swing/AbstractButton/bug4391622.java b/test/jdk/javax/swing/AbstractButton/bug4391622.java new file mode 100644 index 000000000000..7d3e8588f175 --- /dev/null +++ b/test/jdk/javax/swing/AbstractButton/bug4391622.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2001, 2025, 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.awt.Color; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.InputEvent; +import java.awt.image.BufferedImage; +import java.io.IOException; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JToolBar; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4391622 + * @summary The toolbar's button which is added as action should ignore text + * @key headful + * @run main bug4391622 + */ + +public class bug4391622 { + private static Icon RED, GREEN; + private static JButton bt; + private static JFrame f; + private static volatile Point buttonLocation; + private static volatile int buttonWidth; + private static volatile int buttonHeight; + + public static void main(String[] args) throws Exception { + try { + createTestImages(); + createUI(); + runTest(); + verifyTest(); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + private static void createTestImages() throws IOException { + int imageWidth = 32; + int imageHeight = 32; + BufferedImage redImg = new BufferedImage(imageWidth, imageHeight, + BufferedImage.TYPE_INT_RGB); + Graphics2D g = redImg.createGraphics(); + g.setColor(Color.RED); + g.fillRect(0, 0, imageWidth, imageHeight); + g.dispose(); + RED = new ImageIcon(redImg); + BufferedImage greenImg = new BufferedImage(imageWidth, imageHeight, + BufferedImage.TYPE_INT_RGB); + g = greenImg.createGraphics(); + g.setColor(Color.GREEN); + g.fillRect(0, 0, imageWidth, imageHeight); + g.dispose(); + GREEN = new ImageIcon(greenImg); + } + + private static void createUI() throws Exception { + SwingUtilities.invokeAndWait(() -> { + f = new JFrame("bug4391622"); + Action changeIt = new ChangeIt(); + + JToolBar toolbar = new JToolBar(); + bt = toolbar.add(changeIt); + f.add(bt); + f.pack(); + f.setLocationRelativeTo(null); + f.setVisible(true); + }); + } + + private static void runTest() throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(500); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + buttonLocation = bt.getLocationOnScreen(); + buttonWidth = bt.getWidth(); + buttonHeight = bt.getHeight(); + }); + robot.mouseMove(buttonLocation.x + buttonWidth / 2, + buttonLocation.y + buttonHeight / 2 ); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + } + + private static void verifyTest() { + if (bt.getText() != null) { + throw new RuntimeException("The toolbar's button shouldn't" + + " have any text."); + } + } + + public static class ChangeIt extends AbstractAction { + private boolean c = true; + + public ChangeIt() { + putValue(Action.NAME, "Red"); + putValue(Action.SMALL_ICON, RED); + } + + public void actionPerformed(ActionEvent event) { + c = !c; + putValue(Action.NAME, c ? "Red" : "Green"); + putValue(Action.SMALL_ICON, c ? RED : GREEN); + } + } +} diff --git a/test/jdk/javax/swing/JList/bug4183379.java b/test/jdk/javax/swing/JList/bug4183379.java new file mode 100644 index 000000000000..784b92a6f16f --- /dev/null +++ b/test/jdk/javax/swing/JList/bug4183379.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2001, 2025, 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 4183379 + * @summary JList has wrong scrolling behavior when you click in the "troth" + * of a scrollbar, in a scrollpane. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4183379 + */ + +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.JScrollPane; + +public class bug4183379 { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Click mouse several times in the "troth" of a scrollbars + in a scrollpane containing a list. + The list should scrolls by one block, i.e.: + + For vertical scrolling: + - if scrolling down the last visible element should become the + first completely visible element + - if scrolling up, the first visible element should become the + last completely visible element + + For horizontal scrolling: + - for scrolling left if the beginning of the first column is not + visible it should become visible, otherwise the beginning of the + previous column should become visible; + - for scrolling right the next colunm after first visible column + should become visible. + """; + PassFailJFrame.builder() + .title("bug4183379 Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(bug4183379::initialize) + .build() + .awaitAndCheck(); + } + + private static JFrame initialize() { + JFrame fr = new JFrame("bug4183379"); + + String[] data = new String[90]; + for (int i=0; i<90; i++) { + data[i] = "item number "+i; + } + + JList lst = new JList(data); + lst.setLayoutOrientation(JList.VERTICAL_WRAP); + lst.setVisibleRowCount(20); + + JScrollPane jsp = new JScrollPane(lst); + fr.add(jsp); + fr.setSize(210,200); + fr.setAlwaysOnTop(true); + return fr; + } +} diff --git a/test/jdk/javax/swing/JList/bug4251306.java b/test/jdk/javax/swing/JList/bug4251306.java new file mode 100644 index 000000000000..ec5309460885 --- /dev/null +++ b/test/jdk/javax/swing/JList/bug4251306.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 1999, 2025, 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 4251306 + * @summary Test that Shift-Space keybinding works properly in JList. + * @key headful + * @run main bug4251306 + */ + +import java.awt.Robot; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.KeyEvent; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.JScrollPane; +import javax.swing.SwingUtilities; + +public class bug4251306 { + private static JFrame f; + private static JList lst; + private static CountDownLatch listGainedFocusLatch; + private static volatile boolean failed; + public static void main(String[] args) throws Exception { + try { + listGainedFocusLatch = new CountDownLatch(1); + createUI(); + runTest(); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + private static void createUI() throws Exception { + SwingUtilities.invokeAndWait(() -> { + f = new JFrame("bug4251306"); + lst = new JList<>(new String[]{"anaheim", "bill", + "chicago", "dingo"}); + lst.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + listGainedFocusLatch.countDown(); + } + }); + JScrollPane sp = new JScrollPane(lst); + f.add(sp); + f.pack(); + f.setLocationRelativeTo(null); + f.setAlwaysOnTop(true); + f.setVisible(true); + }); + } + + private static void runTest() throws Exception { + if (!listGainedFocusLatch.await(3, TimeUnit.SECONDS)) { + throw new RuntimeException("Waited too long, but can't gain focus for list"); + } + Robot robot = new Robot(); + robot.setAutoDelay(500); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_A); + robot.keyRelease(KeyEvent.VK_A); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_SHIFT); + robot.keyPress(KeyEvent.VK_SPACE); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_SPACE); + robot.keyRelease(KeyEvent.VK_SHIFT); + + SwingUtilities.invokeAndWait(() -> { + if (!lst.isSelectedIndex(0) || + !lst.isSelectedIndex(1) || + !lst.isSelectedIndex(2) || + !lst.isSelectedIndex(3)) { + failed = true; + } + }); + if (failed) { + throw new RuntimeException("Required list items are not selected"); + } + } +} diff --git a/test/jdk/javax/swing/JMenu/bug4624845.java b/test/jdk/javax/swing/JMenu/bug4624845.java new file mode 100644 index 000000000000..54524b7a42e7 --- /dev/null +++ b/test/jdk/javax/swing/JMenu/bug4624845.java @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2002, 2025, 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 4624845 + * @requires (os.family == "windows") + * @summary Tests how submenus in WinLAF are painted + * @key headful + * @run main bug4624845 + */ + +import java.awt.Color; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +public class bug4624845 { + private static JFrame f; + private static JMenu menu, subMenu; + private static JMenuItem menuItem; + private static volatile Point menuLocation; + private static volatile Point subMenuLocation; + private static volatile Point menuItemLocation; + private static volatile int menuWidth; + private static volatile int menuHeight; + private static volatile int subMenuWidth; + private static volatile int subMenuHeight; + private static volatile int menuItemWidth; + private static volatile int menuItemHeight; + private static Color menuItemColor; + private static Color subMenuColor; + private static boolean passed; + private final static int OFFSET = 2; + private static final int COLOR_TOLERANCE = 10; + + public static void main(String[] args) throws Exception { + try { + UIManager.setLookAndFeel + ("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + } catch (Exception e) { + throw new RuntimeException("Failed to set Windows LAF"); + } + try { + bug4624845 test = new bug4624845(); + SwingUtilities.invokeAndWait(() -> test.createUI()); + runTest(); + verifyColor(); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + if (!passed) { + throw new RuntimeException("Nested MenuItem color : " + + menuItemColor + " is not similar to sub Menu color : " + + subMenuColor); + } + } + private void createUI() { + f = new JFrame("bug4624845"); + menu = new JMenu("Menu"); + menu.add(new JMenuItem("Item 1")); + + subMenu = new JMenu("Submenu"); + menuItem = new JMenuItem("This"); + subMenu.add(menuItem); + subMenu.add(new JMenuItem("That")); + menu.add(subMenu); + + JMenuBar mBar = new JMenuBar(); + mBar.add(menu); + f.add(mBar); + f.pack(); + f.setLocationRelativeTo(null); + f.setVisible(true); + } + + private static void runTest() throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(200); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + menuLocation = menu.getLocationOnScreen(); + menuWidth = menu.getWidth(); + menuHeight = menu.getHeight(); + }); + robot.mouseMove(menuLocation.x + menuWidth / 2, + menuLocation.y + menuHeight / 2 ); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + subMenuLocation = subMenu.getLocationOnScreen(); + subMenuWidth = subMenu.getWidth(); + subMenuHeight = subMenu.getHeight(); + }); + robot.mouseMove(subMenuLocation.x + subMenuWidth / 2, + subMenuLocation.y + subMenuHeight / 2 ); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + subMenuColor = robot. + getPixelColor(subMenuLocation.x + OFFSET, + subMenuLocation.y + OFFSET); + SwingUtilities.invokeAndWait(() -> { + menuItemLocation = menuItem.getLocationOnScreen(); + menuItemWidth = subMenu.getWidth(); + menuItemHeight = subMenu.getHeight(); + }); + robot.mouseMove(menuItemLocation.x + menuItemWidth / 2, + menuItemLocation.y + menuItemHeight / 2 ); + robot.waitForIdle(); + menuItemColor = robot. + getPixelColor(menuItemLocation.x + OFFSET, + menuItemLocation.y + OFFSET); + } + + private static void verifyColor() { + + int red1 = subMenuColor.getRed(); + int blue1 = subMenuColor.getBlue(); + int green1 = subMenuColor.getGreen(); + + int red2 = menuItemColor.getRed(); + int blue2 = menuItemColor.getBlue(); + int green2 = menuItemColor.getGreen(); + + passed = true; + if ((Math.abs(red1 - red2) > COLOR_TOLERANCE) + || (Math.abs(green1 - green2) > COLOR_TOLERANCE) + || (Math.abs(blue1 - blue2) > COLOR_TOLERANCE)) { + passed = false; + } + } +} From 60d6903be7970c2e036eec245603e5c47747f3ad Mon Sep 17 00:00:00 2001 From: Sergey Nazarkin Date: Tue, 14 Apr 2026 11:48:20 +0000 Subject: [PATCH 173/223] 8330806: test/hotspot/jtreg/compiler/c1/TestLargeMonitorOffset.java fails on ARM32 Backport-of: 0e0dfca21f64ecfcb3e5ed7cdc2a173834faa509 --- src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp index 45786898458b..3bab1d17616e 100644 --- a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp @@ -152,8 +152,14 @@ void LIR_Assembler::osr_entry() { int monitor_offset = (method()->max_locals() + 2 * (number_of_locks - 1)) * BytesPerWord; for (int i = 0; i < number_of_locks; i++) { int slot_offset = monitor_offset - (i * 2 * BytesPerWord); - __ ldr(R1, Address(OSR_buf, slot_offset + 0*BytesPerWord)); - __ ldr(R2, Address(OSR_buf, slot_offset + 1*BytesPerWord)); + if (slot_offset >= 4096 - BytesPerWord) { + __ add_slow(R2, OSR_buf, slot_offset); + __ ldr(R1, Address(R2, 0*BytesPerWord)); + __ ldr(R2, Address(R2, 1*BytesPerWord)); + } else { + __ ldr(R1, Address(OSR_buf, slot_offset + 0*BytesPerWord)); + __ ldr(R2, Address(OSR_buf, slot_offset + 1*BytesPerWord)); + } __ str(R1, frame_map()->address_for_monitor_lock(i)); __ str(R2, frame_map()->address_for_monitor_object(i)); } From 0c02f89b0b2c732e6b4c233456b6aaa5c284b2d4 Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Wed, 15 Apr 2026 09:18:02 +0000 Subject: [PATCH 174/223] 8380947: Add pull request template Backport-of: df09910ec879dc628484588a3137298504fceaf1 --- .github/pull_request_template.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000000..d3f63784ecec --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,5 @@ + + + +--------- +- [ ] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). From e8b6bc92d9a2e196b2dc3a3f0b49ef669a239708 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 15 Apr 2026 10:11:29 +0000 Subject: [PATCH 175/223] 8315588: JShell does not accept underscore from JEP 443 even with --enable-preview Backport-of: 2bf1863e24c8842e3ddbdacda54e412023951983 --- .../jdk/jshell/CompletenessAnalyzer.java | 2 +- test/langtools/jdk/jshell/UnnamedTest.java | 80 ++++++++++++++++++- 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java b/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java index 007f0d4f7351..1579a48786cb 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java @@ -190,7 +190,7 @@ static enum TK { EOF(TokenKind.EOF, 0), // ERROR(TokenKind.ERROR, XERRO), // IDENTIFIER(TokenKind.IDENTIFIER, XEXPR1|XDECL1|XTERM), // - UNDERSCORE(TokenKind.UNDERSCORE, XERRO), // _ + UNDERSCORE(TokenKind.UNDERSCORE, XDECL1), // _ CLASS(TokenKind.CLASS, XEXPR|XDECL1|XBRACESNEEDED), // class decl (MAPPED: DOTCLASS) MONKEYS_AT(TokenKind.MONKEYS_AT, XEXPR|XDECL1), // @ IMPORT(TokenKind.IMPORT, XDECL1|XSTART), // import -- consider declaration diff --git a/test/langtools/jdk/jshell/UnnamedTest.java b/test/langtools/jdk/jshell/UnnamedTest.java index 87ce6f68cadd..9c7bb6ba5a23 100644 --- a/test/langtools/jdk/jshell/UnnamedTest.java +++ b/test/langtools/jdk/jshell/UnnamedTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 9999999 + * @bug 8315851 8315588 * @summary Tests for unnamed variables * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api @@ -34,12 +34,17 @@ */ import java.util.function.Consumer; + +import jdk.jshell.SourceCodeAnalysis; import jdk.jshell.VarSnippet; import org.testng.Assert; import org.testng.annotations.Test; import jdk.jshell.JShell; +import static jdk.jshell.SourceCodeAnalysis.Completeness.COMPLETE; +import static jdk.jshell.SourceCodeAnalysis.Completeness.DEFINITELY_INCOMPLETE; + public class UnnamedTest extends KullaTesting { @Test @@ -50,6 +55,79 @@ public void unnamed() { Assert.assertEquals(getState().varValue(sn2), "\"x\""); } + static final String[] definitely_incomplete = new String[]{ + "int _ = ", + "int m(String v, int r) {\n" + + " try {\n" + + " return Integer.parseInt(v, r);\n" + + " } catch (NumberFormatException _) {", + "try (final Lock _ = ", + "try (Lock _ = null) {\n" + + " try (Lock _ = null) {", + "for (var _ : strs", + "TwoParams p1 = (_, _) ->", + "for (int _ = 0, _ = 1, x = 1;", + "if (r instanceof R(_" + }; + + static final String[] complete = new String[]{ + "int _ = 42;", + "int m(String v, int r) {\n" + + " try {\n" + + " return Integer.parseInt(v, r);\n" + + " } catch (NumberFormatException _) { } }", + "try (final Lock _ = TEST) {}", + "try (Lock _ = null) {\n" + + " try (Lock _ = null) { } }", + "for (var _ : strs) { }", + "TwoParams p1 = (_, _) -> {};", + "for (int _ = 0, _ = 1, x = 1; x <= 1 ; x++) {}", + "if (r instanceof R(_)) { }" + }; + + private void assertStatus(String input, SourceCodeAnalysis.Completeness status, String source) { + String augSrc; + switch (status) { + case COMPLETE_WITH_SEMI: + augSrc = source + ";"; + break; + + case DEFINITELY_INCOMPLETE: + augSrc = null; + break; + + case CONSIDERED_INCOMPLETE: + augSrc = source + ";"; + break; + + case EMPTY: + case COMPLETE: + case UNKNOWN: + augSrc = source; + break; + + default: + throw new AssertionError(); + } + assertAnalyze(input, status, augSrc); + } + + private void assertStatus(String[] ins, SourceCodeAnalysis.Completeness status) { + for (String input : ins) { + assertStatus(input, status, input); + } + } + + @Test + public void test_definitely_incomplete() { + assertStatus(definitely_incomplete, DEFINITELY_INCOMPLETE); + } + + @Test + public void test_definitely_complete() { + assertStatus(complete, COMPLETE); + } + @Override public void setUp(Consumer bc) { super.setUp(bc.andThen(b -> b.compilerOptions("--enable-preview", "--source", System.getProperty("java.specification.version")))); From 56260f1d516044aec6176bce5b4ddba10a14c18e Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 15 Apr 2026 10:16:33 +0000 Subject: [PATCH 176/223] 8322532: JShell : Unnamed variable issue Backport-of: f0cfd361bd6a98dc1192dab2116fdd3904f130f8 --- .../share/classes/jdk/jshell/CompletenessAnalyzer.java | 2 +- test/langtools/jdk/jshell/VariablesTest.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java b/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java index 1579a48786cb..663ca164a3de 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java @@ -190,7 +190,7 @@ static enum TK { EOF(TokenKind.EOF, 0), // ERROR(TokenKind.ERROR, XERRO), // IDENTIFIER(TokenKind.IDENTIFIER, XEXPR1|XDECL1|XTERM), // - UNDERSCORE(TokenKind.UNDERSCORE, XDECL1), // _ + UNDERSCORE(TokenKind.UNDERSCORE, XDECL1|XEXPR), // _ CLASS(TokenKind.CLASS, XEXPR|XDECL1|XBRACESNEEDED), // class decl (MAPPED: DOTCLASS) MONKEYS_AT(TokenKind.MONKEYS_AT, XEXPR|XDECL1), // @ IMPORT(TokenKind.IMPORT, XDECL1|XSTART), // import -- consider declaration diff --git a/test/langtools/jdk/jshell/VariablesTest.java b/test/langtools/jdk/jshell/VariablesTest.java index 51ccbd17d604..56546955e082 100644 --- a/test/langtools/jdk/jshell/VariablesTest.java +++ b/test/langtools/jdk/jshell/VariablesTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8144903 8177466 8191842 8211694 8213725 8239536 8257236 8252409 8294431 + * @bug 8144903 8177466 8191842 8211694 8213725 8239536 8257236 8252409 8294431 8322532 * @summary Tests for EvaluationState.variables * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api @@ -621,4 +621,10 @@ public void varAnonymousClassAndStaticField() { //JDK-8294431 assertEval("var obj = new Object() { public static final String msg = \"hello\"; };"); } + public void underscoreAsLambdaParameter() { //JDK-8322532 + assertAnalyze("Func f = _ -> 0; int i;", + "Func f = _ -> 0;", + " int i;", true); + } + } From a537fe5225e98cde0cd88b1df77742ac519ce3e6 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 15 Apr 2026 10:19:03 +0000 Subject: [PATCH 177/223] 8329273: C2 SuperWord: Some basic MemorySegment IR tests Reviewed-by: mdoerr Backport-of: c4867c62c44b48e48845608fe4b29b58749767ad --- .../loopopts/superword/TestMemorySegment.java | 820 ++++++++++++++++++ 1 file changed, 820 insertions(+) create mode 100644 test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java new file mode 100644 index 000000000000..391b6a1b1585 --- /dev/null +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java @@ -0,0 +1,820 @@ +/* + * 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. + */ + +package compiler.loopopts.superword; + +import compiler.lib.ir_framework.*; +import jdk.test.lib.Utils; +import java.nio.ByteBuffer; +import java.util.Map; +import java.util.HashMap; +import java.util.Random; +import java.lang.foreign.*; + +/* + * @test id=byte-array + * @bug 8329273 + * @summary Test vectorization of loops over MemorySegment + * @library /test/lib / + * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java + * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment ByteArray + */ + +/* + * @test id=char-array + * @bug 8329273 + * @summary Test vectorization of loops over MemorySegment + * @library /test/lib / + * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java + * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment CharArray + */ + +/* + * @test id=short-array + * @bug 8329273 + * @summary Test vectorization of loops over MemorySegment + * @library /test/lib / + * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java + * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment ShortArray + */ + +/* + * @test id=int-array + * @bug 8329273 + * @summary Test vectorization of loops over MemorySegment + * @library /test/lib / + * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java + * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment IntArray + */ + +/* + * @test id=long-array + * @bug 8329273 + * @summary Test vectorization of loops over MemorySegment + * @library /test/lib / + * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java + * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment LongArray + */ + +/* + * @test id=float-array + * @bug 8329273 + * @summary Test vectorization of loops over MemorySegment + * @library /test/lib / + * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java + * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment FloatArray + */ + +/* + * @test id=double-array + * @bug 8329273 + * @summary Test vectorization of loops over MemorySegment + * @library /test/lib / + * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java + * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment DoubleArray + */ + +/* + * @test id=byte-buffer + * @bug 8329273 + * @summary Test vectorization of loops over MemorySegment + * @library /test/lib / + * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java + * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment ByteBuffer + */ + +/* + * @test id=byte-buffer-direct + * @bug 8329273 + * @summary Test vectorization of loops over MemorySegment + * @library /test/lib / + * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java + * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment ByteBufferDirect + */ + +/* + * @test id=native + * @bug 8329273 + * @summary Test vectorization of loops over MemorySegment + * @library /test/lib / + * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java + * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment Native + */ + +// FAILS: mixed providers currently do not vectorize. Maybe there is some inlining issue. +// /* +// * @test id=mixed-array +// * @bug 8329273 +// * @summary Test vectorization of loops over MemorySegment +// * @library /test/lib / +// * @run driver compiler.loopopts.superword.TestMemorySegment MixedArray +// */ +// +// /* +// * @test id=MixedBuffer +// * @bug 8329273 +// * @summary Test vectorization of loops over MemorySegment +// * @library /test/lib / +// * @run driver compiler.loopopts.superword.TestMemorySegment MixedBuffer +// */ +// +// /* +// * @test id=mixed +// * @bug 8329273 +// * @summary Test vectorization of loops over MemorySegment +// * @library /test/lib / +// * @run driver compiler.loopopts.superword.TestMemorySegment Mixed +// */ + +public class TestMemorySegment { + public static void main(String[] args) { + TestFramework framework = new TestFramework(TestMemorySegmentImpl.class); + framework.addFlags("--enable-preview", "-DmemorySegmentProviderNameForTestVM=" + args[0]); + framework.setDefaultWarmup(100); + framework.start(); + } +} + +class TestMemorySegmentImpl { + static final int BACKING_SIZE = 1024 * 8; + static final Random RANDOM = Utils.getRandomInstance(); + + + interface TestFunction { + Object[] run(); + } + + interface MemorySegmentProvider { + MemorySegment newMemorySegment(); + } + + static MemorySegmentProvider provider; + + static { + String providerName = System.getProperty("memorySegmentProviderNameForTestVM"); + provider = switch (providerName) { + case "ByteArray" -> TestMemorySegmentImpl::newMemorySegmentOfByteArray; + case "CharArray" -> TestMemorySegmentImpl::newMemorySegmentOfCharArray; + case "ShortArray" -> TestMemorySegmentImpl::newMemorySegmentOfShortArray; + case "IntArray" -> TestMemorySegmentImpl::newMemorySegmentOfIntArray; + case "LongArray" -> TestMemorySegmentImpl::newMemorySegmentOfLongArray; + case "FloatArray" -> TestMemorySegmentImpl::newMemorySegmentOfFloatArray; + case "DoubleArray" -> TestMemorySegmentImpl::newMemorySegmentOfDoubleArray; + case "ByteBuffer" -> TestMemorySegmentImpl::newMemorySegmentOfByteBuffer; + case "ByteBufferDirect" -> TestMemorySegmentImpl::newMemorySegmentOfByteBufferDirect; + case "Native" -> TestMemorySegmentImpl::newMemorySegmentOfNative; + case "MixedArray" -> TestMemorySegmentImpl::newMemorySegmentOfMixedArray; + case "MixedBuffer" -> TestMemorySegmentImpl::newMemorySegmentOfMixedBuffer; + case "Mixed" -> TestMemorySegmentImpl::newMemorySegmentOfMixed; + default -> throw new RuntimeException("Test argument not recognized: " + providerName); + }; + } + + // List of tests + Map tests = new HashMap<>(); + + // List of gold, the results from the first run before compilation + Map golds = new HashMap<>(); + + public TestMemorySegmentImpl () { + // Generate two MemorySegments as inputs + MemorySegment a = newMemorySegment(); + MemorySegment b = newMemorySegment(); + fillRandom(a); + fillRandom(b); + + // Add all tests to list + tests.put("testMemorySegmentBadExitCheck", () -> testMemorySegmentBadExitCheck(copy(a))); + tests.put("testIntLoop_iv_byte", () -> testIntLoop_iv_byte(copy(a))); + tests.put("testIntLoop_longIndex_intInvar_sameAdr_byte", () -> testIntLoop_longIndex_intInvar_sameAdr_byte(copy(a), 0)); + tests.put("testIntLoop_longIndex_longInvar_sameAdr_byte", () -> testIntLoop_longIndex_longInvar_sameAdr_byte(copy(a), 0)); + tests.put("testIntLoop_longIndex_intInvar_byte", () -> testIntLoop_longIndex_intInvar_byte(copy(a), 0)); + tests.put("testIntLoop_longIndex_longInvar_byte", () -> testIntLoop_longIndex_longInvar_byte(copy(a), 0)); + tests.put("testIntLoop_intIndex_intInvar_byte", () -> testIntLoop_intIndex_intInvar_byte(copy(a), 0)); + tests.put("testIntLoop_iv_int", () -> testIntLoop_iv_int(copy(a))); + tests.put("testIntLoop_longIndex_intInvar_sameAdr_int", () -> testIntLoop_longIndex_intInvar_sameAdr_int(copy(a), 0)); + tests.put("testIntLoop_longIndex_longInvar_sameAdr_int", () -> testIntLoop_longIndex_longInvar_sameAdr_int(copy(a), 0)); + tests.put("testIntLoop_longIndex_intInvar_int", () -> testIntLoop_longIndex_intInvar_int(copy(a), 0)); + tests.put("testIntLoop_longIndex_longInvar_int", () -> testIntLoop_longIndex_longInvar_int(copy(a), 0)); + tests.put("testIntLoop_intIndex_intInvar_int", () -> testIntLoop_intIndex_intInvar_int(copy(a), 0)); + tests.put("testLongLoop_iv_byte", () -> testLongLoop_iv_byte(copy(a))); + tests.put("testLongLoop_longIndex_intInvar_sameAdr_byte", () -> testLongLoop_longIndex_intInvar_sameAdr_byte(copy(a), 0)); + tests.put("testLongLoop_longIndex_longInvar_sameAdr_byte", () -> testLongLoop_longIndex_longInvar_sameAdr_byte(copy(a), 0)); + tests.put("testLongLoop_longIndex_intInvar_byte", () -> testLongLoop_longIndex_intInvar_byte(copy(a), 0)); + tests.put("testLongLoop_longIndex_longInvar_byte", () -> testLongLoop_longIndex_longInvar_byte(copy(a), 0)); + tests.put("testLongLoop_intIndex_intInvar_byte", () -> testLongLoop_intIndex_intInvar_byte(copy(a), 0)); + tests.put("testLongLoop_iv_int", () -> testLongLoop_iv_int(copy(a))); + tests.put("testLongLoop_longIndex_intInvar_sameAdr_int", () -> testLongLoop_longIndex_intInvar_sameAdr_int(copy(a), 0)); + tests.put("testLongLoop_longIndex_longInvar_sameAdr_int", () -> testLongLoop_longIndex_longInvar_sameAdr_int(copy(a), 0)); + tests.put("testLongLoop_longIndex_intInvar_int", () -> testLongLoop_longIndex_intInvar_int(copy(a), 0)); + tests.put("testLongLoop_longIndex_longInvar_int", () -> testLongLoop_longIndex_longInvar_int(copy(a), 0)); + tests.put("testLongLoop_intIndex_intInvar_int", () -> testLongLoop_intIndex_intInvar_int(copy(a), 0)); + + // Compute gold value for all test methods before compilation + for (Map.Entry entry : tests.entrySet()) { + String name = entry.getKey(); + TestFunction test = entry.getValue(); + Object[] gold = test.run(); + golds.put(name, gold); + } + } + + MemorySegment newMemorySegment() { + return provider.newMemorySegment(); + } + + MemorySegment copy(MemorySegment src) { + MemorySegment dst = newMemorySegment(); + MemorySegment.copy(src, 0, dst, 0, src.byteSize()); + return dst; + } + + static MemorySegment newMemorySegmentOfByteArray() { + return MemorySegment.ofArray(new byte[BACKING_SIZE]); + } + + static MemorySegment newMemorySegmentOfCharArray() { + return MemorySegment.ofArray(new char[BACKING_SIZE / 2]); + } + + static MemorySegment newMemorySegmentOfShortArray() { + return MemorySegment.ofArray(new short[BACKING_SIZE / 2]); + } + + static MemorySegment newMemorySegmentOfIntArray() { + return MemorySegment.ofArray(new int[BACKING_SIZE / 4]); + } + + static MemorySegment newMemorySegmentOfLongArray() { + return MemorySegment.ofArray(new long[BACKING_SIZE / 8]); + } + + static MemorySegment newMemorySegmentOfFloatArray() { + return MemorySegment.ofArray(new float[BACKING_SIZE / 4]); + } + + static MemorySegment newMemorySegmentOfDoubleArray() { + return MemorySegment.ofArray(new double[BACKING_SIZE / 8]); + } + + static MemorySegment newMemorySegmentOfByteBuffer() { + return MemorySegment.ofBuffer(ByteBuffer.allocate(BACKING_SIZE)); + } + + static MemorySegment newMemorySegmentOfByteBufferDirect() { + return MemorySegment.ofBuffer(ByteBuffer.allocateDirect(BACKING_SIZE)); + } + + static MemorySegment newMemorySegmentOfNative() { + // Auto arena: GC decides when there is no reference to the MemorySegment, + // and then it deallocates the backing memory. + return Arena.ofAuto().allocate(BACKING_SIZE, 1); + } + + static MemorySegment newMemorySegmentOfMixedArray() { + switch(RANDOM.nextInt(7)) { + case 0 -> { return newMemorySegmentOfByteArray(); } + case 1 -> { return newMemorySegmentOfCharArray(); } + case 2 -> { return newMemorySegmentOfShortArray(); } + case 3 -> { return newMemorySegmentOfIntArray(); } + case 4 -> { return newMemorySegmentOfLongArray(); } + case 5 -> { return newMemorySegmentOfFloatArray(); } + default -> { return newMemorySegmentOfDoubleArray(); } + } + } + + static MemorySegment newMemorySegmentOfMixedBuffer() { + switch (RANDOM.nextInt(2)) { + case 0 -> { return newMemorySegmentOfByteBuffer(); } + default -> { return newMemorySegmentOfByteBufferDirect(); } + } + } + + static MemorySegment newMemorySegmentOfMixed() { + switch (RANDOM.nextInt(3)) { + case 0 -> { return newMemorySegmentOfMixedArray(); } + case 1 -> { return newMemorySegmentOfMixedBuffer(); } + default -> { return newMemorySegmentOfNative(); } + } + } + + static void fillRandom(MemorySegment data) { + for (int i = 0; i < (int)data.byteSize(); i += 8) { + data.set(ValueLayout.JAVA_LONG_UNALIGNED, i, RANDOM.nextLong()); + } + } + + + static void verify(String name, Object[] gold, Object[] result) { + if (gold.length != result.length) { + throw new RuntimeException("verify " + name + ": not the same number of outputs: gold.length = " + + gold.length + ", result.length = " + result.length); + } + for (int i = 0; i < gold.length; i++) { + Object g = gold[i]; + Object r = result[i]; + if (g == r) { + throw new RuntimeException("verify " + name + ": should be two separate objects (with identical content):" + + " gold[" + i + "] == result[" + i + "]"); + } + + if (!(g instanceof MemorySegment && r instanceof MemorySegment)) { + throw new RuntimeException("verify " + name + ": only MemorySegment supported, i=" + i); + } + + MemorySegment mg = (MemorySegment)g; + MemorySegment mr = (MemorySegment)r; + + if (mg.byteSize() != mr.byteSize()) { + throw new RuntimeException("verify " + name + ": MemorySegment must have same byteSize:" + + " gold[" + i + "].byteSize = " + mg.byteSize() + + " result[" + i + "].byteSize = " + mr.byteSize()); + } + + for (int j = 0; j < (int)mg.byteSize(); j++) { + byte vg = mg.get(ValueLayout.JAVA_BYTE, j); + byte vr = mr.get(ValueLayout.JAVA_BYTE, j); + if (vg != vr) { + throw new RuntimeException("verify " + name + ": MemorySegment must have same content:" + + " gold[" + i + "][" + j + "] = " + vg + + " result[" + i + "][" + j + "] = " + vr); + } + } + } + } + + @Run(test = {"testMemorySegmentBadExitCheck", + "testIntLoop_iv_byte", + "testIntLoop_longIndex_intInvar_sameAdr_byte", + "testIntLoop_longIndex_longInvar_sameAdr_byte", + "testIntLoop_longIndex_intInvar_byte", + "testIntLoop_longIndex_longInvar_byte", + "testIntLoop_intIndex_intInvar_byte", + "testIntLoop_iv_int", + "testIntLoop_longIndex_intInvar_sameAdr_int", + "testIntLoop_longIndex_longInvar_sameAdr_int", + "testIntLoop_longIndex_intInvar_int", + "testIntLoop_longIndex_longInvar_int", + "testIntLoop_intIndex_intInvar_int", + "testLongLoop_iv_byte", + "testLongLoop_longIndex_intInvar_sameAdr_byte", + "testLongLoop_longIndex_longInvar_sameAdr_byte", + "testLongLoop_longIndex_intInvar_byte", + "testLongLoop_longIndex_longInvar_byte", + "testLongLoop_intIndex_intInvar_byte", + "testLongLoop_iv_int", + "testLongLoop_longIndex_intInvar_sameAdr_int", + "testLongLoop_longIndex_longInvar_sameAdr_int", + "testLongLoop_longIndex_intInvar_int", + "testLongLoop_longIndex_longInvar_int", + "testLongLoop_intIndex_intInvar_int"}) + void runTests() { + for (Map.Entry entry : tests.entrySet()) { + String name = entry.getKey(); + TestFunction test = entry.getValue(); + // Recall gold value from before compilation + Object[] gold = golds.get(name); + // Compute new result + Object[] result = test.run(); + // Compare gold and new result + verify(name, gold, result); + } + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0", + IRNode.ADD_VB, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS + // Exit check: iv < long_limit -> (long)iv < long_limit + // Thus, we have an int-iv, but a long-exit-check. + // Is not properly recognized by either CountedLoop or LongCountedLoop + static Object[] testMemorySegmentBadExitCheck(MemorySegment a) { + for (int i = 0; i < a.byteSize(); i++) { + long adr = i; + byte v = a.get(ValueLayout.JAVA_BYTE, adr); + a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0", + IRNode.ADD_VB, "> 0", + IRNode.STORE_VECTOR, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + static Object[] testIntLoop_iv_byte(MemorySegment a) { + for (int i = 0; i < (int)a.byteSize(); i++) { + long adr = i; + byte v = a.get(ValueLayout.JAVA_BYTE, adr); + a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0", + IRNode.ADD_VB, "> 0", + IRNode.STORE_VECTOR, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + static Object[] testIntLoop_longIndex_intInvar_sameAdr_byte(MemorySegment a, int invar) { + for (int i = 0; i < (int)a.byteSize(); i++) { + long adr = (long)(i) + (long)(invar); + byte v = a.get(ValueLayout.JAVA_BYTE, adr); + a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0", + IRNode.ADD_VB, "> 0", + IRNode.STORE_VECTOR, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + static Object[] testIntLoop_longIndex_longInvar_sameAdr_byte(MemorySegment a, long invar) { + for (int i = 0; i < (int)a.byteSize(); i++) { + long adr = (long)(i) + (long)(invar); + byte v = a.get(ValueLayout.JAVA_BYTE, adr); + a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0", + IRNode.ADD_VB, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: invariants are sorted differently, because of differently inserted Cast. + // See: JDK-8330274 + static Object[] testIntLoop_longIndex_intInvar_byte(MemorySegment a, int invar) { + for (int i = 0; i < (int)a.byteSize(); i++) { + long adr1 = (long)(i) + (long)(invar); + byte v = a.get(ValueLayout.JAVA_BYTE, adr1); + long adr2 = (long)(i) + (long)(invar); + a.set(ValueLayout.JAVA_BYTE, adr2, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0", + IRNode.ADD_VB, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: invariants are sorted differently, because of differently inserted Cast. + // See: JDK-8330274 + static Object[] testIntLoop_longIndex_longInvar_byte(MemorySegment a, long invar) { + for (int i = 0; i < (int)a.byteSize(); i++) { + long adr1 = (long)(i) + (long)(invar); + byte v = a.get(ValueLayout.JAVA_BYTE, adr1); + long adr2 = (long)(i) + (long)(invar); + a.set(ValueLayout.JAVA_BYTE, adr2, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0", + IRNode.ADD_VB, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: RangeCheck cannot be eliminated because of int_index + static Object[] testIntLoop_intIndex_intInvar_byte(MemorySegment a, int invar) { + for (int i = 0; i < (int)a.byteSize(); i++) { + int int_index = i + invar; + byte v = a.get(ValueLayout.JAVA_BYTE, int_index); + a.set(ValueLayout.JAVA_BYTE, int_index, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0", + IRNode.ADD_VI, "> 0", + IRNode.STORE_VECTOR, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIf = {"AlignVector", "false"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + static Object[] testIntLoop_iv_int(MemorySegment a) { + for (int i = 0; i < (int)a.byteSize()/4; i++ ) { + long adr = 4L * i; + int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr); + a.set(ValueLayout.JAVA_INT_UNALIGNED, adr, (int)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0", + IRNode.ADD_VI, "> 0", + IRNode.STORE_VECTOR, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIf = {"AlignVector", "false"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + static Object[] testIntLoop_longIndex_intInvar_sameAdr_int(MemorySegment a, int invar) { + for (int i = 0; i < (int)a.byteSize()/4; i++) { + long adr = 4L * (long)(i) + 4L * (long)(invar); + int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr); + a.set(ValueLayout.JAVA_INT_UNALIGNED, adr, (int)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0", + IRNode.ADD_VI, "> 0", + IRNode.STORE_VECTOR, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIf = {"AlignVector", "false"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + static Object[] testIntLoop_longIndex_longInvar_sameAdr_int(MemorySegment a, long invar) { + for (int i = 0; i < (int)a.byteSize()/4; i++) { + long adr = 4L * (long)(i) + 4L * (long)(invar); + int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr); + a.set(ValueLayout.JAVA_INT_UNALIGNED, adr, (int)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_I, "= 0", + IRNode.ADD_VI, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: invariants are sorted differently, because of differently inserted Cast. + // See: JDK-8330274 + static Object[] testIntLoop_longIndex_intInvar_int(MemorySegment a, int invar) { + for (int i = 0; i < (int)a.byteSize()/4; i++) { + long adr1 = 4L * (long)(i) + 4L * (long)(invar); + int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr1); + long adr2 = 4L * (long)(i) + 4L * (long)(invar); + a.set(ValueLayout.JAVA_INT_UNALIGNED, adr2, (int)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_I, "= 0", + IRNode.ADD_VI, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: invariants are sorted differently, because of differently inserted Cast. + // See: JDK-8330274 + static Object[] testIntLoop_longIndex_longInvar_int(MemorySegment a, long invar) { + for (int i = 0; i < (int)a.byteSize()/4; i++) { + long adr1 = 4L * (long)(i) + 4L * (long)(invar); + int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr1); + long adr2 = 4L * (long)(i) + 4L * (long)(invar); + a.set(ValueLayout.JAVA_INT_UNALIGNED, adr2, (int)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_I, "= 0", + IRNode.ADD_VI, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: RangeCheck cannot be eliminated because of int_index + static Object[] testIntLoop_intIndex_intInvar_int(MemorySegment a, int invar) { + for (int i = 0; i < (int)a.byteSize()/4; i++) { + int int_index = i + invar; + int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, 4L * int_index); + a.set(ValueLayout.JAVA_INT_UNALIGNED, 4L * int_index, (int)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0", + IRNode.ADD_VB, "> 0", + IRNode.STORE_VECTOR, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + static Object[] testLongLoop_iv_byte(MemorySegment a) { + for (long i = 0; i < a.byteSize(); i++) { + long adr = i; + byte v = a.get(ValueLayout.JAVA_BYTE, adr); + a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0", + IRNode.ADD_VB, "> 0", + IRNode.STORE_VECTOR, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + static Object[] testLongLoop_longIndex_intInvar_sameAdr_byte(MemorySegment a, int invar) { + for (long i = 0; i < a.byteSize(); i++) { + long adr = (long)(i) + (long)(invar); + byte v = a.get(ValueLayout.JAVA_BYTE, adr); + a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0", + IRNode.ADD_VB, "> 0", + IRNode.STORE_VECTOR, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + static Object[] testLongLoop_longIndex_longInvar_sameAdr_byte(MemorySegment a, long invar) { + for (long i = 0; i < a.byteSize(); i++) { + long adr = (long)(i) + (long)(invar); + byte v = a.get(ValueLayout.JAVA_BYTE, adr); + a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0", + IRNode.ADD_VB, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: invariants are sorted differently, because of differently inserted Cast. + // See: JDK-8330274 + static Object[] testLongLoop_longIndex_intInvar_byte(MemorySegment a, int invar) { + for (long i = 0; i < a.byteSize(); i++) { + long adr1 = (long)(i) + (long)(invar); + byte v = a.get(ValueLayout.JAVA_BYTE, adr1); + long adr2 = (long)(i) + (long)(invar); + a.set(ValueLayout.JAVA_BYTE, adr2, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0", + IRNode.ADD_VB, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: invariants are sorted differently, because of differently inserted Cast. + // See: JDK-8330274 + static Object[] testLongLoop_longIndex_longInvar_byte(MemorySegment a, long invar) { + for (long i = 0; i < a.byteSize(); i++) { + long adr1 = (long)(i) + (long)(invar); + byte v = a.get(ValueLayout.JAVA_BYTE, adr1); + long adr2 = (long)(i) + (long)(invar); + a.set(ValueLayout.JAVA_BYTE, adr2, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0", + IRNode.ADD_VB, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: RangeCheck cannot be eliminated because of int_index + static Object[] testLongLoop_intIndex_intInvar_byte(MemorySegment a, int invar) { + for (long i = 0; i < a.byteSize(); i++) { + int int_index = (int)(i + invar); + byte v = a.get(ValueLayout.JAVA_BYTE, int_index); + a.set(ValueLayout.JAVA_BYTE, int_index, (byte)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0", + IRNode.ADD_VI, "> 0", + IRNode.STORE_VECTOR, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIf = {"AlignVector", "false"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + static Object[] testLongLoop_iv_int(MemorySegment a) { + for (long i = 0; i < a.byteSize()/4; i++ ) { + long adr = 4L * i; + int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr); + a.set(ValueLayout.JAVA_INT_UNALIGNED, adr, (int)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + //@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0", + // IRNode.ADD_VI, "> 0", + // IRNode.STORE_VECTOR, "> 0"}, + // applyIfPlatform = {"64-bit", "true"}, + // applyIf = {"AlignVector", "false"}, + // applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: for native memory. I think it is because of invariants, but need investigation. + // The long -> int loop conversion introduces extra invariants. + static Object[] testLongLoop_longIndex_intInvar_sameAdr_int(MemorySegment a, int invar) { + for (long i = 0; i < a.byteSize()/4; i++) { + long adr = 4L * (long)(i) + 4L * (long)(invar); + int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr); + a.set(ValueLayout.JAVA_INT_UNALIGNED, adr, (int)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + //@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0", + // IRNode.ADD_VI, "> 0", + // IRNode.STORE_VECTOR, "> 0"}, + // applyIfPlatform = {"64-bit", "true"}, + // applyIf = {"AlignVector", "false"}, + // applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: for native memory. I think it is because of invariants, but need investigation. + // The long -> int loop conversion introduces extra invariants. + static Object[] testLongLoop_longIndex_longInvar_sameAdr_int(MemorySegment a, long invar) { + for (long i = 0; i < a.byteSize()/4; i++) { + long adr = 4L * (long)(i) + 4L * (long)(invar); + int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr); + a.set(ValueLayout.JAVA_INT_UNALIGNED, adr, (int)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_I, "= 0", + IRNode.ADD_VI, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: invariants are sorted differently, because of differently inserted Cast. + // See: JDK-8330274 + static Object[] testLongLoop_longIndex_intInvar_int(MemorySegment a, int invar) { + for (long i = 0; i < a.byteSize()/4; i++) { + long adr1 = 4L * (long)(i) + 4L * (long)(invar); + int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr1); + long adr2 = 4L * (long)(i) + 4L * (long)(invar); + a.set(ValueLayout.JAVA_INT_UNALIGNED, adr2, (int)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_I, "= 0", + IRNode.ADD_VI, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: invariants are sorted differently, because of differently inserted Cast. + // See: JDK-8330274 + static Object[] testLongLoop_longIndex_longInvar_int(MemorySegment a, long invar) { + for (long i = 0; i < a.byteSize()/4; i++) { + long adr1 = 4L * (long)(i) + 4L * (long)(invar); + int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr1); + long adr2 = 4L * (long)(i) + 4L * (long)(invar); + a.set(ValueLayout.JAVA_INT_UNALIGNED, adr2, (int)(v + 1)); + } + return new Object[]{ a }; + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_I, "= 0", + IRNode.ADD_VI, "= 0", + IRNode.STORE_VECTOR, "= 0"}, + applyIfPlatform = {"64-bit", "true"}, + applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) + // FAILS: RangeCheck cannot be eliminated because of int_index + static Object[] testLongLoop_intIndex_intInvar_int(MemorySegment a, int invar) { + for (long i = 0; i < a.byteSize()/4; i++) { + int int_index = (int)(i + invar); + int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, 4L * int_index); + a.set(ValueLayout.JAVA_INT_UNALIGNED, 4L * int_index, (int)(v + 1)); + } + return new Object[]{ a }; + } +} From e2d8b620ac4c4c465ebc941e7ca64ba123dc4c75 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Wed, 15 Apr 2026 13:05:46 +0000 Subject: [PATCH 178/223] 8352877: Opensource Several Font related tests - Batch 1 Backport-of: b539fb0bc14869164f5f2c9780f2a40db707cc55 --- test/jdk/java/awt/font/TestDevanagari.java | 101 +++++++++++ .../awt/font/TextLayout/TestControls.java | 161 ++++++++++++++++++ .../font/TextLayout/TestGraphicOutline.java | 155 +++++++++++++++++ 3 files changed, 417 insertions(+) create mode 100644 test/jdk/java/awt/font/TestDevanagari.java create mode 100644 test/jdk/java/awt/font/TextLayout/TestControls.java create mode 100644 test/jdk/java/awt/font/TextLayout/TestGraphicOutline.java diff --git a/test/jdk/java/awt/font/TestDevanagari.java b/test/jdk/java/awt/font/TestDevanagari.java new file mode 100644 index 000000000000..f4424b32b6b9 --- /dev/null +++ b/test/jdk/java/awt/font/TestDevanagari.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2004, 2025, 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.awt.Font; +import java.awt.GraphicsEnvironment; + +import javax.swing.JFrame; +import javax.swing.JTextArea; + +/* + * @test + * @bug 5014727 + * @summary Display Devanagari text and make sure the character + * that appears after the nukta (dot) isn't duplicated. + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame jtreg.SkippedException + * @run main/manual TestDevanagari + */ + +public class TestDevanagari { + + private static final String text = """ + Ra Nukta Ra + \u0930\u093c\u0930"""; + private static final Font font = getPhysicalFontForText(text, Font.PLAIN, 20); + + public static void main(String[] args) throws Exception { + if (font == null) { + throw new jtreg.SkippedException("No Devanagari font found. Test Skipped."); + } + + final String INSTRUCTIONS = """ + You should see two Devanagari Letters 'Ra': + The first with Nukta sign (dot under it), the second without. + The second character (after the Nukta sign) shouldn't be visible twice + + Pass the test if this is true. + """; + + PassFailJFrame.builder() + .title("TestDevanagari Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(TestDevanagari::createUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createUI() { + JFrame frame = new JFrame("TestDevanagari UI"); + JTextArea textArea = new JTextArea(); + textArea.setFont(font); + textArea.setText(text); + + frame.add(textArea); + frame.setSize(300, 200); + return frame; + } + + private static Font getPhysicalFontForText(String text, int style, int size) { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + String[] names = ge.getAvailableFontFamilyNames(); + + for (String n : names) { + switch (n.toLowerCase()) { + case "dialog": + case "dialoginput": + case "serif": + case "sansserif": + case "monospaced": + break; + default: + Font f = new Font(n, style, size); + if (f.canDisplayUpTo(text) == -1) { + return f; + } + } + } + return null; + } +} diff --git a/test/jdk/java/awt/font/TextLayout/TestControls.java b/test/jdk/java/awt/font/TextLayout/TestControls.java new file mode 100644 index 000000000000..ee15038a8459 --- /dev/null +++ b/test/jdk/java/awt/font/TextLayout/TestControls.java @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2001, 2025, 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.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Panel; +import java.awt.ScrollPane; +import java.awt.font.FontRenderContext; +import java.awt.font.TextLayout; + +/* + * @test + * @bug 4517298 + * @summary Display special control characters using both TextLayout.draw and + * Graphics.drawString. In no case should a missing glyph appear. + * Also display the advance of the control characters, in all cases + * these should be 0. The space character is also displayed as a reference. + * Note, the character is rendered between '><' but owing to the directional + * properties of two of the characters, the second '<' is rendered as '>'. + * This is correct behavior. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestControls + */ + +public class TestControls { + private static String fontName = Font.DIALOG; + + public static void main(String[] args) throws Exception { + final String INSTRUCTIONS = """ + A number of control characters are displayed, one per line. + Each line displays the hex value of the character, the character + between '><' as rendered by TextLayout, the character between '><' + as rendered by drawString, and the advance of the character. + The first line renders the space character, as a reference. + The following lines all render the controls. + All controls should not render (even as space) and report a zero advance. + + Pass the test if this is true. + + Note: two of the control characters have the effect of changing the '<' + following the control character so that it renders as '>'. + This is not an error."""; + + PassFailJFrame.builder() + .title("TestControls Instruction") + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(TestControls::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame f = new Frame("TestControls Test UI"); + Panel panel = new ControlPanel(fontName); + ScrollPane sp = new ScrollPane(); + sp.add("Center", panel); + f.add(sp); + f.setSize(450, 400); + return f; + } + + static class ControlPanel extends Panel { + + static final char[] chars = { + (char)0x0020, (char)0x0009, + (char)0x000A, (char)0x000D, (char)0x200C, (char)0x200D, (char)0x200E, + (char)0x200F, (char)0x2028, (char)0x2029, (char)0x202A, (char)0x202B, + (char)0x202C, (char)0x202D, (char)0x202E, (char)0x206A, (char)0x206B, + (char)0x206C, (char)0x206D, (char)0x206E, (char)0x206F + }; + + ControlPanel(String fontName) { + Font font = new Font(fontName, Font.PLAIN, 24); + System.out.println("using font: " + font); + setFont(font); + setForeground(Color.BLACK); + setBackground(Color.WHITE); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(400, 750); + } + + @Override + public Dimension getMaximumSize() { + return getPreferredSize(); + } + + @Override + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D)g; + FontRenderContext frc = g2d.getFontRenderContext(); + Font font = g2d.getFont(); + FontMetrics fm = g2d.getFontMetrics(); + Insets insets = getInsets(); + + String jvmString = System.getProperty("java.version"); + String osString = System.getProperty("os.name") + " / " + + System.getProperty("os.arch") + " / " + + System.getProperty("os.version"); + + int x = insets.left + 10; + int y = insets.top; + + y += 30; + g2d.drawString("jvm: " + jvmString, x, y); + + y += 30; + g2d.drawString("os: " + osString, x, y); + + y += 30; + g2d.drawString("font: " + font.getFontName(), x, y); + + for (int i = 0; i < chars.length; ++i) { + String s = ">" + chars[i] + "<"; + x = insets.left + 10; + y += 30; + + g2d.drawString(Integer.toHexString(chars[i]), x, y); + x += 100; + + new TextLayout(s, font, frc).draw(g2d, x, y); + x += 100; + + g2d.drawString(s, x, y); + x += 100; + + g2d.drawString(Integer.toString(fm.charWidth(chars[i])), x, y); + } + } + } +} diff --git a/test/jdk/java/awt/font/TextLayout/TestGraphicOutline.java b/test/jdk/java/awt/font/TextLayout/TestGraphicOutline.java new file mode 100644 index 000000000000..42efd4185f4c --- /dev/null +++ b/test/jdk/java/awt/font/TextLayout/TestGraphicOutline.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2003, 2025, 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.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Shape; +import java.awt.font.FontRenderContext; +import java.awt.font.GraphicAttribute; +import java.awt.font.ShapeGraphicAttribute; +import java.awt.font.TextAttribute; +import java.awt.font.TextLayout; +import java.awt.geom.Ellipse2D; +import java.awt.geom.Rectangle2D; +import java.text.AttributedCharacterIterator; +import java.text.AttributedString; + +import javax.swing.JPanel; + +/* + * @test + * @bug 4915565 4920820 4920952 + * @summary Display graphics (circles) embedded in text, and draw both the outline (top) + * and black box bounds (bottom) of the result. The circles should each display at a + * different height. The outline and frames should approximately (within a pixel + * or two) surround each character. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestGraphicOutline + */ + +public class TestGraphicOutline { + + public static void main(String[] args) throws Exception { + final String INSTRUCTIONS = """ + Display graphics (circles) embedded in text, and draw both the + outline (top) and black box bounds (bottom) of the result. + + The circles should each display at a different height. + The outline and frames should approximately (within a pixel or two) + surround each character. + + Pass the test if these conditions hold. + + 'Black box bounds' is a term that refers to the bounding rectangles + of each glyph, see the TextLayout API getBlackBoxBounds. It does not + mean that the rendered outlines in the test are supposed to be black. + The color of the outlines does not matter and is not part of the test + conditions. Since there is no API for embedded graphics to return an + outline that matches the shape of the graphics, the outlines of the + graphics are their visual bounding boxes, which are rectangles. + + This is not an error. These outlines, as stated, should surround each + character's graphic."""; + + PassFailJFrame.builder() + .title("TestGraphicOutline Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(TestGraphicsPanel::new) + .build() + .awaitAndCheck(); + } + + private static final class TestGraphicsPanel extends JPanel { + + TextLayout tl; + + public TestGraphicsPanel() { + setBackground(Color.white); + setPreferredSize(new Dimension(650, 300)); + setName("2D Text"); + } + + @Override + public void paint(Graphics g) { + Graphics2D g2 = (Graphics2D) g; + int w = getSize().width; + int h = getSize().height; + + g2.setColor(getBackground()); + g2.fillRect(0, 0, w, h); + + Font f1 = new Font(Font.SANS_SERIF, Font.BOLD, 60); + Font f2 = new Font(Font.SERIF, Font.ITALIC, 80); + String str = "The Starry Night ok?"; + + AttributedString ats = new AttributedString(str); + + Shape s = new Ellipse2D.Float(0, -10, 12, 12); + GraphicAttribute iga1 = new ShapeGraphicAttribute(s, GraphicAttribute.TOP_ALIGNMENT, false); + GraphicAttribute iga2 = new ShapeGraphicAttribute(s, GraphicAttribute.HANGING_BASELINE, false); + GraphicAttribute iga3 = new ShapeGraphicAttribute(s, GraphicAttribute.CENTER_BASELINE, false); + GraphicAttribute iga4 = new ShapeGraphicAttribute(s, GraphicAttribute.ROMAN_BASELINE, false); + GraphicAttribute iga5 = new ShapeGraphicAttribute(s, GraphicAttribute.BOTTOM_ALIGNMENT, false); + + ats.addAttribute(TextAttribute.CHAR_REPLACEMENT, iga1, 1, 2); + ats.addAttribute(TextAttribute.CHAR_REPLACEMENT, iga2, 3, 4); + ats.addAttribute(TextAttribute.CHAR_REPLACEMENT, iga3, 7, 8); + ats.addAttribute(TextAttribute.CHAR_REPLACEMENT, iga4, 10, 11); + ats.addAttribute(TextAttribute.CHAR_REPLACEMENT, iga5, 14, 15); + ats.addAttribute(TextAttribute.FONT, f1, 0, 20); + ats.addAttribute(TextAttribute.FONT, f2, 4, 10); + AttributedCharacterIterator iter = ats.getIterator(); + + FontRenderContext frc = g2.getFontRenderContext(); + tl = new TextLayout(iter, frc); + Rectangle2D bounds = tl.getBounds(); + float sw = (float) bounds.getWidth(); + float sh = (float) bounds.getHeight(); + + g2.translate((w - sw) / 2f, h / 2f - sh + tl.getAscent() - 2); + + g2.setColor(Color.blue); + tl.draw(g2, 0, 0); + g2.draw(bounds); + + g2.setColor(Color.black); + Shape shape = tl.getOutline(null); + g2.draw(shape); + + g2.translate(0, sh + 5); + + g2.setColor(Color.blue); + tl.draw(g2, 0, 0); + g2.draw(bounds); + + g2.setColor(Color.red); + shape = tl.getBlackBoxBounds(0, tl.getCharacterCount()); + g2.draw(shape); + } + } +} From 34e4fa2202734b0945e0ed5e5db9c09c48eb4ba1 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Wed, 15 Apr 2026 13:06:14 +0000 Subject: [PATCH 179/223] 8340851: Open some TextArea awt tests Backport-of: 40a44e1c1b83a0a4edf48fa4d2aafa70e223e2fa --- .../TextArea/TextAreaAppendScrollTest.java | 98 ++++++++++++++++ .../java/awt/TextArea/TextAreaCursorTest.java | 86 ++++++++++++++ .../java/awt/TextArea/TextAreaKeypadTest.java | 62 ++++++++++ .../awt/TextArea/TextAreaSelectionTest.java | 111 ++++++++++++++++++ 4 files changed, 357 insertions(+) create mode 100644 test/jdk/java/awt/TextArea/TextAreaAppendScrollTest.java create mode 100644 test/jdk/java/awt/TextArea/TextAreaCursorTest.java create mode 100644 test/jdk/java/awt/TextArea/TextAreaKeypadTest.java create mode 100644 test/jdk/java/awt/TextArea/TextAreaSelectionTest.java diff --git a/test/jdk/java/awt/TextArea/TextAreaAppendScrollTest.java b/test/jdk/java/awt/TextArea/TextAreaAppendScrollTest.java new file mode 100644 index 000000000000..f506f54f6f14 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaAppendScrollTest.java @@ -0,0 +1,98 @@ +/* + * 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 + * 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.awt.Button; +import java.awt.Frame; +import java.awt.TextArea; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 5003402 + * @summary TextArea must scroll automatically when calling append and select, even when not in focus + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaAppendScrollTest + */ + +public class TextAreaAppendScrollTest extends Frame implements ActionListener { + int phase; + int pos1, pos2; + TextArea area; + private static final String INSTRUCTIONS = """ + Press "Click Here" button. + The word "First" should be visible in the TextArea. + + Press "Click Here" button again. + The word "Next" should be visible in the TextArea. + + Press "Click Here" button again. + The word "Last" should be visible in the TextArea. + If you have seen all three words, press Pass, else press Fail. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaAppendScrollTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(TextAreaAppendScrollTest::new) + .build() + .awaitAndCheck(); + } + + public TextAreaAppendScrollTest() { + area = new TextArea(); + add("Center", area); + Button bt1 = new Button("Click Here"); + add("South", bt1); + String filler = ""; + for (int i = 0; i < 100; i++) { + filler = filler + i + "\n"; + } + String text = filler; + pos1 = text.length(); + text = text + "First\n" + filler; + pos2 = text.length(); + text = text + "Next\n" + filler; + area.setText(text); + phase = 0; + bt1.addActionListener(this); + pack(); + } + + public void actionPerformed(ActionEvent ev) { + if (phase == 0) { + area.select(pos1, pos1); + phase = 1; + } else if (phase == 1) { + area.select(pos2, pos2); + phase = 2; + } else { + area.append("Last\n"); + phase = 0; + } + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaCursorTest.java b/test/jdk/java/awt/TextArea/TextAreaCursorTest.java new file mode 100644 index 000000000000..ec342e38a155 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaCursorTest.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 1997, 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.awt.BorderLayout; +import java.awt.Button; +import java.awt.Cursor; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.TextArea; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4060320 + * @summary Test TextArea cursor shape on its scrollbars + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaCursorTest + */ + +public class TextAreaCursorTest { + private static final String INSTRUCTIONS = """ + Move the cursor into textarea and on scrollbar. Verify that the shape of + cursor on scrollbar should not be I-beam. Also, when the cursor in textarea + is set to some other shape, it does not affect the cursor shape on the + scrollbars. + """; + + public static void main(String args[]) throws Exception { + PassFailJFrame.builder() + .title("TextAreaCursorTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(TextAreaCursorTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI () { + Frame f = new Frame("TextAreaCursorTest"); + BorderLayout layout = new BorderLayout(); + f.setLayout(layout); + + TextArea ta = new TextArea("A test to make sure that cursor \n" + + "on scrollbars has the correct shape\n\n" + + "Press button to change the textarea\n" + + "cursor to Hand_Cursor\n" + + "Make sure that the cursor on scrollbars\n" + + "remains the same", 10, 30); + + Button bu = new Button("Change Cursor"); + + f.add(ta, BorderLayout.NORTH); + f.add(bu, BorderLayout.SOUTH); + bu.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Cursor curs1 = new Cursor(Cursor.HAND_CURSOR); + ta.setCursor(curs1); + } + }); + f.pack(); + return f; + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaKeypadTest.java b/test/jdk/java/awt/TextArea/TextAreaKeypadTest.java new file mode 100644 index 000000000000..24fabdd01ab8 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaKeypadTest.java @@ -0,0 +1,62 @@ +/* + * 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 + * 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.awt.BorderLayout; +import java.awt.Frame; +import java.awt.TextArea; + +/* + * @test + * @bug 6240876 + * @summary Number pad up & down arrows don't work in XToolkit TextArea + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaKeypadTest + */ + +public class TextAreaKeypadTest { + private static final String INSTRUCTIONS = """ + Press pass if you can move the caret in the textarea with _number pad_ UP/DOWN keys. + Press fail if you don't. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaKeypadTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(TextAreaKeypadTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame frame = new Frame("TextAreaKeypadTest"); + frame.setLayout(new BorderLayout()); + TextArea area = new TextArea("One\nTwo\nThree", 3, 3, TextArea.SCROLLBARS_NONE); + frame.add("Center", area); + frame.pack(); + return frame; + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaSelectionTest.java b/test/jdk/java/awt/TextArea/TextAreaSelectionTest.java new file mode 100644 index 000000000000..ed6ccb34fa25 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaSelectionTest.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 1997, 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.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.TextArea; +import java.awt.TextField; + +/* + * @test + * @bug 4095946 + * @summary 592677:TEXTFIELD TAB SELECTION CONFUSING; REMOVE ES_NOHIDESEL STYLE IN + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaSelectionTest + */ + +public class TextAreaSelectionTest { + private static final String INSTRUCTIONS = """ + Please look at the 'TextAreaSelectionTest' frame. + + If you see that the all TextFields and TextAreas have + the highlighted selections, the test FAILED. Else, if + you see that the text of the focused component is + highlighted, it is ok. + + Try to traverse the focus through all components by + pressing CTRL+TAB. If the focused component highlights + its selection, the test is passed for a while. + + Please select the entire/part of the text of some component + by mouse and choose some menu item. If the highlighted + selection is hidden, the test FAILED. + + Please select the entire/part of the text of some component + by mouse and click right mouse button. A context menu + should appear. Please check its items. + Press ESC to hide the context menu. If the selection + of the text component is not visible, the test FAILED. + + Please double click on the word 'DoubleClickMe' in the + first text area. If there are several words selected, the + test FAILED, if the word 'DoubleClickMe' is selected only, + the test PASSED! + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaSelectionTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(TextAreaSelectionTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame f = new Frame("TextAreaSelectionTest"); + f.setLayout(new FlowLayout()); + + MenuBar mb = new MenuBar(); + String name = "Submenu"; + Menu m = new Menu(name, false); + m.add(new MenuItem(name + " item 1")); + m.add(new MenuItem(name + " item 2")); + m.add(new MenuItem(name + " item 3")); + mb.add(m); + + TextField tf1, tf2; + TextArea ta1, ta2; + f.setMenuBar(mb); + f.add(tf1 = new TextField("some text")); + f.add(tf2 = new TextField("more text")); + String eoln = System.getProperty("line.separator", "\n"); + f.add(ta1 = new TextArea("some text" + eoln + eoln + "DoubleClickMe")); + f.add(ta2 = new TextArea("more text")); + + tf1.selectAll(); + tf2.selectAll(); + ta1.selectAll(); + ta2.selectAll(); + + f.pack(); + return f; + } + +} From 475749d63e68965603ed194104e1270eef92380a Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Wed, 15 Apr 2026 13:06:36 +0000 Subject: [PATCH 180/223] 8339879: Open some dialog awt tests Backport-of: 60713463c7014e4e15da73023e82ef58d7134b48 --- test/jdk/java/awt/Dialog/DefaultIconTest.java | 71 ++++ .../awt/Dialog/DialogInitialResizability.java | 96 ++++++ .../jdk/java/awt/Dialog/NestedDialogTest.java | 312 ++++++++++++++++++ .../ShownModalDialogSerializationTest.java | 92 ++++++ 4 files changed, 571 insertions(+) create mode 100644 test/jdk/java/awt/Dialog/DefaultIconTest.java create mode 100644 test/jdk/java/awt/Dialog/DialogInitialResizability.java create mode 100644 test/jdk/java/awt/Dialog/NestedDialogTest.java create mode 100644 test/jdk/java/awt/Dialog/ShownModalDialogSerializationTest.java diff --git a/test/jdk/java/awt/Dialog/DefaultIconTest.java b/test/jdk/java/awt/Dialog/DefaultIconTest.java new file mode 100644 index 000000000000..8d2ec8c406f0 --- /dev/null +++ b/test/jdk/java/awt/Dialog/DefaultIconTest.java @@ -0,0 +1,71 @@ +/* + * 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 + * 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.awt.Dialog; +import java.awt.Frame; + +/* + * @test + * @bug 4964237 + * @requires (os.family == "windows") + * @summary Win: Changing theme changes java dialogs title icon + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DefaultIconTest + */ + +public class DefaultIconTest { + static String instructions = """ + This test shows frame and two dialogs + Change windows theme. Resizable dialog should retain default icon + Non-resizable dialog should retain no icon + Press PASS if icons look correct, FAIL otherwise + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ShownModalDialogSerializationTest Instructions") + .instructions(instructions) + .testTimeOut(5) + .rows(10) + .columns(35) + .testUI(DefaultIconTest::createGUIs) + .build() + .awaitAndCheck(); + } + + public static Frame createGUIs() { + Frame f = new Frame("DefaultIconTest"); + f.setSize(200, 100); + Dialog d1 = new Dialog(f, "Resizable Dialog, should show default icon"); + d1.setSize(200, 100); + d1.setVisible(true); + d1.setLocation(0, 150); + Dialog d2 = new Dialog(f, "Non-resizable dialog, should have no icon"); + d2.setSize(200, 100); + d2.setVisible(true); + d2.setResizable(false); + d2.setLocation(0, 300); + return f; + } +} diff --git a/test/jdk/java/awt/Dialog/DialogInitialResizability.java b/test/jdk/java/awt/Dialog/DialogInitialResizability.java new file mode 100644 index 000000000000..7ecde39c4add --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogInitialResizability.java @@ -0,0 +1,96 @@ +/* + * 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 + * 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.awt.Dialog; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; + +/* + * @test + * @bug 4912551 + * @summary Checks that with resizable set to false before show() + * dialog can not be resized. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DialogInitialResizability + */ + +public class DialogInitialResizability { + static String instructions = """ + When this test is run a dialog will display (setResizable Test). + This dialog should not be resizable. + + Additionally ensure that there are NO componentResized events in the log section. + If the above conditions are true, then Press PASS else FAIL. + """; + + private static final Dimension INITIAL_SIZE = new Dimension(400, 150); + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("DialogInitialResizability") + .instructions(instructions) + .testTimeOut(5) + .rows((int) instructions.lines().count() + 2) + .columns(40) + .testUI(DialogInitialResizability::createGUI) + .logArea() + .build() + .awaitAndCheck(); + } + + public static MyDialog createGUI() { + Frame f = new Frame("invisible dialog owner"); + + MyDialog ld = new MyDialog(f); + ld.setBounds(100, 100, INITIAL_SIZE.width, INITIAL_SIZE.height); + ld.setResizable(false); + + PassFailJFrame.log("Dialog isResizable is set to: " + ld.isResizable()); + PassFailJFrame.log("Dialog Initial Size " + ld.getSize()); + return ld; + } + + private static class MyDialog extends Dialog implements ComponentListener { + public MyDialog(Frame f) { + super(f, "setResizable test", false); + this.addComponentListener(this); + } + + public void componentResized(ComponentEvent e) { + if (!e.getComponent().getSize().equals(INITIAL_SIZE)) { + PassFailJFrame.log("Component Resized. Test Failed!!"); + } + } + + public void componentMoved(ComponentEvent e) { + } + + public void componentShown(ComponentEvent e) { + } + + public void componentHidden(ComponentEvent e) { + } + } +} diff --git a/test/jdk/java/awt/Dialog/NestedDialogTest.java b/test/jdk/java/awt/Dialog/NestedDialogTest.java new file mode 100644 index 000000000000..28fb1bc919e6 --- /dev/null +++ b/test/jdk/java/awt/Dialog/NestedDialogTest.java @@ -0,0 +1,312 @@ +/* + * Copyright (c) 1998, 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.awt.Button; +import java.awt.Choice; +import java.awt.Dialog; +import java.awt.FileDialog; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.List; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Vector; +import java.util.Enumeration; + +/* + * @test + * @bug 4110094 4178930 4178390 + * @summary Test: Rewrite of Win modal dialogs + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual NestedDialogTest + */ + +public class NestedDialogTest { + private static Vector windows = new Vector(); + static String instructions = """ + To solve various race conditions, windows modal dialogs were rewritten. This + test exercises various modal dialog boundary conditions and checks that + previous fixes to modality are incorporated in the rewrite. + + Check the following: + - No IllegalMonitorStateException is thrown when a dialog closes + + - Open multiple nested dialogs and verify that all other windows + are disabled when modal dialog is active. + + - Check that the proper window is activated when a modal dialog closes. + + - Close nested dialogs out of order (e.g. close dialog1 before dialog2) + and verify that this works and no deadlock occurs. + + - Check that all other windows are disabled when a FileDialog is open. + + - Check that the proper window is activated when a FileDialog closes. + + - Verify that the active window nevers switches to another application + when closing dialogs, even temporarily. + + - Check that choosing Hide always sucessfully hides a dialog. You should + try this multiple times to catch any race conditions. + + - Check that the scrollbar on the Choice component in the dialog works, as opposed + to just using drag-scrolling or the cursor keys + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("NestedDialogTest") + .instructions(instructions) + .testTimeOut(5) + .rows((int) instructions.lines().count() + 2) + .columns(35) + .testUI(NestedDialogTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame frame1 = new NestedDialogTestFrame("frame0"); + Frame frame2 = new NestedDialogTestFrame("frame1"); + frame2.setLocation(100, 100); + return frame1; + } + + public static void addWindow(Window window) { + // System.out.println("Pushing window " + window); + windows.removeElement(window); + windows.addElement(window); + } + + public static void removeWindow(Window window) { + // System.out.println("Popping window " + window); + windows.removeElement(window); + } + + public static Window getWindow(int index) { + return (Window) windows.elementAt(index); + } + + public static Enumeration enumWindows() { + return windows.elements(); + } + + public static int getWindowIndex(Window win) { + return windows.indexOf(win); + } +} + +class NestedDialogTestFrame extends Frame { + NestedDialogTestFrame(String name) { + super(name); + setSize(200, 200); + show(); + + setLayout(new FlowLayout()); + Button btnDlg = new Button("Dialog..."); + add(btnDlg); + Button btnFileDlg = new Button("FileDialog..."); + add(btnFileDlg); + + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent ev) { + System.exit(0); + } + }); + + btnDlg.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + Dialog d1 = new SimpleDialog(NestedDialogTestFrame.this, null, true); + System.out.println("Returned from showing dialog: " + d1); + } + } + ); + + btnFileDlg.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + FileDialog dlg = new FileDialog(NestedDialogTestFrame.this); + dlg.show(); + } + } + ); + + validate(); + } + + public void show() { + if (!isVisible()) { + NestedDialogTest.addWindow(this); + } + super.show(); + } + + public void dispose() { + NestedDialogTest.removeWindow(this); + super.dispose(); + } +} + +class SimpleDialog extends Dialog { + Button btnNested; + Button btnFileDlg; + Button btnShow; + Button btnHide; + Button btnDispose; + Button btnExit; + List listWins; + Dialog dlgPrev; + + public SimpleDialog(Frame frame, Dialog prev, boolean isModal) { + super(frame, "", isModal); + + dlgPrev = prev; + + addWindowListener(new WindowAdapter() { + public void windowActivated(WindowEvent ev) { + populateListWin(); + } + }); + + setTitle(getName()); + + Panel panelNorth = new Panel(); + panelNorth.setLayout(new GridLayout(1, 1)); + listWins = new List(); + panelNorth.add(listWins); + + Panel panelSouth = new Panel(); + panelSouth.setLayout(new FlowLayout()); + btnNested = new Button("Dialog..."); + panelSouth.add(btnNested); + btnFileDlg = new Button("FileDialog..."); + panelSouth.add(btnFileDlg); + btnShow = new Button("Show"); + panelSouth.add(btnShow); + btnHide = new Button("Hide"); + panelSouth.add(btnHide); + btnDispose = new Button("Dispose"); + panelSouth.add(btnDispose); + + Choice cbox = new Choice(); + cbox.add("Test1"); + cbox.add("Test2"); + cbox.add("Test3"); + cbox.add("Test4"); + cbox.add("Test5"); + cbox.add("Test6"); + cbox.add("Test7"); + cbox.add("Test8"); + cbox.add("Test9"); + cbox.add("Test10"); + cbox.add("Test11"); + panelSouth.add(cbox); + + validate(); + + add("Center", panelNorth); + add("South", panelSouth); + + btnNested.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Dialog dlg = new SimpleDialog((Frame) getParent(), SimpleDialog.this, true); + System.out.println("Returned from showing dialog: " + dlg); + } + }); + + btnFileDlg.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + FileDialog dlg = new FileDialog((Frame) getParent()); + dlg.show(); + } + }); + + btnHide.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Window wnd = getSelectedWindow(); + System.out.println(wnd); + wnd.hide(); + } + }); + + btnShow.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + getSelectedWindow().show(); + } + }); + + btnDispose.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + getSelectedWindow().dispose(); + populateListWin(); + } + }); + + pack(); + setSize(getSize().width, getSize().height * 2); + if (dlgPrev != null) { + Point pt = dlgPrev.getLocation(); + setLocation(pt.x + 30, pt.y + 50); + } + show(); + } + + private Window getSelectedWindow() { + Window window; + int index = listWins.getSelectedIndex(); + + window = NestedDialogTest.getWindow(index); + return window; + } + + private void populateListWin() { + Enumeration enumWindows = NestedDialogTest.enumWindows(); + + listWins.removeAll(); + while (enumWindows.hasMoreElements()) { + Window win = (Window) enumWindows.nextElement(); + listWins.add(win.getName()); + } + listWins.select(NestedDialogTest.getWindowIndex(this)); + } + + public void show() { + if (!isVisible()) { + NestedDialogTest.addWindow(this); + } + super.show(); + } + + public void dispose() { + NestedDialogTest.removeWindow(this); + super.dispose(); + } +} diff --git a/test/jdk/java/awt/Dialog/ShownModalDialogSerializationTest.java b/test/jdk/java/awt/Dialog/ShownModalDialogSerializationTest.java new file mode 100644 index 000000000000..b57dd2cf8f23 --- /dev/null +++ b/test/jdk/java/awt/Dialog/ShownModalDialogSerializationTest.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2002, 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.awt.Dialog; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Label; + +import java.awt.TextArea; +import java.io.File; +import java.io.FileOutputStream; +import java.io.ObjectOutputStream; + +/* + * @test + * @bug 4739757 + * @summary REGRESSION: Modal Dialog is not serializable after showing + * @key headful + * @run main ShownModalDialogSerializationTest + */ + +public class ShownModalDialogSerializationTest { + static volatile Frame frame; + static volatile Frame outputFrame; + static volatile Dialog dialog; + + public static void main(String[] args) throws Exception { + + EventQueue.invokeLater(ShownModalDialogSerializationTest::createTestUI); + + while (dialog == null || !dialog.isShowing()) { + Thread.sleep(500); + } + File file = new File("dialog.ser"); + FileOutputStream fos = new FileOutputStream(file); + ObjectOutputStream oos = new ObjectOutputStream(fos); + oos.writeObject(dialog); + oos.flush(); + file.delete(); + + EventQueue.invokeAndWait(ShownModalDialogSerializationTest::deleteTestUI); + } + + static void deleteTestUI() { + if (dialog != null) { + dialog.setVisible(false); + dialog.dispose(); + } + if (frame != null) { + frame.setVisible(false); + frame.dispose(); + } + if (outputFrame != null) { + outputFrame.setVisible(false); + outputFrame.dispose(); + } + } + + private static void createTestUI() { + outputFrame = new Frame("ShownModalDialogSerializationTest"); + TextArea output = new TextArea(40, 50); + outputFrame.add(output); + + frame = new Frame("invisible dialog owner"); + dialog = new Dialog(frame, "Dialog for Close", true); + dialog.add(new Label("Close This Dialog")); + outputFrame.setSize(200, 200); + outputFrame.setVisible(true); + dialog.pack(); + dialog.setVisible(true); + } +} From 65e68833e74cd365518e888ac857455bab873c76 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Wed, 15 Apr 2026 13:08:59 +0000 Subject: [PATCH 181/223] 8339975: Open some dialog awt tests 2 Backport-of: 12551ae64a7d09d1ea76d4f48f181962402020fb --- .../java/awt/Dialog/DialogDisposeLeak.java | 200 ++++++++++++++++++ test/jdk/java/awt/Dialog/FileDialogTest.java | 189 +++++++++++++++++ test/jdk/java/awt/Dialog/TaskbarIconTest.java | 145 +++++++++++++ .../jdk/java/awt/Dialog/WindowInputBlock.java | 134 ++++++++++++ 4 files changed, 668 insertions(+) create mode 100644 test/jdk/java/awt/Dialog/DialogDisposeLeak.java create mode 100644 test/jdk/java/awt/Dialog/FileDialogTest.java create mode 100644 test/jdk/java/awt/Dialog/TaskbarIconTest.java create mode 100644 test/jdk/java/awt/Dialog/WindowInputBlock.java diff --git a/test/jdk/java/awt/Dialog/DialogDisposeLeak.java b/test/jdk/java/awt/Dialog/DialogDisposeLeak.java new file mode 100644 index 000000000000..9d581519de36 --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogDisposeLeak.java @@ -0,0 +1,200 @@ +/* + * Copyright (c) 1998, 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.awt.AWTEvent; +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Label; +import java.awt.Toolkit; +import java.awt.event.MouseEvent; +import java.awt.event.FocusEvent; +import java.awt.event.MouseAdapter; + +/* + * @test + * @bug 4193022 + * @summary Test for bug(s): 4193022, disposing dialog leaks memory + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DialogDisposeLeak + */ + +public class DialogDisposeLeak { + private static final String INSTRUCTIONS = """ + Click on the Dialog... button in the frame that appears. + Now dismiss the dialog by clicking on the label in the dialog. + + Repeat this around 10 times. At some point the label in the frame should change + to indicated that the dialog has been garbage collected and the test passed. + """; + + public static void main(String args[]) throws Exception { + Frame frame = new DisposeFrame(); + PassFailJFrame.builder() + .title("DialogDisposeLeak") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(frame) + .build() + .awaitAndCheck(); + } +} + +class DisposeFrame extends Frame { + Label label = new Label("Test not passed yet"); + + DisposeFrame() { + super("DisposeLeak test"); + setLayout(new FlowLayout()); + Button btn = new Button("Dialog..."); + add(btn); + btn.addActionListener(ev -> { + Dialog dlg = new DisposeDialog(DisposeFrame.this); + dlg.setVisible(true); + } + ); + add(label); + pack(); + } + + public void testOK() { + label.setText("Test has passed. Dialog finalized."); + } +} + +class DisposeDialog extends Dialog { + DisposeDialog(Frame frame) { + super(frame, "DisposeDialog", true); + setLocation(frame.getX(), frame.getY()); + + setLayout(new FlowLayout()); + LightweightComp lw = new LightweightComp("Click here to dispose"); + lw.addMouseListener( + new MouseAdapter() { + public void mouseEntered(MouseEvent ev) { + System.out.println("Entered lw"); + } + + public void mouseExited(MouseEvent ev) { + System.out.println("Exited lw"); + } + + public void mouseReleased(MouseEvent ev) { + System.out.println("Released lw"); + DisposeDialog.this.dispose(); + // try to force GC and finalization + for (int n = 0; n < 100; n++) { + byte[] bytes = new byte[1024 * 1024 * 8]; + System.gc(); + } + } + } + ); + add(lw); + pack(); + } + + public void finalize() { + ((DisposeFrame) getParent()).testOK(); + } +} + +// simple lightweight component, focus traversable, highlights upon focus +class LightweightComp extends Component { + FontMetrics fm; + String label; + private static final int FOCUS_GONE = 0; + private static final int FOCUS_TEMP = 1; + private static final int FOCUS_HAVE = 2; + int focusLevel = FOCUS_GONE; + public static int nameCounter = 0; + + public LightweightComp(String lwLabel) { + label = lwLabel; + enableEvents(AWTEvent.FOCUS_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK); + setName("lw" + nameCounter++); + } + + public Dimension getPreferredSize() { + if (fm == null) fm = Toolkit.getDefaultToolkit().getFontMetrics(getFont()); + return new Dimension(fm.stringWidth(label) + 2, fm.getHeight() + 2); + } + + public void paint(Graphics g) { + Dimension s = getSize(); + + // erase the background + g.setColor(getBackground()); + g.fillRect(0, 0, s.width, s.height); + + g.setColor(getForeground()); + + // draw the string + g.drawString(label, 2, fm.getHeight()); + + // draw a focus rectangle + if (focusLevel > FOCUS_GONE) { + if (focusLevel == FOCUS_TEMP) { + g.setColor(Color.gray); + } else { + g.setColor(Color.blue); + } + } else { + g.setColor(Color.black); + } + g.drawRect(1, 1, s.width - 2, s.height - 2); + } + + public boolean isFocusTraversable() { + return true; + } + + protected void processFocusEvent(FocusEvent e) { + super.processFocusEvent(e); + if (e.getID() == FocusEvent.FOCUS_GAINED) { + focusLevel = FOCUS_HAVE; + } else { + if (e.isTemporary()) { + focusLevel = FOCUS_TEMP; + } else { + focusLevel = FOCUS_GONE; + } + } + repaint(); + } + + protected void processMouseEvent(MouseEvent e) { + if (e.getID() == MouseEvent.MOUSE_PRESSED) { + requestFocus(); + } + super.processMouseEvent(e); + } +} + diff --git a/test/jdk/java/awt/Dialog/FileDialogTest.java b/test/jdk/java/awt/Dialog/FileDialogTest.java new file mode 100644 index 000000000000..4ac937d773d8 --- /dev/null +++ b/test/jdk/java/awt/Dialog/FileDialogTest.java @@ -0,0 +1,189 @@ +/* + * Copyright (c) 1998, 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.awt.Button; +import java.awt.Container; +import java.awt.FileDialog; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4105025 4153487 4177107 4146229 4119383 4181310 4152317 + * @summary Test: FileDialogTest + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FileDialogTest + */ + +public class FileDialogTest extends Panel implements ActionListener { + Button buttonShow, buttonNullShow, buttonShowHide, buttonShowDispose; + TextField fieldFile; + TextField fieldDir; + TextField fieldTitle; + private static final String INSTRUCTIONS = """ + 1. Set file, directory, and title fields to some real values + Title will not show on macos dialog + 2. Click the "Get File..." button. + 3. Verify that dialog is set to proper file and directory, and that + title is also set. + 4. Select a file and OK the dialog + (or whatever the selection button is). + 5. Verify that the file and directory fields reflect the file chosen. + 6. Now, click the "Get null File with null Directory..." button. + 7. Verify that the file list matches the listed directory. + 8. Cancel or OK the dialog. + 9. Verify that no NullPointerException is thrown. + 10. Now, click the "Show FileDialog, then hide() in 5 s..." button. + 11. Wait for 5 seconds. The FileDialog should then + disappear automatically. + 12. 12-14 are Windows specific. Set file to some invalid value, + like "/<>++". + 13. Click the "Get File..." button. + 14. Verify that FileDialog is shown with empty "file" field. + 15. Run the test on different locales. Verify that filter string + "All Files" is localized. + """; + + public static void main(String args[]) throws Exception { + Frame frame = new Frame("FileDialogTest"); + frame.setLayout(new GridLayout()); + frame.add(new FileDialogTest()); + frame.pack(); + + PassFailJFrame.builder() + .title("FileDialogTest") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(frame) + .build() + .awaitAndCheck(); + } + + public FileDialogTest() { + setLayout(new GridLayout(6, 2)); + + buttonShow = new Button("Get File..."); + add(buttonShow); + buttonNullShow = new Button("Get null File with null Directory..."); + add(buttonNullShow); + buttonShowHide = new Button("Show FileDialog, then hide() in 5 s..."); + add(buttonShowHide); + buttonShowDispose = + new Button("Show FileDialog, then dispose() in 5 s..."); + add(buttonShowDispose); + + add(new Label("")); + add(new Label("")); + + add(new Label("File:")); + fieldFile = new TextField(20); + add(fieldFile); + + add(new Label("Directory:")); + fieldDir = new TextField(20); + add(fieldDir); + + add(new Label("Title:")); + fieldTitle = new TextField(20); + fieldTitle.setText("TestTitle"); + add(fieldTitle); + + buttonShow.addActionListener(this); + buttonNullShow.addActionListener(this); + buttonShowHide.addActionListener(this); + buttonShowDispose.addActionListener(this); + } + + public void actionPerformed(ActionEvent evt) { + if (evt.getSource() == buttonShow) { + FileDialog fd = new FileDialog(getFrame(), fieldTitle.getText()); + fd.setFile(fieldFile.getText()); + fd.setDirectory(fieldDir.getText()); + fd.show(); + System.out.println("back from show"); + fieldFile.setText(fd.getFile()); + fieldDir.setText(fd.getDirectory()); + fd.dispose(); + } else if (evt.getSource() == buttonNullShow) { + FileDialog fd = new FileDialog(getFrame(), fieldTitle.getText()); + fd.setFile(null); + fd.setDirectory(null); + fd.show(); + System.out.println("back from show"); + fieldFile.setText(fd.getFile()); + fieldDir.setText(fd.getDirectory()); + fd.setFile(null); + fd.setDirectory(null); + fd.dispose(); + } else if (evt.getSource() == buttonShowHide) { + final FileDialog fd = new FileDialog(getFrame(), + fieldTitle.getText()); + fd.setFile(fieldFile.getText()); + fd.setDirectory(fieldDir.getText()); + new Thread(new Runnable() { + public void run() { + try { + Thread.currentThread().sleep(5000); + } catch (InterruptedException ex) { + } + fd.hide(); + } + }).start(); + fd.show(); + System.out.println("back from show"); + fd.dispose(); + } else if (evt.getSource() == buttonShowDispose) { + final FileDialog fd = new FileDialog(getFrame(), + fieldTitle.getText()); + fd.setFile(fieldFile.getText()); + fd.setDirectory(fieldDir.getText()); + new Thread(() -> { + try { + Thread.currentThread().sleep(5000); + } catch (InterruptedException ex) { + } + fd.dispose(); + }).start(); + fd.show(); + System.out.println("back from show"); + fd.dispose(); + } + } + + private Frame getFrame() { + Container cont = getParent(); + while (cont != null) { + if (cont instanceof Frame) { + return (Frame) cont; + } + cont = cont.getParent(); + } + return null; + } +} diff --git a/test/jdk/java/awt/Dialog/TaskbarIconTest.java b/test/jdk/java/awt/Dialog/TaskbarIconTest.java new file mode 100644 index 000000000000..2ced3853a0c0 --- /dev/null +++ b/test/jdk/java/awt/Dialog/TaskbarIconTest.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2006, 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.awt.Button; +import java.awt.Dialog; +import java.awt.FileDialog; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.awt.print.PageFormat; +import java.awt.print.PrinterJob; + +/* + * @test + * @bug 6488834 + * @requires (os.family == "windows") + * @summary Tests that native dialogs (file, page, print) appear or + don't appear on the windows taskbar depending of their parent + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TaskbarIconTest +*/ + +public class TaskbarIconTest { + private static WindowListener wl = new WindowAdapter() { + public void windowClosing(WindowEvent we) { + Window w = we.getWindow(); + w.dispose(); + Window owner = w.getOwner(); + if (owner != null) { + owner.dispose(); + } + } + }; + + private static ActionListener al = new ActionListener() { + public void actionPerformed(ActionEvent ae) { + Button b = (Button) ae.getSource(); + + String bLabel = b.getLabel(); + boolean hasParent = (bLabel.indexOf("parentless") < 0); + Frame parent = hasParent ? new Frame("Parent") : null; + + if (bLabel.startsWith("Java")) { + Dialog d = new Dialog(parent, "Java dialog", true); + d.setBounds(0, 0, 160, 120); + d.addWindowListener(wl); + d.setVisible(true); + } else if (bLabel.startsWith("File")) { + FileDialog d = new FileDialog(parent, "File dialog"); + d.setVisible(true); + } else if (bLabel.startsWith("Print")) { + PrinterJob pj = PrinterJob.getPrinterJob(); + pj.printDialog(); + } else if (bLabel.startsWith("Page")) { + PrinterJob pj = PrinterJob.getPrinterJob(); + pj.pageDialog(new PageFormat()); + } + } + }; + + private static final String INSTRUCTIONS = """ + When the test starts a frame 'Main' is shown. It contains + several buttons, pressing each of them shows a dialog. + Some of the dialogs have a parent window, others are + parentless, according to the corresponding button's test. + + Press each button one after another. Make sure that all + parentless dialogs have an icon in the windows taskbar + and all the dialogs with parents don't. Press PASS or + FAIL button depending on the result. + + Note: as all the dialogs shown are modal, you have to close + them before showing the next dialog or PASS or FAIL buttons." + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("WindowInputBlock") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(TaskbarIconTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Button b; + + Frame mainFrame = new Frame("Main"); + mainFrame.setBounds(120, 240, 160, 240); + mainFrame.setLayout(new GridLayout(6, 1)); + + b = new Button("Java dialog, with parent"); + b.addActionListener(al); + mainFrame.add(b); + + b = new Button("Java dialog, parentless"); + b.addActionListener(al); + mainFrame.add(b); + + b = new Button("File dialog, with parent"); + b.addActionListener(al); + mainFrame.add(b); + + b = new Button("File dialog, parentless"); + b.addActionListener(al); + mainFrame.add(b); + + b = new Button("Print dialog, parentless"); + b.addActionListener(al); + mainFrame.add(b); + + b = new Button("Page dialog, parentless"); + b.addActionListener(al); + mainFrame.add(b); + + return mainFrame; + } +} diff --git a/test/jdk/java/awt/Dialog/WindowInputBlock.java b/test/jdk/java/awt/Dialog/WindowInputBlock.java new file mode 100644 index 000000000000..c38e8653ecc8 --- /dev/null +++ b/test/jdk/java/awt/Dialog/WindowInputBlock.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 1998, 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.awt.BorderLayout; +import java.awt.Color; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +/* + * @test + * @bug 4124096 + * @summary Modal JDialog is not modal on Solaris + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual WindowInputBlock + */ + +public class WindowInputBlock { + private static final String INSTRUCTIONS = """ + When the Window is up, you see a "Show Modal Dialog" button, a + "Test" button and a TextField. + Verify that the "Test" button is clickable, and the TextField can + receive focus. + + Now, click on "Show Modal Dialog" button to bring up a modal dialog + and verify that both "Test" button and TextField are not accessible. + Close the new dialog window. If the test behaved as described, pass + this test. Otherwise, fail this test. + + """; + + public static void main(String[] argv) throws Exception { + JFrame frame = new ModalDialogTest(); + PassFailJFrame.builder() + .title("WindowInputBlock") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(frame) + .build() + .awaitAndCheck(); + } +} + +class ModalDialogTest extends JFrame implements ActionListener { + JDialog dialog = new JDialog(new JFrame(), "Modal Dialog", true); + + public ModalDialogTest() { + setTitle("Modal Dialog Test"); + JPanel controlPanel = new JPanel(); + JPanel infoPanel = new JPanel(); + JButton showButton = new JButton("Show Modal Dialog"); + JButton testButton = new JButton("Test"); + JTextField textField = new JTextField("Test"); + + getContentPane().setLayout(new BorderLayout()); + infoPanel.setLayout(new GridLayout(0, 1)); + + showButton.setOpaque(true); + showButton.setBackground(Color.yellow); + + testButton.setOpaque(true); + testButton.setBackground(Color.pink); + + controlPanel.add(showButton); + controlPanel.add(testButton); + controlPanel.add(textField); + + infoPanel.add(new JLabel("Click the \"Show Modal Dialog\" button " + + "to display a modal JDialog.")); + infoPanel.add(new JLabel("Click the \"Test\" button to verify " + + "dialog modality.")); + + getContentPane().add(BorderLayout.NORTH, controlPanel); + getContentPane().add(BorderLayout.SOUTH, infoPanel); + dialog.setSize(200, 200); + + showButton.addActionListener(this); + testButton.addActionListener(this); + + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + System.exit(0); + } + + public void windowClosed(WindowEvent e) { + System.exit(0); + } + }); + + pack(); + setSize(450, 120); + } + + public void actionPerformed(ActionEvent evt) { + String command = evt.getActionCommand(); + + if (command == "Show Modal Dialog") { + System.out.println("*** Invoking JDialog.show() ***"); + dialog.setLocation(200, 200); + dialog.setVisible(true); + } else if (command == "Test") { + System.out.println("*** Test ***"); + } + } +} From 9805518769501c72c8e495a1f0e3c2e62ac07c60 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Wed, 15 Apr 2026 13:09:24 +0000 Subject: [PATCH 182/223] 8340140: Open some dialog awt tests 3 Backport-of: 4e703b285b5b34fdfb342d194cd744660d4c2be1 --- .../java/awt/Dialog/ClosingParentTest.java | 100 +++++++++++++++++ .../awt/Dialog/FileDialogEmptyTitleTest.java | 59 ++++++++++ .../java/awt/Dialog/FileDialogUIUpdate.java | 83 ++++++++++++++ .../awt/Dialog/MenuAndModalDialogTest.java | 104 ++++++++++++++++++ 4 files changed, 346 insertions(+) create mode 100644 test/jdk/java/awt/Dialog/ClosingParentTest.java create mode 100644 test/jdk/java/awt/Dialog/FileDialogEmptyTitleTest.java create mode 100644 test/jdk/java/awt/Dialog/FileDialogUIUpdate.java create mode 100644 test/jdk/java/awt/Dialog/MenuAndModalDialogTest.java diff --git a/test/jdk/java/awt/Dialog/ClosingParentTest.java b/test/jdk/java/awt/Dialog/ClosingParentTest.java new file mode 100644 index 000000000000..9b2750ab95fa --- /dev/null +++ b/test/jdk/java/awt/Dialog/ClosingParentTest.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2000, 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.awt.Button; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowAdapter; + +/* + * @test + * @bug 4336913 + * @summary On Windows, disable parent window controls while modal dialog is being created. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ClosingParentTest + */ + +public class ClosingParentTest { + + static String instructions = """ + When the test starts, you will see a Frame with a Button + titled 'Show modal dialog with delay'. Press this button + and before the modal Dialog is shown, try to close the + Frame using X button or system menu for windowing systems + which don't provide X button in Window decorations. The + delay before Dialog showing is 5 seconds. + If in test output you see message about WINDOW_CLOSING + being dispatched, then test fails. If no such message + is printed, the test passes. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ClosingParentTest") + .instructions(instructions) + .testTimeOut(5) + .rows(10) + .columns(35) + .testUI(ClosingParentTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame frame = new Frame("Main Frame"); + Dialog dialog = new Dialog(frame, true); + + Button button = new Button("Show modal dialog with delay"); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + try { + Thread.currentThread().sleep(5000); + } catch (InterruptedException x) { + x.printStackTrace(); + } + + dialog.setVisible(true); + } + }); + frame.add(button); + frame.pack(); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + System.out.println("WINDOW_CLOSING dispatched on the frame"); + } + }); + + dialog.setSize(100, 100); + dialog.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + dialog.dispose(); + } + }); + + return frame; + } +} diff --git a/test/jdk/java/awt/Dialog/FileDialogEmptyTitleTest.java b/test/jdk/java/awt/Dialog/FileDialogEmptyTitleTest.java new file mode 100644 index 000000000000..d288a7c18f65 --- /dev/null +++ b/test/jdk/java/awt/Dialog/FileDialogEmptyTitleTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 1998, 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.awt.FileDialog; +import java.awt.Frame; + +/* + * @test + * @bug 4177831 + * @summary solaris: default FileDialog title is not empty + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FileDialogEmptyTitleTest + */ + +public class FileDialogEmptyTitleTest { + static String instructions = """ + Test passes if title of file dialog is empty, + otherwise test failed. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("FileDialogEmptyTitleTest") + .instructions(instructions) + .testTimeOut(5) + .rows(10) + .columns(35) + .testUI(FileDialogEmptyTitleTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static FileDialog createGUI() { + Frame frame = new Frame("invisible dialog owner"); + FileDialog fileDialog = new FileDialog(frame); + return fileDialog; + } +} diff --git a/test/jdk/java/awt/Dialog/FileDialogUIUpdate.java b/test/jdk/java/awt/Dialog/FileDialogUIUpdate.java new file mode 100644 index 000000000000..f97d947991b4 --- /dev/null +++ b/test/jdk/java/awt/Dialog/FileDialogUIUpdate.java @@ -0,0 +1,83 @@ +/* + * 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 + * 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.awt.BorderLayout; +import java.awt.Button; +import java.awt.FileDialog; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4859390 + * @requires (os.family == "windows") + * @summary Verify that FileDialog matches the look + of the native windows FileDialog + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FileDialogUIUpdate + */ + +public class FileDialogUIUpdate extends Frame { + static String instructions = """ + Click the button to show the FileDialog. Then open the Paint + application (usually found in Program Files->Accessories). + Select File->Open from Paint to display a native Open dialog. + Compare the native dialog to the AWT FileDialog. + Specifically, confirm that the Places Bar icons are along the left side (or + not, if the native dialog doesn't have them), and that the + dialogs are both resizable (or not). + If the file dialogs both look the same press Pass. If not, + press Fail. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("FileDialogUIUpdate") + .instructions(instructions) + .testTimeOut(5) + .rows(12) + .columns(35) + .testUI(FileDialogUIUpdate::new) + .build() + .awaitAndCheck(); + } + + public FileDialogUIUpdate() { + final FileDialog fd = new FileDialog(new Frame("FileDialogUIUpdate frame"), + "Open FileDialog"); + Button showButton = new Button("Show FileDialog"); + setLayout(new BorderLayout()); + + fd.setDirectory("c:/"); + showButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + fd.setVisible(true); + } + }); + + add(showButton); + setSize(200, 200); + } +} diff --git a/test/jdk/java/awt/Dialog/MenuAndModalDialogTest.java b/test/jdk/java/awt/Dialog/MenuAndModalDialogTest.java new file mode 100644 index 000000000000..c22116ff8df1 --- /dev/null +++ b/test/jdk/java/awt/Dialog/MenuAndModalDialogTest.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 1997, 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.awt.Button; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4070085 + * @summary Java program locks up X server + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuAndModalDialogTest + */ + +public class MenuAndModalDialogTest { + static Frame frame; + static String instructions = """ + 1. Bring up the File Menu and leave it up. + 2. In a few seconds, the modal dialog will appear. + 3. Verify that your system does not lock up when you push the "OK" button. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame pf = PassFailJFrame.builder() + .title("MenuAndModalDialogTest") + .instructions(instructions) + .testTimeOut(5) + .rows(10) + .columns(35) + .testUI(MenuAndModalDialogTest::createFrame) + .build(); + + // Allow time to pop up the menu + try { + Thread.currentThread().sleep(5000); + } catch (InterruptedException exception) { + } + + createDialog(); + pf.awaitAndCheck(); + } + + public static Frame createFrame() { + frame = new Frame("MenuAndModalDialogTest frame"); + + MenuBar menuBar = new MenuBar(); + frame.setMenuBar(menuBar); + + Menu file = new Menu("File"); + menuBar.add(file); + + MenuItem menuItem = new MenuItem("A Menu Entry"); + file.add(menuItem); + + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + return frame; + } + + public static void createDialog() { + Dialog dialog = new Dialog(frame); + + Button button = new Button("OK"); + dialog.add(button); + button.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + dialog.dispose(); + } + } + ); + + dialog.setSize(200, 200); + dialog.setModal(true); + dialog.setVisible(true); + } +} From a9376b2cff6b8bcbe4c870d4e7a0ea550796d92c Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Wed, 15 Apr 2026 14:11:10 +0000 Subject: [PATCH 183/223] 8340336: Open some checkbox awt tests Backport-of: 1ea1f33f66326804ca2892fe0659a9acb7ee72ae --- .../awt/Checkbox/AppearanceIfLargeFont.java | 84 ++++++++++++ .../Checkbox/CheckboxMenuItemEventsTest.java | 120 ++++++++++++++++++ test/jdk/java/awt/Container/ValidateTest.java | 78 ++++++++++++ 3 files changed, 282 insertions(+) create mode 100644 test/jdk/java/awt/Checkbox/AppearanceIfLargeFont.java create mode 100644 test/jdk/java/awt/Checkbox/CheckboxMenuItemEventsTest.java create mode 100644 test/jdk/java/awt/Container/ValidateTest.java diff --git a/test/jdk/java/awt/Checkbox/AppearanceIfLargeFont.java b/test/jdk/java/awt/Checkbox/AppearanceIfLargeFont.java new file mode 100644 index 000000000000..7995b43ed18d --- /dev/null +++ b/test/jdk/java/awt/Checkbox/AppearanceIfLargeFont.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2006, 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.awt.Button; +import java.awt.CheckboxMenuItem; +import java.awt.Frame; +import java.awt.PopupMenu; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 6401956 + * @summary The right mark of the CheckboxMenu item is broken + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual AppearanceIfLargeFont + */ + +public class AppearanceIfLargeFont extends Frame { + private static final String INSTRUCTIONS = """ + 1) Make sure that font-size is large. + You could change this using 'Appearance' dialog. + 2) Press button 'Press' + You will see a menu item with check-mark. + 3) If check-mark is correctly painted then the test passed. + Otherwise, test failed. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("AppearanceIfLargeFont") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(AppearanceIfLargeFont::new) + .build() + .awaitAndCheck(); + } + + public AppearanceIfLargeFont() { + createComponents(); + + setSize(200, 200); + validate(); + } + + void createComponents() { + final Button press = new Button("Press"); + final PopupMenu popup = new PopupMenu(); + press.add(popup); + add(press); + + CheckboxMenuItem item = new CheckboxMenuItem("CheckboxMenuItem", true); + popup.add(item); + + press.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent ae) { + popup.show(press, press.getSize().width, 0); + } + } + ); + } +} diff --git a/test/jdk/java/awt/Checkbox/CheckboxMenuItemEventsTest.java b/test/jdk/java/awt/Checkbox/CheckboxMenuItemEventsTest.java new file mode 100644 index 000000000000..425c24ba7ef4 --- /dev/null +++ b/test/jdk/java/awt/Checkbox/CheckboxMenuItemEventsTest.java @@ -0,0 +1,120 @@ +/* + * 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 + * 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.awt.BorderLayout; +import java.awt.Button; +import java.awt.CheckboxMenuItem; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.awt.TextArea; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/* + * @test + * @bug 4814163 5005195 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Tests events fired by CheckboxMenuItem + * @run main/manual CheckboxMenuItemEventsTest +*/ + +public class CheckboxMenuItemEventsTest extends Frame implements ActionListener { + Button trigger; + PopupMenu popup; + TextArea ta; + + class Listener implements ItemListener, ActionListener { + public void itemStateChanged(ItemEvent e) { + ta.append("CORRECT: ItemEvent fired\n"); + } + + public void actionPerformed(ActionEvent e) { + ta.append("ERROR: ActionEvent fired\n"); + } + } + + Listener listener = new Listener(); + + private static final String INSTRUCTIONS = """ + Press button to invoke popup menu + When you press checkbox menu item + Item state should toggle (on/off). + ItemEvent should be displayed in log below. + And ActionEvent should not be displayed + Press PASS if ItemEvents are generated + and ActionEvents are not, FAIL Otherwise. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("CheckboxMenuItemEventsTest") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(CheckboxMenuItemEventsTest::new) + .build() + .awaitAndCheck(); + } + + public CheckboxMenuItemEventsTest() { + CheckboxMenuItem i1 = new CheckboxMenuItem("CheckBoxMenuItem 1"); + CheckboxMenuItem i2 = new CheckboxMenuItem("CheckBoxMenuItem 2"); + Panel p1 = new Panel(); + Panel p2 = new Panel(); + + setLayout(new BorderLayout()); + ta = new TextArea(); + p2.add(ta); + + trigger = new Button("menu"); + trigger.addActionListener(this); + + popup = new PopupMenu(); + + i1.addItemListener(listener); + i1.addActionListener(listener); + popup.add(i1); + i2.addItemListener(listener); + i2.addActionListener(listener); + popup.add(i2); + + trigger.add(popup); + + p1.add(trigger); + + add(p1, BorderLayout.NORTH); + add(p2, BorderLayout.SOUTH); + + pack(); + validate(); + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == (Object) trigger) { + popup.show(trigger, trigger.getSize().width, 0); + } + } +} diff --git a/test/jdk/java/awt/Container/ValidateTest.java b/test/jdk/java/awt/Container/ValidateTest.java new file mode 100644 index 000000000000..935766094cf7 --- /dev/null +++ b/test/jdk/java/awt/Container/ValidateTest.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 1998, 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.awt.EventQueue; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Panel; + +/* + * @test + * @bug 4136190 + * @requires (os.family == "windows") + * @summary Recursive validation calls would cause major USER resource leakage + * @key headful + * @run main/timeout=30 ValidateTest + */ + +public class ValidateTest { + static Frame frame; + + public static void main(String args[]) throws Exception { + try { + EventQueue.invokeAndWait(() -> { + createGUI(); + }); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public static void createGUI() { + frame = new Frame("Test for 4136190 : JVM and win95 resource leakage issues"); + frame.setLayout(new GridLayout(1, 1)); + MyPanel panel = new MyPanel(); + frame.add(panel); + frame.invalidate(); + frame.validate(); + frame.setSize(500, 400); + frame.setVisible(true); + } + + static class MyPanel extends Panel { + int recurseCounter = 0; + + public void validate() { + recurseCounter++; + if (recurseCounter >= 100) { + return; + } + getParent().validate(); + super.validate(); + } + } +} \ No newline at end of file From 0e45c0e0cb075566cfae3987783a251c081a9db1 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Wed, 15 Apr 2026 14:14:25 +0000 Subject: [PATCH 184/223] 8340494: Open some dialog awt tests 4 Backport-of: 60af9078fb4b1bce7c1fee171cd050c1cb0b1223 --- .../awt/Container/ActivateOnFocusTest.java | 141 ++++++++ .../java/awt/Container/MouseEnteredTest.java | 244 ++++++++++++++ .../java/awt/Dialog/ModalExcludedTest.java | 315 ++++++++++++++++++ 3 files changed, 700 insertions(+) create mode 100644 test/jdk/java/awt/Container/ActivateOnFocusTest.java create mode 100644 test/jdk/java/awt/Container/MouseEnteredTest.java create mode 100644 test/jdk/java/awt/Dialog/ModalExcludedTest.java diff --git a/test/jdk/java/awt/Container/ActivateOnFocusTest.java b/test/jdk/java/awt/Container/ActivateOnFocusTest.java new file mode 100644 index 000000000000..ee60f985e989 --- /dev/null +++ b/test/jdk/java/awt/Container/ActivateOnFocusTest.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 1998, 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.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; + +/* + * @test + * @bug 4111098 + * @key headful + * @summary Test for no window activation on control requestFocus() + * @run main/timeout=30 ActivateOnFocusTest + */ + +public class ActivateOnFocusTest { + static MyFrame mf1; + static Point p; + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> { + mf1 = new MyFrame(); + mf1.setBounds(100, 100, 300, 300); + mf1.mc1.requestFocusInWindow(); + }); + + Robot robot = new Robot(); + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + p = mf1.mb.getLocationOnScreen(); + }); + + robot.waitForIdle(); + + robot.mouseMove(p.x + 5, p.y + 5); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.delay(250); + + } finally { + if (mf1 != null) { + EventQueue.invokeAndWait(mf1::dispose); + } + } + } +} + +class MyFrame extends Frame implements ActionListener { + public Button mb; + public MyComponent mc1; + public MyComponent mc2; + + public MyFrame() { + super(); + setTitle("ActivateOnFocusTest"); + setLayout(new FlowLayout()); + mb = new Button("Pull"); + mb.addActionListener(this); + add(mb); + mc1 = new MyComponent(Color.red); + add(mc1); + mc2 = new MyComponent(Color.blue); + add(mc2); + addWindowListener(new WindowAdapter() { + @Override + public void windowActivated(WindowEvent e) { + mc1.requestFocusInWindow(); + } + @Override + public void windowDeactivated(WindowEvent e) { + mc2.requestFocusInWindow(); + } + }); + setVisible(true); + } + + public void actionPerformed(ActionEvent e) { + MyFrame mf2 = new MyFrame(); + mf2.setBounds(200, 200, 300, 300); + mf2.setVisible(true); + mf2.mc1.requestFocusInWindow(); + } +} + +class MyComponent extends Component { + public MyComponent(Color c) { + super(); + setBackground(c); + } + + public void paint(Graphics g) { + Dimension d = getSize(); + g.setColor(getBackground()); + g.fillRect(0, 0, d.width, d.height); + } + + public boolean isFocusTraversable() { + return true; + } + + public Dimension getPreferredSize() { + return new Dimension(50, 50); + } +} diff --git a/test/jdk/java/awt/Container/MouseEnteredTest.java b/test/jdk/java/awt/Container/MouseEnteredTest.java new file mode 100644 index 000000000000..3bd5d3e4778e --- /dev/null +++ b/test/jdk/java/awt/Container/MouseEnteredTest.java @@ -0,0 +1,244 @@ +/* + * Copyright (c) 1998, 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.awt.Component; +import java.awt.EventQueue; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import javax.swing.ButtonGroup; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.JTextArea; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +/* + * @test + * @bug 4159745 + * @key headful + * @summary Mediumweight popup dragging broken + * @run main MouseEnteredTest + */ + +public class MouseEnteredTest extends JFrame implements ActionListener { + static volatile MouseEnteredTest test; + static volatile Point p; + static volatile Point p2; + + static String strMotif = "Motif"; + static String motifClassName = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; + static char cMotif = 'o'; + + static String strWindows = "Windows"; + static String windowsClassName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; + static char cWindows = 'W'; + + static String strMetal = "Metal"; + static String metalClassName = "javax.swing.plaf.metal.MetalLookAndFeel"; + static char cMetal = 'M'; + + static JMenu m; + static JMenu menu; + + static MouseListener ml = new MouseEnteredTest.MouseEventListener(); + + public MouseEnteredTest() { + setTitle("MouseEnteredTest"); + JPopupMenu.setDefaultLightWeightPopupEnabled(false); + setJMenuBar(getMyMenuBar()); + getContentPane().add("Center", new JTextArea()); + setSize(400, 500); + setLocationRelativeTo(null); + setVisible(true); + } + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> { + test = new MouseEnteredTest(); + }); + + Robot robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + p = m.getLocationOnScreen(); + p2 = menu.getLocationOnScreen(); + }); + robot.waitForIdle(); + robot.delay(250); + robot.mouseMove(p.x + 5, p.y + 10); + robot.waitForIdle(); + + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (int i = p.x; i < p2.x + 10; i = i + 2) { + robot.mouseMove(i, p2.y + 10); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(2000); + + if (m.isPopupMenuVisible()) { + throw new RuntimeException("First menu is showing. Test Failed."); + } + } finally { + if (test != null) { + EventQueue.invokeAndWait(test::dispose); + } + } + } + + public JMenuBar getMyMenuBar() { + JMenuBar menubar; + JMenuItem menuItem; + + menubar = GetLNFMenuBar(); + + menu = menubar.add(new JMenu("Test")); + menu.setName("Test"); + menu.addMouseListener(ml); + menu.setMnemonic('T'); + menuItem = menu.add(new JMenuItem("Menu Item")); + menuItem.addActionListener(this); + menuItem.setMnemonic('M'); + menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.ALT_MASK)); + + JRadioButtonMenuItem mi = new JRadioButtonMenuItem("Radio Button"); + mi.addActionListener(this); + mi.setMnemonic('R'); + mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.ALT_MASK)); + menu.add(mi); + + JCheckBoxMenuItem mi1 = new JCheckBoxMenuItem("Check Box"); + mi1.addActionListener(this); + mi1.setMnemonic('C'); + mi1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.ALT_MASK)); + menu.add(mi1); + return menubar; + } + + public void actionPerformed(ActionEvent e) { + String str = e.getActionCommand(); + if (str.equals(metalClassName) || str.equals(windowsClassName) || str.equals(motifClassName)) { + changeLNF(str); + } else { + System.out.println("ActionEvent: " + str); + } + } + + public void changeLNF(String str) { + System.out.println("Changing LNF to " + str); + try { + UIManager.setLookAndFeel(str); + SwingUtilities.updateComponentTreeUI(this); + pack(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public JMenuBar GetLNFMenuBar() { + JMenuBar mbar = new JMenuBar(); + m = new JMenu("Look and Feel"); + m.setName("Look and Feel"); + m.addMouseListener(ml); + m.setMnemonic('L'); + ButtonGroup bg = new ButtonGroup(); + + JRadioButtonMenuItem mi; + + mi = new JRadioButtonMenuItem(strMetal); + mi.addActionListener(this); + mi.setActionCommand(metalClassName); + mi.setMnemonic(cMetal); + mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK)); + mi.setSelected(true); + bg.add(mi); + m.add(mi); + + mi = new JRadioButtonMenuItem(strWindows); + mi.addActionListener(this); + mi.setActionCommand(windowsClassName); + mi.setMnemonic(cWindows); + mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK)); + bg.add(mi); + m.add(mi); + + mi = new JRadioButtonMenuItem(strMotif); + mi.addActionListener(this); + mi.setActionCommand(motifClassName); + mi.setMnemonic(cMotif); + mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, ActionEvent.ALT_MASK)); + bg.add(mi); + m.add(mi); + + mbar.add(m); + return mbar; + } + + static class MouseEventListener implements MouseListener, MouseMotionListener { + public void mouseClicked(MouseEvent e) { + System.out.println("In mouseClicked for " + e.getComponent().getName()); + } + + public void mousePressed(MouseEvent e) { + Component c = e.getComponent(); + System.out.println("In mousePressed for " + c.getName()); + } + + public void mouseReleased(MouseEvent e) { + System.out.println("In mouseReleased for " + e.getComponent().getName()); + } + + public void mouseEntered(MouseEvent e) { + System.out.println("In mouseEntered for " + e.getComponent().getName()); + System.out.println("MouseEvent:" + e.getComponent()); + } + + public void mouseExited(MouseEvent e) { + System.out.println("In mouseExited for " + e.getComponent().getName()); + } + + public void mouseDragged(MouseEvent e) { + System.out.println("In mouseDragged for " + e.getComponent().getName()); + } + + public void mouseMoved(MouseEvent e) { + System.out.println("In mouseMoved for " + e.getComponent().getName()); + } + } +} diff --git a/test/jdk/java/awt/Dialog/ModalExcludedTest.java b/test/jdk/java/awt/Dialog/ModalExcludedTest.java new file mode 100644 index 000000000000..2531c26d3bc3 --- /dev/null +++ b/test/jdk/java/awt/Dialog/ModalExcludedTest.java @@ -0,0 +1,315 @@ +/* + * 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 + * 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.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dialog; +import java.awt.FileDialog; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.JobAttributes; +import java.awt.PageAttributes; +import java.awt.Panel; +import java.awt.PrintJob; +import java.awt.TextArea; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; + +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; + +import sun.awt.SunToolkit; + +/* + * @test + * @bug 4813288 4866704 + * @summary Test for "modal exclusion" functionality + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame + * @modules java.desktop/sun.awt + * @run main/manual ModalExcludedTest + */ + +public class ModalExcludedTest { + private static final String INSTRUCTIONS = """ + 1. Press 'Modal dialog w/o modal excluded' button below + A window, a modeless dialog and a modal dialog will appear + Make sure the frame and the modeless dialog are inaccessible, + i.e. receive no mouse and keyboard events. MousePressed and + KeyPressed events are logged in the text area - use it + to watch events + Close all 3 windows + + 2. Press 'Modal dialog w/ modal excluded' button below + Again, 3 windows will appear (frame, dialog, modal dialog), + but the frame and the dialog would be modal excluded, i.e. + behave the same way as there is no modal dialog shown. Verify + this by pressing mouse buttons and typing any keys. The + RootFrame would be modal blocked - verify this too + Close all 3 windows + + 3. Repeat step 2 for file and print dialogs using appropriate + buttons below + + Notes: if there is no printer installed in the system you may not + get any print dialogs + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ModalExcludedTest") + .instructions(INSTRUCTIONS) + .rows(10) + .columns(35) + .testUI(ModalExcludedTest::createGUIs) + .build() + .awaitAndCheck(); + } + + public static Frame createGUIs() { + final Frame f = new Frame("RootFrame"); + f.setBounds(0, 0, 480, 500); + f.setLayout(new BorderLayout()); + + final TextArea messages = new TextArea(); + + final WindowListener wl = new WindowAdapter() { + public void windowClosing(WindowEvent ev) { + if (ev.getSource() instanceof Window) { + ((Window) ev.getSource()).dispose(); + } + } + }; + final MouseListener ml = new MouseAdapter() { + public void mousePressed(MouseEvent ev) { + messages.append(ev + "\n"); + } + }; + final KeyListener kl = new KeyAdapter() { + public void keyPressed(KeyEvent ev) { + messages.append(ev + "\n"); + } + }; + + if (!SunToolkit.isModalExcludedSupported()) { + throw new jtreg.SkippedException("Modal exclude is not supported on this platform."); + } + + messages.addMouseListener(ml); + messages.addKeyListener(kl); + f.add(messages, BorderLayout.CENTER); + + Panel buttons = new Panel(); + buttons.setLayout(new GridLayout(6, 1)); + + Button b = new Button("Modal dialog w/o modal excluded"); + b.addActionListener(ev -> { + Frame ff = new Frame("Non-modal-excluded frame"); + ff.setBounds(400, 0, 200, 100); + ff.addWindowListener(wl); + ff.addMouseListener(ml); + ff.addKeyListener(kl); + ff.setVisible(true); + + Dialog dd = new Dialog(ff, "Non-modal-excluded dialog", false); + dd.setBounds(500, 100, 200, 100); + dd.addWindowListener(wl); + dd.addMouseListener(ml); + dd.addKeyListener(kl); + dd.setVisible(true); + + Dialog d = new Dialog(f, "Modal dialog", true); + d.setBounds(600, 200, 200, 100); + d.addWindowListener(wl); + d.addMouseListener(ml); + d.addKeyListener(kl); + d.setVisible(true); + }); + buttons.add(b); + + Button c = new Button("Modal dialog w/ modal excluded"); + c.addActionListener(ev -> { + JFrame ff = new JFrame("Modal-excluded frame"); + ff.setBounds(400, 0, 200, 100); + ff.addWindowListener(wl); + ff.addMouseListener(ml); + ff.addKeyListener(kl); + JMenuBar mb = new JMenuBar(); + JMenu m = new JMenu("Test menu"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + mb.add(m); + ff.setJMenuBar(mb); + // 1: set visible + ff.setVisible(true); + + Dialog dd = new Dialog(ff, "Modal-excluded dialog", false); + dd.setBounds(500, 100, 200, 100); + dd.addWindowListener(wl); + dd.addMouseListener(ml); + dd.addKeyListener(kl); + dd.setVisible(true); + + // 2: set modal excluded + SunToolkit.setModalExcluded(ff); + + Dialog d = new Dialog(f, "Modal dialog", true); + d.setBounds(600, 200, 200, 100); + d.addWindowListener(wl); + d.addMouseListener(ml); + d.addKeyListener(kl); + d.setVisible(true); + }); + buttons.add(c); + + Button c1 = new Button("Modal dialog before modal excluded"); + c1.addActionListener(ev -> { + // 1: create dialog + Dialog d = new Dialog(f, "Modal dialog", true); + d.setBounds(600, 200, 200, 100); + d.addWindowListener(wl); + d.addMouseListener(ml); + d.addKeyListener(kl); + + // 2: create frame + Frame ff = new Frame("Modal-excluded frame"); + // 3: set modal excluded + SunToolkit.setModalExcluded(ff); + ff.setBounds(400, 0, 200, 100); + ff.addWindowListener(wl); + ff.addMouseListener(ml); + ff.addKeyListener(kl); + // 4: show frame + ff.setVisible(true); + + Dialog dd = new Dialog(ff, "Modal-excluded dialog", false); + dd.setBounds(500, 100, 200, 100); + dd.addWindowListener(wl); + dd.addMouseListener(ml); + dd.addKeyListener(kl); + dd.setVisible(true); + + // 5: show dialog + d.setVisible(true); + }); + buttons.add(c1); + + Button d = new Button("File dialog w/ modal excluded"); + d.addActionListener(ev -> { + Frame ff = new Frame("Modal-excluded frame"); + ff.setBounds(400, 0, 200, 100); + ff.addWindowListener(wl); + ff.addMouseListener(ml); + ff.addKeyListener(kl); + // 1: set modal excluded (peer is not created yet) + SunToolkit.setModalExcluded(ff); + // 2: set visible + ff.setVisible(true); + + Dialog dd = new Dialog(ff, "Modal-excluded dialog", false); + dd.setBounds(500, 100, 200, 100); + dd.addWindowListener(wl); + dd.addMouseListener(ml); + dd.addKeyListener(kl); + dd.setVisible(true); + SunToolkit.setModalExcluded(dd); + + Dialog d1 = new FileDialog(f, "File dialog"); + d1.setVisible(true); + }); + buttons.add(d); + + Button e = new Button("Native print dialog w/ modal excluded"); + e.addActionListener(ev -> { + Frame ff = new Frame("Modal-excluded frame"); + ff.setBounds(400, 0, 200, 100); + ff.addWindowListener(wl); + ff.addMouseListener(ml); + ff.addKeyListener(kl); + ff.setVisible(true); + SunToolkit.setModalExcluded(ff); + + Dialog dd = new Dialog(ff, "Modal-excluded dialog", false); + dd.setBounds(500, 100, 200, 100); + dd.addWindowListener(wl); + dd.addMouseListener(ml); + dd.addKeyListener(kl); + dd.setVisible(true); + + JobAttributes jobAttributes = new JobAttributes(); + jobAttributes.setDialog(JobAttributes.DialogType.NATIVE); + PageAttributes pageAttributes = new PageAttributes(); + PrintJob job = Toolkit.getDefaultToolkit().getPrintJob(f, "Test", jobAttributes, pageAttributes); + }); + buttons.add(e); + + Button g = new Button("Common print dialog w/ modal excluded"); + g.addActionListener(ev -> { + Frame ff = new Frame("Modal-excluded frame"); + ff.setBounds(400, 0, 200, 100); + ff.addWindowListener(wl); + ff.addMouseListener(ml); + ff.addKeyListener(kl); + ff.setVisible(true); + SunToolkit.setModalExcluded(ff); + ff.dispose(); + // modal excluded must still be alive + ff.setVisible(true); + + Dialog dd = new Dialog(ff, "Modal-excluded dialog", false); + dd.setBounds(500, 100, 200, 100); + dd.addWindowListener(wl); + dd.addMouseListener(ml); + dd.addKeyListener(kl); + dd.setVisible(true); + + JobAttributes jobAttributes = new JobAttributes(); + jobAttributes.setDialog(JobAttributes.DialogType.COMMON); + PageAttributes pageAttributes = new PageAttributes(); + PrintJob job = Toolkit.getDefaultToolkit().getPrintJob(f, "Test", jobAttributes, pageAttributes); + }); + buttons.add(g); + + f.add(buttons, BorderLayout.SOUTH); + return f; + } +} From 9c42f780fa6170ee67136eba9423d5c75f2c937e Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Wed, 15 Apr 2026 15:59:38 +0000 Subject: [PATCH 185/223] 8323672: Suppress unwanted autoconf added flags in CC and CXX Reviewed-by: sgehwolf Backport-of: 5eae20f73b9e8578d58c7e49d2da79cf1b0b229c --- make/autoconf/toolchain.m4 | 6 +--- make/autoconf/util.m4 | 64 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 5 deletions(-) diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4 index 069ced05f329..a2b576ac1ab3 100644 --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -380,7 +380,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION], [ # Restore old path, except for the microsoft toolchain, which requires the # toolchain path to remain in place. Otherwise the compiler will not work in - # some siutations in later configure checks. + # some situations in later configure checks. if test "x$TOOLCHAIN_TYPE" != "xmicrosoft"; then PATH="$OLD_PATH" fi @@ -389,10 +389,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION], # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2" CFLAGS="$ORG_CFLAGS" CXXFLAGS="$ORG_CXXFLAGS" - - # filter out some unwanted additions autoconf may add to CXX; we saw this on macOS with autoconf 2.72 - UTIL_GET_NON_MATCHING_VALUES(cxx_filtered, $CXX, -std=c++11 -std=gnu++11) - CXX="$cxx_filtered" ]) # Check if a compiler is of the toolchain type we expect, and save the version diff --git a/make/autoconf/util.m4 b/make/autoconf/util.m4 index 76426005f81d..c87411c8ab3f 100644 --- a/make/autoconf/util.m4 +++ b/make/autoconf/util.m4 @@ -26,6 +26,70 @@ m4_include([util_paths.m4]) ############################################################################### +# Overwrite the existing version of AC_PROG_CC with our own custom variant. +# Unlike the regular AC_PROG_CC, the compiler list must always be passed. +AC_DEFUN([AC_PROG_CC], +[ + AC_LANG_PUSH(C) + AC_ARG_VAR([CC], [C compiler command]) + AC_ARG_VAR([CFLAGS], [C compiler flags]) + + _AC_ARG_VAR_LDFLAGS() + _AC_ARG_VAR_LIBS() + _AC_ARG_VAR_CPPFLAGS() + + AC_CHECK_TOOLS(CC, [$1]) + + test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH]) + + # Provide some information about the compiler. + _AS_ECHO_LOG([checking for _AC_LANG compiler version]) + set X $ac_compile + ac_compiler=$[2] + for ac_option in --version -v -V -qversion -version; do + _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) + done + + m4_expand_once([_AC_COMPILER_EXEEXT]) + m4_expand_once([_AC_COMPILER_OBJEXT]) + + _AC_PROG_CC_G + + AC_LANG_POP(C) +]) + +############################################################################### +# Overwrite the existing version of AC_PROG_CXX with our own custom variant. +# Unlike the regular AC_PROG_CXX, the compiler list must always be passed. +AC_DEFUN([AC_PROG_CXX], +[ + AC_LANG_PUSH(C++) + AC_ARG_VAR([CXX], [C++ compiler command]) + AC_ARG_VAR([CXXFLAGS], [C++ compiler flags]) + + _AC_ARG_VAR_LDFLAGS() + _AC_ARG_VAR_LIBS() + _AC_ARG_VAR_CPPFLAGS() + + AC_CHECK_TOOLS(CXX, [$1]) + + # Provide some information about the compiler. + _AS_ECHO_LOG([checking for _AC_LANG compiler version]) + set X $ac_compile + ac_compiler=$[2] + for ac_option in --version -v -V -qversion; do + _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) + done + + m4_expand_once([_AC_COMPILER_EXEEXT]) + m4_expand_once([_AC_COMPILER_OBJEXT]) + + _AC_PROG_CXX_G + + AC_LANG_POP(C++) +]) + +################################################################################ # Create a function/macro that takes a series of named arguments. The call is # similar to AC_DEFUN, but the setup of the function looks like this: # UTIL_DEFUN_NAMED([MYFUNC], [FOO *BAR], [$@], [ From 90168f5538083d845cf41f64c6c182c01babd4cb Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 15 Apr 2026 19:04:12 +0000 Subject: [PATCH 186/223] 8333729: C2 SuperWord: remove some @requires usages in test/hotspot/jtreg/compiler/loopopts/superword Reviewed-by: rschmelter Backport-of: 7b38bfea331437ad99277032de7fce939303abc8 --- .../superword/CoLocatePackMemoryState.java | 3 +- .../loopopts/superword/RedTest_long.java | 6 +++- .../loopopts/superword/ReductionPerf.java | 5 ++- .../superword/TestCyclicDependency.java | 1 - .../superword/TestDependencyOffsets.java | 6 ++-- .../superword/TestGeneralizedReductions.java | 20 +++++++---- ...tIndependentPacksWithCyclicDependency.java | 9 +++-- ...IndependentPacksWithCyclicDependency2.java | 5 ++- .../superword/TestLargeScaleAndStride.java | 3 +- .../superword/TestMovingLoadBeforeStore.java | 6 ++-- .../superword/TestPeeledReductionNode.java | 5 +-- .../superword/TestPickFirstMemoryState.java | 1 - .../superword/TestPickLastMemoryState.java | 1 - .../TestScheduleReordersScalarMemops.java | 5 ++- .../superword/TestUnorderedReduction.java | 12 +++---- ...norderedReductionPartialVectorization.java | 2 +- .../loopopts/superword/Vec_MulAddS2I.java | 33 ++++++++++++++----- 17 files changed, 70 insertions(+), 53 deletions(-) diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/CoLocatePackMemoryState.java b/test/hotspot/jtreg/compiler/loopopts/superword/CoLocatePackMemoryState.java index 9dc1cf1f031b..c60144da0cda 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/CoLocatePackMemoryState.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/CoLocatePackMemoryState.java @@ -24,12 +24,11 @@ /** * @test - * @requires vm.compiler2.enabled * @bug 8238438 * @summary Tests to select the memory state of the last load in a load pack in SuperWord::co_locate_pack. * * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,compiler.loopopts.superword.CoLocatePackMemoryState::test - * -XX:LoopMaxUnroll=16 compiler.loopopts.superword.CoLocatePackMemoryState + * -XX:+IgnoreUnrecognizedVMOptions -XX:LoopMaxUnroll=16 compiler.loopopts.superword.CoLocatePackMemoryState */ package compiler.loopopts.superword; diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java b/test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java index 27bfa8cec0eb..ee691a91bdad 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java @@ -25,7 +25,6 @@ * @test * @bug 8240248 * @summary Add C2 x86 Superword support for scalar logical reduction optimizations : long test - * @requires vm.bits == "64" * @library /test/lib / * @run driver compiler.loopopts.superword.RedTest_long */ @@ -137,6 +136,7 @@ public static void reductionInit2( failOn = {IRNode.ADD_REDUCTION_VL}) @IR(applyIfCPUFeature = {"avx2", "true"}, applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"}, + applyIfPlatform = {"64-bit", "true"}, counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop public static long sumReductionImplement( long[] a, @@ -154,6 +154,7 @@ public static long sumReductionImplement( failOn = {IRNode.OR_REDUCTION_V}) @IR(applyIfCPUFeature = {"avx2", "true"}, applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"}, + applyIfPlatform = {"64-bit", "true"}, counts = {IRNode.OR_REDUCTION_V, ">= 1", IRNode.OR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop public static long orReductionImplement( long[] a, @@ -171,6 +172,7 @@ public static long orReductionImplement( failOn = {IRNode.AND_REDUCTION_V}) @IR(applyIfCPUFeature = {"avx2", "true"}, applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"}, + applyIfPlatform = {"64-bit", "true"}, counts = {IRNode.AND_REDUCTION_V, ">= 1", IRNode.AND_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop public static long andReductionImplement( long[] a, @@ -188,6 +190,7 @@ public static long andReductionImplement( failOn = {IRNode.XOR_REDUCTION_V}) @IR(applyIfCPUFeature = {"avx2", "true"}, applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"}, + applyIfPlatform = {"64-bit", "true"}, counts = {IRNode.XOR_REDUCTION_V, ">= 1", IRNode.XOR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop public static long xorReductionImplement( long[] a, @@ -205,6 +208,7 @@ public static long xorReductionImplement( failOn = {IRNode.MUL_REDUCTION_VL}) @IR(applyIfCPUFeature = {"avx512dq", "true"}, applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"}, + applyIfPlatform = {"64-bit", "true"}, counts = {IRNode.MUL_REDUCTION_VL, ">= 1", IRNode.MUL_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop public static long mulReductionImplement( long[] a, diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java b/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java index b1495d00548f..591765bb5823 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java @@ -25,11 +25,10 @@ * @test * @bug 8074981 8302652 * @summary Test SuperWord Reduction Perf. - * @requires vm.compiler2.enabled - * @requires vm.simpleArch == "x86" | vm.simpleArch == "x64" | vm.simpleArch == "aarch64" | vm.simpleArch == "riscv64" * @library /test/lib / - * @run main/othervm -Xbatch -XX:LoopUnrollLimit=250 + * @run main/othervm -Xbatch * -XX:CompileCommand=exclude,compiler.loopopts.superword.ReductionPerf::main + * -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 * compiler.loopopts.superword.ReductionPerf */ diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestCyclicDependency.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestCyclicDependency.java index 94e47f3f7479..3849f1b05cf2 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestCyclicDependency.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestCyclicDependency.java @@ -27,7 +27,6 @@ * @bug 8298935 * @summary Writing forward on array creates cyclic dependency * which leads to wrong result, when ignored. - * @requires vm.compiler2.enabled * @library /test/lib / * @run driver TestCyclicDependency */ diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java index c0afe1d66a52..60356b79959a 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java @@ -28,7 +28,7 @@ * Note: CompileCommand Option Vectorize is enabled. * * Note: this test is auto-generated. Please modify / generate with script: - * https://bugs.openjdk.org/browse/JDK-8312570 + * https://bugs.openjdk.org/browse/JDK-8333729 * * Types: int, long, short, char, byte, float, double * Offsets: 0, -1, 1, -2, 2, -3, 3, -4, 4, -7, 7, -8, 8, -14, 14, -16, 16, -18, 18, -20, 20, -31, 31, -32, 32, -63, 63, -64, 64, -65, 65, -128, 128, -129, 129, -192, 192 @@ -93,7 +93,6 @@ * @test id=vanilla-A * @bug 8298935 8310308 8312570 * @summary Test SuperWord: vector size, offsets, dependencies, alignment. - * @requires vm.compiler2.enabled * @library /test/lib / * @run driver compiler.loopopts.superword.TestDependencyOffsets vanilla-A */ @@ -102,7 +101,6 @@ * @test id=vanilla-U * @bug 8298935 8310308 8312570 * @summary Test SuperWord: vector size, offsets, dependencies, alignment. - * @requires vm.compiler2.enabled * @library /test/lib / * @run driver compiler.loopopts.superword.TestDependencyOffsets vanilla-U */ @@ -1266,7 +1264,7 @@ public static void main(String args[]) { "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestDependencyOffsets::init", "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestDependencyOffsets::test*", "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestDependencyOffsets::verify", - "-XX:LoopUnrollLimit=250"); + "-XX:+IgnoreUnrecognizedVMOptions", "-XX:LoopUnrollLimit=250"); if (args.length != 1) { throw new RuntimeException("Test requires exactly one argument!"); diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestGeneralizedReductions.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestGeneralizedReductions.java index 60ecaf0e4c89..7d0916ba6a9d 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestGeneralizedReductions.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestGeneralizedReductions.java @@ -27,7 +27,6 @@ * @summary Test reduction vectorizations that are enabled by performing SLP * reduction analysis on unrolled loops. * @library /test/lib / - * @requires vm.bits == 64 * @run driver compiler.loopopts.superword.TestGeneralizedReductions */ @@ -42,7 +41,7 @@ public class TestGeneralizedReductions { public static void main(String[] args) throws Exception { // Fix maximum number of unrolls for test stability. - TestFramework.runWithFlags("-XX:LoopMaxUnroll=16"); + TestFramework.runWithFlags("-XX:+IgnoreUnrecognizedVMOptions", "-XX:LoopMaxUnroll=16"); } @Run(test = {"testReductionOnGlobalAccumulator", @@ -82,7 +81,9 @@ private static void initArray(long[] array) { } @Test - @IR(applyIfCPUFeature = {"avx2", "true"}, applyIf = {"SuperWordReductions", "true"}, + @IR(applyIfCPUFeature = {"avx2", "true"}, + applyIf = {"SuperWordReductions", "true"}, + applyIfPlatform = {"64-bit", "true"}, counts = {IRNode.ADD_REDUCTION_VI, ">= 1"}) private static long testReductionOnGlobalAccumulator(long[] array) { acc = 0; @@ -93,7 +94,9 @@ private static long testReductionOnGlobalAccumulator(long[] array) { } @Test - @IR(applyIfCPUFeature = {"avx2", "true"}, applyIf = {"SuperWordReductions", "true"}, + @IR(applyIfCPUFeature = {"avx2", "true"}, + applyIf = {"SuperWordReductions", "true"}, + applyIfPlatform = {"64-bit", "true"}, counts = {IRNode.ADD_REDUCTION_VI, ">= 1"}) private static long testReductionOnPartiallyUnrolledLoop(long[] array) { int sum = 0; @@ -105,7 +108,9 @@ private static long testReductionOnPartiallyUnrolledLoop(long[] array) { } @Test - @IR(applyIfCPUFeature = {"avx2", "true"}, applyIf = {"SuperWordReductions", "true"}, + @IR(applyIfCPUFeature = {"avx2", "true"}, + applyIf = {"SuperWordReductions", "true"}, + applyIfPlatform = {"64-bit", "true"}, counts = {IRNode.ADD_REDUCTION_VI, ">= 1"}) private static long testReductionOnLargePartiallyUnrolledLoop(long[] array) { int sum = 0; @@ -128,7 +133,9 @@ private static long testReductionOnLargePartiallyUnrolledLoop(long[] array) { // If this limitation is overcome in the future, the test case should be // turned into a positive one. @Test - @IR(applyIfCPUFeature = {"avx2", "true"}, applyIf = {"SuperWordReductions", "true"}, + @IR(applyIfCPUFeature = {"avx2", "true"}, + applyIf = {"SuperWordReductions", "true"}, + applyIfPlatform = {"64-bit", "true"}, failOn = {IRNode.ADD_REDUCTION_VI}) private static long testReductionOnPartiallyUnrolledLoopWithSwappedInputs(long[] array) { int sum = 0; @@ -142,6 +149,7 @@ private static long testReductionOnPartiallyUnrolledLoopWithSwappedInputs(long[] @Test @IR(applyIfCPUFeature = {"avx2", "true"}, applyIfAnd = {"SuperWordReductions", "true","UsePopCountInstruction", "true"}, + applyIfPlatform = {"64-bit", "true"}, counts = {IRNode.ADD_REDUCTION_VI, ">= 1", IRNode.POPCOUNT_VL, ">= 1"}) private static long testMapReductionOnGlobalAccumulator(long[] array) { diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency.java index b594b446234e..197ae08b6d88 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency.java @@ -27,8 +27,6 @@ * @bug 8304042 * @summary Test some examples with independent packs with cyclic dependency * between the packs. - * @requires vm.bits == 64 - * @requires vm.compiler2.enabled * @modules java.base/jdk.internal.misc * @library /test/lib / * @run driver compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency @@ -78,7 +76,7 @@ public static void main(String args[]) { "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency::test*", "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency::verify", "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency::init", - "-XX:LoopUnrollLimit=1000"); + "-XX:+IgnoreUnrecognizedVMOptions", "-XX:LoopUnrollLimit=1000"); } TestIndependentPacksWithCyclicDependency() { @@ -120,6 +118,7 @@ public void runTest0() { @Test @IR(counts = {IRNode.ADD_VI, "> 0", IRNode.MUL_VF, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) static void test0(int[] dataIa, int[] dataIb, float[] dataFa, float[] dataFb) { for (int i = 0; i < RANGE; i+=2) { @@ -144,6 +143,7 @@ public void runTest1() { @Test @IR(counts = {IRNode.ADD_VI, "> 0", IRNode.MUL_VF, "> 0", IRNode.VECTOR_CAST_F2I, "> 0", IRNode.VECTOR_CAST_I2F, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"}) static void test1(int[] dataIa, int[] dataIb, float[] dataFa, float[] dataFb) { for (int i = 0; i < RANGE; i+=2) { @@ -167,6 +167,7 @@ public void runTest2() { @Test @IR(counts = {IRNode.ADD_VI, "> 0", IRNode.MUL_VI, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) static void test2(int[] dataIa, int[] dataIb, float[] dataFa, float[] dataFb) { for (int i = 0; i < RANGE; i+=2) { @@ -191,6 +192,7 @@ public void runTest3() { @Test @IR(counts = {IRNode.ADD_VI, "> 0", IRNode.MUL_VF, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) static void test3(int[] dataIa, int[] dataIb, float[] dataFa, float[] dataFb) { for (int i = 0; i < RANGE; i+=2) { @@ -267,6 +269,7 @@ public void runTest6() { @Test @IR(counts = {IRNode.ADD_VI, "> 0", IRNode.MUL_VI, "> 0", IRNode.ADD_VF, "> 0"}, + applyIfPlatform = {"64-bit", "true"}, applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"}) static void test6(int[] dataIa, int[] dataIb, float[] dataFa, float[] dataFb, long[] dataLa, long[] dataLb) { diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency2.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency2.java index 867363fb5202..2be7d52c7808 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency2.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency2.java @@ -28,11 +28,10 @@ * @summary Test some examples with independent packs with cyclic dependency * between the packs. * Before fix, this hit: "assert(!is_visited) failed: visit only once" - * @requires vm.compiler2.enabled * @modules java.base/jdk.internal.misc * @library /test/lib / - * @run main/othervm -XX:LoopUnrollLimit=250 - * -XX:CompileCommand=compileonly,compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency2::test + * @run main/othervm -XX:CompileCommand=compileonly,compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency2::test + * -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250 * compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency2 */ diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestLargeScaleAndStride.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestLargeScaleAndStride.java index cfb2931d928d..b3453c24d778 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestLargeScaleAndStride.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestLargeScaleAndStride.java @@ -35,8 +35,7 @@ * @bug 8328938 * @modules java.base/jdk.internal.misc * @library /test/lib / - * @requires vm.compiler2.enabled - * @run main/othervm -XX:+AlignVector compiler.loopopts.superword.TestLargeScaleAndStride + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlignVector compiler.loopopts.superword.TestLargeScaleAndStride */ package compiler.loopopts.superword; diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestMovingLoadBeforeStore.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestMovingLoadBeforeStore.java index 80922aeffe9c..a8c0750c6564 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestMovingLoadBeforeStore.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestMovingLoadBeforeStore.java @@ -24,7 +24,6 @@ /** * @test - * @requires vm.compiler2.enabled * @requires vm.cpu.features ~= ".*avx2.*" * @bug 8316679 8316594 * @summary In SuperWord::output, LoadVector can be moved before StoreVector, but only if it is proven to be safe. @@ -32,9 +31,10 @@ * @modules java.base/jdk.internal.misc * @library /test/lib * @run main/othervm -XX:CompileCommand=compileonly,compiler.loopopts.superword.TestMovingLoadBeforeStore::test* - * -Xbatch -XX:LoopUnrollLimit=100 - * -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM * --add-modules java.base --add-exports java.base/jdk.internal.misc=ALL-UNNAMED + * -Xbatch + * -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM + * -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=100 * compiler.loopopts.superword.TestMovingLoadBeforeStore */ diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestPeeledReductionNode.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestPeeledReductionNode.java index 99e1e2465f8b..b69bff04088b 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestPeeledReductionNode.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestPeeledReductionNode.java @@ -29,8 +29,9 @@ * @library /test/lib * @comment The test is run with -XX:LoopUnrollLimit=32 to prevent unrolling * from fully replacing vectorization. - * @run main/othervm -Xbatch -XX:LoopUnrollLimit=32 - * compiler.loopopts.superword.TestPeeledReductionNode + * @run main/othervm -Xbatch + * -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=32 + * compiler.loopopts.superword.TestPeeledReductionNode */ package compiler.loopopts.superword; diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestPickFirstMemoryState.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestPickFirstMemoryState.java index 488e32c416a8..5d419766aebf 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestPickFirstMemoryState.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestPickFirstMemoryState.java @@ -24,7 +24,6 @@ /** * @test - * @requires vm.compiler2.enabled * @bug 8240281 * @summary Test which needs to select the memory state of the first load in a load pack in SuperWord::co_locate_pack. * diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestPickLastMemoryState.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestPickLastMemoryState.java index 4b71202e99f9..813a7df4cb7b 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestPickLastMemoryState.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestPickLastMemoryState.java @@ -24,7 +24,6 @@ /** * @test - * @requires vm.compiler2.enabled * @bug 8290910 8293216 * @summary Test which needs to select the memory state of the last load in a load pack in SuperWord::co_locate_pack. * diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestScheduleReordersScalarMemops.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestScheduleReordersScalarMemops.java index 416c360d6f18..c54a684c6911 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestScheduleReordersScalarMemops.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestScheduleReordersScalarMemops.java @@ -28,7 +28,6 @@ * @bug 8304720 * @summary Test some examples where non-vectorized memops also need to * be reordered during SuperWord::schedule. - * @requires vm.compiler2.enabled * @modules java.base/jdk.internal.misc * @library /test/lib / * @run driver compiler.loopopts.superword.TestScheduleReordersScalarMemops @@ -55,8 +54,8 @@ public static void main(String args[]) { "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestScheduleReordersScalarMemops::test*", "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestScheduleReordersScalarMemops::verify", "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestScheduleReordersScalarMemops::init", - "-XX:LoopUnrollLimit=1000", - "-XX:-TieredCompilation", "-Xbatch"); + "-XX:-TieredCompilation", "-Xbatch", + "-XX:+IgnoreUnrecognizedVMOptions", "-XX:LoopUnrollLimit=1000"); } TestScheduleReordersScalarMemops() { diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReduction.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReduction.java index 30cdc05bfe5c..eed03b3a4a1d 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReduction.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReduction.java @@ -25,7 +25,6 @@ * @test id=Vanilla-Unaligned * @bug 8302652 8314612 * @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop - * @requires vm.compiler2.enabled * @library /test/lib / * @run driver compiler.loopopts.superword.TestUnorderedReduction Vanilla-Unaligned */ @@ -34,7 +33,6 @@ * @test id=Vanilla-Aligned * @bug 8302652 8314612 * @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop - * @requires vm.compiler2.enabled * @library /test/lib / * @run driver compiler.loopopts.superword.TestUnorderedReduction Vanilla-Aligned */ @@ -43,7 +41,6 @@ * @test id=MaxVectorSize16-Unaligned * @bug 8302652 8314612 * @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop - * @requires vm.compiler2.enabled * @library /test/lib / * @run driver compiler.loopopts.superword.TestUnorderedReduction MaxVectorSize16-Unaligned */ @@ -52,7 +49,6 @@ * @test id=MaxVectorSize32-Aligned * @bug 8302652 8314612 * @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop - * @requires vm.compiler2.enabled * @library /test/lib / * @run driver compiler.loopopts.superword.TestUnorderedReduction MaxVectorSize32-Aligned */ @@ -75,10 +71,10 @@ public static void main(String[] args) { } switch (args[0]) { - case "Vanilla-Unaligned" -> { framework.addFlags("-XX:-AlignVector"); } - case "Vanilla-Aligned" -> { framework.addFlags("-XX:+AlignVector"); } - case "MaxVectorSize16-Unaligned" -> { framework.addFlags("-XX:-AlignVector", "-XX:MaxVectorSize=16"); } - case "MaxVectorSize32-Aligned" -> { framework.addFlags("-XX:+AlignVector", "-XX:MaxVectorSize=32"); } + case "Vanilla-Unaligned" -> { framework.addFlags("-XX:+IgnoreUnrecognizedVMOptions", "-XX:-AlignVector"); } + case "Vanilla-Aligned" -> { framework.addFlags("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AlignVector"); } + case "MaxVectorSize16-Unaligned" -> { framework.addFlags("-XX:+IgnoreUnrecognizedVMOptions", "-XX:-AlignVector", "-XX:MaxVectorSize=16"); } + case "MaxVectorSize32-Aligned" -> { framework.addFlags("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AlignVector", "-XX:MaxVectorSize=32"); } default -> { throw new RuntimeException("Test argument not recognized: " + args[0]); } } framework.start(); diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java index 431bbe9ac4f4..5fe6658ff686 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java @@ -26,7 +26,6 @@ * @bug JDK-8310130 * @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop * Here a case with partial vectorization of the reduction. - * @requires vm.bits == "64" * @library /test/lib / * @run driver compiler.loopopts.superword.TestUnorderedReductionPartialVectorization */ @@ -62,6 +61,7 @@ public void runTests() throws Exception { @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0", IRNode.VECTOR_CAST_I2L, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0", IRNode.OR_REDUCTION_V, "> 0",}, + applyIfPlatform = {"64-bit", "true"}, applyIfCPUFeatureOr = {"avx2", "true"}) static long test1(int[] data, long sum) { for (int i = 0; i < data.length; i++) { diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/Vec_MulAddS2I.java b/test/hotspot/jtreg/compiler/loopopts/superword/Vec_MulAddS2I.java index f63692871adb..d595e914ff40 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/Vec_MulAddS2I.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/Vec_MulAddS2I.java @@ -27,47 +27,62 @@ * @bug 8214751 * @summary Test operations in C2 MulAddS2I and MulAddVS2VI nodes. * @library /test/lib - * @requires vm.compiler2.enabled * - * @run main/othervm -XX:LoopUnrollLimit=250 + * @run main/othervm + * -XX:+IgnoreUnrecognizedVMOptions + * -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 * -XX:+UseSuperWord * -XX:LoopMaxUnroll=2 * compiler.loopopts.superword.Vec_MulAddS2I - * @run main/othervm -XX:LoopUnrollLimit=250 + * @run main/othervm + * -XX:+IgnoreUnrecognizedVMOptions + * -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 * -XX:-UseSuperWord * -XX:LoopMaxUnroll=2 * compiler.loopopts.superword.Vec_MulAddS2I * - * @run main/othervm -XX:LoopUnrollLimit=250 + * @run main/othervm + * -XX:+IgnoreUnrecognizedVMOptions + * -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 * -XX:+UseSuperWord * -XX:LoopMaxUnroll=4 * compiler.loopopts.superword.Vec_MulAddS2I - * @run main/othervm -XX:LoopUnrollLimit=250 + * @run main/othervm + * -XX:+IgnoreUnrecognizedVMOptions + * -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 * -XX:-UseSuperWord * -XX:LoopMaxUnroll=4 * compiler.loopopts.superword.Vec_MulAddS2I * - * @run main/othervm -XX:LoopUnrollLimit=250 + * @run main/othervm + * -XX:+IgnoreUnrecognizedVMOptions + * -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 * -XX:+UseSuperWord * -XX:LoopMaxUnroll=8 * compiler.loopopts.superword.Vec_MulAddS2I - * @run main/othervm -XX:LoopUnrollLimit=250 + * @run main/othervm + * -XX:+IgnoreUnrecognizedVMOptions + * -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 * -XX:-UseSuperWord * -XX:LoopMaxUnroll=8 * compiler.loopopts.superword.Vec_MulAddS2I * - * @run main/othervm -XX:LoopUnrollLimit=250 + * @run main/othervm + * -XX:+IgnoreUnrecognizedVMOptions + * -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 * -XX:+UseSuperWord * -XX:LoopMaxUnroll=16 * compiler.loopopts.superword.Vec_MulAddS2I - * @run main/othervm -XX:LoopUnrollLimit=250 + * @run main/othervm + * -XX:+IgnoreUnrecognizedVMOptions + * -XX:LoopUnrollLimit=250 * -XX:CompileThresholdScaling=0.1 * -XX:-UseSuperWord * -XX:LoopMaxUnroll=16 From 349c1d6dca4b59be7b3ff8f121e54fa8162ee8e9 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 15 Apr 2026 19:07:06 +0000 Subject: [PATCH 187/223] 8350808: Small typos in JShell method SnippetEvent.toString() Backport-of: 6012e8d2505af786bd4f17cf56b1e81a102485d4 --- .../classes/jdk/jshell/SnippetEvent.java | 8 +-- .../jdk/jshell/SnippetEventToStringTest.java | 63 +++++++++++++++++++ 2 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 test/langtools/jdk/jshell/SnippetEventToStringTest.java diff --git a/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java b/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java index f18fa429339b..0c80b6d43881 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -148,9 +148,9 @@ public String toString() { ",previousStatus=" + previousStatus + ",status=" + status + ",isSignatureChange=" + isSignatureChange + - ",causeSnippet" + causeSnippet + - (value == null? "" : "value=" + value) + - (exception == null? "" : "exception=" + exception) + + ",causeSnippet=" + causeSnippet + + (value == null? "" : ",value=" + value) + + (exception == null? "" : ",exception=" + exception) + ")"; } } diff --git a/test/langtools/jdk/jshell/SnippetEventToStringTest.java b/test/langtools/jdk/jshell/SnippetEventToStringTest.java new file mode 100644 index 000000000000..7d2de3879518 --- /dev/null +++ b/test/langtools/jdk/jshell/SnippetEventToStringTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2025, 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 8350808 + * @summary Check for proper formatting of SnippetEvent.toString() + * @run testng SnippetEventToStringTest + */ + +import java.util.Map; +import java.util.List; + +import jdk.jshell.JShell; +import jdk.jshell.SnippetEvent; +import jdk.jshell.execution.LocalExecutionControlProvider; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + +public class SnippetEventToStringTest { + + @DataProvider(name = "cases") + public String[][] sourceLevels() { + return new String[][] { + { "*", ",causeSnippet=null" }, + { "123", ",value=123" }, + { "throw new Exception(\"foo\");", ",exception=jdk.jshell.EvalException: foo" } + }; + } + + @Test(dataProvider = "cases") + private void verifySnippetEvent(String source, String match) { + try (JShell jsh = JShell.builder().executionEngine(new LocalExecutionControlProvider(), Map.of()).build()) { + List result = jsh.eval(source); + assertEquals(result.size(), 1); + String string = result.get(0).toString(); + if (!string.contains(match)) + throw new AssertionError(String.format("\"%s\" not found in \"%s\"", match, string)); + } + } +} From 4cca66e9ae451a7be9dd0755da26f5f2af59e313 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 15 Apr 2026 19:08:57 +0000 Subject: [PATCH 188/223] 8341833: incomplete snippet from loaded files from command line is ignored Reviewed-by: rschmelter Backport-of: 3c7f78c066b303d32defeda95d617fd90dc6e066 --- .../jdk/internal/jshell/tool/JShellTool.java | 3 ++ .../jshell/tool/resources/l10n.properties | 1 + .../langtools/jdk/jshell/StartOptionTest.java | 33 ++++++++++++++++++- .../jdk/jshell/ToolProviderTest.java | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java index 0ff0c75efd46..1de13400338b 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java @@ -1290,6 +1290,9 @@ private String getInput(String initial) throws IOException{ continue; } if (line == null) { + if (!src.isEmpty()) { + errormsg("jshell.err.incomplete.input", src); + } //EOF if (input.interactiveOutput()) { // End after user ctrl-D diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties index 56af7e2b7433..26f20ad8d70b 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties @@ -169,6 +169,7 @@ jshell.err.exception.thrown = Exception {0} jshell.err.exception.thrown.message = Exception {0}: {1} jshell.err.exception.cause = Caused by: {0} jshell.err.exception.cause.message = Caused by: {0}: {1} +jshell.err.incomplete.input = Incomplete input: {0} jshell.console.see.synopsis = jshell.console.see.full.documentation = diff --git a/test/langtools/jdk/jshell/StartOptionTest.java b/test/langtools/jdk/jshell/StartOptionTest.java index aa8d9be03a9e..3f4a86bff0a5 100644 --- a/test/langtools/jdk/jshell/StartOptionTest.java +++ b/test/langtools/jdk/jshell/StartOptionTest.java @@ -22,12 +22,13 @@ */ /* - * @test 8151754 8080883 8160089 8170162 8166581 8172102 8171343 8178023 8186708 8179856 8185840 8190383 + * @test 8151754 8080883 8160089 8170162 8166581 8172102 8171343 8178023 8186708 8179856 8185840 8190383 8341833 * @summary Testing startExCe-up options. * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.jdeps/com.sun.tools.javap * jdk.jshell/jdk.internal.jshell.tool + * jdk.jshell/jdk.internal.jshell.tool.resources:+open * @library /tools/lib * @build Compiler toolbox.ToolBox * @run testng StartOptionTest @@ -38,13 +39,16 @@ import java.io.PrintStream; import java.nio.charset.StandardCharsets; import java.nio.file.Path; +import java.text.MessageFormat; import java.util.HashMap; import java.util.Locale; +import java.util.ResourceBundle; import java.util.function.Consumer; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; +import jdk.jshell.JShell; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -126,6 +130,14 @@ protected void startExCoUoCeCn(Consumer checkExitCode, check(usererr, null, "usererr"); } + protected void startCheckError(Consumer checkError, + String... args) { + runShell(args); + check(cmderr, checkError, "userout"); + check(userout, null, "userout"); + check(usererr, null, "usererr"); + } + // Start with an exit code and command error check protected void startExCe(int eec, Consumer checkError, String... args) { StartOptionTest.this.startExCoUoCeCn( @@ -358,6 +370,25 @@ public void testShowVersion() { "--show-version"); } + public void testErroneousFile() { + String code = """ + var v = ( + System.console().readLine("prompt: "); + /exit + """; + String readLinePrompt = writeToFile(code); + String expectedErrorFormat = + ResourceBundle.getBundle("jdk.internal.jshell.tool.resources.l10n", + Locale.getDefault(), + JShell.class.getModule()) + .getString("jshell.err.incomplete.input"); + String expectedError = + new MessageFormat(expectedErrorFormat).format(new Object[] {code}); + startCheckError(s -> assertEquals(s, expectedError), + readLinePrompt); + } + + @AfterMethod public void tearDown() { cmdout = null; diff --git a/test/langtools/jdk/jshell/ToolProviderTest.java b/test/langtools/jdk/jshell/ToolProviderTest.java index be8ba23f7c48..2209b08a0e1a 100644 --- a/test/langtools/jdk/jshell/ToolProviderTest.java +++ b/test/langtools/jdk/jshell/ToolProviderTest.java @@ -34,6 +34,7 @@ * jdk.compiler/com.sun.tools.javac.main * jdk.jdeps/com.sun.tools.javap * jdk.jshell/jdk.internal.jshell.tool + * jdk.jshell/jdk.internal.jshell.tool.resources:+open * @library /tools/lib * @build Compiler toolbox.ToolBox * @run testng ToolProviderTest From 218a2dcd6f4909f550a42bac9f30589209b62909 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 15 Apr 2026 19:18:44 +0000 Subject: [PATCH 189/223] 8359364: java/net/URL/EarlyOrDelayedParsing test fails intermittently Backport-of: 57cabc6d741c14a8029aec324ba96e8ced4afcbd --- .../java/net/URL/EarlyOrDelayedParsing.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/jdk/java/net/URL/EarlyOrDelayedParsing.java b/test/jdk/java/net/URL/EarlyOrDelayedParsing.java index 57fa76c23bb8..e286631be6b3 100644 --- a/test/jdk/java/net/URL/EarlyOrDelayedParsing.java +++ b/test/jdk/java/net/URL/EarlyOrDelayedParsing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -38,6 +38,10 @@ import java.io.IOException; import java.net.ConnectException; import java.net.MalformedURLException; +import java.net.Proxy; +import java.net.ProxySelector; +import java.net.SocketAddress; +import java.net.URI; import java.net.URL; import java.net.UnknownHostException; import java.util.ArrayList; @@ -57,6 +61,19 @@ public class EarlyOrDelayedParsing { { String value = System.getProperty("jdk.net.url.delayParsing", "false"); EARLY_PARSING = !value.isEmpty() && !Boolean.parseBoolean(value); + if (!EARLY_PARSING) { + // we will open the connection in that case. + // make sure no proxy is selected + ProxySelector.setDefault(new ProxySelector() { + @Override + public List select(URI uri) { + return List.of(Proxy.NO_PROXY); + } + @Override + public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { + } + }); + } } // Some characters that when included at the wrong place From 8723275b9c73cf55a20b3b46153e0353f7e0e41f Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 15 Apr 2026 19:25:11 +0000 Subject: [PATCH 190/223] 8373239: Test java/awt/print/PrinterJob/PageRanges.java fails with incorrect selection of printed pages Backport-of: 1161a640abe454b47de95ed73452a78535160deb --- .../windows/classes/sun/awt/windows/WPrinterJob.java | 6 +++++- test/jdk/java/awt/print/PrinterJob/PageRanges.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java b/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java index 85b4866e2323..14fb10849cf3 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, 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 @@ -1742,6 +1742,10 @@ private void setRangeCopiesAttribute(int from, int to, boolean isRangeSet, if (isRangeSet) { attributes.add(new PageRanges(from, to)); setPageRange(from, to); + } else { + attributes.remove(PageRanges.class); + setPageRange(Pageable.UNKNOWN_NUMBER_OF_PAGES, + Pageable.UNKNOWN_NUMBER_OF_PAGES); } defaultCopies = false; attributes.add(new Copies(copies)); diff --git a/test/jdk/java/awt/print/PrinterJob/PageRanges.java b/test/jdk/java/awt/print/PrinterJob/PageRanges.java index d446460c52d4..9fa28693f620 100644 --- a/test/jdk/java/awt/print/PrinterJob/PageRanges.java +++ b/test/jdk/java/awt/print/PrinterJob/PageRanges.java @@ -23,7 +23,7 @@ /* * @test - * @bug 6575331 8297191 + * @bug 6575331 8297191 8373239 * @key printer * @summary The specified pages should be printed. * @library /java/awt/regtesthelpers From 2f48fbf0eba2527b177dcabe3cc0a8caf5065003 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 15 Apr 2026 19:30:27 +0000 Subject: [PATCH 191/223] 8378417: Printing All pages results in NPE for 1.1 PrintJob Backport-of: 623ab91b0a6ee3c957c36adb179fc4baea770b6d --- .../classes/sun/awt/windows/WPrinterJob.java | 4 +- .../awt/PrintJob/TestPrintNoException.java | 61 +++++++++++++++++++ .../java/awt/print/PrinterJob/PageRanges.java | 2 +- 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 test/jdk/java/awt/PrintJob/TestPrintNoException.java diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java b/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java index 14fb10849cf3..5e0e8e44b75d 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java @@ -1743,7 +1743,9 @@ private void setRangeCopiesAttribute(int from, int to, boolean isRangeSet, attributes.add(new PageRanges(from, to)); setPageRange(from, to); } else { - attributes.remove(PageRanges.class); + // Sets default values for PageRange attribute and setPageRange + attributes.add(new PageRanges(1, + Integer.MAX_VALUE)); setPageRange(Pageable.UNKNOWN_NUMBER_OF_PAGES, Pageable.UNKNOWN_NUMBER_OF_PAGES); } diff --git a/test/jdk/java/awt/PrintJob/TestPrintNoException.java b/test/jdk/java/awt/PrintJob/TestPrintNoException.java new file mode 100644 index 000000000000..b54ac8de56bd --- /dev/null +++ b/test/jdk/java/awt/PrintJob/TestPrintNoException.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2026, 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.awt.Frame; +import java.awt.JobAttributes; +import java.awt.PrintJob; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.KeyEvent; + +/* + * @test + * @bug 8378417 + * @key headful printer + * @summary Verifies No Exception is thrown when Printing "All" pages + * @run main TestPrintNoException + */ + +public class TestPrintNoException { + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + Thread t = new Thread (() -> { + robot.delay(5000); + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + robot.waitForIdle(); + }); + + Frame testFrame = new Frame("print"); + try { + t.start(); + PrintJob pj = Toolkit.getDefaultToolkit().getPrintJob(testFrame, null, null); + if (pj != null) { + pj.end(); + } + } finally { + testFrame.dispose(); + } + } +} diff --git a/test/jdk/java/awt/print/PrinterJob/PageRanges.java b/test/jdk/java/awt/print/PrinterJob/PageRanges.java index 9fa28693f620..c5d05cbce354 100644 --- a/test/jdk/java/awt/print/PrinterJob/PageRanges.java +++ b/test/jdk/java/awt/print/PrinterJob/PageRanges.java @@ -23,7 +23,7 @@ /* * @test - * @bug 6575331 8297191 8373239 + * @bug 6575331 8297191 8373239 8378417 * @key printer * @summary The specified pages should be printed. * @library /java/awt/regtesthelpers From 8ab61c7f588e39bd389fccd8214f20e9bca03470 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 16 Apr 2026 13:44:43 +0000 Subject: [PATCH 192/223] 8382047: Update Libpng to 1.6.57 Reviewed-by: andrew Backport-of: 20e8ea0e0640bf8b0727cf30ced041a1def9c350 --- src/java.desktop/share/legal/libpng.md | 3 +- .../native/libsplashscreen/libpng/CHANGES | 11 ++++ .../native/libsplashscreen/libpng/README | 2 +- .../share/native/libsplashscreen/libpng/png.c | 4 +- .../share/native/libsplashscreen/libpng/png.h | 14 ++--- .../native/libsplashscreen/libpng/pngconf.h | 2 +- .../libsplashscreen/libpng/pnglibconf.h | 2 +- .../native/libsplashscreen/libpng/pngrtran.c | 28 +++++----- .../native/libsplashscreen/libpng/pngset.c | 54 +++++++++++++++++-- 9 files changed, 89 insertions(+), 31 deletions(-) diff --git a/src/java.desktop/share/legal/libpng.md b/src/java.desktop/share/legal/libpng.md index 034de22bf25f..7783fc7ff032 100644 --- a/src/java.desktop/share/legal/libpng.md +++ b/src/java.desktop/share/legal/libpng.md @@ -1,4 +1,4 @@ -## libpng v1.6.56 +## libpng v1.6.57 ### libpng License
@@ -180,6 +180,7 @@ Authors, for copyright and licensing purposes.
  * Mans Rullgard
  * Matt Sarett
  * Mike Klein
+ * Mohammad Seet
  * Pascal Massimino
  * Paul Schmidt
  * Petr Simecek
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
index 673d4d50420f..ba81df0c0e61 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
@@ -6368,6 +6368,17 @@ Version 1.6.56 [March 25, 2026]
     (Contributed by Bob Friesenhahn and Philippe Antoine.)
   Performed various refactorings and cleanups.
 
+Version 1.6.57 [April 8, 2026]
+  Fixed CVE-2026-34757 (medium severity):
+    Use-after-free in `png_set_PLTE`, `png_set_tRNS` and `png_set_hIST`
+    leading to corrupted chunk data and potential heap information disclosure.
+    Also hardened the append-style setters (`png_set_text`, `png_set_sPLT`,
+    `png_set_unknown_chunks`) against a theoretical variant of the same
+    aliasing pattern.
+    (Reported by Iv4n .)
+  Fixed integer overflow in rowbytes computation in read transforms.
+    (Contributed by Mohammad Seet.)
+
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
 Subscription is required; visit
 
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/README b/src/java.desktop/share/native/libsplashscreen/libpng/README
index d0b085f79334..179b8dc8cb4d 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/README
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/README
@@ -1,4 +1,4 @@
-README for libpng version 1.6.56
+README for libpng version 1.6.57
 ================================
 
 See the note about version numbers near the top of `png.h`.
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.c b/src/java.desktop/share/native/libsplashscreen/libpng/png.c
index fd095b515b91..e4e13b0a6840 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/png.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.c
@@ -42,7 +42,7 @@
 #include "pngpriv.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_56 Your_png_h_is_not_version_1_6_56;
+typedef png_libpng_version_1_6_57 Your_png_h_is_not_version_1_6_57;
 
 /* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the
  * corresponding macro definitions.  This causes a compile time failure if
@@ -849,7 +849,7 @@ png_get_copyright(png_const_structrp png_ptr)
    return PNG_STRING_COPYRIGHT
 #else
    return PNG_STRING_NEWLINE \
-      "libpng version 1.6.56" PNG_STRING_NEWLINE \
+      "libpng version 1.6.57" PNG_STRING_NEWLINE \
       "Copyright (c) 2018-2026 Cosmin Truta" PNG_STRING_NEWLINE \
       "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
       PNG_STRING_NEWLINE \
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.h b/src/java.desktop/share/native/libsplashscreen/libpng/png.h
index 56ec204cd1a4..349e7d073831 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/png.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.h
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * libpng version 1.6.56
+ * libpng version 1.6.57
  *
  * Copyright (c) 2018-2026 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
@@ -43,7 +43,7 @@
  *   libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
  *   libpng versions 0.97, January 1998, through 1.6.35, July 2018:
  *     Glenn Randers-Pehrson
- *   libpng versions 1.6.36, December 2018, through 1.6.56, March 2026:
+ *   libpng versions 1.6.36, December 2018, through 1.6.57, April 2026:
  *     Cosmin Truta
  *   See also "Contributing Authors", below.
  */
@@ -267,7 +267,7 @@
  *    ...
  *    1.5.30                  15    10530  15.so.15.30[.0]
  *    ...
- *    1.6.56                  16    10656  16.so.16.56[.0]
+ *    1.6.57                  16    10657  16.so.16.57[.0]
  *
  *    Henceforth the source version will match the shared-library major and
  *    minor numbers; the shared-library major version number will be used for
@@ -303,7 +303,7 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.56"
+#define PNG_LIBPNG_VER_STRING "1.6.57"
 #define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
 
 /* The versions of shared library builds should stay in sync, going forward */
@@ -314,7 +314,7 @@
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MINOR   6
-#define PNG_LIBPNG_VER_RELEASE 56
+#define PNG_LIBPNG_VER_RELEASE 57
 
 /* This should be zero for a public release, or non-zero for a
  * development version.
@@ -345,7 +345,7 @@
  * From version 1.0.1 it is:
  * XXYYZZ, where XX=major, YY=minor, ZZ=release
  */
-#define PNG_LIBPNG_VER 10656 /* 1.6.56 */
+#define PNG_LIBPNG_VER 10657 /* 1.6.57 */
 
 /* Library configuration: these options cannot be changed after
  * the library has been built.
@@ -455,7 +455,7 @@ extern "C" {
 /* This triggers a compiler error in png.c, if png.c and png.h
  * do not agree upon the version number.
  */
-typedef char *png_libpng_version_1_6_56;
+typedef char *png_libpng_version_1_6_57;
 
 /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
  *
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
index 5772e6ebb1c8..1a5bb7b60f8a 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * libpng version 1.6.56
+ * libpng version 1.6.57
  *
  * Copyright (c) 2018-2026 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
index 4a7e51d112dc..de63c9989279 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
@@ -31,7 +31,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  */
-/* libpng version 1.6.56 */
+/* libpng version 1.6.57 */
 
 /* Copyright (c) 2018-2026 Cosmin Truta */
 /* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
index f0972ba9bef9..838c8460f910 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
@@ -2408,7 +2408,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
       }
       row_info->bit_depth = 8;
       row_info->pixel_depth = (png_byte)(8 * row_info->channels);
-      row_info->rowbytes = row_width * row_info->channels;
+      row_info->rowbytes = (size_t)row_width * row_info->channels;
    }
 }
 #endif
@@ -2610,7 +2610,7 @@ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
 
       row_info->bit_depth = 8;
       row_info->pixel_depth = (png_byte)(8 * row_info->channels);
-      row_info->rowbytes = row_info->width * row_info->channels;
+      row_info->rowbytes = (size_t)row_info->width * row_info->channels;
    }
 }
 #endif
@@ -2638,7 +2638,7 @@ png_do_chop(png_row_infop row_info, png_bytep row)
 
       row_info->bit_depth = 8;
       row_info->pixel_depth = (png_byte)(8 * row_info->channels);
-      row_info->rowbytes = row_info->width * row_info->channels;
+      row_info->rowbytes = (size_t)row_info->width * row_info->channels;
    }
 }
 #endif
@@ -2874,7 +2874,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
             *(--dp) = lo_filler;
             row_info->channels = 2;
             row_info->pixel_depth = 16;
-            row_info->rowbytes = row_width * 2;
+            row_info->rowbytes = (size_t)row_width * 2;
          }
 
          else
@@ -2889,7 +2889,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
             }
             row_info->channels = 2;
             row_info->pixel_depth = 16;
-            row_info->rowbytes = row_width * 2;
+            row_info->rowbytes = (size_t)row_width * 2;
          }
       }
 
@@ -2912,7 +2912,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
             *(--dp) = hi_filler;
             row_info->channels = 2;
             row_info->pixel_depth = 32;
-            row_info->rowbytes = row_width * 4;
+            row_info->rowbytes = (size_t)row_width * 4;
          }
 
          else
@@ -2929,7 +2929,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
             }
             row_info->channels = 2;
             row_info->pixel_depth = 32;
-            row_info->rowbytes = row_width * 4;
+            row_info->rowbytes = (size_t)row_width * 4;
          }
       }
 #endif
@@ -2953,7 +2953,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
             *(--dp) = lo_filler;
             row_info->channels = 4;
             row_info->pixel_depth = 32;
-            row_info->rowbytes = row_width * 4;
+            row_info->rowbytes = (size_t)row_width * 4;
          }
 
          else
@@ -2970,7 +2970,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
             }
             row_info->channels = 4;
             row_info->pixel_depth = 32;
-            row_info->rowbytes = row_width * 4;
+            row_info->rowbytes = (size_t)row_width * 4;
          }
       }
 
@@ -2997,7 +2997,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
             *(--dp) = hi_filler;
             row_info->channels = 4;
             row_info->pixel_depth = 64;
-            row_info->rowbytes = row_width * 8;
+            row_info->rowbytes = (size_t)row_width * 8;
          }
 
          else
@@ -3019,7 +3019,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
 
             row_info->channels = 4;
             row_info->pixel_depth = 64;
-            row_info->rowbytes = row_width * 8;
+            row_info->rowbytes = (size_t)row_width * 8;
          }
       }
 #endif
@@ -4513,7 +4513,7 @@ png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info,
                }
                row_info->bit_depth = 8;
                row_info->pixel_depth = 32;
-               row_info->rowbytes = row_width * 4;
+               row_info->rowbytes = (size_t)row_width * 4;
                row_info->color_type = 6;
                row_info->channels = 4;
             }
@@ -4521,7 +4521,7 @@ png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info,
             else
             {
                sp = row + (size_t)row_width - 1;
-               dp = row + (size_t)(row_width * 3) - 1;
+               dp = row + (size_t)row_width * 3 - 1;
                i = 0;
 #ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
                i = png_do_expand_palette_rgb8_neon(png_ptr, row_info, row,
@@ -4540,7 +4540,7 @@ png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info,
 
                row_info->bit_depth = 8;
                row_info->pixel_depth = 24;
-               row_info->rowbytes = row_width * 3;
+               row_info->rowbytes = (size_t)row_width * 3;
                row_info->color_type = 2;
                row_info->channels = 3;
             }
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c
index 05d18cd06b74..29082a6be089 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c
@@ -414,6 +414,7 @@ void PNGAPI
 png_set_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
     png_const_uint_16p hist)
 {
+   png_uint_16 safe_hist[PNG_MAX_PALETTE_LENGTH];
    int i;
 
    png_debug1(1, "in %s storage function", "hIST");
@@ -430,6 +431,13 @@ png_set_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
       return;
    }
 
+   /* Snapshot the caller's hist before freeing, in case it points to
+    * info_ptr->hist (getter-to-setter aliasing).
+    */
+   memcpy(safe_hist, hist, (unsigned int)info_ptr->num_palette *
+       (sizeof (png_uint_16)));
+   hist = safe_hist;
+
    png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
 
    /* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in
@@ -771,7 +779,7 @@ void PNGAPI
 png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
     png_const_colorp palette, int num_palette)
 {
-
+   png_color safe_palette[PNG_MAX_PALETTE_LENGTH];
    png_uint_32 max_palette_length;
 
    png_debug1(1, "in %s storage function", "PLTE");
@@ -805,6 +813,15 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
       png_error(png_ptr, "Invalid palette");
    }
 
+   /* Snapshot the caller's palette before freeing, in case it points to
+    * info_ptr->palette (getter-to-setter aliasing).
+    */
+   if (num_palette > 0)
+      memcpy(safe_palette, palette, (unsigned int)num_palette *
+          (sizeof (png_color)));
+
+   palette = safe_palette;
+
    png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
 
    /* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
@@ -966,6 +983,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
     png_const_textp text_ptr, int num_text)
 {
    int i;
+   png_textp old_text = NULL;
 
    png_debug1(1, "in text storage function, chunk typeid = 0x%lx",
       png_ptr == NULL ? 0xabadca11UL : (unsigned long)png_ptr->chunk_name);
@@ -1013,7 +1031,10 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
          return 1;
       }
 
-      png_free(png_ptr, info_ptr->text);
+      /* Defer freeing the old array until after the copy loop below,
+       * in case text_ptr aliases info_ptr->text (getter-to-setter).
+       */
+      old_text = info_ptr->text;
 
       info_ptr->text = new_text;
       info_ptr->free_me |= PNG_FREE_TEXT;
@@ -1098,6 +1119,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
       {
          png_chunk_report(png_ptr, "text chunk: out of memory",
              PNG_CHUNK_WRITE_ERROR);
+         png_free(png_ptr, old_text);
 
          return 1;
       }
@@ -1151,6 +1173,8 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
       png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
    }
 
+   png_free(png_ptr, old_text);
+
    return 0;
 }
 #endif
@@ -1194,6 +1218,16 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
 
    if (trans_alpha != NULL)
    {
+       /* Snapshot the caller's trans_alpha before freeing, in case it
+        * points to info_ptr->trans_alpha (getter-to-setter aliasing).
+        */
+       png_byte safe_trans[PNG_MAX_PALETTE_LENGTH];
+
+       if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
+          memcpy(safe_trans, trans_alpha, (size_t)num_trans);
+
+       trans_alpha = safe_trans;
+
        png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
 
        if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
@@ -1278,6 +1312,7 @@ png_set_sPLT(png_const_structrp png_ptr,
  */
 {
    png_sPLT_tp np;
+   png_sPLT_tp old_spalettes;
 
    png_debug1(1, "in %s storage function", "sPLT");
 
@@ -1298,7 +1333,10 @@ png_set_sPLT(png_const_structrp png_ptr,
       return;
    }
 
-   png_free(png_ptr, info_ptr->splt_palettes);
+   /* Defer freeing the old array until after the copy loop below,
+    * in case entries aliases info_ptr->splt_palettes (getter-to-setter).
+    */
+   old_spalettes = info_ptr->splt_palettes;
 
    info_ptr->splt_palettes = np;
    info_ptr->free_me |= PNG_FREE_SPLT;
@@ -1362,6 +1400,8 @@ png_set_sPLT(png_const_structrp png_ptr,
    }
    while (--nentries);
 
+   png_free(png_ptr, old_spalettes);
+
    if (nentries > 0)
       png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
 }
@@ -1410,6 +1450,7 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
     png_inforp info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)
 {
    png_unknown_chunkp np;
+   png_unknown_chunkp old_unknowns;
 
    if (png_ptr == NULL || info_ptr == NULL || num_unknowns <= 0 ||
        unknowns == NULL)
@@ -1456,7 +1497,10 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
       return;
    }
 
-   png_free(png_ptr, info_ptr->unknown_chunks);
+   /* Defer freeing the old array until after the copy loop below,
+    * in case unknowns aliases info_ptr->unknown_chunks (getter-to-setter).
+    */
+   old_unknowns = info_ptr->unknown_chunks;
 
    info_ptr->unknown_chunks = np; /* safe because it is initialized */
    info_ptr->free_me |= PNG_FREE_UNKN;
@@ -1502,6 +1546,8 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
       ++np;
       ++(info_ptr->unknown_chunks_num);
    }
+
+   png_free(png_ptr, old_unknowns);
 }
 
 void PNGAPI

From ba793cd1fa59b73024d77fb52b14d4228bea0ec9 Mon Sep 17 00:00:00 2001
From: Satyen Subramaniam 
Date: Mon, 20 Apr 2026 16:43:20 +0000
Subject: [PATCH 193/223] 8346683: Problem list automated tests that fail on
 macOS15

Backport-of: 30cb94d6b04a2be764a11b38f8bacabc7aaf9388
---
 test/jdk/ProblemList.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
index 9b674a8f86d4..ed665db4007a 100644
--- a/test/jdk/ProblemList.txt
+++ b/test/jdk/ProblemList.txt
@@ -119,6 +119,7 @@ java/awt/Focus/FocusOwnerFrameOnClick/FocusOwnerFrameOnClick.java 8081489 generi
 java/awt/Focus/IconifiedFrameFocusChangeTest/IconifiedFrameFocusChangeTest.java 6849364 generic-all
 java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusToFrontTest.java 6848406 generic-all
 java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusSetVisibleTest.java 6848407 generic-all
+java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java 8340374 macosx-all
 java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java 8022302 generic-all
 java/awt/Frame/RestoreToOppositeScreen/RestoreToOppositeScreen.java 8286840 linux-all
 java/awt/Frame/InitialIconifiedTest.java 7144049,8203920 macosx-all,linux-all
@@ -126,8 +127,9 @@ java/awt/Frame/FocusTest.java 8341480 macosx-all
 java/awt/FileDialog/FileDialogIconTest/FileDialogIconTest.java 8160558 windows-all
 java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java 8060176 windows-all,macosx-all
 java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java 8060176 windows-all,macosx-all
+java/awt/dnd/FileListBetweenJVMsTest/FileListBetweenJVMsTest.java 8353673 macosx-all
 java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.java 8171510 macosx-all
-java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java 8288839 windows-x64
+java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java 8288839 windows-x64,macosx-all
 java/awt/dnd/DragExitBeforeDropTest.java 8242805 macosx-all
 java/awt/dnd/DragThresholdTest.java 8076299 macosx-all
 java/awt/dnd/CustomDragCursorTest.java 8242805 macosx-all

From da55a56513c7b8503dc1c01c3e6ac9b524525243 Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Tue, 21 Apr 2026 05:53:05 +0000
Subject: [PATCH 194/223] 8365623: test/jdk/sun/security/pkcs11/tls/ tests
 skipped without skip exception

Backport-of: f7b5db1a5be2d8a56bb88c7df0451709ab68de49
---
 test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java |  7 +++----
 .../security/pkcs11/tls/TestKeyMaterialChaCha20.java  | 11 +++++------
 .../jdk/sun/security/pkcs11/tls/TestMasterSecret.java |  7 ++++---
 test/jdk/sun/security/pkcs11/tls/TestPRF.java         |  7 ++++---
 test/jdk/sun/security/pkcs11/tls/TestPremaster.java   | 10 +++++-----
 .../sun/security/pkcs11/tls/tls12/FipsModeTLS12.java  | 10 +++++-----
 6 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java b/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java
index 2083dadc5b2e..ac4132ecb2f1 100644
--- a/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java
+++ b/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2025, 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
@@ -36,7 +36,6 @@
 import java.io.BufferedReader;
 import java.nio.file.Files;
 import java.nio.file.Paths;
-import java.security.InvalidAlgorithmParameterException;
 import java.security.Provider;
 import java.security.ProviderException;
 import java.util.Arrays;
@@ -46,6 +45,7 @@
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
 
+import jtreg.SkippedException;
 import sun.security.internal.spec.TlsKeyMaterialParameterSpec;
 import sun.security.internal.spec.TlsKeyMaterialSpec;
 
@@ -61,8 +61,7 @@ public static void main(String[] args) throws Exception {
     @Override
     public void main(Provider provider) throws Exception {
         if (provider.getService("KeyGenerator", "SunTlsKeyMaterial") == null) {
-            System.out.println("Provider does not support algorithm, skipping");
-            return;
+            throw new SkippedException("Provider does not support algorithm, skipping");
         }
 
         try (BufferedReader reader = Files.newBufferedReader(
diff --git a/test/jdk/sun/security/pkcs11/tls/TestKeyMaterialChaCha20.java b/test/jdk/sun/security/pkcs11/tls/TestKeyMaterialChaCha20.java
index 51471fca65ae..b784a3127c62 100644
--- a/test/jdk/sun/security/pkcs11/tls/TestKeyMaterialChaCha20.java
+++ b/test/jdk/sun/security/pkcs11/tls/TestKeyMaterialChaCha20.java
@@ -35,6 +35,8 @@
 import javax.crypto.SecretKey;
 import java.security.Provider;
 import java.security.NoSuchAlgorithmException;
+
+import jtreg.SkippedException;
 import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
 import sun.security.internal.spec.TlsMasterSecretParameterSpec;
 import sun.security.internal.spec.TlsKeyMaterialParameterSpec;
@@ -52,20 +54,17 @@ public void main(Provider provider) throws Exception {
         try {
             kg1 = KeyGenerator.getInstance("SunTlsRsaPremasterSecret", provider);
         } catch (Exception e) {
-            System.out.println("Skipping, SunTlsRsaPremasterSecret KeyGenerator not supported");
-            return;
+            throw new SkippedException("Skipping, SunTlsRsaPremasterSecret KeyGenerator not supported");
         }
         try {
             kg2 = KeyGenerator.getInstance("SunTls12MasterSecret", provider);
         } catch (Exception e) {
-            System.out.println("Skipping, SunTls12MasterSecret KeyGenerator not supported");
-            return;
+            throw new SkippedException("Skipping, SunTls12MasterSecret KeyGenerator not supported");
         }
         try {
             kg3 = KeyGenerator.getInstance("SunTls12KeyMaterial", provider);
         } catch (Exception e) {
-            System.out.println("Skipping, SunTls12KeyMaterial KeyGenerator not supported");
-            return;
+            throw new SkippedException("Skipping, SunTls12KeyMaterial KeyGenerator not supported");
         }
 
         kg1.init(new TlsRsaPremasterSecretParameterSpec(0x0303, 0x0303));
diff --git a/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java b/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java
index 816e76697ced..d47fee98284a 100644
--- a/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java
+++ b/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2025, 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
@@ -43,6 +43,8 @@
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
 import javax.crypto.spec.SecretKeySpec;
+
+import jtreg.SkippedException;
 import sun.security.internal.interfaces.TlsMasterSecret;
 import sun.security.internal.spec.TlsMasterSecretParameterSpec;
 
@@ -57,8 +59,7 @@ public static void main(String[] args) throws Exception {
     @Override
     public void main(Provider provider) throws Exception {
         if (provider.getService("KeyGenerator", "SunTlsMasterSecret") == null) {
-            System.out.println("Not supported by provider, skipping");
-            return;
+            throw new SkippedException("Not supported by provider, skipping");
         }
 
         try (BufferedReader reader = Files.newBufferedReader(
diff --git a/test/jdk/sun/security/pkcs11/tls/TestPRF.java b/test/jdk/sun/security/pkcs11/tls/TestPRF.java
index d99c21d0e568..9682dc700351 100644
--- a/test/jdk/sun/security/pkcs11/tls/TestPRF.java
+++ b/test/jdk/sun/security/pkcs11/tls/TestPRF.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2025, 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
@@ -41,6 +41,8 @@
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
 import javax.crypto.spec.SecretKeySpec;
+
+import jtreg.SkippedException;
 import sun.security.internal.spec.TlsPrfParameterSpec;
 
 public class TestPRF extends PKCS11Test {
@@ -54,8 +56,7 @@ public static void main(String[] args) throws Exception {
     @Override
     public void main(Provider provider) throws Exception {
         if (provider.getService("KeyGenerator", "SunTlsPrf") == null) {
-            System.out.println("Provider does not support algorithm, skipping");
-            return;
+            throw new SkippedException("Provider does not support algorithm, skipping");
         }
 
         try (BufferedReader reader = Files.newBufferedReader(
diff --git a/test/jdk/sun/security/pkcs11/tls/TestPremaster.java b/test/jdk/sun/security/pkcs11/tls/TestPremaster.java
index ebae28c996c7..173ffe69b563 100644
--- a/test/jdk/sun/security/pkcs11/tls/TestPremaster.java
+++ b/test/jdk/sun/security/pkcs11/tls/TestPremaster.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2025, 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
@@ -37,6 +37,8 @@
 import java.security.InvalidAlgorithmParameterException;
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
+
+import jtreg.SkippedException;
 import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
 
 public class TestPremaster extends PKCS11Test {
@@ -49,8 +51,7 @@ public static void main(String[] args) throws Exception {
     public void main(Provider provider) throws Exception {
         if (provider.getService(
                 "KeyGenerator", "SunTlsRsaPremasterSecret") == null) {
-            System.out.println("Not supported by provider, skipping");
-            return;
+            throw new SkippedException("Not supported by provider, skipping");
         }
         KeyGenerator kg;
         kg = KeyGenerator.getInstance("SunTlsRsaPremasterSecret", provider);
@@ -88,8 +89,7 @@ private static void test(KeyGenerator kg,
         } catch (InvalidAlgorithmParameterException iape) {
             // S12 removed support for SSL v3.0
             if (clientVersion == 0x300 || serverVersion == 0x300) {
-                System.out.println("Skip testing SSLv3 due to no support");
-                return;
+                throw new SkippedException("Skip testing SSLv3 due to no support");
             }
             // unexpected, pass it up
             throw iape;
diff --git a/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java b/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java
index eff712024d5c..a07d2d49d27e 100644
--- a/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java
+++ b/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java
@@ -65,6 +65,7 @@
 import javax.net.ssl.TrustManagerFactory;
 
 import jdk.test.lib.security.SecurityUtils;
+import jtreg.SkippedException;
 import sun.security.internal.spec.TlsMasterSecretParameterSpec;
 import sun.security.internal.spec.TlsPrfParameterSpec;
 import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
@@ -88,12 +89,11 @@ public static void main(String[] args) throws Exception {
         try {
             initialize();
         } catch (Exception e) {
-            System.out.println("Test skipped: failure during" +
-                    " initialization");
             if (enableDebug) {
                 System.out.println(e);
             }
-            return;
+            throw new SkippedException("Test skipped: failure during" +
+                                       " initialization");
         }
 
         if (shouldRun()) {
@@ -105,8 +105,8 @@ public static void main(String[] args) throws Exception {
 
             System.out.println("Test PASS - OK");
         } else {
-            System.out.println("Test skipped: TLS 1.2 mechanisms" +
-                    " not supported by current SunPKCS11 back-end");
+            throw new SkippedException("Test skipped: TLS 1.2 mechanisms" +
+                                       " not supported by current SunPKCS11 back-end");
         }
     }
 

From aac3bc57d57e4f3a82e51b26449b2c1d1ab12949 Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Tue, 21 Apr 2026 05:55:17 +0000
Subject: [PATCH 195/223] 8370489: Some compiler tests miss the @key randomness

Reviewed-by: mdoerr
Backport-of: 4975b2d8c5a9dcf70a286003db752b686eeb4ed3
---
 .../jtreg/compiler/c2/TestMinMaxSubword.java  |  1 +
 .../c2/irTests/TestMulNodeIdealization.java   |  3 +-
 .../compiler/c2/irTests/TestShiftAndMask.java |  1 +
 .../loopopts/superword/MinMaxRed_Int.java     |  1 +
 .../loopopts/superword/ReductionPerf.java     |  3 +-
 .../superword/TestDependencyOffsets.java      | 35 +++++++++++++++++++
 .../loopopts/superword/TestMemorySegment.java |  1 +
 .../jtreg/compiler/vectorapi/Test8278948.java |  3 +-
 .../TestVectorCompressExpandBits.java         |  1 +
 .../vectorization/TestAutoVecIntMinMax.java   |  1 +
 .../vectorization/TestEor3AArch64.java        |  1 +
 .../vectorization/TestMacroLogicVector.java   |  3 +-
 .../vectorization/TestVectorZeroCount.java    | 12 +++----
 13 files changed, 56 insertions(+), 10 deletions(-)

diff --git a/test/hotspot/jtreg/compiler/c2/TestMinMaxSubword.java b/test/hotspot/jtreg/compiler/c2/TestMinMaxSubword.java
index 955aa4058f04..a7e90353f905 100644
--- a/test/hotspot/jtreg/compiler/c2/TestMinMaxSubword.java
+++ b/test/hotspot/jtreg/compiler/c2/TestMinMaxSubword.java
@@ -31,6 +31,7 @@
 /*
  * @test
  * @bug 8294816
+ * @key randomness
  * @summary Test Math.min/max vectorization miscompilation for integer subwords
  * @library /test/lib /
  * @requires vm.compiler2.enabled
diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestMulNodeIdealization.java b/test/hotspot/jtreg/compiler/c2/irTests/TestMulNodeIdealization.java
index ca6d5fbe1185..e0307f2eb981 100644
--- a/test/hotspot/jtreg/compiler/c2/irTests/TestMulNodeIdealization.java
+++ b/test/hotspot/jtreg/compiler/c2/irTests/TestMulNodeIdealization.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, 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
@@ -31,6 +31,7 @@
 /*
  * @test
  * @bug 8291336
+ * @key randomness
  * @summary Test that transformation of multiply-by-2 is appropriately turned into additions.
  * @library /test/lib /
  * @requires vm.compiler2.enabled
diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestShiftAndMask.java b/test/hotspot/jtreg/compiler/c2/irTests/TestShiftAndMask.java
index 4396873425ae..c3bdd5f9bbdc 100644
--- a/test/hotspot/jtreg/compiler/c2/irTests/TestShiftAndMask.java
+++ b/test/hotspot/jtreg/compiler/c2/irTests/TestShiftAndMask.java
@@ -31,6 +31,7 @@
 /*
  * @test
  * @bug 8277850 8278949 8285793
+ * @key randomness
  * @summary C2: optimize mask checks in counted loops
  * @library /test/lib /
  * @run driver compiler.c2.irTests.TestShiftAndMask
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/MinMaxRed_Int.java b/test/hotspot/jtreg/compiler/loopopts/superword/MinMaxRed_Int.java
index 9b17fa710ded..6190910933a3 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/MinMaxRed_Int.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/MinMaxRed_Int.java
@@ -24,6 +24,7 @@
 /**
  * @test
  * @bug 8302673
+ * @key randomness
  * @summary [SuperWord] MaxReduction and MinReduction should vectorize for int
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.MinMaxRed_Int
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java b/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java
index 591765bb5823..10181ab3da29 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8074981 8302652
+ * @key randomness
  * @summary Test SuperWord Reduction Perf.
  * @library /test/lib /
  * @run main/othervm -Xbatch
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java
index 60356b79959a..323da99ad34f 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java
@@ -92,6 +92,7 @@
 /*
  * @test id=vanilla-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.TestDependencyOffsets vanilla-A
@@ -100,6 +101,7 @@
 /*
  * @test id=vanilla-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.TestDependencyOffsets vanilla-U
@@ -108,6 +110,7 @@
 /*
  * @test id=sse4-v016-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -119,6 +122,7 @@
 /*
  * @test id=sse4-v016-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -130,6 +134,7 @@
 /*
  * @test id=sse4-v008-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -141,6 +146,7 @@
 /*
  * @test id=sse4-v008-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -163,6 +169,7 @@
 /*
  * @test id=sse4-v004-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -174,6 +181,7 @@
 /*
  * @test id=sse4-v002-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -185,6 +193,7 @@
 /*
  * @test id=sse4-v002-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -196,6 +205,7 @@
 /*
  * @test id=avx1-v032-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -207,6 +217,7 @@
 /*
  * @test id=avx1-v032-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -218,6 +229,7 @@
 /*
  * @test id=avx1-v016-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -229,6 +241,7 @@
 /*
  * @test id=avx1-v016-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -240,6 +253,7 @@
 /*
  * @test id=avx2-v032-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -251,6 +265,7 @@
 /*
  * @test id=avx2-v032-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -262,6 +277,7 @@
 /*
  * @test id=avx2-v016-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -273,6 +289,7 @@
 /*
  * @test id=avx2-v016-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -284,6 +301,7 @@
 /*
  * @test id=avx512-v064-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -295,6 +313,7 @@
 /*
  * @test id=avx512-v064-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -306,6 +325,7 @@
 /*
  * @test id=avx512-v032-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -317,6 +337,7 @@
 /*
  * @test id=avx512-v032-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -328,6 +349,7 @@
 /*
  * @test id=avx512bw-v064-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -339,6 +361,7 @@
 /*
  * @test id=avx512bw-v064-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -350,6 +373,7 @@
 /*
  * @test id=avx512bw-v032-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -361,6 +385,7 @@
 /*
  * @test id=avx512bw-v032-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -372,6 +397,7 @@
 /*
  * @test id=vec-v064-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -382,6 +408,7 @@
 /*
  * @test id=vec-v064-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -392,6 +419,7 @@
 /*
  * @test id=vec-v032-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -402,6 +430,7 @@
 /*
  * @test id=vec-v032-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -412,6 +441,7 @@
 /*
  * @test id=vec-v016-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -422,6 +452,7 @@
 /*
  * @test id=vec-v016-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -432,6 +463,7 @@
 /*
  * @test id=vec-v008-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -442,6 +474,7 @@
 /*
  * @test id=vec-v008-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -452,6 +485,7 @@
 /*
  * @test id=vec-v004-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -462,6 +496,7 @@
 /*
  * @test id=vec-v004-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java
index 391b6a1b1585..c5f333c44bf1 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java
@@ -34,6 +34,7 @@
 /*
  * @test id=byte-array
  * @bug 8329273
+ * @key randomness
  * @summary Test vectorization of loops over MemorySegment
  * @library /test/lib /
  * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java
diff --git a/test/hotspot/jtreg/compiler/vectorapi/Test8278948.java b/test/hotspot/jtreg/compiler/vectorapi/Test8278948.java
index 5218e10c4af6..5170c188133a 100644
--- a/test/hotspot/jtreg/compiler/vectorapi/Test8278948.java
+++ b/test/hotspot/jtreg/compiler/vectorapi/Test8278948.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, 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
@@ -33,6 +33,7 @@
 /*
  * @test
  * @bug 8278948
+ * @key randomness
  * @summary Intermediate integer promotion vector length encoding is calculated incorrectly on x86
  * @modules jdk.incubator.vector
  * @library /test/lib
diff --git a/test/hotspot/jtreg/compiler/vectorapi/TestVectorCompressExpandBits.java b/test/hotspot/jtreg/compiler/vectorapi/TestVectorCompressExpandBits.java
index f5174b7e6dcd..8889ccd0d268 100644
--- a/test/hotspot/jtreg/compiler/vectorapi/TestVectorCompressExpandBits.java
+++ b/test/hotspot/jtreg/compiler/vectorapi/TestVectorCompressExpandBits.java
@@ -38,6 +38,7 @@
 /**
  * @test
  * @bug 8301012
+ * @key randomness
  * @library /test/lib /
  * @requires os.arch == "aarch64" & vm.cpu.features ~= ".*sve2.*" & vm.cpu.features ~= ".*svebitperm.*"
  * @summary [vectorapi]: Intrinsify CompressBitsV/ExpandBitsV and add the AArch64 SVE backend implementation
diff --git a/test/hotspot/jtreg/compiler/vectorization/TestAutoVecIntMinMax.java b/test/hotspot/jtreg/compiler/vectorization/TestAutoVecIntMinMax.java
index e3baed37804e..0aa1b07bb80b 100644
--- a/test/hotspot/jtreg/compiler/vectorization/TestAutoVecIntMinMax.java
+++ b/test/hotspot/jtreg/compiler/vectorization/TestAutoVecIntMinMax.java
@@ -30,6 +30,7 @@
 /*
  * @test
  * @bug 8288107
+ * @key randomness
  * @summary Auto-vectorization enhancement for integer Math.max/Math.min operations
  * @library /test/lib /
  * @requires vm.compiler2.enabled
diff --git a/test/hotspot/jtreg/compiler/vectorization/TestEor3AArch64.java b/test/hotspot/jtreg/compiler/vectorization/TestEor3AArch64.java
index d5a3de09123b..3fed3eda1249 100644
--- a/test/hotspot/jtreg/compiler/vectorization/TestEor3AArch64.java
+++ b/test/hotspot/jtreg/compiler/vectorization/TestEor3AArch64.java
@@ -33,6 +33,7 @@
 /*
  * @test
  * @bug 8293488
+ * @key randomness
  * @summary Test EOR3 Neon/SVE2 instruction for aarch64 SHA3 extension
  * @library /test/lib /
  * @requires os.arch == "aarch64"
diff --git a/test/hotspot/jtreg/compiler/vectorization/TestMacroLogicVector.java b/test/hotspot/jtreg/compiler/vectorization/TestMacroLogicVector.java
index d2486f0ed774..9ab5994f5663 100644
--- a/test/hotspot/jtreg/compiler/vectorization/TestMacroLogicVector.java
+++ b/test/hotspot/jtreg/compiler/vectorization/TestMacroLogicVector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, 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
@@ -24,6 +24,7 @@
 /**
  * @test
  * @bug 8241040
+ * @key randomness
  * @library /test/lib
  *
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions
diff --git a/test/hotspot/jtreg/compiler/vectorization/TestVectorZeroCount.java b/test/hotspot/jtreg/compiler/vectorization/TestVectorZeroCount.java
index f4c8845b8570..573b3b020d35 100644
--- a/test/hotspot/jtreg/compiler/vectorization/TestVectorZeroCount.java
+++ b/test/hotspot/jtreg/compiler/vectorization/TestVectorZeroCount.java
@@ -21,20 +21,20 @@
  * questions.
  */
 
+package compiler.vectorization;
+
+import java.util.Random;
+import jdk.test.lib.Utils;
+
 /* @test
  * @bug 8349637
+ * @key randomness
  * @requires vm.flavor == "server" & (vm.opt.TieredStopAtLevel == null | vm.opt.TieredStopAtLevel == 4)
  * @summary Ensure that vectorization of numberOfLeadingZeros and numberOfTrailingZeros outputs correct values
  * @library /test/lib /
  * @run main/othervm compiler.vectorization.TestVectorZeroCount
  */
 
-package compiler.vectorization;
-
-import java.util.Random;
-
-import jdk.test.lib.Utils;
-
 public class TestVectorZeroCount {
     private static final int SIZE = 1024;
     private static final Random RANDOM = Utils.getRandomInstance();

From 978e96d385f787f74c7d4150038564a8ea06afca Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Tue, 21 Apr 2026 05:57:45 +0000
Subject: [PATCH 196/223] 8373537: Migrate "test/jdk/com/sun/net/httpserver/"
 to null-safe "SimpleSSLContext" methods

Reviewed-by: rschmelter
Backport-of: 14c93b2afbf0135e872866c7f8468d9ce6df1e0d
---
 test/jdk/com/sun/net/httpserver/SANTest.java       |  7 ++++---
 test/jdk/com/sun/net/httpserver/SelCacheTest.java  |  4 ++--
 test/jdk/com/sun/net/httpserver/Test1.java         |  5 +++--
 test/jdk/com/sun/net/httpserver/Test12.java        |  5 +++--
 test/jdk/com/sun/net/httpserver/Test13.java        |  5 +++--
 test/jdk/com/sun/net/httpserver/Test6a.java        |  4 ++--
 test/jdk/com/sun/net/httpserver/Test7a.java        |  2 +-
 test/jdk/com/sun/net/httpserver/Test8a.java        |  4 ++--
 test/jdk/com/sun/net/httpserver/Test9.java         |  5 +++--
 test/jdk/com/sun/net/httpserver/Test9a.java        |  9 +++++----
 .../httpserver/bugs/HandlerConnectionClose.java    |  6 +++---
 .../httpserver/simpleserver/HttpsServerTest.java   | 14 +++++++++-----
 .../jwebserver/MaxRequestTimeTest.java             |  8 +++-----
 13 files changed, 43 insertions(+), 35 deletions(-)

diff --git a/test/jdk/com/sun/net/httpserver/SANTest.java b/test/jdk/com/sun/net/httpserver/SANTest.java
index dc7f5e7bdd53..948ebdce30b6 100644
--- a/test/jdk/com/sun/net/httpserver/SANTest.java
+++ b/test/jdk/com/sun/net/httpserver/SANTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -61,7 +61,7 @@
  */
 public class SANTest implements HttpServerAdapters {
 
-    static SSLContext ctx;
+    private static SSLContext ctx;
 
     static HttpServer getHttpsServer(InetSocketAddress addr, Executor exec, SSLContext ctx) throws Exception {
         HttpsServer server = HttpsServer.create(addr, 0);
@@ -99,6 +99,8 @@ static HttpTestServer initServer(boolean h2, InetAddress addr, SSLContext ctx,
     }
 
     public static void main (String[] args) throws Exception {
+        ctx = SimpleSSLContext.findSSLContext();
+
         // Http/1.1 servers
         HttpTestServer h1s1 = null;
         HttpTestServer h1s2 = null;
@@ -110,7 +112,6 @@ public static void main (String[] args) throws Exception {
         ExecutorService executor=null;
         try {
             System.out.print ("SANTest: ");
-            ctx = new SimpleSSLContext().get();
             executor = Executors.newCachedThreadPool();
 
             InetAddress l1 = InetAddress.getByName("::1");
diff --git a/test/jdk/com/sun/net/httpserver/SelCacheTest.java b/test/jdk/com/sun/net/httpserver/SelCacheTest.java
index 5104e88244e9..1417c3d8582e 100644
--- a/test/jdk/com/sun/net/httpserver/SelCacheTest.java
+++ b/test/jdk/com/sun/net/httpserver/SelCacheTest.java
@@ -62,9 +62,10 @@ public class SelCacheTest extends Test {
     private static final String TEMP_FILE_PREFIX =
             HttpServer.class.getPackageName() + '-' + SelCacheTest.class.getSimpleName() + '-';
 
-    static SSLContext ctx;
+    private static SSLContext ctx;
 
     public static void main(String[] args) throws Exception {
+        ctx = SimpleSSLContext.findSSLContext();
         HttpServer s1 = null;
         HttpsServer s2 = null;
         ExecutorService executor=null;
@@ -87,7 +88,6 @@ public static void main(String[] args) throws Exception {
             executor = Executors.newCachedThreadPool();
             s1.setExecutor(executor);
             s2.setExecutor(executor);
-            ctx = new SimpleSSLContext().get();
             s2.setHttpsConfigurator(new HttpsConfigurator(ctx));
             s1.start();
             s2.start();
diff --git a/test/jdk/com/sun/net/httpserver/Test1.java b/test/jdk/com/sun/net/httpserver/Test1.java
index 32bab4d91784..522e43a0b46b 100644
--- a/test/jdk/com/sun/net/httpserver/Test1.java
+++ b/test/jdk/com/sun/net/httpserver/Test1.java
@@ -69,9 +69,11 @@ public class Test1 extends Test {
     private static final String TEMP_FILE_PREFIX =
             HttpServer.class.getPackageName() + '-' + Test1.class.getSimpleName() + '-';
 
-    static SSLContext ctx;
+    private static SSLContext ctx;
 
     public static void main (String[] args) throws Exception {
+        ctx = SimpleSSLContext.findSSLContext();
+
         HttpServer s1 = null;
         HttpsServer s2 = null;
         ExecutorService executor=null;
@@ -94,7 +96,6 @@ public static void main (String[] args) throws Exception {
             executor = Executors.newCachedThreadPool();
             s1.setExecutor (executor);
             s2.setExecutor (executor);
-            ctx = new SimpleSSLContext().get();
             s2.setHttpsConfigurator(new HttpsConfigurator (ctx));
             s1.start();
             s2.start();
diff --git a/test/jdk/com/sun/net/httpserver/Test12.java b/test/jdk/com/sun/net/httpserver/Test12.java
index 2a0ee1fc0a44..102b607f2129 100644
--- a/test/jdk/com/sun/net/httpserver/Test12.java
+++ b/test/jdk/com/sun/net/httpserver/Test12.java
@@ -56,9 +56,11 @@ public class Test12 extends Test {
     private static final String TEMP_FILE_PREFIX =
             HttpServer.class.getPackageName() + '-' + Test12.class.getSimpleName() + '-';
 
-    static SSLContext ctx;
+    private static SSLContext ctx;
 
     public static void main (String[] args) throws Exception {
+        ctx = SimpleSSLContext.findSSLContext();
+
         HttpServer s1 = null;
         HttpsServer s2 = null;
         Path smallFilePath = createTempFileOfSize(TEMP_FILE_PREFIX, null, 23);
@@ -77,7 +79,6 @@ public static void main (String[] args) throws Exception {
             HttpContext c2 = s2.createContext ("/", h);
             s1.setExecutor (executor);
             s2.setExecutor (executor);
-            ctx = new SimpleSSLContext().get();
             s2.setHttpsConfigurator(new HttpsConfigurator (ctx));
             s1.start();
             s2.start();
diff --git a/test/jdk/com/sun/net/httpserver/Test13.java b/test/jdk/com/sun/net/httpserver/Test13.java
index ead3ff95acd6..f7ade590f2cd 100644
--- a/test/jdk/com/sun/net/httpserver/Test13.java
+++ b/test/jdk/com/sun/net/httpserver/Test13.java
@@ -59,13 +59,15 @@ public class Test13 extends Test {
     private static final String TEMP_FILE_PREFIX =
             HttpServer.class.getPackageName() + '-' + Test13.class.getSimpleName() + '-';
 
-    static SSLContext ctx;
+    private static SSLContext ctx;
 
     final static int NUM = 32; // was 32
 
     static boolean fail = false;
 
     public static void main (String[] args) throws Exception {
+        ctx = SimpleSSLContext.findSSLContext();
+
         HttpServer s1 = null;
         HttpsServer s2 = null;
         ExecutorService executor=null;
@@ -87,7 +89,6 @@ public static void main (String[] args) throws Exception {
             executor = Executors.newCachedThreadPool();
             s1.setExecutor (executor);
             s2.setExecutor (executor);
-            ctx = new SimpleSSLContext().get();
             s2.setHttpsConfigurator(new HttpsConfigurator (ctx));
             s1.start();
             s2.start();
diff --git a/test/jdk/com/sun/net/httpserver/Test6a.java b/test/jdk/com/sun/net/httpserver/Test6a.java
index bbe107f5e2fd..21a4aebdc75a 100644
--- a/test/jdk/com/sun/net/httpserver/Test6a.java
+++ b/test/jdk/com/sun/net/httpserver/Test6a.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6270015
  * @library /test/lib
@@ -54,7 +54,7 @@ public static void main (String[] args) throws Exception {
         HttpsServer server = HttpsServer.create (addr, 0);
         HttpContext ctx = server.createContext ("/test", handler);
         ExecutorService executor = Executors.newCachedThreadPool();
-        SSLContext ssl = new SimpleSSLContext().get();
+        SSLContext ssl = SimpleSSLContext.findSSLContext();
         server.setExecutor (executor);
         server.setHttpsConfigurator(new HttpsConfigurator (ssl));
         server.start ();
diff --git a/test/jdk/com/sun/net/httpserver/Test7a.java b/test/jdk/com/sun/net/httpserver/Test7a.java
index 5ff01ade9a03..58d40bd8ddee 100644
--- a/test/jdk/com/sun/net/httpserver/Test7a.java
+++ b/test/jdk/com/sun/net/httpserver/Test7a.java
@@ -58,7 +58,7 @@ public static void main (String[] args) throws Exception {
         HttpsServer server = HttpsServer.create (addr, 0);
         HttpContext ctx = server.createContext ("/test", handler);
         ExecutorService executor = Executors.newCachedThreadPool();
-        SSLContext ssl = new SimpleSSLContext().get();
+        SSLContext ssl = SimpleSSLContext.findSSLContext();
         server.setHttpsConfigurator(new HttpsConfigurator (ssl));
         server.setExecutor (executor);
         server.start ();
diff --git a/test/jdk/com/sun/net/httpserver/Test8a.java b/test/jdk/com/sun/net/httpserver/Test8a.java
index 6c642f7c22aa..67f9c93172ab 100644
--- a/test/jdk/com/sun/net/httpserver/Test8a.java
+++ b/test/jdk/com/sun/net/httpserver/Test8a.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2025, 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
@@ -61,7 +61,7 @@ public static void main (String[] args) throws Exception {
             server = HttpsServer.create (addr, 0);
             HttpContext ctx = server.createContext ("/test", handler);
             executor = Executors.newCachedThreadPool();
-            SSLContext ssl = new SimpleSSLContext().get();
+            SSLContext ssl = SimpleSSLContext.findSSLContext();
             server.setHttpsConfigurator(new HttpsConfigurator (ssl));
             server.setExecutor (executor);
             server.start ();
diff --git a/test/jdk/com/sun/net/httpserver/Test9.java b/test/jdk/com/sun/net/httpserver/Test9.java
index 6051de965960..92489d88dd69 100644
--- a/test/jdk/com/sun/net/httpserver/Test9.java
+++ b/test/jdk/com/sun/net/httpserver/Test9.java
@@ -58,10 +58,12 @@ public class Test9 extends Test {
     private static final String TEMP_FILE_PREFIX =
             HttpServer.class.getPackageName() + '-' + Test9.class.getSimpleName() + '-';
 
-    static SSLContext ctx;
+    private static SSLContext ctx;
     static volatile boolean error = false;
 
     public static void main (String[] args) throws Exception {
+        ctx = SimpleSSLContext.findSSLContext();
+
         HttpServer s1 = null;
         HttpsServer s2 = null;
         ExecutorService executor=null;
@@ -83,7 +85,6 @@ public static void main (String[] args) throws Exception {
             executor = Executors.newCachedThreadPool();
             s1.setExecutor (executor);
             s2.setExecutor (executor);
-            ctx = new SimpleSSLContext().get();
             s2.setHttpsConfigurator(new HttpsConfigurator (ctx));
             s1.start();
             s2.start();
diff --git a/test/jdk/com/sun/net/httpserver/Test9a.java b/test/jdk/com/sun/net/httpserver/Test9a.java
index 85acfd265187..290acd343570 100644
--- a/test/jdk/com/sun/net/httpserver/Test9a.java
+++ b/test/jdk/com/sun/net/httpserver/Test9a.java
@@ -56,11 +56,14 @@ public class Test9a extends Test {
     private static final String TEMP_FILE_PREFIX =
             HttpServer.class.getPackageName() + '-' + Test9a.class.getSimpleName() + '-';
 
-    static SSLContext serverCtx;
-    static volatile SSLContext clientCtx = null;
+    private static SSLContext serverCtx;
+    private static SSLContext clientCtx;
     static volatile boolean error = false;
 
     public static void main (String[] args) throws Exception {
+        serverCtx = SimpleSSLContext.findSSLContext();
+        clientCtx = SimpleSSLContext.findSSLContext();
+
         HttpsServer server = null;
         ExecutorService executor=null;
         Path smallFilePath = createTempFileOfSize(TEMP_FILE_PREFIX, null, 23);
@@ -76,8 +79,6 @@ public static void main (String[] args) throws Exception {
             HttpContext c1 = server.createContext ("/", h);
             executor = Executors.newCachedThreadPool();
             server.setExecutor (executor);
-            serverCtx = new SimpleSSLContext().get();
-            clientCtx = new SimpleSSLContext().get();
             server.setHttpsConfigurator(new HttpsConfigurator (serverCtx));
             server.start();
 
diff --git a/test/jdk/com/sun/net/httpserver/bugs/HandlerConnectionClose.java b/test/jdk/com/sun/net/httpserver/bugs/HandlerConnectionClose.java
index 89839e462c51..0d44d9677892 100644
--- a/test/jdk/com/sun/net/httpserver/bugs/HandlerConnectionClose.java
+++ b/test/jdk/com/sun/net/httpserver/bugs/HandlerConnectionClose.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, 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
@@ -63,7 +63,7 @@ public class HandlerConnectionClose
 {
     static final int ONEK = 1024;
     static final long POST_SIZE = ONEK * 1L;
-    SSLContext sslContext;
+    private static SSLContext sslContext;
     Logger logger;
 
     void test(String[] args) throws Exception {
@@ -77,7 +77,6 @@ void test(String[] args) throws Exception {
         } finally {
             httpServer.stop(0);
         }
-        sslContext = new SimpleSSLContext().get();
         HttpServer httpsServer = startHttpServer("https");
         try {
             testHttpURLConnection(httpsServer, "https","/close/legacy/https/chunked");
@@ -425,6 +424,7 @@ public void handle(HttpExchange t) throws IOException {
     void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);}
     void debug(String message) {if(debug) { System.out.println(message); }  }
     public static void main(String[] args) throws Throwable {
+        sslContext = SimpleSSLContext.findSSLContext();
         Class k = new Object(){}.getClass().getEnclosingClass();
         try {k.getMethod("instanceMain",String[].class)
                 .invoke( k.newInstance(), (Object) args);}
diff --git a/test/jdk/com/sun/net/httpserver/simpleserver/HttpsServerTest.java b/test/jdk/com/sun/net/httpserver/simpleserver/HttpsServerTest.java
index 2227c4cd4379..37bba945fc9f 100644
--- a/test/jdk/com/sun/net/httpserver/simpleserver/HttpsServerTest.java
+++ b/test/jdk/com/sun/net/httpserver/simpleserver/HttpsServerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -40,7 +40,6 @@
 import java.net.http.HttpResponse.BodyHandlers;
 import java.nio.charset.StandardCharsets;
 import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.logging.ConsoleHandler;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -67,7 +66,14 @@ public class HttpsServerTest {
     static final boolean ENABLE_LOGGING = true;
     static final Logger LOGGER = Logger.getLogger("com.sun.net.httpserver");
 
-    SSLContext sslContext;
+    private static SSLContext sslContext;
+
+    static {
+        try {
+            sslContext = SimpleSSLContext.findSSLContext();
+        } catch (IOException e) {}
+        SSLContext.setDefault(sslContext);
+    }
 
     @BeforeTest
     public void setup() throws IOException {
@@ -77,8 +83,6 @@ public void setup() throws IOException {
             ch.setLevel(Level.ALL);
             LOGGER.addHandler(ch);
         }
-        sslContext = new SimpleSSLContext().get();
-        SSLContext.setDefault(sslContext);
     }
 
     @Test
diff --git a/test/jdk/com/sun/net/httpserver/simpleserver/jwebserver/MaxRequestTimeTest.java b/test/jdk/com/sun/net/httpserver/simpleserver/jwebserver/MaxRequestTimeTest.java
index c972f87dc180..385615ecd3d3 100644
--- a/test/jdk/com/sun/net/httpserver/simpleserver/jwebserver/MaxRequestTimeTest.java
+++ b/test/jdk/com/sun/net/httpserver/simpleserver/jwebserver/MaxRequestTimeTest.java
@@ -78,18 +78,16 @@ public class MaxRequestTimeTest {
     static final String LOOPBACK_ADDR = InetAddress.getLoopbackAddress().getHostAddress();
     static final AtomicInteger PORT = new AtomicInteger();
 
-    static SSLContext sslContext;
+    private static SSLContext sslContext;
 
     @BeforeTest
     public void setup() throws IOException {
+        sslContext = SimpleSSLContext.findSSLContext();
+
         if (Files.exists(TEST_DIR)) {
             FileUtils.deleteFileTreeWithRetry(TEST_DIR);
         }
         Files.createDirectories(TEST_DIR);
-
-        sslContext = new SimpleSSLContext().get();
-        if (sslContext == null)
-            throw new AssertionError("Unexpected null sslContext");
     }
 
     @Test

From 51fded4d27046e467cb4b5bf16101451529dba92 Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Tue, 21 Apr 2026 06:31:03 +0000
Subject: [PATCH 197/223] 8376152: Test
 javax/sound/sampled/Clip/bug5070081.java timed out then completed

Backport-of: 0ab8a85e87cb607c48a45900550998f0d36cf761
---
 test/jdk/javax/sound/sampled/Clip/bug5070081.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/jdk/javax/sound/sampled/Clip/bug5070081.java b/test/jdk/javax/sound/sampled/Clip/bug5070081.java
index e7bf7e30de2a..89e9d591d28d 100644
--- a/test/jdk/javax/sound/sampled/Clip/bug5070081.java
+++ b/test/jdk/javax/sound/sampled/Clip/bug5070081.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2026, 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
@@ -31,7 +31,8 @@
 
 /*
  * @test
- * @bug 5070081
+ * @key sound
+ * @bug 5070081 8376152
  * @summary Tests that javax.sound.sampled.Clip does not loses position through
  *          stop/start
  */

From 13c9878beef8c0db19a1cf7a10cfc9ac57c544ea Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Tue, 21 Apr 2026 06:42:07 +0000
Subject: [PATCH 198/223] 8365776: Convert JShell tests to use JUnit instead of
 TestNG

Reviewed-by: mbaesken
Backport-of: 3e04da1b6aa93c917603911255129928d003fa83
---
 test/langtools/jdk/jshell/AnalysisTest.java   |  11 +-
 .../jdk/jshell/AnalyzeSnippetTest.java        |  48 +++---
 .../jshell/BadExecutionControlSpecTest.java   |  11 +-
 .../jdk/jshell/ClassMembersTest.java          |  26 +--
 test/langtools/jdk/jshell/ClassPathTest.java  |  13 +-
 test/langtools/jdk/jshell/ClassesTest.java    |  57 +++++--
 .../jdk/jshell/CommandCompletionTest.java     |  20 ++-
 .../jdk/jshell/CompilerOptionsTest.java       |  13 +-
 .../jdk/jshell/CompletenessStressTest.java    |  10 +-
 .../jdk/jshell/CompletenessTest.java          |  25 ++-
 .../jdk/jshell/CompletionSuggestionTest.java  |  56 ++++++-
 .../langtools/jdk/jshell/ComputeFQNsTest.java |  20 +--
 test/langtools/jdk/jshell/ConsoleTest.java    |  18 +--
 .../jdk/jshell/CustomInputToolBuilder.java    |  12 +-
 test/langtools/jdk/jshell/DropTest.java       |  18 ++-
 test/langtools/jdk/jshell/EditorTestBase.java |  28 ++--
 test/langtools/jdk/jshell/EmptyTest.java      |  13 +-
 .../jdk/jshell/ErrorRecoveryTest.java         |  10 +-
 .../jdk/jshell/ErrorTranslationTest.java      |  26 +--
 .../jdk/jshell/ExceptionMessageTest.java      |  19 +--
 test/langtools/jdk/jshell/ExceptionsTest.java |  46 ++++--
 .../jdk/jshell/ExecutionControlSpecTest.java  |  14 +-
 .../jdk/jshell/ExecutionControlTestBase.java  |   4 +-
 .../jdk/jshell/ExpectedDiagnostic.java        |  14 +-
 .../jdk/jshell/ExternalEditorTest.java        |  37 ++---
 .../FailOverDirectExecutionControlTest.java   |  28 ++--
 ...ilOverExecutionControlDyingLaunchTest.java |  10 +-
 ...OverExecutionControlHangingLaunchTest.java |  10 +-
 ...OverExecutionControlHangingListenTest.java |  10 +-
 .../jshell/FailOverExecutionControlTest.java  |  10 +-
 .../langtools/jdk/jshell/FileManagerTest.java |  15 +-
 .../jshell/ForwardReferenceImportTest.java    |  24 ++-
 .../jdk/jshell/ForwardReferenceTest.java      |  33 ++--
 .../langtools/jdk/jshell/GetResourceTest.java |  13 +-
 .../langtools/jdk/jshell/HighlightUITest.java |   6 +-
 test/langtools/jdk/jshell/HistoryTest.java    |  34 ++--
 test/langtools/jdk/jshell/HistoryUITest.java  |   9 +-
 test/langtools/jdk/jshell/IOTest.java         |  17 +-
 .../langtools/jdk/jshell/IdGeneratorTest.java |  20 ++-
 test/langtools/jdk/jshell/IgnoreTest.java     |  16 +-
 .../jshell/IllegalArgumentExceptionTest.java  |  15 +-
 test/langtools/jdk/jshell/ImportTest.java     |  20 ++-
 .../jshell/InaccessibleExpressionTest.java    |  24 +--
 test/langtools/jdk/jshell/IndentUITest.java   |   8 +-
 test/langtools/jdk/jshell/InferTypeTest.java  |   8 +-
 .../langtools/jdk/jshell/JShellQueryTest.java |  18 ++-
 .../jdk/jshell/JShellStateClosedTest.java     |  21 ++-
 test/langtools/jdk/jshell/JavadocTest.java    |  10 +-
 ...diBadOptionLaunchExecutionControlTest.java |  12 +-
 ...diBadOptionListenExecutionControlTest.java |  12 +-
 ...diBogusHostListenExecutionControlTest.java |  12 +-
 .../JdiFailingLaunchExecutionControlTest.java |  12 +-
 .../JdiFailingListenExecutionControlTest.java |  12 +-
 .../JdiHangingLaunchExecutionControlTest.java |  10 +-
 .../JdiHangingListenExecutionControlTest.java |  10 +-
 .../JdiLaunchingExecutionControlTest.java     |  10 +-
 .../JdiListeningExecutionControlTest.java     |  10 +-
 ...isteningLocalhostExecutionControlTest.java |  10 +-
 .../jshell/KullaCompletenessStressTest.java   |  22 +--
 test/langtools/jdk/jshell/KullaTesting.java   | 150 +++++++++---------
 test/langtools/jdk/jshell/MethodsTest.java    |  49 ++++--
 test/langtools/jdk/jshell/ModifiersTest.java  |  23 ++-
 .../jdk/jshell/MultipleDocumentationTest.java |  12 +-
 .../jdk/jshell/MyExecutionControl.java        |   4 +-
 test/langtools/jdk/jshell/NullTest.java       |   8 +-
 .../jshell/PasteAndMeasurementsUITest.java    |  10 +-
 .../jdk/jshell/PipeInputStreamTest.java       |  22 +--
 test/langtools/jdk/jshell/RecordsTest.java    |  20 +--
 .../jdk/jshell/RejectedFailedTest.java        |  29 ++--
 .../langtools/jdk/jshell/ReplToolTesting.java |  21 ++-
 test/langtools/jdk/jshell/ReplaceTest.java    |  29 +++-
 .../jdk/jshell/SealedClassesTest.java         |  12 +-
 test/langtools/jdk/jshell/ShutdownTest.java   |  77 +++++----
 .../jdk/jshell/SimpleRegressionTest.java      |  48 ++++--
 .../jdk/jshell/SnippetEventToStringTest.java  |  18 ++-
 .../jdk/jshell/SnippetHighlightTest.java      |  13 +-
 .../jdk/jshell/SnippetStatusListenerTest.java |  45 +++---
 test/langtools/jdk/jshell/SnippetTest.java    |  31 +++-
 .../langtools/jdk/jshell/SourceLevelTest.java |  14 +-
 .../langtools/jdk/jshell/StartOptionTest.java |  53 ++++---
 .../jdk/jshell/StopExecutionTest.java         |  24 +--
 .../jshell/T8146368/JShellTest8146368.java    |   8 +-
 .../T8146368/JShellToolTest8146368.java       |   8 +-
 test/langtools/jdk/jshell/Test8294583.java    |  13 +-
 test/langtools/jdk/jshell/Test8296012.java    |  13 +-
 test/langtools/jdk/jshell/ToolBasicTest.java  |  84 +++++++---
 .../jdk/jshell/ToolCommandOptionTest.java     |  23 ++-
 .../jshell/ToolEnableNativeAccessTest.java    |   9 +-
 .../jdk/jshell/ToolEnablePreviewTest.java     |   9 +-
 test/langtools/jdk/jshell/ToolFormatTest.java |  42 +++--
 .../jdk/jshell/ToolLocalSimpleTest.java       |  10 +-
 .../jdk/jshell/ToolLocaleMessageTest.java     |  16 +-
 .../ToolMultilineSnippetHistoryTest.java      |   8 +-
 .../jdk/jshell/ToolProviderTest.java          |   8 +-
 test/langtools/jdk/jshell/ToolReloadTest.java |  19 ++-
 test/langtools/jdk/jshell/ToolRetainTest.java |  17 +-
 .../jdk/jshell/ToolShiftTabTest.java          |  13 +-
 test/langtools/jdk/jshell/ToolSimpleTest.java |  13 +-
 .../jdk/jshell/ToolTabCommandTest.java        |  10 +-
 .../jdk/jshell/ToolTabSnippetTest.java        |  12 +-
 test/langtools/jdk/jshell/ToolingTest.java    |   5 +-
 test/langtools/jdk/jshell/TypeNameTest.java   |  23 ++-
 test/langtools/jdk/jshell/UITesting.java      |   4 +-
 .../jdk/jshell/UndefinedClassTest.java        |   9 +-
 test/langtools/jdk/jshell/UnicodeTest.java    |  13 +-
 test/langtools/jdk/jshell/UnnamedTest.java    |  12 +-
 .../jdk/jshell/UserExecutionControlTest.java  |  18 +--
 test/langtools/jdk/jshell/UserInputTest.java  |  12 +-
 .../jdk/jshell/UserJdiUserRemoteTest.java     |  22 +--
 test/langtools/jdk/jshell/VariablesTest.java  |  70 ++++++--
 test/langtools/jdk/jshell/WrapperTest.java    |  72 +++++----
 111 files changed, 1445 insertions(+), 942 deletions(-)

diff --git a/test/langtools/jdk/jshell/AnalysisTest.java b/test/langtools/jdk/jshell/AnalysisTest.java
index f6cd5bf9efb5..478301f3fd59 100644
--- a/test/langtools/jdk/jshell/AnalysisTest.java
+++ b/test/langtools/jdk/jshell/AnalysisTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -25,14 +25,14 @@
  * @test
  * @summary Test SourceCodeAnalysis
  * @build KullaTesting TestingInputStream
- * @run testng AnalysisTest
+ * @run junit AnalysisTest
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class AnalysisTest extends KullaTesting {
 
+    @Test
     public void testSource() {
         assertAnalyze("int x=3//test", "int x=3;//test", "", true);
         assertAnalyze("int x=3 ;//test", "int x=3 ;//test", "", true);
@@ -41,6 +41,7 @@ public void testSource() {
         assertAnalyze("int ff; int v // hi", "int ff;", " int v // hi", true);
     }
 
+    @Test
     public void testSourceSlashStar() {
         assertAnalyze("/*zoo*/int x=3 /*test*/", "/*zoo*/int x=3; /*test*/", "", true);
         assertAnalyze("/*zoo*/int x=3 ;/*test*/", "/*zoo*/int x=3 ;/*test*/", "", true);
@@ -49,11 +50,13 @@ public void testSourceSlashStar() {
         assertAnalyze("int ff; int v /*hgjghj*/", "int ff;", " int v /*hgjghj*/", true);
     }
 
+    @Test
     public void testIncomplete() {
         assertAnalyze("void m() { //erer", null, "void m() { //erer\n", false);
         assertAnalyze("int m=//", null, "int m=//\n", false);
     }
 
+    @Test
     public void testExpression() {
         assertAnalyze("45//test", "45//test", "", true);
         assertAnalyze("45;//test", "45;//test", "", true);
diff --git a/test/langtools/jdk/jshell/AnalyzeSnippetTest.java b/test/langtools/jdk/jshell/AnalyzeSnippetTest.java
index 3e2e1a839e2b..e1a9efb820ed 100644
--- a/test/langtools/jdk/jshell/AnalyzeSnippetTest.java
+++ b/test/langtools/jdk/jshell/AnalyzeSnippetTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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
@@ -26,7 +26,7 @@
  * @bug 8182270
  * @summary test non-eval Snippet analysis
  * @build KullaTesting TestingInputStream
- * @run testng AnalyzeSnippetTest
+ * @run junit AnalyzeSnippetTest
  */
 
 import java.io.ByteArrayOutputStream;
@@ -34,15 +34,12 @@
 import java.util.List;
 import jdk.jshell.Snippet;
 import jdk.jshell.DeclarationSnippet;
-import org.testng.annotations.Test;
 
 import jdk.jshell.JShell;
 import jdk.jshell.MethodSnippet;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import jdk.jshell.ErroneousSnippet;
 import jdk.jshell.ExpressionSnippet;
 import jdk.jshell.ImportSnippet;
@@ -52,14 +49,16 @@
 import jdk.jshell.TypeDeclSnippet;
 import jdk.jshell.VarSnippet;
 import static jdk.jshell.Snippet.SubKind.*;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class AnalyzeSnippetTest {
 
     JShell state;
     SourceCodeAnalysis sca;
 
-    @BeforeMethod
+    @BeforeEach
     public void setUp() {
         state = JShell.builder()
                 .out(new PrintStream(new ByteArrayOutputStream()))
@@ -69,7 +68,7 @@ public void setUp() {
         sca = state.sourceCodeAnalysis();
     }
 
-    @AfterMethod
+    @AfterEach
     public void tearDown() {
         if (state != null) {
             state.close();
@@ -78,55 +77,61 @@ public void tearDown() {
         sca = null;
     }
 
+    @Test
     public void testImport() {
         ImportSnippet sn = (ImportSnippet) assertSnippet("import java.util.List;",
                 SubKind.SINGLE_TYPE_IMPORT_SUBKIND);
-        assertEquals(sn.name(), "List");
+        assertEquals("List", sn.name());
         sn = (ImportSnippet) assertSnippet("import static java.nio.file.StandardOpenOption.CREATE;",
                 SubKind.SINGLE_STATIC_IMPORT_SUBKIND);
         assertTrue(sn.isStatic());
     }
 
+    @Test
     public void testClass() {
         TypeDeclSnippet sn = (TypeDeclSnippet) assertSnippet("class C {}",
                 SubKind.CLASS_SUBKIND);
-        assertEquals(sn.name(), "C");
+        assertEquals("C", sn.name());
         sn = (TypeDeclSnippet) assertSnippet("enum EE {A, B , C}",
                 SubKind.ENUM_SUBKIND);
     }
 
+    @Test
     public void testMethod() {
         MethodSnippet sn = (MethodSnippet) assertSnippet("int m(int x) { return x + x; }",
                 SubKind.METHOD_SUBKIND);
-        assertEquals(sn.name(), "m");
-        assertEquals(sn.signature(), "(int)int");
+        assertEquals("m", sn.name());
+        assertEquals("(int)int", sn.signature());
     }
 
+    @Test
     public void testVar() {
         VarSnippet sn = (VarSnippet) assertSnippet("int i;",
                 SubKind.VAR_DECLARATION_SUBKIND);
-        assertEquals(sn.name(), "i");
-        assertEquals(sn.typeName(), "int");
+        assertEquals("i", sn.name());
+        assertEquals("int", sn.typeName());
         sn = (VarSnippet) assertSnippet("int jj = 6;",
                 SubKind.VAR_DECLARATION_WITH_INITIALIZER_SUBKIND);
         sn = (VarSnippet) assertSnippet("2 + 2",
                 SubKind.TEMP_VAR_EXPRESSION_SUBKIND);
     }
 
+    @Test
     public void testExpression() {
         state.eval("int aa = 10;");
         ExpressionSnippet sn = (ExpressionSnippet) assertSnippet("aa",
                 SubKind.VAR_VALUE_SUBKIND);
-        assertEquals(sn.name(), "aa");
-        assertEquals(sn.typeName(), "int");
+        assertEquals("aa", sn.name());
+        assertEquals("int", sn.typeName());
         sn = (ExpressionSnippet) assertSnippet("aa;",
                 SubKind.VAR_VALUE_SUBKIND);
-        assertEquals(sn.name(), "aa");
-        assertEquals(sn.typeName(), "int");
+        assertEquals("aa", sn.name());
+        assertEquals("int", sn.typeName());
         sn = (ExpressionSnippet) assertSnippet("aa = 99",
                 SubKind.ASSIGNMENT_SUBKIND);
     }
 
+    @Test
     public void testStatement() {
         StatementSnippet sn = (StatementSnippet) assertSnippet("System.out.println(33)",
                 SubKind.STATEMENT_SUBKIND);
@@ -134,6 +139,7 @@ public void testStatement() {
                 SubKind.STATEMENT_SUBKIND);
     }
 
+    @Test
     public void testErroneous() {
         ErroneousSnippet sn = (ErroneousSnippet) assertSnippet("+++",
                 SubKind.UNKNOWN_SUBKIND);
diff --git a/test/langtools/jdk/jshell/BadExecutionControlSpecTest.java b/test/langtools/jdk/jshell/BadExecutionControlSpecTest.java
index a4f4158a5c74..f7b34a0e1942 100644
--- a/test/langtools/jdk/jshell/BadExecutionControlSpecTest.java
+++ b/test/langtools/jdk/jshell/BadExecutionControlSpecTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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,7 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
  *          jdk.jshell/jdk.internal.jshell.tool
- * @run testng BadExecutionControlSpecTest
+ * @run junit BadExecutionControlSpecTest
  */
 
 import java.io.ByteArrayInputStream;
@@ -38,12 +38,11 @@
 import java.io.PrintStream;
 import java.util.Collections;
 import java.util.List;
-import org.testng.annotations.Test;
 import jdk.jshell.spi.ExecutionControl;
 import jdk.jshell.spi.ExecutionEnv;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class BadExecutionControlSpecTest {
     private static void assertIllegal(String spec) throws Throwable {
         try {
@@ -80,6 +79,7 @@ public void closeDown() {
         }
     }
 
+    @Test
     public void syntaxTest() throws Throwable {
         assertIllegal(":launch(true)");
         assertIllegal("jdi:launch(true");
@@ -87,6 +87,7 @@ public void syntaxTest() throws Throwable {
         assertIllegal("jdi:,");
     }
 
+    @Test
     public void notFoundTest() throws Throwable {
         assertIllegal("fruitbats");
         assertIllegal("jdi:baz(true)");
diff --git a/test/langtools/jdk/jshell/ClassMembersTest.java b/test/langtools/jdk/jshell/ClassMembersTest.java
index 25360770ab3e..6e188e7b8eb2 100644
--- a/test/langtools/jdk/jshell/ClassMembersTest.java
+++ b/test/langtools/jdk/jshell/ClassMembersTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -26,7 +26,7 @@
  * @bug 8139829
  * @summary Test access to members of user defined class.
  * @build KullaTesting TestingInputStream ExpectedDiagnostic
- * @run testng/timeout=600 ClassMembersTest
+ * @run junit/timeout=600 ClassMembersTest
  */
 
 import java.lang.annotation.RetentionPolicy;
@@ -36,22 +36,26 @@
 import javax.tools.Diagnostic;
 
 import jdk.jshell.SourceCodeAnalysis;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
 import jdk.jshell.TypeDeclSnippet;
 import static jdk.jshell.Snippet.Status.OVERWRITTEN;
 import static jdk.jshell.Snippet.Status.VALID;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class ClassMembersTest extends KullaTesting {
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         setUp(builder -> builder.executionEngine("local"));
     }
 
-    @Test(dataProvider = "memberTestCase")
+    @ParameterizedTest
+    @MethodSource("memberTestCaseGenerator")
     public void memberTest(AccessModifier accessModifier, CodeChunk codeChunk, Static isStaticMember, Static isStaticReference) {
         MemberTestCase testCase = new MemberTestCase(accessModifier, codeChunk, isStaticMember, isStaticReference);
         assertEval(testCase.generateSource());
@@ -78,7 +82,8 @@ private List parseCode(String input) {
         return list;
     }
 
-    @Test(dataProvider = "memberTestCase")
+    @ParameterizedTest
+    @MethodSource("memberTestCaseGenerator")
     public void extendsMemberTest(AccessModifier accessModifier, CodeChunk codeChunk, Static isStaticMember, Static isStaticReference) {
         MemberTestCase testCase = new ExtendsMemberTestCase(accessModifier, codeChunk, isStaticMember, isStaticReference);
         String input = testCase.generateSource();
@@ -151,7 +156,8 @@ public void enumTest() {
                 new ExpectedDiagnostic("compiler.err.non-static.cant.be.ref", 0, 8, 1, -1, -1, Diagnostic.Kind.ERROR));
     }
 
-    @Test(dataProvider = "retentionPolicyTestCase")
+    @ParameterizedTest
+    @MethodSource("retentionPolicyTestCaseGenerator")
     public void annotationTest(RetentionPolicy policy) {
         assertEval("import java.lang.annotation.*;");
         String annotationSource =
@@ -174,7 +180,6 @@ public void annotationTest(RetentionPolicy policy) {
         assertEval("C.Inner.class.getAnnotationsByType(A.class).length > 0;", isRuntimeVisible);
     }
 
-    @DataProvider(name = "retentionPolicyTestCase")
     public Object[][] retentionPolicyTestCaseGenerator() {
         List list = new ArrayList<>();
         for (RetentionPolicy policy : RetentionPolicy.values()) {
@@ -183,7 +188,6 @@ public Object[][] retentionPolicyTestCaseGenerator() {
         return list.toArray(new Object[list.size()][]);
     }
 
-    @DataProvider(name = "memberTestCase")
     public Object[][] memberTestCaseGenerator() {
         List list = new ArrayList<>();
         for (AccessModifier accessModifier : AccessModifier.values()) {
diff --git a/test/langtools/jdk/jshell/ClassPathTest.java b/test/langtools/jdk/jshell/ClassPathTest.java
index b9c862743890..6c2320ffac27 100644
--- a/test/langtools/jdk/jshell/ClassPathTest.java
+++ b/test/langtools/jdk/jshell/ClassPathTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -30,20 +30,20 @@
  * @library /tools/lib
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build KullaTesting TestingInputStream Compiler
- * @run testng ClassPathTest
+ * @run junit ClassPathTest
  */
 
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ClassPathTest extends KullaTesting {
 
     private final Compiler compiler = new Compiler();
     private final Path outDir = Paths.get("class_path_test");
 
+    @Test
     public void testDirectory() {
         compiler.compile(outDir, "package pkg; public class TestDirectory { }");
         assertDeclareFail("import pkg.TestDirectory;", "compiler.err.doesnt.exist");
@@ -52,6 +52,7 @@ public void testDirectory() {
         assertEval("new pkg.TestDirectory();");
     }
 
+    @Test
     public void testJar() {
         compiler.compile(outDir, "package pkg; public class TestJar { }");
         String jarName = "test.jar";
@@ -62,6 +63,7 @@ public void testJar() {
         assertEval("new pkg.TestJar();");
     }
 
+    @Test
     public void testAmbiguousDirectory() {
         Path p1 = outDir.resolve("dir1");
         compiler.compile(p1,
@@ -82,6 +84,7 @@ public void testAmbiguousDirectory() {
         assertEval("new p.TestAmbiguous();", "first");
     }
 
+    @Test
     public void testAmbiguousJar() {
         Path p1 = outDir.resolve("dir1");
         compiler.compile(p1,
@@ -104,11 +107,13 @@ public void testAmbiguousJar() {
         assertEval("new p.TestAmbiguous();", "first");
     }
 
+    @Test
     public void testEmptyClassPath() {
         addToClasspath("");
         assertEval("new java.util.ArrayList();");
     }
 
+    @Test
     public void testUnknown() {
         addToClasspath(compiler.getPath(outDir.resolve("UNKNOWN")));
         assertDeclareFail("new Unknown();", "compiler.err.cant.resolve.location");
diff --git a/test/langtools/jdk/jshell/ClassesTest.java b/test/langtools/jdk/jshell/ClassesTest.java
index 8c17c8072f8d..4e1e297d077b 100644
--- a/test/langtools/jdk/jshell/ClassesTest.java
+++ b/test/langtools/jdk/jshell/ClassesTest.java
@@ -26,7 +26,7 @@
  * @bug 8145239 8129559 8080354 8189248 8010319 8246353 8247456 8282160 8292755 8319532
  * @summary Tests for EvaluationState.classes
  * @build KullaTesting TestingInputStream ExpectedDiagnostic
- * @run testng ClassesTest
+ * @run junit ClassesTest
  */
 
 import java.util.ArrayList;
@@ -37,8 +37,6 @@
 import jdk.jshell.Snippet;
 import jdk.jshell.TypeDeclSnippet;
 import jdk.jshell.VarSnippet;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 
 import jdk.jshell.Diag;
 import jdk.jshell.Snippet.Status;
@@ -51,16 +49,22 @@
 import static jdk.jshell.Snippet.Status.OVERWRITTEN;
 import static jdk.jshell.Snippet.Status.NONEXISTENT;
 import static jdk.jshell.Snippet.SubKind.*;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-@Test
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class ClassesTest extends KullaTesting {
 
+    @Test
     public void noClasses() {
         assertNumberOfActiveClasses(0);
     }
 
+    @Test
     public void testSignature1() {
         TypeDeclSnippet c1 = classKey(assertEval("class A extends B {}", added(RECOVERABLE_NOT_DEFINED)));
         assertTypeDeclSnippet(c1, "A", RECOVERABLE_NOT_DEFINED, CLASS_SUBKIND, 1, 0);
@@ -82,6 +86,7 @@ public void testSignature1() {
         assertTypeDeclSnippet(c5, "A", RECOVERABLE_NOT_DEFINED, CLASS_SUBKIND, 1, 0);
     }
 
+    @Test
     public void testSignature2() {
         TypeDeclSnippet c1 = (TypeDeclSnippet) assertDeclareFail("class A { void f() { return g(); } }", "compiler.err.prob.found.req");
         assertTypeDeclSnippet(c1, "A", REJECTED, CLASS_SUBKIND, 0, 2);
@@ -92,27 +97,32 @@ public void testSignature2() {
                 ste(c2, RECOVERABLE_DEFINED, DROPPED, true, null));
     }
 
+    @Test
     public void classDeclaration() {
         assertEval("class A { }");
         assertClasses(clazz(KullaTesting.ClassType.CLASS, "A"));
     }
 
 
+    @Test
     public void interfaceDeclaration() {
         assertEval("interface A { }");
         assertClasses(clazz(KullaTesting.ClassType.INTERFACE, "A"));
     }
 
+    @Test
     public void annotationDeclaration() {
         assertEval("@interface A { }");
         assertClasses(clazz(KullaTesting.ClassType.ANNOTATION, "A"));
     }
 
+    @Test
     public void enumDeclaration() {
         assertEval("enum A { }");
         assertClasses(clazz(KullaTesting.ClassType.ENUM, "A"));
     }
 
+    @Test
     public void classesDeclaration() {
         assertEval("interface A { }");
         assertEval("class B implements A { }");
@@ -128,6 +138,7 @@ public void classesDeclaration() {
         assertActiveKeys();
     }
 
+    @Test
     public void classesRedeclaration1() {
         Snippet a = classKey(assertEval("class A { }"));
         Snippet b = classKey(assertEval("interface B { }"));
@@ -149,6 +160,7 @@ public void classesRedeclaration1() {
         assertActiveKeys();
     }
 
+    @Test
     public void classesRedeclaration2() {
         assertEval("class A { }");
         assertClasses(clazz(KullaTesting.ClassType.CLASS, "A"));
@@ -180,6 +192,7 @@ public void classesRedeclaration2() {
     }
 
     //8154496: test3 update: sig change should false
+    @Test
     public void classesRedeclaration3() {
         Snippet a = classKey(assertEval("class A { }"));
         assertClasses(clazz(KullaTesting.ClassType.CLASS, "A"));
@@ -201,6 +214,7 @@ public void classesRedeclaration3() {
         assertActiveKeys();
     }
 
+    @Test
     public void classesCyclic1() {
         Snippet b = classKey(assertEval("class B extends A { }",
                 added(RECOVERABLE_NOT_DEFINED)));
@@ -221,11 +235,12 @@ public void classesCyclic1() {
             diags = diagsA;
             assertTrue(diagsB.isEmpty());
         }
-        assertEquals(diags.size(), 1, "Expected one error");
-        assertEquals(diags.get(0).getCode(), "compiler.err.cyclic.inheritance", "Expected cyclic inheritance error");
+        assertEquals(1, diags.size(), "Expected one error");
+        assertEquals("compiler.err.cyclic.inheritance", diags.get(0).getCode(), "Expected cyclic inheritance error");
         assertActiveKeys();
     }
 
+    @Test
     public void classesCyclic2() {
         Snippet d = classKey(assertEval("class D extends E { }", added(RECOVERABLE_NOT_DEFINED)));
         assertEval("class E { D d; }",
@@ -234,6 +249,7 @@ public void classesCyclic2() {
         assertActiveKeys();
     }
 
+    @Test
     public void classesCyclic3() {
         Snippet outer = classKey(assertEval("class Outer { class Inner extends Foo { } }",
                 added(RECOVERABLE_NOT_DEFINED)));
@@ -247,6 +263,7 @@ public void classesCyclic3() {
         assertActiveKeys();
     }
 
+    @Test
     public void classesIgnoredModifiers() {
         assertEval("public interface A { }");
         assertEval("static class B implements A { }");
@@ -254,6 +271,7 @@ public void classesIgnoredModifiers() {
         assertActiveKeys();
     }
 
+    @Test
     public void classesIgnoredModifiersAnnotation() {
         assertEval("public @interface X { }");
         assertEval("@X public interface A { }");
@@ -262,6 +280,7 @@ public void classesIgnoredModifiersAnnotation() {
         assertActiveKeys();
     }
 
+    @Test
     public void classesIgnoredModifiersOtherModifiers() {
         assertEval("strictfp public interface A { }");
         assertEval("strictfp static class B implements A { }");
@@ -269,6 +288,7 @@ public void classesIgnoredModifiersOtherModifiers() {
         assertActiveKeys();
     }
 
+    @Test
     public void ignoreModifierSpaceIssue() {
         assertEval("interface I { void f(); } ");
         // there should not be a space between 'I' and '{' to reproduce the failure
@@ -277,7 +297,6 @@ public void ignoreModifierSpaceIssue() {
         assertActiveKeys();
     }
 
-    @DataProvider(name = "innerClasses")
     public Object[][] innerClasses() {
         List list = new ArrayList<>();
         for (ClassType outerClassType : ClassType.values()) {
@@ -288,7 +307,8 @@ public Object[][] innerClasses() {
         return list.toArray(new Object[list.size()][]);
     }
 
-    @Test(dataProvider = "innerClasses")
+    @ParameterizedTest
+    @MethodSource("innerClasses")
     public void innerClasses(ClassType outerClassType, ClassType innerClassType) {
         String source =
                 outerClassType + " A {" + (outerClassType == ClassType.ENUM ? ";" : "") +
@@ -299,6 +319,7 @@ public void innerClasses(ClassType outerClassType, ClassType innerClassType) {
         assertActiveKeys();
     }
 
+    @Test
     public void testInnerClassesCrash() {
         Snippet a = classKey(assertEval("class A { class B extends A {} }"));
         Snippet a2 = classKey(assertEval("class A { interface I1 extends I2 {} interface I2 {} }",
@@ -309,20 +330,23 @@ public void testInnerClassesCrash() {
                 ste(a2, VALID, OVERWRITTEN, false, MAIN_SNIPPET));
     }
 
+    @Test
     public void testInnerClassesCrash1() {
         assertEval("class A { class B extends A {} B getB() { return new B();} }");
-        assertEquals(varKey(assertEval("A a = new A();")).name(), "a");
+        assertEquals("a", varKey(assertEval("A a = new A();")).name());
         VarSnippet variableKey = varKey(assertEval("a.getB();"));
-        assertEquals(variableKey.typeName(), "A.B");
+        assertEquals("A.B", variableKey.typeName());
     }
 
+    @Test
     public void testInnerClassesCrash2() {
         assertEval("class A { interface I1 extends I2 {} interface I2 {} I1 x; }");
-        assertEquals(varKey(assertEval("A a = new A();")).name(), "a");
+        assertEquals("a", varKey(assertEval("A a = new A();")).name());
         VarSnippet variableKey = varKey(assertEval("a.x;"));
-        assertEquals(variableKey.typeName(), "A.I1");
+        assertEquals("A.I1", variableKey.typeName());
     }
 
+    @Test
     public void testCircular() {
         assertEval("import java.util.function.Supplier;");
         TypeDeclSnippet aClass =
@@ -342,6 +366,7 @@ public void testCircular() {
         assertEval("new A()");
     }
 
+    @Test
     public void testCircular8282160() {
         TypeDeclSnippet classKey = classKey(assertEval("""
                                                        class B {
@@ -360,6 +385,7 @@ public void run() {}
                    ste(classKey, Status.RECOVERABLE_NOT_DEFINED, Status.VALID, true, null));
     }
 
+    @Test
     public void testDefaultMethodInInterface() {
         assertEvalFail("""
                        interface C {
@@ -374,6 +400,7 @@ public void run() {
                        """);
     }
 
+    @Test
     public void testNonSealed() {
         assertAnalyze("non-sealed class C extends B {}int i;",
                       "non-sealed class C extends B {}",
diff --git a/test/langtools/jdk/jshell/CommandCompletionTest.java b/test/langtools/jdk/jshell/CommandCompletionTest.java
index 3a818a74e1e5..ef02e1359734 100644
--- a/test/langtools/jdk/jshell/CommandCompletionTest.java
+++ b/test/langtools/jdk/jshell/CommandCompletionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -32,7 +32,7 @@
  * @library /tools/lib
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build ReplToolTesting TestingInputStream Compiler
- * @run testng CommandCompletionTest
+ * @run junit CommandCompletionTest
  */
 
 import java.io.IOException;
@@ -46,16 +46,16 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import org.testng.SkipException;
-import org.testng.annotations.Test;
 
 import jdk.internal.jshell.tool.JShellTool;
 import jdk.internal.jshell.tool.JShellToolBuilder;
 import jdk.jshell.SourceCodeAnalysis.Suggestion;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.Test;
 
 public class CommandCompletionTest extends ReplToolTesting {
 
@@ -94,7 +94,7 @@ public void assertCompletion(boolean after, String code, boolean isSmart, String
     public void assertCompletion(String code, boolean isSmart, String... expected) {
         List completions = computeCompletions(code, isSmart);
         List expectedL = Arrays.asList(expected);
-        assertEquals(completions, expectedL, "Command: " + code + ", output: " +
+        assertEquals(expectedL, completions, "Command: " + code + ", output: " +
                 completions.toString() + ", expected: " + expectedL.toString());
     }
 
@@ -356,9 +356,7 @@ public void testUserHome() throws IOException {
                                   .map(file -> file.getFileName().toString().replace(" ", "\\ "))
                                   .orElse(null);
         }
-        if (selectedFile == null) {
-            throw new SkipException("No suitable file(s) found for this test in " + home);
-        }
+        Assumptions.assumeFalse(selectedFile == null, "No suitable file(s) found for this test in " + home);
         try (Stream content = Files.list(home)) {
             completions = content.filter(CLASSPATH_FILTER)
                                  .filter(file -> file.getFileName().toString().startsWith(selectedFile.replace("\\ ", " ")))
diff --git a/test/langtools/jdk/jshell/CompilerOptionsTest.java b/test/langtools/jdk/jshell/CompilerOptionsTest.java
index 1b4f5a8002dc..e4c9332d5aa6 100644
--- a/test/langtools/jdk/jshell/CompilerOptionsTest.java
+++ b/test/langtools/jdk/jshell/CompilerOptionsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -26,28 +26,29 @@
  * @bug 8159635
  * @summary Test setting compiler options
  * @build KullaTesting TestingInputStream
- * @run testng CompilerOptionsTest
+ * @run junit CompilerOptionsTest
  */
 
 import javax.tools.Diagnostic;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
 import static jdk.jshell.Snippet.Status.VALID;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class CompilerOptionsTest extends KullaTesting {
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         setUp(b -> b.compilerOptions("-source", "8", "-Xlint:cast,-options"));
     }
 
+    @Test
     public void testLint() {
         assertDeclareWarn1("String s = (String)\"hello\";",
                 new ExpectedDiagnostic("compiler.warn.redundant.cast", 11, 26, 11, -1, -1, Diagnostic.Kind.WARNING));
     }
 
+    @Test
     public void testSourceVersion() {
         assertEval("import java.util.ArrayList;", added(VALID));
         // Diamond with anonymous classes allowed in 9
diff --git a/test/langtools/jdk/jshell/CompletenessStressTest.java b/test/langtools/jdk/jshell/CompletenessStressTest.java
index 167ba716b10b..4b20ae93d467 100644
--- a/test/langtools/jdk/jshell/CompletenessStressTest.java
+++ b/test/langtools/jdk/jshell/CompletenessStressTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -64,12 +64,12 @@
 
 import jdk.jshell.SourceCodeAnalysis;
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 
 import static java.lang.Integer.max;
 import static java.lang.Integer.min;
 import static jdk.jshell.SourceCodeAnalysis.Completeness.*;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class CompletenessStressTest extends KullaTesting {
     public final static String JDK_ROOT_SRC_PROP = "jdk.root.src";
@@ -99,7 +99,6 @@ public File[] getDirectoriesToTest() {
         };
     }
 
-    @DataProvider(name = "crawler")
     public Object[][] dataProvider() throws IOException {
         File[] srcDirs = getDirectoriesToTest();
         List list = new ArrayList<>();
@@ -121,7 +120,8 @@ public Object[][] dataProvider() throws IOException {
         return list.toArray(new String[list.size()][]);
     }
 
-    @Test(dataProvider = "crawler")
+    @ParameterizedTest
+    @MethodSource("dataProvider")
     public void testFile(String fileName) throws IOException {
         File file = getSourceFile(fileName);
         final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
diff --git a/test/langtools/jdk/jshell/CompletenessTest.java b/test/langtools/jdk/jshell/CompletenessTest.java
index 79d819656891..d638b3e86262 100644
--- a/test/langtools/jdk/jshell/CompletenessTest.java
+++ b/test/langtools/jdk/jshell/CompletenessTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -26,7 +26,7 @@
  * @bug 8149524 8131024 8165211 8080071 8130454 8167343 8129559 8114842 8182268 8223782 8235474 8246774 8276149
  * @summary Test SourceCodeAnalysis
  * @build KullaTesting TestingInputStream
- * @run testng CompletenessTest
+ * @run junit CompletenessTest
  */
 
 import java.util.Map;
@@ -35,13 +35,11 @@
 import javax.lang.model.SourceVersion;
 import jdk.jshell.JShell;
 
-import org.testng.annotations.Test;
 import jdk.jshell.SourceCodeAnalysis.Completeness;
 
 import static jdk.jshell.SourceCodeAnalysis.Completeness.*;
-import org.testng.annotations.BeforeMethod;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class CompletenessTest extends KullaTesting {
 
     // Add complete units that end with semicolon to complete_with_semi (without
@@ -282,30 +280,37 @@ private void assertStatus(String[] ins, Completeness status) {
         }
     }
 
+    @Test
     public void test_complete() {
          assertStatus(complete, COMPLETE);
     }
 
+    @Test
     public void test_expression() {
         assertStatus(expression, COMPLETE);
     }
 
+    @Test
     public void test_complete_with_semi() {
         assertStatus(complete_with_semi, COMPLETE_WITH_SEMI);
     }
 
+    @Test
     public void test_considered_incomplete() {
         assertStatus(considered_incomplete, CONSIDERED_INCOMPLETE);
     }
 
+    @Test
     public void test_definitely_incomplete() {
         assertStatus(definitely_incomplete, DEFINITELY_INCOMPLETE);
     }
 
+    @Test
     public void test_unknown() {
         assertStatus(definitely_incomplete, DEFINITELY_INCOMPLETE);
     }
 
+    @Test
     public void testCompleted_complete_with_semi() {
         for (String in : complete_with_semi) {
             String input = in + ";";
@@ -313,6 +318,7 @@ public void testCompleted_complete_with_semi() {
         }
     }
 
+    @Test
     public void testCompleted_expression_with_semi() {
         for (String in : expression) {
             String input = in + ";";
@@ -320,6 +326,7 @@ public void testCompleted_expression_with_semi() {
         }
     }
 
+    @Test
     public void testCompleted_considered_incomplete() {
         for (String in : considered_incomplete) {
             String input = in + ";";
@@ -336,12 +343,14 @@ private void assertSourceByStatus(String first) {
         }
     }
 
+    @Test
     public void testCompleteSource_complete() {
         for (String input : complete) {
             assertSourceByStatus(input);
         }
     }
 
+    @Test
     public void testCompleteSource_complete_with_semi() {
         for (String in : complete_with_semi) {
             String input = in + ";";
@@ -349,6 +358,7 @@ public void testCompleteSource_complete_with_semi() {
         }
     }
 
+    @Test
     public void testCompleteSource_expression() {
         for (String in : expression) {
             String input = in + ";";
@@ -356,6 +366,7 @@ public void testCompleteSource_expression() {
         }
     }
 
+    @Test
     public void testCompleteSource_considered_incomplete() {
         for (String in : considered_incomplete) {
             String input = in + ";";
@@ -363,15 +374,18 @@ public void testCompleteSource_considered_incomplete() {
         }
     }
 
+    @Test
     public void testTrailingSlash() {
         assertStatus("\"abc\\", UNKNOWN, "\"abc\\");
     }
 
+    @Test
     public void testOpenComment() {
         assertStatus("int xx; /* hello", DEFINITELY_INCOMPLETE, null);
         assertStatus("/**  test", DEFINITELY_INCOMPLETE, null);
     }
 
+    @Test
     public void testTextBlocks() {
         assertStatus("\"\"\"", DEFINITELY_INCOMPLETE, null);
         assertStatus("\"\"\"broken", DEFINITELY_INCOMPLETE, null);
@@ -389,6 +403,7 @@ public void testTextBlocks() {
         assertStatus("\"\"\"\n\\{0}", DEFINITELY_INCOMPLETE, null);
     }
 
+    @Test
     public void testMiscSource() {
         assertStatus("if (t) if ", DEFINITELY_INCOMPLETE, "if (t) if"); //Bug
         assertStatus("int m() {} dfd", COMPLETE, "int m() {}");
diff --git a/test/langtools/jdk/jshell/CompletionSuggestionTest.java b/test/langtools/jdk/jshell/CompletionSuggestionTest.java
index dda5e9f9f060..73b06a045d16 100644
--- a/test/langtools/jdk/jshell/CompletionSuggestionTest.java
+++ b/test/langtools/jdk/jshell/CompletionSuggestionTest.java
@@ -32,7 +32,7 @@
  *          jdk.jshell/jdk.jshell:open
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build KullaTesting TestingInputStream Compiler
- * @run testng CompletionSuggestionTest
+ * @run junit CompletionSuggestionTest
  */
 
 import java.io.IOException;
@@ -50,18 +50,19 @@
 import java.util.jar.JarOutputStream;
 
 import jdk.jshell.Snippet;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
 
 import static jdk.jshell.Snippet.Status.VALID;
 import static jdk.jshell.Snippet.Status.OVERWRITTEN;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class CompletionSuggestionTest extends KullaTesting {
 
     private final Compiler compiler = new Compiler();
     private final Path outDir = Paths.get("completion_suggestion_test");
 
+    @Test
     public void testMemberExpr() {
         assertEval("class Test { static void test() { } }");
         assertCompletion("Test.t|", "test()");
@@ -111,16 +112,19 @@ public void testMemberExpr() {
         assertCompletion("\"\"\"\n\"\"\".leng|", "length()");
     }
 
+    @Test
     public void testStartOfExpression() {
         assertEval("int ccTest = 0;");
         assertCompletion("System.err.println(cc|", "ccTest");
         assertCompletion("for (int i = cc|", "ccTest");
     }
 
+    @Test
     public void testParameter() {
         assertCompletion("class C{void method(int num){num|", "num");
     }
 
+    @Test
     public void testPrimitive() {
         Set primitives = new HashSet<>(Arrays.asList("boolean", "char", "byte", "short", "int", "long", "float", "double"));
         Set onlyVoid = new HashSet<>(Collections.singletonList("void"));
@@ -154,6 +158,7 @@ public void testPrimitive() {
         assertCompletion("class A(Arrays.asList("Object", "Void")),
@@ -166,6 +171,7 @@ public void testEmpty() {
                 new HashSet<>(Arrays.asList("$REPL00DOESNOTMATTER")));
     }
 
+    @Test
     public void testSmartCompletion() {
         assertEval("int ccTest1 = 0;");
         assertEval("int ccTest2 = 0;");
@@ -198,6 +204,7 @@ public void testSmartCompletion() {
         assertCompletion("new Klass(|", true, "ccTest1", "ccTest2");
     }
 
+    @Test
     public void testSmartCompletionInOverriddenMethodInvocation() {
         assertEval("int ccTest1 = 0;");
         assertEval("int ccTest2 = 0;");
@@ -208,6 +215,7 @@ public void testSmartCompletionInOverriddenMethodInvocation() {
         assertCompletion("new Extend().method(|", true, "ccTest1", "ccTest2");
     }
 
+    @Test
     public void testSmartCompletionForBoxedType() {
         assertEval("int ccTest1 = 0;");
         assertEval("Integer ccTest2 = 0;");
@@ -223,6 +231,7 @@ public void testSmartCompletionForBoxedType() {
         assertCompletion("method3(|", true, "ccTest1", "ccTest2", "ccTest3", "method1(", "method2(", "method3(");
     }
 
+    @Test
     public void testNewClass() {
         assertCompletion("String str = new Strin|", "String(", "StringBuffer(", "StringBuilder(", "StringIndexOutOfBoundsException(");
         assertCompletion("String str = new java.lang.Strin|", "String(", "StringBuffer(", "StringBuilder(", "StringIndexOutOfBoundsException(");
@@ -243,6 +252,7 @@ public void testNewClass() {
         assertCompletion("new String(I.A|", "A");
     }
 
+    @Test
     public void testFullyQualified() {
         assertCompletion("Optional opt = java.u|", "util.");
         assertCompletionIncludesExcludes("Optional opt = java.util.O|", new HashSet<>(Collections.singletonList("Optional")), Collections.emptySet());
@@ -271,15 +281,18 @@ public void testFullyQualified() {
         assertCompletion("p1.p3.|", "Test");
     }
 
+    @Test
     public void testCheckAccessibility() {
         assertCompletion("java.util.regex.Pattern.co|", "compile(");
     }
 
+    @Test
     public void testCompletePackages() {
         assertCompletion("java.u|", "util.");
         assertCompletionIncludesExcludes("jav|", new HashSet<>(Arrays.asList("java.", "javax.")), Collections.emptySet());
     }
 
+    @Test
     public void testImports() {
         assertCompletion("import java.u|", "util.");
         assertCompletionIncludesExcludes("import jav|", new HashSet<>(Arrays.asList("java.", "javax.")), Collections.emptySet());
@@ -298,10 +311,12 @@ public void testImports() {
                 new HashSet<>(Arrays.asList("class")));
     }
 
+    @Test
     public void testImportStart() {
         assertCompletionIncludesExcludes("import c|", Set.of("com."), Set.of());
     }
 
+    @Test
     public void testBrokenClassFile() throws Exception {
         Compiler compiler = new Compiler();
         Path testOutDir = Paths.get("CompletionTestBrokenClassFile");
@@ -311,6 +326,7 @@ public void testBrokenClassFile() throws Exception {
         assertCompletion("import inner.|");
     }
 
+    @Test
     public void testDocumentation() throws Exception {
         dontReadParameterNamesFromClassFile();
         assertSignature("System.getProperty(|",
@@ -339,6 +355,7 @@ public void testDocumentation() throws Exception {
         assertSignature("field.FieldTest.R|", "field.FieldTest.R(java.lang.String s, E e)");
     }
 
+    @Test
     public void testMethodsWithNoArguments() throws Exception {
         dontReadParameterNamesFromClassFile();
         assertSignature("System.out.println(|",
@@ -354,11 +371,13 @@ public void testMethodsWithNoArguments() throws Exception {
                 "void java.io.PrintStream.println(Object)");
     }
 
+    @Test
     public void testErroneous() {
         assertCompletion("Undefined.|");
         assertSignature("does.not.exist|");
     }
 
+    @Test
     public void testClinit() {
         assertEval("enum E{;}");
         assertEval("class C{static{}}");
@@ -366,6 +385,7 @@ public void testClinit() {
         assertCompletionIncludesExcludes("C.|", Collections.emptySet(), new HashSet<>(Collections.singletonList("")));
     }
 
+    @Test
     public void testMethodHeaderContext() {
         assertCompletion("private void f(Runn|", "Runnable");
         assertCompletion("void f(Runn|", "Runnable");
@@ -377,6 +397,7 @@ public void testMethodHeaderContext() {
         assertCompletion("void f(Object o1) throws HogeHoge.|", true, "HogeHogeException");
     }
 
+    @Test
     public void testTypeVariables() {
         assertCompletion("class A { public void test() { TY|", "TYPE");
         assertCompletion("class A { public static void test() { TY|");
@@ -384,6 +405,7 @@ public void testTypeVariables() {
         assertCompletion("class A { public static  void test() { TY|", "TYPE");
     }
 
+    @Test
     public void testGeneric() {
         assertEval("import java.util.concurrent.*;");
         assertCompletion("java.util.Listf(T... ts)", "void f(A a)");
     }
 
+    @Test
     public void testClass() {
         assertSignature("String|", "java.lang.String");
     }
 
+    @Test
     public void testDocumentationOfUserDefinedConstructors() {
         Snippet a = classKey(assertEval("class A {}"));
         assertSignature("new A(|", "A()");
@@ -519,6 +547,7 @@ public void testDocumentationOfUserDefinedConstructors() {
         assertSignature("new A(|", "A(T a)", "A(int i)", " A(T t, U u)");
     }
 
+    @Test
     public void testDocumentationOfOverriddenMethods() throws Exception {
         dontReadParameterNamesFromClassFile();
         assertSignature("\"\".wait(|",
@@ -534,6 +563,7 @@ public void testDocumentationOfOverriddenMethods() throws Exception {
         assertSignature("new Extend().method(|", "void Extend.method()");
     }
 
+    @Test
     public void testDocumentationOfInvisibleMethods() {
         assertSignature("Object.wait(|");
         assertSignature("\"\".indexOfSupplementary(|");
@@ -545,12 +575,14 @@ public void testDocumentationOfInvisibleMethods() {
         assertSignature("new A().method(|");
     }
 
+    @Test
     public void testDocumentationOfInvisibleConstructors() {
         assertSignature("new Compiler(|");
         assertEval("class A { private A() {} }");
         assertSignature("new A(|");
     }
 
+    @Test
     public void testDocumentationWithBoxing() {
         assertEval("int primitive = 0;");
         assertEval("Integer boxed = 0;");
@@ -567,6 +599,7 @@ public void testDocumentationWithBoxing() {
                 "void method(Object n, int o)");
     }
 
+    @Test
     public void testDocumentationWithGenerics() {
         class TestDocumentationWithGenerics {
             private final Function codeFacotry;
@@ -621,6 +654,7 @@ void assertDoc(String generics, String expectedGenerics) {
         });
     }
 
+    @Test
     public void testVarArgs() {
         assertEval("int i = 0;");
         assertEval("class Foo1 { static void m(int... i) { } } ");
@@ -646,6 +680,7 @@ public void testVarArgs() {
         assertCompletion("Foo4.m(ia, |", true, "str");
     }
 
+    @Test
     public void testConstructorAsMemberOf() {
         assertEval("class Baz { Baz(X x) { } } ");
         assertEval("String str = null;");
@@ -657,6 +692,7 @@ public void testConstructorAsMemberOf() {
         assertCompletion("Foo.m(new Baz<>(|", true, "str");
     }
 
+    @Test
     public void testIntersection() {
         assertEval(" Z get() { return null; }");
         assertEval("var v = get();");
@@ -666,6 +702,7 @@ public void testIntersection() {
         assertCompletion("Number r = |", true);
     }
 
+    @Test
     public void testAnonymous() {
         assertEval("var v = new Runnable() { public void run() { } public int length() { return 0; } };");
         assertCompletionIncludesExcludes("v.|", true, Set.of("run()", "length()"), Set.of());
@@ -673,10 +710,12 @@ public void testAnonymous() {
         assertCompletion("CharSequence r = |", true);
     }
 
+    @Test
     public void testCompletionInAnonymous() {
         assertCompletionIncludesExcludes("new Undefined() { int i = \"\".l|", Set.of("length()"), Set.of());
     }
 
+    @Test
     public void testMemberReferences() {
         assertEval("class C {" +
                    "    public static String stat() { return null; }" +
@@ -700,6 +739,7 @@ public void testMemberReferences() {
         assertCompletion("FI2 fi = C::|", true, "statConvert1", "statConvert3");
     }
 
+    @Test
     public void testBrokenLambdaCompletion() {
         assertEval("interface Consumer { public void consume(T t); }");
         assertEval("interface Function { public R convert(T t); }");
@@ -721,7 +761,7 @@ public void testBrokenLambdaCompletion() {
         assertCompletion("String s = m8(x -> {x.tri|", "trim()");
     }
 
-    @BeforeMethod
+    @BeforeEach
     public void setUp() {
         setUp(builder -> builder.executionEngine("local"));
 
@@ -753,7 +793,8 @@ private void dontReadParameterNamesFromClassFile() throws Exception {
         keepParameterNames.set(getAnalysis(), new String[0]);
     }
 
-    @Test(enabled = false) //TODO 8171829
+    @Test //TODO 8171829
+    @Disabled
     public void testBrokenClassFile2() throws IOException {
         Path broken = outDir.resolve("broken");
         compiler.compile(broken,
@@ -776,6 +817,7 @@ public void testBrokenClassFile2() throws IOException {
         assertCompletion("Broke|", "BrokenA", "BrokenC");
     }
 
+    @Test
     public void testStatements() {
         assertEval("String s = \"\";");
         assertCompletion("if (s.conta|", (Boolean) null, "contains(");
@@ -788,11 +830,13 @@ public void testStatements() {
         assertCompletion("for (var v : s.conta|", (Boolean) null, "contains(");
     }
 
+    @Test
     public void testRecord() {
         assertCompletion("record R() implements Ru|", true, "Runnable");
     }
 
     //JDK-8296789
+    @Test
     public void testParentMembers() {
         assertEval("var sb=new StringBuilder();");
         assertCompletionIncludesExcludes("sb.|", true, Set.of("capacity()", "setLength("), Set.of("maybeLatin1"));
diff --git a/test/langtools/jdk/jshell/ComputeFQNsTest.java b/test/langtools/jdk/jshell/ComputeFQNsTest.java
index 68bb530f311e..8e7f5a1d8897 100644
--- a/test/langtools/jdk/jshell/ComputeFQNsTest.java
+++ b/test/langtools/jdk/jshell/ComputeFQNsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -31,7 +31,7 @@
  *          jdk.jshell/jdk.jshell:open
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build KullaTesting TestingInputStream Compiler
- * @run testng ComputeFQNsTest
+ * @run junit ComputeFQNsTest
  */
 
 import java.io.Writer;
@@ -41,15 +41,16 @@
 import java.util.Arrays;
 
 import jdk.jshell.SourceCodeAnalysis.QualifiedNames;
-import static org.testng.Assert.*;
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ComputeFQNsTest extends KullaTesting {
 
     private final Compiler compiler = new Compiler();
     private final Path outDir = Paths.get("ComputeFQNsTest");
 
+    @Test
     public void testAddImport() throws Exception {
         compiler.compile(outDir, "package test1; public class FQNTestClass { }", "package test2; public class FQNTestClass { }");
         String jarName = "test.jar";
@@ -77,7 +78,8 @@ public void testAddImport() throws Exception {
         assertInferredFQNs("class X { ArrayList", "ArrayList".length(), false, "java.util.ArrayList");
     }
 
-    @Test(enabled = false) //TODO 8161165
+    @Test //TODO 8161165
+    @Disabled
     public void testSuspendIndexing() throws Throwable {
         compiler.compile(outDir, "package test; public class FQNTest { }");
         String jarName = "test.jar";
@@ -127,8 +129,8 @@ public void testSuspendIndexing() throws Throwable {
 
         QualifiedNames candidates = getAnalysis().listQualifiedNames(code, code.length());
 
-        assertEquals(candidates.getNames(), Arrays.asList(), "Input: " + code + ", candidates=" + candidates.getNames());
-        assertEquals(candidates.isUpToDate(), false, "Input: " + code + ", up-to-date=" + candidates.isUpToDate());
+        assertEquals(Arrays.asList(), candidates.getNames(), "Input: " + code + ", candidates=" + candidates.getNames());
+        assertEquals(false, candidates.isUpToDate(), "Input: " + code + ", up-to-date=" + candidates.isUpToDate());
 
         Files.delete(continueMarkFile);
 
@@ -136,7 +138,7 @@ public void testSuspendIndexing() throws Throwable {
 
         candidates = getAnalysis().listQualifiedNames(code, code.length());
 
-        assertEquals(candidates.getNames(), Arrays.asList("test.FQNTest"), "Input: " + code + ", candidates=" + candidates.getNames());
+        assertEquals(Arrays.asList("test.FQNTest"), candidates.getNames(), "Input: " + code + ", candidates=" + candidates.getNames());
         assertEquals(true, candidates.isUpToDate(), "Input: " + code + ", up-to-date=" + candidates.isUpToDate());
     }
 
diff --git a/test/langtools/jdk/jshell/ConsoleTest.java b/test/langtools/jdk/jshell/ConsoleTest.java
index 0ee19c557c02..aaffbc1d1cb9 100644
--- a/test/langtools/jdk/jshell/ConsoleTest.java
+++ b/test/langtools/jdk/jshell/ConsoleTest.java
@@ -26,7 +26,7 @@
  * @bug 8298425
  * @summary Verify behavior of System.console()
  * @build KullaTesting TestingInputStream
- * @run testng ConsoleTest
+ * @run junit ConsoleTest
  */
 
 import java.io.IOError;
@@ -43,8 +43,8 @@
 import jdk.jshell.JShell;
 import jdk.jshell.JShellConsole;
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 public class ConsoleTest extends KullaTesting {
 
@@ -60,7 +60,7 @@ public Charset charset() {
         console = new ThrowingJShellConsole() {
             @Override
             public String readLine(String prompt) throws IOError {
-                assertEquals(prompt, "expected");
+                assertEquals("expected", prompt);
                 return "AB";
             }
         };
@@ -68,7 +68,7 @@ public String readLine(String prompt) throws IOError {
         console = new ThrowingJShellConsole() {
             @Override
             public char[] readPassword(String prompt) throws IOError {
-                assertEquals(prompt, "expected");
+                assertEquals("expected", prompt);
                 return "AB".toCharArray();
             }
         };
@@ -116,7 +116,7 @@ public void flush() {
         console = new ThrowingJShellConsole() {
             @Override
             public String readLine(String prompt) throws IOError {
-                assertEquals(prompt, "expected");
+                assertEquals("expected", prompt);
                 return "AB";
             }
         };
@@ -144,7 +144,7 @@ public void close() throws IOException {}
         int count = 1_000;
         assertEval("for (int i = 0; i < " + count + "; i++) System.console().writer().write(\"A\");");
         String expected = "A".repeat(count);
-        assertEquals(sb.toString(), expected);
+        assertEquals(expected, sb.toString());
     }
 
     @Test
@@ -169,7 +169,7 @@ public void close() throws IOException {}
         String testStr = "\u30A2"; // Japanese katakana (A2 >= 80) (JDK-8354910)
         assertEval("System.console().writer().write(\"" + testStr + "\".repeat(" + count + "))");
         String expected = testStr.repeat(count);
-        assertEquals(sb.toString(), expected);
+        assertEquals(expected, sb.toString());
     }
 
     @Test
@@ -205,7 +205,7 @@ public void close() throws IOException {}
                    """.replace("${repeats}", "" + repeats)
                       .replace("${output}", "" + output));
         String expected = "A".repeat(repeats * output);
-        assertEquals(sb.toString(), expected);
+        assertEquals(expected, sb.toString());
     }
 
     @Override
diff --git a/test/langtools/jdk/jshell/CustomInputToolBuilder.java b/test/langtools/jdk/jshell/CustomInputToolBuilder.java
index 523981b3d915..f6fdf97ae1ee 100644
--- a/test/langtools/jdk/jshell/CustomInputToolBuilder.java
+++ b/test/langtools/jdk/jshell/CustomInputToolBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -27,7 +27,7 @@
  * @summary Verify JavaShellToolBuilder uses provided inputs
  * @modules jdk.jshell
  * @build KullaTesting TestingInputStream
- * @run testng CustomInputToolBuilder
+ * @run junit CustomInputToolBuilder
  */
 
 import java.io.ByteArrayInputStream;
@@ -38,15 +38,14 @@
 import java.util.HashMap;
 import java.util.List;
 import jdk.jshell.tool.JavaShellToolBuilder;
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
-import static org.testng.Assert.assertTrue;
-
-@Test
 public class CustomInputToolBuilder extends KullaTesting {
 
     private static final String TEST_JDK = "test.jdk";
 
+    @Test
     public void checkCustomInput() throws Exception {
         String testJdk = System.getProperty(TEST_JDK);
         try {
@@ -102,6 +101,7 @@ private void doTest(boolean interactiveTerminal, String code, String... expected
             }
     }
 
+    @Test
     public void checkInteractiveTerminal() throws Exception {
         String testJdk = System.getProperty(TEST_JDK);
         try {
diff --git a/test/langtools/jdk/jshell/DropTest.java b/test/langtools/jdk/jshell/DropTest.java
index e277d1cbeea4..1501d391a4d9 100644
--- a/test/langtools/jdk/jshell/DropTest.java
+++ b/test/langtools/jdk/jshell/DropTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -26,20 +26,20 @@
  * @bug 8081431 8080069 8167128 8199623
  * @summary Test of JShell#drop().
  * @build KullaTesting TestingInputStream
- * @run testng DropTest
+ * @run junit DropTest
  */
 
 import jdk.jshell.DeclarationSnippet;
 import jdk.jshell.Snippet;
 import jdk.jshell.MethodSnippet;
 import jdk.jshell.VarSnippet;
-import org.testng.annotations.Test;
 
 import static jdk.jshell.Snippet.Status.*;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class DropTest extends KullaTesting {
 
+    @Test
     public void testDrop() {
         Snippet var = varKey(assertEval("int x;"));
         Snippet method = methodKey(assertEval("int mu() { return x * 4; }"));
@@ -88,6 +88,7 @@ public void testDrop() {
         assertActiveKeys();
     }
 
+    @Test
     public void testDropImport() {
         Snippet imp = importKey(assertEval("import java.util.*;"));
         Snippet decl = varKey(
@@ -101,11 +102,13 @@ public void testDropImport() {
         assertDeclareFail("list;", "compiler.err.cant.resolve.location");
     }
 
+    @Test
     public void testDropStatement() {
         Snippet x = key(assertEval("if (true);"));
         assertDrop(x, ste(x, VALID, DROPPED, true, null));
     }
 
+    @Test
     public void testDropVarToMethod() {
         Snippet x = varKey(assertEval("int x;"));
         DeclarationSnippet method = methodKey(assertEval("double mu() { return x * 4; }"));
@@ -123,6 +126,7 @@ public void testDropVarToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testDropMethodToMethod() {
         Snippet a = methodKey(assertEval("double a() { return 2; }"));
         DeclarationSnippet b = methodKey(assertEval("double b() { return a() * 10; }"));
@@ -139,6 +143,7 @@ public void testDropMethodToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testDropClassToMethod() {
         Snippet c = classKey(assertEval("class C { int f() { return 7; } }"));
         DeclarationSnippet m = methodKey(assertEval("int m() { return new C().f(); }"));
@@ -150,6 +155,7 @@ public void testDropClassToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testDropVarToClass() {
         Snippet x = varKey(assertEval("int x;"));
         DeclarationSnippet a = classKey(assertEval("class A { double a = 4 * x; }"));
@@ -165,6 +171,7 @@ public void testDropVarToClass() {
         assertActiveKeys();
     }
 
+    @Test
     public void testDropMethodToClass() {
         Snippet x = methodKey(assertEval("int x() { return 0; }"));
         DeclarationSnippet a = classKey(assertEval("class A { double a = 4 * x(); }"));
@@ -179,6 +186,7 @@ public void testDropMethodToClass() {
         assertActiveKeys();
     }
 
+    @Test
     public void testDropClassToClass() {
         Snippet a = classKey(assertEval("class A {}"));
         Snippet b = classKey(assertEval("class B extends A {}"));
@@ -204,6 +212,7 @@ public void testDropClassToClass() {
         assertActiveKeys();
     }
 
+    @Test
     public void testDropNoUpdate() {
         String as1 = "class A {}";
         String as2 = "class A extends java.util.ArrayList {}";
@@ -228,6 +237,7 @@ public void testDropNoUpdate() {
     }
 
     // 8199623
+    @Test
     public void testTwoForkedDrop() {
         MethodSnippet p = methodKey(assertEval("void p() throws Exception { ((String) null).toString(); }"));
         MethodSnippet n = methodKey(assertEval("void n() throws Exception { try { p(); } catch (Exception ex) { throw new RuntimeException(\"bar\", ex); }}"));
diff --git a/test/langtools/jdk/jshell/EditorTestBase.java b/test/langtools/jdk/jshell/EditorTestBase.java
index 422d07ba1c8f..a384c09fcb13 100644
--- a/test/langtools/jdk/jshell/EditorTestBase.java
+++ b/test/langtools/jdk/jshell/EditorTestBase.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -25,10 +25,10 @@
 import java.util.concurrent.Executors;
 import java.util.function.Consumer;
 
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
 public abstract class EditorTestBase extends ReplToolTesting {
 
@@ -61,11 +61,11 @@ void assertEditOutput(boolean after, String cmd, Consumer checkOutput, A
     }
 
     void assertEditInput(boolean after, String cmd, String input, Action action) {
-        assertEditInput(after, cmd, s -> assertEquals(s, input, "Input"), action);
+        assertEditInput(after, cmd, s -> assertEquals(input, s, "Input"), action);
     }
 
     void assertEditOutput(boolean after, String cmd, String output, Action action) {
-        assertEditOutput(after, cmd, s -> assertEquals(s.trim(), output.trim(), "command"), action);
+        assertEditOutput(after, cmd, s -> assertEquals(output.trim(), s.trim(), "command"), action);
     }
 
     @Test
@@ -219,16 +219,15 @@ public void testEditMethod2() {
 
     @Test
     public void testNoArguments() {
-        testEditor(
-                a -> assertVariable(a, "int", "a"),
+        testEditor(a -> assertVariable(a, "int", "a"),
                 a -> assertMethod(a, "void f() {}", "()void", "f"),
                 a -> assertClass(a, "class A {}", "class", "A"),
                 a -> assertEditInput(a, "/ed", s -> {
                     String[] ss = s.split("\n");
-                    assertEquals(ss.length, 3, "Expected 3 lines: " + s);
-                    assertEquals(ss[0], "int a;");
-                    assertEquals(ss[1], "void f() {}");
-                    assertEquals(ss[2], "class A {}");
+                    assertEquals(3, ss.length, "Expected 3 lines: " + s);
+                    assertEquals("int a;", ss[0]);
+                    assertEquals("void f() {}", ss[1]);
+                    assertEquals("class A {}", ss[2]);
                 }, this::exit)
         );
     }
@@ -263,7 +262,8 @@ public void testAccept() {
         );
     }
 
-    @Test(enabled = false) // TODO JDK-8191875
+    @Test // TODO JDK-8191875
+    @Disabled
     public void testStatementMush() {
         testEditor(
                 a -> assertCommand(a, "System.out.println(\"Hello\")",
diff --git a/test/langtools/jdk/jshell/EmptyTest.java b/test/langtools/jdk/jshell/EmptyTest.java
index 6e838432220f..937ab04cb2d9 100644
--- a/test/langtools/jdk/jshell/EmptyTest.java
+++ b/test/langtools/jdk/jshell/EmptyTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, 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
@@ -25,34 +25,39 @@
  * @test
  * @summary null test
  * @build KullaTesting TestingInputStream
- * @run testng EmptyTest
+ * @run junit EmptyTest
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class EmptyTest extends KullaTesting {
 
+    @Test
     public void testEmpty() {
         assertEvalEmpty("");
     }
 
+    @Test
     public void testSpace() {
         assertEvalEmpty("    ");
     }
 
+    @Test
     public void testSemicolon() {
         assertEval(";", "");
     }
 
+    @Test
     public void testSlashStarComment() {
         assertEvalEmpty("/*test*/");
     }
 
+    @Test
     public void testSlashStarCommentSemicolon() {
         assertEval("/*test*/;", "");
     }
 
+    @Test
     public void testSlashComment() {
         assertEvalEmpty("// test");
     }
diff --git a/test/langtools/jdk/jshell/ErrorRecoveryTest.java b/test/langtools/jdk/jshell/ErrorRecoveryTest.java
index f07db23f977b..5e4f2e9656c5 100644
--- a/test/langtools/jdk/jshell/ErrorRecoveryTest.java
+++ b/test/langtools/jdk/jshell/ErrorRecoveryTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -31,17 +31,17 @@
  *          jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib
  * @build KullaTesting TestingInputStream ExpectedDiagnostic toolbox.ToolBox Compiler
- * @run testng ErrorRecoveryTest
+ * @run junit ErrorRecoveryTest
  */
 
-import org.testng.annotations.Test;
 import static jdk.jshell.Snippet.Status.NONEXISTENT;
 import static jdk.jshell.Snippet.Status.RECOVERABLE_NOT_DEFINED;
 import static jdk.jshell.Snippet.Status.REJECTED;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ErrorRecoveryTest extends KullaTesting {
 
+    @Test
     public void testExceptionErrors() {
         assertEval("import java.lang.annotation.Repeatable;");
         assertEval("""
@@ -51,6 +51,7 @@ public void testExceptionErrors() {
                    ste(MAIN_SNIPPET, NONEXISTENT, RECOVERABLE_NOT_DEFINED, false, null));
     }
 
+    @Test
     public void testBrokenName() {
         assertEval("int strictfp = 0;",
                    DiagCheck.DIAG_ERROR,
@@ -58,6 +59,7 @@ public void testBrokenName() {
                    ste(MAIN_SNIPPET, NONEXISTENT, REJECTED, false, null));
     }
 
+    @Test
     public void testBooleanPatternExpression() {
         assertEval("Number n = 0;");
         assertEval("if (!n instanceof Integer i) {}",
diff --git a/test/langtools/jdk/jshell/ErrorTranslationTest.java b/test/langtools/jdk/jshell/ErrorTranslationTest.java
index 4db2ff65469b..1aa1b2c41ddb 100644
--- a/test/langtools/jdk/jshell/ErrorTranslationTest.java
+++ b/test/langtools/jdk/jshell/ErrorTranslationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -31,7 +31,7 @@
  *          jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib
  * @build KullaTesting TestingInputStream ExpectedDiagnostic toolbox.ToolBox Compiler
- * @run testng ErrorTranslationTest
+ * @run junit ErrorTranslationTest
  */
 
 import java.nio.file.Path;
@@ -41,15 +41,15 @@
 
 import javax.tools.Diagnostic;
 
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-@Test
 public class ErrorTranslationTest extends ReplToolTesting {
 
-    @Test(enabled = false) // TODO 8080353
+    @Test // TODO 8080353
+    @Disabled
     public void testErrors() {
         test(
                 a -> assertDiagnostic(a, "abstract void f();", newExpectedDiagnostic(0, 8, 0, -1, -1, Diagnostic.Kind.ERROR)),
@@ -60,6 +60,7 @@ public void testErrors() {
         );
     }
 
+    @Test
     public void testlvtiErrors() {
         test(
                 a -> assertDiagnostic(a, "var broken = () -> {};", newExpectedDiagnostic(0, 22, 0, -1, -1, Diagnostic.Kind.ERROR)),
@@ -67,13 +68,15 @@ public void testlvtiErrors() {
         );
     }
 
+    @Test
     public void testExceptionErrors() {
         test(
                 a -> assertDiagnostic(a, "try { } catch (IllegalStateException | java.io.IOException ex) { }", newExpectedDiagnostic(39, 58, -1, -1, -1, Diagnostic.Kind.ERROR))
         );
     }
 
-    @Test(enabled = false) // TODO 8132147
+    @Test // TODO 8132147
+    @Disabled
     public void stressTest() {
         Compiler compiler = new Compiler();
         Path oome = compiler.getPath("OOME.repl");
@@ -115,11 +118,11 @@ private Consumer assertDiagnostic(String expectedSource, ExpectedDiagnos
                 throw new AssertionError("Not enough lines: " + s);
             }
             String kind = getKind(expectedDiagnostic.getKind());
-            assertEquals(lines[0], kind);
+            assertEquals(kind, lines[0]);
             boolean found = false;
             for (int i = 0; i < lines.length; i++) {
                 if (lines[i].endsWith(expectedSource)) {
-                    assertEquals(lines[i + 1], expectedMarkingLine, "Input: " + expectedSource + ", marking line: ");
+                    assertEquals(expectedMarkingLine, lines[i + 1], "Input: " + expectedSource + ", marking line: ");
                     found = true;
                 }
             }
@@ -146,6 +149,7 @@ private String createMarkingLine(int start, int end) {
         return sb.toString();
     }
 
+    @Test
     public String getKind(Diagnostic.Kind kind) {
         switch (kind) {
             case WARNING:
diff --git a/test/langtools/jdk/jshell/ExceptionMessageTest.java b/test/langtools/jdk/jshell/ExceptionMessageTest.java
index fe8eec577392..c329afeb35e8 100644
--- a/test/langtools/jdk/jshell/ExceptionMessageTest.java
+++ b/test/langtools/jdk/jshell/ExceptionMessageTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8185108
  * @summary Test exception().getMessage() in events returned by eval()
- * @run testng ExceptionMessageTest
+ * @run junit ExceptionMessageTest
  * @key intermittent
  */
 
@@ -42,22 +42,23 @@
 import jdk.jshell.spi.ExecutionControlProvider;
 import jdk.jshell.spi.ExecutionEnv;
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ExceptionMessageTest {
 
+    @Test
     public void testDefaultEC() {
         doTestCases(new JdiExecutionControlProvider(), "default");
     }
 
+    @Test
     public void testLocalEC() {
         doTestCases(new LocalExecutionControlProvider(), "local");
     }
 
+    @Test
     public void testDirectEC() {
         doTestCases(new ExecutionControlProvider() {
             public ExecutionControl generate(ExecutionEnv env, Map param) throws Throwable {
@@ -85,11 +86,11 @@ private void doTestCases(ExecutionControlProvider ec, String label) {
 
     private void doTest(JShell jshell, String label, String code, String expected) {
         List result = jshell.eval(code);
-        assertEquals(result.size(), 1, "Expected only one event");
+        assertEquals(1, result.size(), "Expected only one event");
         SnippetEvent evt = result.get(0);
         Exception exc = evt.exception();
         String out = exc.getMessage();
-        assertEquals(out, expected, "Exception message not as expected: " +
+        assertEquals(expected, out, "Exception message not as expected: " +
                 label + " -- " + code);
     }
 }
diff --git a/test/langtools/jdk/jshell/ExceptionsTest.java b/test/langtools/jdk/jshell/ExceptionsTest.java
index 765c3696f072..f7273b2a6fcd 100644
--- a/test/langtools/jdk/jshell/ExceptionsTest.java
+++ b/test/langtools/jdk/jshell/ExceptionsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -31,7 +31,7 @@
  * @library /tools/lib
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build KullaTesting TestingInputStream Compiler
- * @run testng ExceptionsTest
+ * @run junit ExceptionsTest
  */
 
 import java.io.IOException;
@@ -46,16 +46,16 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-import static org.testng.Assert.*;
-
-@Test
 public class ExceptionsTest extends KullaTesting {
 
     private final Compiler compiler = new Compiler();
     private final Path outDir = Paths.get("test_class_path");
 
+    @Test
     public void throwUncheckedException() {
         String message = "error_message";
         SnippetEvent cr = assertEvalException("throw new RuntimeException(\"" + message + "\");");
@@ -64,6 +64,7 @@ public void throwUncheckedException() {
                         newStackTraceElement("", "", cr.snippet(), 1)));
     }
 
+    @Test
     public void throwCheckedException() {
         String message = "error_message";
         SnippetEvent cr = assertEvalException("throw new Exception(\"" + message + "\");");
@@ -72,6 +73,7 @@ public void throwCheckedException() {
                         newStackTraceElement("", "", cr.snippet(), 1)));
     }
 
+    @Test
     public void throwFromStaticMethodOfClass() {
         String message = "error_message";
         Snippet s1 = methodKey(assertEval("void f() { throw new RuntimeException(\"" + message + "\"); }"));
@@ -84,6 +86,7 @@ public void throwFromStaticMethodOfClass() {
                         newStackTraceElement("", "", cr3.snippet(), 1)));
     }
 
+    @Test
     public void throwFromStaticMethodOfInterface() {
         String message = "error_message";
         Snippet s1 = methodKey(assertEval("void f() { throw new RuntimeException(\"" + message + "\"); }"));
@@ -96,6 +99,7 @@ public void throwFromStaticMethodOfInterface() {
                         newStackTraceElement("", "", cr3.snippet(), 1)));
     }
 
+    @Test
     public void throwChained() {
         String message1 = "error_message1";
         String message2 = "error_message2";
@@ -122,6 +126,7 @@ public void throwChained() {
                         newStackTraceElement("", "", cr4.snippet(), 1)));
     }
 
+    @Test
     public void throwChainedUnresolved() {
         String message1 = "error_message1";
         String message2 = "error_message2";
@@ -144,6 +149,7 @@ public void throwChainedUnresolved() {
                         newStackTraceElement("", "", cr4.snippet(), 1)));
     }
 
+    @Test
     public void throwFromConstructor() {
         String message = "error_message";
         Snippet s1 = methodKey(assertEval("void f() { throw new RuntimeException(\"" + message + "\"); }"));
@@ -156,6 +162,7 @@ public void throwFromConstructor() {
                         newStackTraceElement("", "", cr3.snippet(), 1)));
     }
 
+    @Test
     public void throwFromDefaultMethodOfInterface() {
         String message = "error_message";
         Snippet s1 = methodKey(assertEval("void f() { throw new RuntimeException(\"" + message + "\"); }"));
@@ -168,6 +175,7 @@ public void throwFromDefaultMethodOfInterface() {
                         newStackTraceElement("", "", cr3.snippet(), 1)));
     }
 
+    @Test
     public void throwFromLambda() {
         String message = "lambda";
         Snippet s1 = varKey(assertEval(
@@ -182,6 +190,7 @@ public void throwFromLambda() {
                         newStackTraceElement("", "", cr2.snippet(), 1)));
     }
 
+    @Test
     public void throwFromAnonymousClass() {
         String message = "anonymous";
         Snippet s1 = varKey(assertEval(
@@ -198,6 +207,7 @@ public void throwFromAnonymousClass() {
                         newStackTraceElement("", "", cr2.snippet(), 1)));
     }
 
+    @Test
     public void throwFromLocalClass() {
         String message = "local";
         Snippet s1 = methodKey(assertEval(
@@ -219,6 +229,7 @@ public void throwFromLocalClass() {
     }
 
     // test 8210527
+    @Test
     public void throwFromWithoutSource() {
         String message = "show this";
         SnippetEvent se = assertEvalException("java.lang.reflect.Proxy.newProxyInstance(" +
@@ -232,6 +243,7 @@ public void throwFromWithoutSource() {
     }
 
     // test 8210527
+    @Test
     public void throwFromNoSource() {
         Path path = outDir.resolve("fail");
         compiler.compile(path,
@@ -250,6 +262,7 @@ public void throwFromNoSource() {
     }
 
     // test 8212167
+    @Test
     public void throwLineFormat1() {
         SnippetEvent se = assertEvalException(
                 "if (true) { \n" +
@@ -261,6 +274,7 @@ public void throwLineFormat1() {
                         newStackTraceElement("", "", se.snippet(), 3)));
     }
 
+    @Test
     public void throwLineFormat3() {
         Snippet sp = methodKey(assertEval(
                 "int p() \n" +
@@ -292,13 +306,15 @@ public void throwLineFormat3() {
                         newStackTraceElement("", "", se.snippet(), 1)));
     }
 
-    @Test(enabled = false) // TODO 8129427
+    @Test // TODO 8129427
+    @Disabled
     public void outOfMemory() {
         assertEval("import java.util.*;");
         assertEval("List list = new ArrayList<>();");
         assertExecuteException("while (true) { list.add(new byte[10000]); }", OutOfMemoryError.class);
     }
 
+    @Test
     public void stackOverflow() {
         assertEval("void f() { f(); }");
         assertExecuteException("f();", StackOverflowError.class);
@@ -361,11 +377,11 @@ private void assertExceptionMatch(Throwable exception, String source, ExceptionI
             EvalException ex = (EvalException) exception;
             String actualException = ex.getExceptionClassName();
             String expectedException = exceptionInfo.exception.getCanonicalName();
-            assertEquals(actualException, expectedException,
+            assertEquals(expectedException, actualException,
                     String.format("Given \"%s\" expected exception: %s, got: %s%nStack trace:%n%s",
                             source, expectedException, actualException, getStackTrace(ex)));
             if (exceptionInfo.message != null) {
-                assertEquals(ex.getMessage(), exceptionInfo.message,
+                assertEquals(exceptionInfo.message, ex.getMessage(),
                         String.format("Given \"%s\" expected message: %s, got: %s",
                                 source, exceptionInfo.message, ex.getMessage()));
             }
@@ -395,7 +411,7 @@ private void assertAnyExceptionMatch(Throwable exception, AnyExceptionInfo excep
                     "Expected UnresolvedReferenceException: " + exception);
             UnresolvedExceptionInfo uei = (UnresolvedExceptionInfo) exceptionInfo;
             UnresolvedReferenceException ure = (UnresolvedReferenceException) exception;
-            assertEquals(ure.getSnippet(), uei.sn);
+            assertEquals(uei.sn, ure.getSnippet());
             assertStackMatch(ure, "", exceptionInfo);
         }
     }
@@ -405,20 +421,20 @@ private void assertStackTrace(StackTraceElement[] actual, StackTraceElement[] ex
             if (actual == null || expected == null) {
                 fail(message);
             } else {
-                assertEquals(actual.length, expected.length, message + " : arrays do not have the same size");
+                assertEquals(expected.length, actual.length, message + " : arrays do not have the same size");
                 for (int i = 0; i < actual.length; ++i) {
                     StackTraceElement actualElement = actual[i];
                     StackTraceElement expectedElement = expected[i];
-                    assertEquals(actualElement.getClassName(), expectedElement.getClassName(), message + " : class names [" + i + "]");
+                    assertEquals(expectedElement.getClassName(), actualElement.getClassName(), message + " : class names [" + i + "]");
                     String expectedMethodName = expectedElement.getMethodName();
                     if (expectedMethodName.startsWith("lambda$")) {
                         assertTrue(actualElement.getMethodName().startsWith("lambda$"), message + " : method names");
                     } else {
-                        assertEquals(actualElement.getMethodName(), expectedElement.getMethodName(), message + " : method names [" + i + "]");
+                        assertEquals(expectedElement.getMethodName(), actualElement.getMethodName(), message + " : method names [" + i + "]");
                     }
-                    assertEquals(actualElement.getFileName(), expectedElement.getFileName(), message + " : file names [" + i + "]");
+                    assertEquals(expectedElement.getFileName(), actualElement.getFileName(), message + " : file names [" + i + "]");
                     if (expectedElement.getLineNumber() >= 0) {
-                        assertEquals(actualElement.getLineNumber(), expectedElement.getLineNumber(), message + " : line numbers [" + i + "]"
+                        assertEquals(expectedElement.getLineNumber(), actualElement.getLineNumber(), message + " : line numbers [" + i + "]"
                                 + " -- actual: " + actualElement.getLineNumber() + ", expected: " + expectedElement.getLineNumber() +
                                 " -- in: " + actualElement.getClassName());
                     }
diff --git a/test/langtools/jdk/jshell/ExecutionControlSpecTest.java b/test/langtools/jdk/jshell/ExecutionControlSpecTest.java
index 920310bb1e55..14661030cf06 100644
--- a/test/langtools/jdk/jshell/ExecutionControlSpecTest.java
+++ b/test/langtools/jdk/jshell/ExecutionControlSpecTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -34,20 +34,20 @@
  * @library /tools/lib
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build KullaTesting Compiler
- * @run testng ExecutionControlSpecTest
+ * @run junit ExecutionControlSpecTest
  */
 
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class ExecutionControlSpecTest extends KullaTesting {
 
     ClassLoader ccl;
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         String mod = "my.ec";
@@ -86,7 +86,7 @@ public void setUp() {
         setUp(builder -> builder.executionEngine("prefixing"));
     }
 
-    @AfterMethod
+    @AfterEach
     @Override
     public void tearDown() {
         super.tearDown();
diff --git a/test/langtools/jdk/jshell/ExecutionControlTestBase.java b/test/langtools/jdk/jshell/ExecutionControlTestBase.java
index 20336c902cff..a63e1b16569f 100644
--- a/test/langtools/jdk/jshell/ExecutionControlTestBase.java
+++ b/test/langtools/jdk/jshell/ExecutionControlTestBase.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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,11 +23,11 @@
 
 import javax.tools.Diagnostic;
 
-import org.testng.annotations.Test;
 import jdk.jshell.VarSnippet;
 
 import static jdk.jshell.Snippet.Status.VALID;
 import static jdk.jshell.Snippet.SubKind.*;
+import org.junit.jupiter.api.Test;
 
 public class ExecutionControlTestBase extends KullaTesting {
 
diff --git a/test/langtools/jdk/jshell/ExpectedDiagnostic.java b/test/langtools/jdk/jshell/ExpectedDiagnostic.java
index 2416c9875b83..1fe96200e3c6 100644
--- a/test/langtools/jdk/jshell/ExpectedDiagnostic.java
+++ b/test/langtools/jdk/jshell/ExpectedDiagnostic.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, 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
@@ -24,7 +24,7 @@
 import javax.tools.Diagnostic;
 
 import jdk.jshell.Diag;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class ExpectedDiagnostic {
 
@@ -79,16 +79,16 @@ public Diagnostic.Kind getKind() {
 
     public void assertDiagnostic(Diag diagnostic) {
         String code = diagnostic.getCode();
-        assertEquals(code, this.code, "Expected error: " + this.code + ", got: " + code);
-        assertEquals(diagnostic.isError(), kind == Diagnostic.Kind.ERROR);
+        assertEquals(this.code, code, "Expected error: " + this.code + ", got: " + code);
+        assertEquals(kind == Diagnostic.Kind.ERROR, diagnostic.isError());
         if (startPosition != -1) {
-            assertEquals(diagnostic.getStartPosition(), startPosition, "Start position");
+            assertEquals(startPosition, diagnostic.getStartPosition(), "Start position");
         }
         if (endPosition != -1) {
-            assertEquals(diagnostic.getEndPosition(), endPosition, "End position");
+            assertEquals(endPosition, diagnostic.getEndPosition(), "End position");
         }
         if (position != -1) {
-            assertEquals(diagnostic.getPosition(), position, "Position");
+            assertEquals(position, diagnostic.getPosition(), "Position");
         }
     }
 }
diff --git a/test/langtools/jdk/jshell/ExternalEditorTest.java b/test/langtools/jdk/jshell/ExternalEditorTest.java
index 607637e207c4..cf1ae4f1ae2d 100644
--- a/test/langtools/jdk/jshell/ExternalEditorTest.java
+++ b/test/langtools/jdk/jshell/ExternalEditorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -27,7 +27,7 @@
  * @bug 8143955 8080843 8163816 8143006 8169828 8171130 8162989 8210808
  * @modules jdk.jshell/jdk.internal.jshell.tool
  * @build ReplToolTesting CustomEditor EditorTestBase
- * @run testng ExternalEditorTest
+ * @run junit ExternalEditorTest
  * @key intermittent
  */
 
@@ -47,15 +47,17 @@
 import java.util.concurrent.Future;
 import java.util.function.Consumer;
 
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import org.junit.jupiter.api.AfterAll;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class ExternalEditorTest extends EditorTestBase {
 
     private static Path executionScript;
@@ -133,21 +135,19 @@ public void testEditor(boolean defaultStartup, String[] args, ReplTest... tests)
 
     @Test
     public void testStatementSemicolonAddition() {
-        testEditor(
-                a -> assertCommand(a, "if (true) {}", ""),
+        testEditor(a -> assertCommand(a, "if (true) {}", ""),
                 a -> assertCommand(a, "if (true) {} else {}", ""),
                 a -> assertCommand(a, "Object o", "o ==> null"),
                 a -> assertCommand(a, "if (true) o = new Object() { int x; }", ""),
                 a -> assertCommand(a, "if (true) o = new Object() { int y; }", ""),
                 a -> assertCommand(a, "System.err.flush()", ""), // test still ; for expression statement
                 a -> assertEditOutput(a, "/ed", "", () -> {
-                    assertEquals(getSource(),
-                            "if (true) {}\n" +
+                    assertEquals(                            "if (true) {}\n" +
                             "if (true) {} else {}\n" +
                             "Object o;\n" +
                             "if (true) o = new Object() { int x; };\n" +
                             "if (true) o = new Object() { int y; };\n" +
-                            "System.err.flush();\n");
+                            "System.err.flush();\n", getSource());
                     exit();
                 })
         );
@@ -173,7 +173,7 @@ private static boolean isWindows() {
         return System.getProperty("os.name").startsWith("Windows");
     }
 
-    @BeforeClass
+    @BeforeAll
     public static void setUpExternalEditorTest() throws IOException {
         listener = new ServerSocket(0);
         listener.setSoTimeout(30000);
@@ -250,7 +250,8 @@ public void setUnknownEditor() {
         );
     }
 
-    @Test(enabled = false) // TODO 8159229
+    @Test // TODO 8159229
+    @Disabled
     public void testRemoveTempFile() {
         test(new String[]{"--no-startup"},
                 a -> assertCommandCheckOutput(a, "/set editor " + executionScript,
@@ -264,7 +265,7 @@ public void testRemoveTempFile() {
         );
     }
 
-    @AfterClass
+    @AfterAll
     public static void shutdown() throws IOException {
         executorShutdown();
         if (listener != null) {
diff --git a/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java b/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java
index 99457ea2ce6d..c43ec747ffac 100644
--- a/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -34,7 +34,7 @@
  * @library /tools/lib
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build KullaTesting ExecutionControlTestBase Compiler
- * @run testng FailOverDirectExecutionControlTest
+ * @run junit FailOverDirectExecutionControlTest
  * @key intermittent
  */
 
@@ -48,16 +48,15 @@
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
 import java.util.logging.Logger;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
 import jdk.jshell.execution.FailOverExecutionControlProvider;
 import jdk.jshell.spi.ExecutionControlProvider;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
+import org.junit.jupiter.api.AfterEach;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class FailOverDirectExecutionControlTest extends ExecutionControlTestBase {
 
     ClassLoader ccl;
@@ -93,7 +92,7 @@ public void close() throws SecurityException {
 
     }
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         logger = Logger.getLogger("jdk.jshell.execution");
@@ -134,7 +133,7 @@ public void setUp() {
         setUp(builder -> builder.executionEngine(provider, pm));
     }
 
-    @AfterMethod
+    @AfterEach
     @Override
     public void tearDown() {
         super.tearDown();
@@ -144,11 +143,12 @@ public void tearDown() {
     }
 
     @Override
+    @Test
     public void variables() {
         super.variables();
-        assertEquals(logged.get(Level.FINEST).size(), 1);
-        assertEquals(logged.get(Level.FINE).size(), 2);
-        assertEquals(logged.get(Level.WARNING).size(), 2);
+        assertEquals(1, logged.get(Level.FINEST).size());
+        assertEquals(2, logged.get(Level.FINE).size());
+        assertEquals(2, logged.get(Level.WARNING).size());
         assertNull(logged.get(Level.SEVERE));
         String log = logged.get(Level.WARNING).get(0);
         assertTrue(log.contains("Failure failover -- 0 = alwaysFailing"), log);
diff --git a/test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java b/test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java
index 31011960880d..2e53b11b95a0 100644
--- a/test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java
+++ b/test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -28,17 +28,15 @@
  * @modules jdk.jshell/jdk.jshell.execution
  *          jdk.jshell/jdk.jshell.spi
  * @build KullaTesting ExecutionControlTestBase DyingRemoteAgent
- * @run testng FailOverExecutionControlDyingLaunchTest
+ * @run junit FailOverExecutionControlDyingLaunchTest
  * @key intermittent
  */
 
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
+import org.junit.jupiter.api.BeforeEach;
 
-@Test
 public class FailOverExecutionControlDyingLaunchTest extends ExecutionControlTestBase {
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         setUp(builder -> builder.executionEngine(
diff --git a/test/langtools/jdk/jshell/FailOverExecutionControlHangingLaunchTest.java b/test/langtools/jdk/jshell/FailOverExecutionControlHangingLaunchTest.java
index 9958b7a3284e..0de985b7a28e 100644
--- a/test/langtools/jdk/jshell/FailOverExecutionControlHangingLaunchTest.java
+++ b/test/langtools/jdk/jshell/FailOverExecutionControlHangingLaunchTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -28,16 +28,14 @@
  * @modules jdk.jshell/jdk.jshell.execution
  *          jdk.jshell/jdk.jshell.spi
  * @build KullaTesting ExecutionControlTestBase
- * @run testng FailOverExecutionControlHangingLaunchTest
+ * @run junit FailOverExecutionControlHangingLaunchTest
  */
 
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
+import org.junit.jupiter.api.BeforeEach;
 
-@Test
 public class FailOverExecutionControlHangingLaunchTest extends ExecutionControlTestBase {
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         setUp(builder -> builder.executionEngine(
diff --git a/test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java b/test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java
index 4f29bfe9c7a8..6d61bcb0322f 100644
--- a/test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java
+++ b/test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -28,18 +28,16 @@
  * @modules jdk.jshell/jdk.jshell.execution
  *          jdk.jshell/jdk.jshell.spi
  * @build KullaTesting ExecutionControlTestBase
- * @run testng FailOverExecutionControlHangingListenTest
+ * @run junit FailOverExecutionControlHangingListenTest
  * @key intermittent
  */
 
 import java.net.InetAddress;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
+import org.junit.jupiter.api.BeforeEach;
 
-@Test
 public class FailOverExecutionControlHangingListenTest extends ExecutionControlTestBase {
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         String loopback = InetAddress.getLoopbackAddress().getHostAddress();
diff --git a/test/langtools/jdk/jshell/FailOverExecutionControlTest.java b/test/langtools/jdk/jshell/FailOverExecutionControlTest.java
index 80dc56d72c48..579029af4c0e 100644
--- a/test/langtools/jdk/jshell/FailOverExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/FailOverExecutionControlTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -28,16 +28,14 @@
  * @modules jdk.jshell/jdk.jshell.execution
  *          jdk.jshell/jdk.jshell.spi
  * @build KullaTesting ExecutionControlTestBase
- * @run testng FailOverExecutionControlTest
+ * @run junit FailOverExecutionControlTest
  */
 
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
+import org.junit.jupiter.api.BeforeEach;
 
-@Test
 public class FailOverExecutionControlTest extends ExecutionControlTestBase {
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         setUp(builder -> builder.executionEngine("failover:0(expectedFailureNonExistent1), 1(expectedFailureNonExistent2), "
diff --git a/test/langtools/jdk/jshell/FileManagerTest.java b/test/langtools/jdk/jshell/FileManagerTest.java
index 9e4f063da9dd..c8c6a7dded71 100644
--- a/test/langtools/jdk/jshell/FileManagerTest.java
+++ b/test/langtools/jdk/jshell/FileManagerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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
@@ -25,7 +25,7 @@
  * @test 8173845
  * @summary test custom file managers
  * @build KullaTesting TestingInputStream
- * @run testng FileManagerTest
+ * @run junit FileManagerTest
  */
 
 
@@ -37,12 +37,10 @@
 import javax.tools.JavaFileObject;
 import javax.tools.JavaFileObject.Kind;
 import javax.tools.StandardJavaFileManager;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static org.testng.Assert.assertTrue;
-
-@Test
 public class FileManagerTest extends KullaTesting {
 
     boolean encountered;
@@ -100,12 +98,13 @@ public Iterable getLocation(Location location) {
 
     }
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         setUp(b -> b.fileManager(fm -> new MyFileManager(fm)));
     }
 
+    @Test
     public void testSnippetMemberAssignment() {
         assertEval("java.lang.reflect.Array.get(new String[1], 0) == null");
         assertTrue(encountered, "java.lang.reflect not encountered");
diff --git a/test/langtools/jdk/jshell/ForwardReferenceImportTest.java b/test/langtools/jdk/jshell/ForwardReferenceImportTest.java
index 4e66eaa2196d..4459a424092f 100644
--- a/test/langtools/jdk/jshell/ForwardReferenceImportTest.java
+++ b/test/langtools/jdk/jshell/ForwardReferenceImportTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -25,18 +25,18 @@
  * @test 8173232
  * @summary Test of forward referencing of snippets (related to import).
  * @build KullaTesting TestingInputStream
- * @run testng ForwardReferenceImportTest
+ * @run junit ForwardReferenceImportTest
  */
 
 import jdk.jshell.Snippet;
 import jdk.jshell.DeclarationSnippet;
-import org.testng.annotations.Test;
 
 import static jdk.jshell.Snippet.Status.*;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ForwardReferenceImportTest extends KullaTesting {
 
+    @Test
     public void testImportDeclare() {
         Snippet singleImport = importKey(assertEval("import java.util.List;", added(VALID)));
         Snippet importOnDemand = importKey(assertEval("import java.util.*;", added(VALID)));
@@ -57,6 +57,7 @@ public void testImportDeclare() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardSingleImportMethodToMethod() {
         DeclarationSnippet string = methodKey(assertEval("String string() { return format(\"string\"); }",
                 added(RECOVERABLE_DEFINED)));
@@ -76,6 +77,7 @@ public void testForwardSingleImportMethodToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardImportMethodOnDemandToMethod() {
         DeclarationSnippet string = methodKey(assertEval("String string() { return format(\"string\"); }",
                 added(RECOVERABLE_DEFINED)));
@@ -95,6 +97,7 @@ public void testForwardImportMethodOnDemandToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardSingleImportFieldToMethod() {
         DeclarationSnippet pi = methodKey(assertEval("double pi() { return PI; }",
                 added(RECOVERABLE_DEFINED)));
@@ -114,6 +117,7 @@ public void testForwardSingleImportFieldToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardImportFieldOnDemandToMethod() {
         DeclarationSnippet pi = methodKey(assertEval("double pi() { return PI; }",
                 added(RECOVERABLE_DEFINED)));
@@ -133,6 +137,7 @@ public void testForwardImportFieldOnDemandToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardSingleImportMethodToClass1() {
         Snippet a = classKey(assertEval("class A { String s = format(\"%d\", 10); }",
                 added(RECOVERABLE_DEFINED)));
@@ -153,6 +158,7 @@ public void testForwardSingleImportMethodToClass1() {
                 ste(a, RECOVERABLE_DEFINED, VALID, false, format));
     }
 
+    @Test
     public void testForwardSingleImportMethodToClass2() {
         Snippet a = classKey(assertEval("class A { String s() { return format(\"%d\", 10); } }",
                 added(RECOVERABLE_DEFINED)));
@@ -173,6 +179,7 @@ public void testForwardSingleImportMethodToClass2() {
                 ste(a, RECOVERABLE_DEFINED, VALID, false, format));
     }
 
+    @Test
     public void testForwardSingleImportClassToClass1() {
         Snippet a = classKey(assertEval("class A { static List list; }",
                 added(RECOVERABLE_NOT_DEFINED)));
@@ -195,6 +202,7 @@ public void testForwardSingleImportClassToClass1() {
                 ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, list));
     }
 
+    @Test
     public void testForwardSingleImportClassToClass2() {
         Snippet clsA = classKey(assertEval("class A extends ArrayList { }",
                 added(RECOVERABLE_NOT_DEFINED)));
@@ -219,6 +227,7 @@ public void testForwardSingleImportClassToClass2() {
                 ste(clsA, RECOVERABLE_NOT_DEFINED, VALID, true, arraylist));
     }
 
+    @Test
     public void testForwardImportOnDemandMethodToClass1() {
         Snippet a = classKey(assertEval("class A { String s = format(\"%d\", 10); }",
                 added(RECOVERABLE_DEFINED)));
@@ -241,6 +250,7 @@ public void testForwardImportOnDemandMethodToClass1() {
         assertEval("x.s;", "\"10\"");
     }
 
+    @Test
     public void testForwardImportOnDemandMethodToClass2() {
         Snippet a = classKey(assertEval("class A { String s() { return format(\"%d\", 10); } }",
                 added(RECOVERABLE_DEFINED)));
@@ -261,6 +271,7 @@ public void testForwardImportOnDemandMethodToClass2() {
                 ste(a, RECOVERABLE_DEFINED, VALID, false, format));
     }
 
+    @Test
     public void testForwardImportOnDemandClassToClass1() {
         Snippet a = classKey(assertEval("class A { static List list; }",
                 added(RECOVERABLE_NOT_DEFINED)));
@@ -282,6 +293,7 @@ public void testForwardImportOnDemandClassToClass1() {
                 ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, list));
     }
 
+    @Test
     public void testForwardImportOnDemandClassToClass2() {
         Snippet clsA = classKey(assertEval("class A extends ArrayList { }",
                 added(RECOVERABLE_NOT_DEFINED)));
@@ -305,6 +317,7 @@ public void testForwardImportOnDemandClassToClass2() {
                 ste(vara, RECOVERABLE_NOT_DEFINED, VALID, true, clsA));
     }
 
+    @Test
     public void testForwardSingleImportFieldToClass1() {
         Snippet a = classKey(assertEval("class A { static double pi() { return PI; } }",
                 added(RECOVERABLE_DEFINED)));
@@ -326,6 +339,7 @@ public void testForwardSingleImportFieldToClass1() {
                 ste(a, RECOVERABLE_DEFINED, VALID, false, list));
     }
 
+    @Test
     public void testForwardSingleImportFieldToClass2() {
         Snippet a = classKey(assertEval("class A { static double pi = PI; }",
                 added(RECOVERABLE_DEFINED)));
@@ -347,6 +361,7 @@ public void testForwardSingleImportFieldToClass2() {
                 ste(a, RECOVERABLE_DEFINED, VALID, true, list));
     }
 
+    @Test
     public void testForwardImportOnDemandFieldToClass1() {
         Snippet a = classKey(assertEval("class A { static double pi() { return PI; } }",
                 added(RECOVERABLE_DEFINED)));
@@ -368,6 +383,7 @@ public void testForwardImportOnDemandFieldToClass1() {
                 ste(a, RECOVERABLE_DEFINED, VALID, false, list));
     }
 
+    @Test
     public void testForwardImportOnDemandFieldToClass2() {
         Snippet a = classKey(assertEval("class A { static double pi = PI; }",
                 added(RECOVERABLE_DEFINED)));
diff --git a/test/langtools/jdk/jshell/ForwardReferenceTest.java b/test/langtools/jdk/jshell/ForwardReferenceTest.java
index a010e9ed31a1..841b1f60a8ec 100644
--- a/test/langtools/jdk/jshell/ForwardReferenceTest.java
+++ b/test/langtools/jdk/jshell/ForwardReferenceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -25,7 +25,7 @@
  * @test 8173232 8010319
  * @summary Test of forward referencing of snippets.
  * @build KullaTesting TestingInputStream
- * @run testng ForwardReferenceTest
+ * @run junit ForwardReferenceTest
  */
 
 import java.util.List;
@@ -33,17 +33,17 @@
 import jdk.jshell.MethodSnippet;
 import jdk.jshell.VarSnippet;
 import jdk.jshell.DeclarationSnippet;
-import org.testng.annotations.Test;
 
 import jdk.jshell.SnippetEvent;
 import jdk.jshell.UnresolvedReferenceException;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static jdk.jshell.Snippet.Status.*;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ForwardReferenceTest extends KullaTesting {
 
+    @Test
     public void testOverwriteMethodForwardReferenceClass() {
         Snippet k1 = methodKey(assertEval("int q(Boo b) { return b.x; }",
                 added(RECOVERABLE_NOT_DEFINED)));
@@ -56,6 +56,7 @@ public void testOverwriteMethodForwardReferenceClass() {
         assertActiveKeys();
     }
 
+    @Test
     public void testOverwriteMethodForwardReferenceClassImport() {
         MethodSnippet k1 = methodKey(assertEval("int ff(List lis) { return lis.size(); }",
                 added(RECOVERABLE_NOT_DEFINED)));
@@ -68,6 +69,7 @@ public void testOverwriteMethodForwardReferenceClassImport() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardVarToMethod() {
         DeclarationSnippet t = methodKey(assertEval("int t() { return x; }", added(RECOVERABLE_DEFINED)));
         assertUnresolvedDependencies1(t, RECOVERABLE_DEFINED, "variable x");
@@ -87,6 +89,7 @@ public void testForwardVarToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardMethodToMethod() {
         Snippet t = methodKey(assertEval("int t() { return f(); }", added(RECOVERABLE_DEFINED)));
         Snippet f = methodKey(assertEval("int f() { return g(); }",
@@ -109,6 +112,7 @@ public void testForwardMethodToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardClassToMethod() {
         DeclarationSnippet t = methodKey(assertEval("int t() { return new A().f(); }", added(RECOVERABLE_DEFINED)));
         assertUnresolvedDependencies1(t, RECOVERABLE_DEFINED, "class A");
@@ -133,6 +137,7 @@ public void testForwardClassToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardVarToClass() {
         DeclarationSnippet a = classKey(assertEval("class A { int f() { return g; } }", added(RECOVERABLE_DEFINED)));
         assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "variable g");
@@ -150,6 +155,7 @@ public void testForwardVarToClass() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardVarToClassGeneric() {
         DeclarationSnippet a = classKey(assertEval("class A { final T x; A(T v) { this.x = v; } ; T get() { return x; } int core() { return g; } }", added(RECOVERABLE_DEFINED)));
         assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "variable g");
@@ -159,9 +165,9 @@ public void testForwardVarToClassGeneric() {
         SnippetEvent ste = events.get(0);
         Snippet assn = ste.snippet();
         DeclarationSnippet unsn = ((UnresolvedReferenceException) ste.exception()).getSnippet();
-        assertEquals(unsn.name(), "A", "Wrong with unresolved");
-        assertEquals(getState().unresolvedDependencies(unsn).count(), 1, "Wrong size unresolved");
-        assertEquals(getState().diagnostics(unsn).count(), 0L, "Expected no diagnostics");
+        assertEquals("A", unsn.name(), "Wrong with unresolved");
+        assertEquals(1, getState().unresolvedDependencies(unsn).count(), "Wrong size unresolved");
+        assertEquals(0L, getState().diagnostics(unsn).count(), "Expected no diagnostics");
 
         Snippet g = varKey(assertEval("int g = 10;", "10",
                 added(VALID),
@@ -174,6 +180,7 @@ public void testForwardVarToClassGeneric() {
         assertActiveKeys();
     }
 
+    @Test
    public void testForwardVarToClassExtendsImplements() {
         DeclarationSnippet ik = classKey(assertEval("interface I { default int ii() { return 1; } }", added(VALID)));
         DeclarationSnippet jk = classKey(assertEval("interface J { default int jj() { return 2; } }", added(VALID)));
@@ -200,6 +207,7 @@ public void testForwardVarToClassExtendsImplements() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardVarToInterface() {
         DeclarationSnippet i = classKey(assertEval("interface I { default int f() { return x; } }", added(RECOVERABLE_DEFINED)));
         assertUnresolvedDependencies1(i, RECOVERABLE_DEFINED, "variable x");
@@ -215,6 +223,7 @@ public void testForwardVarToInterface() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardVarToEnum() {
         DeclarationSnippet a = classKey(assertEval("enum E { Q, W, E; float ff() { return fff; } }", added(RECOVERABLE_DEFINED)));
         assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "variable fff");
@@ -232,6 +241,7 @@ public void testForwardVarToEnum() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardMethodToClass() {
         DeclarationSnippet a = classKey(assertEval("class A { int f() { return g(); } }", added(RECOVERABLE_DEFINED)));
         assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "method g()");
@@ -251,6 +261,7 @@ public void testForwardMethodToClass() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardClassToClass1() {
         Snippet a = classKey(assertEval("class A { B b = new B(); }", added(RECOVERABLE_NOT_DEFINED)));
         assertDeclareFail("new A().b;", "compiler.err.cant.resolve.location");
@@ -269,6 +280,7 @@ public void testForwardClassToClass1() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardClassToClass2() {
         Snippet a = classKey(assertEval("class A extends B { }", added(RECOVERABLE_NOT_DEFINED)));
         assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
@@ -287,6 +299,7 @@ public void testForwardClassToClass2() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardClassToClass3() {
         Snippet a = classKey(assertEval("interface A extends B { static int f() { return 10; } }", added(RECOVERABLE_NOT_DEFINED)));
         assertDeclareFail("A.f();", "compiler.err.cant.resolve.location");
@@ -305,12 +318,14 @@ public void testForwardClassToClass3() {
         assertActiveKeys();
     }
 
+    @Test
     public void testForwardVariable() {
         assertEval("int f() { return x; }", added(RECOVERABLE_DEFINED));
         assertEvalUnresolvedException("f();", "f", 1, 0);
         assertActiveKeys();
     }
 
+    @Test
     public void testLocalClassInUnresolved() {
         Snippet f = methodKey(assertEval("void f() { class A {} g(); }", added(RECOVERABLE_DEFINED)));
         assertEval("void g() {}",
diff --git a/test/langtools/jdk/jshell/GetResourceTest.java b/test/langtools/jdk/jshell/GetResourceTest.java
index f8b2b1af2279..dfba8ed588be 100644
--- a/test/langtools/jdk/jshell/GetResourceTest.java
+++ b/test/langtools/jdk/jshell/GetResourceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -27,18 +27,18 @@
  * @summary Check that ClassLoader.getResource works as expected in the JShell agent.
  * @modules jdk.jshell
  * @build KullaTesting TestingInputStream
- * @run testng GetResourceTest
+ * @run junit GetResourceTest
  */
 
 import jdk.jshell.Snippet;
 import static jdk.jshell.Snippet.Status.OVERWRITTEN;
 import static jdk.jshell.Snippet.Status.VALID;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
 
-@Test
 public class GetResourceTest extends KullaTesting {
 
+    @Test
     public void checkGetResource() {
         assertEval("import java.util.Arrays;");
         assertEval("boolean match(byte[] data, byte[] snippet) {\n" +
@@ -57,6 +57,7 @@ public void checkGetResource() {
         assertEval("test()", "true");
     }
 
+    @Test
     public void checkRedefine() {
         assertEval("import java.util.Arrays;");
         assertEval("boolean match(byte[] data, byte[] snippet) {\n" +
@@ -85,6 +86,7 @@ public void checkRedefine() {
         assertEval("test()", "true");
     }
 
+    @Test
     public void checkResourceSize() {
         assertEval("import java.net.*;");
         assertEval("boolean test() throws Exception {\n" +
@@ -97,6 +99,7 @@ public void checkResourceSize() {
         assertEval("test()", "true");
     }
 
+    @Test
     public void checkTimestampCheck() {
         assertEval("import java.net.*;");
         assertEval("import java.time.*;");
@@ -138,6 +141,7 @@ public void checkTimestampCheck() {
         assertEval("nue[0] == nue[2]", "true");
     }
 
+    @Test
     public void checkFieldAccess() {
         assertEval("import java.net.*;");
         assertEval("Class c = new Object() {}.getClass().getEnclosingClass();");
@@ -154,6 +158,7 @@ public void checkFieldAccess() {
         assertEval("connection.getHeaderField(3) == null", "true");
     }
 
+    @Test
     public void checkGetResources() {
         assertEval("import java.net.*;");
         assertEval("Class c = new Object() {}.getClass().getEnclosingClass();");
diff --git a/test/langtools/jdk/jshell/HighlightUITest.java b/test/langtools/jdk/jshell/HighlightUITest.java
index 954cb33117ab..22403d5ae7e0 100644
--- a/test/langtools/jdk/jshell/HighlightUITest.java
+++ b/test/langtools/jdk/jshell/HighlightUITest.java
@@ -35,18 +35,18 @@
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build Compiler UITesting
  * @compile HighlightUITest.java
- * @run testng HighlightUITest
+ * @run junit HighlightUITest
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class HighlightUITest extends UITesting {
 
     public HighlightUITest() {
         super(true);
     }
 
+    @Test
     public void testHighlight() throws Exception {
         System.setProperty("test.enable.highlighter", "true");
         doRunTest((inputSink, out) -> {
diff --git a/test/langtools/jdk/jshell/HistoryTest.java b/test/langtools/jdk/jshell/HistoryTest.java
index a07523d54cb2..923d064c18ae 100644
--- a/test/langtools/jdk/jshell/HistoryTest.java
+++ b/test/langtools/jdk/jshell/HistoryTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -28,7 +28,7 @@
  * @modules jdk.internal.le/jdk.internal.org.jline.reader
  *          jdk.jshell/jdk.internal.jshell.tool:+open
  * @build HistoryTest
- * @run testng HistoryTest
+ * @run junit HistoryTest
  */
 
 import java.lang.reflect.Field;
@@ -37,12 +37,12 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.testng.annotations.Test;
 import jdk.internal.jshell.tool.JShellTool;
 import jdk.internal.jshell.tool.JShellToolBuilder;
 import jdk.internal.org.jline.reader.History;
-import static org.testng.Assert.*;
-import org.testng.annotations.BeforeMethod;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class HistoryTest extends ReplToolTesting {
 
@@ -180,16 +180,16 @@ public void testReadExistingHistory() {
                  }
                   assertCommand(a, "/exit", "");
              });
-        assertEquals(prefsMap.get("HISTORY_LINE_00"), "/debug 0");
-        assertEquals(prefsMap.get("HISTORY_LINE_01"), "void test() {\\");
-        assertEquals(prefsMap.get("HISTORY_LINE_02"), "    System.err.println(1);\\");
-        assertEquals(prefsMap.get("HISTORY_LINE_03"), "    System.err.println(`\\\\\\\\\\");
-        assertEquals(prefsMap.get("HISTORY_LINE_04"), "    \\\\\\");
-        assertEquals(prefsMap.get("HISTORY_LINE_05"), "`);\\");
-        assertEquals(prefsMap.get("HISTORY_LINE_06"), "} //test");
-        assertEquals(prefsMap.get("HISTORY_LINE_07"), "/debug 0");
-        assertEquals(prefsMap.get("HISTORY_LINE_08"), "int i");
-        assertEquals(prefsMap.get("HISTORY_LINE_09"), "/exit");
+        assertEquals("/debug 0", prefsMap.get("HISTORY_LINE_00"));
+        assertEquals("void test() {\\", prefsMap.get("HISTORY_LINE_01"));
+        assertEquals("    System.err.println(1);\\", prefsMap.get("HISTORY_LINE_02"));
+        assertEquals("    System.err.println(`\\\\\\\\\\", prefsMap.get("HISTORY_LINE_03"));
+        assertEquals("    \\\\\\", prefsMap.get("HISTORY_LINE_04"));
+        assertEquals("`);\\", prefsMap.get("HISTORY_LINE_05"));
+        assertEquals("} //test", prefsMap.get("HISTORY_LINE_06"));
+        assertEquals("/debug 0", prefsMap.get("HISTORY_LINE_07"));
+        assertEquals("int i", prefsMap.get("HISTORY_LINE_08"));
+        assertEquals("/exit", prefsMap.get("HISTORY_LINE_09"));
         System.err.println("prefsMap: " + prefsMap);
     }
 
@@ -204,10 +204,10 @@ private History getHistory() throws Exception {
 
     private void previousAndAssert(History history, String expected) {
         assertTrue(history.previous());
-        assertEquals(history.current().toString(), expected);
+        assertEquals(expected, history.current().toString());
     }
 
-    @BeforeMethod
+    @BeforeEach
     public void setUp() {
         super.setUp();
         System.setProperty("jshell.test.allow.incomplete.inputs", "false");
diff --git a/test/langtools/jdk/jshell/HistoryUITest.java b/test/langtools/jdk/jshell/HistoryUITest.java
index 3083fe46688c..aa10010e270a 100644
--- a/test/langtools/jdk/jshell/HistoryUITest.java
+++ b/test/langtools/jdk/jshell/HistoryUITest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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
@@ -35,18 +35,18 @@
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build Compiler UITesting
  * @compile HistoryUITest.java
- * @run testng HistoryUITest
+ * @run junit HistoryUITest
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class HistoryUITest extends UITesting {
 
     public HistoryUITest() {
         super(true);
     }
 
+    @Test
     public void testPrevNextSnippet() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("void test1() {\nSystem.err.println(1);\n}\n");
@@ -78,6 +78,7 @@ public void testPrevNextSnippet() throws Exception {
         });
     }
 
+    @Test
     public void testReRun() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("System.err.println(\"RAN\");\n");
diff --git a/test/langtools/jdk/jshell/IOTest.java b/test/langtools/jdk/jshell/IOTest.java
index 112b956fec31..988b73ec071e 100644
--- a/test/langtools/jdk/jshell/IOTest.java
+++ b/test/langtools/jdk/jshell/IOTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -25,28 +25,29 @@
  * @test
  * @summary Test input/output
  * @build KullaTesting TestingInputStream
- * @run testng IOTest
+ * @run junit IOTest
  */
 
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
 
-import static org.testng.Assert.assertEquals;
-
-@Test
 public class IOTest extends KullaTesting {
 
     String LINE_SEPARATOR = System.getProperty("line.separator");
 
+    @Test
     public void testOutput() {
         assertEval("System.out.println(\"Test\");");
-        assertEquals(getOutput(), "Test" + LINE_SEPARATOR);
+        assertEquals("Test" + LINE_SEPARATOR, getOutput());
     }
 
+    @Test
     public void testErrorOutput() {
         assertEval("System.err.println(\"Oops\");");
-        assertEquals(getErrorOutput(), "Oops" + LINE_SEPARATOR);
+        assertEquals("Oops" + LINE_SEPARATOR, getErrorOutput());
     }
 
+    @Test
     public void testInput() {
         setInput("x");
         assertEval("(char)System.in.read();", "'x'");
diff --git a/test/langtools/jdk/jshell/IdGeneratorTest.java b/test/langtools/jdk/jshell/IdGeneratorTest.java
index e8a38dfe7f05..6c7f6177e039 100644
--- a/test/langtools/jdk/jshell/IdGeneratorTest.java
+++ b/test/langtools/jdk/jshell/IdGeneratorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -25,7 +25,7 @@
  * @test
  * @summary Test custom id generators
  * @build KullaTesting TestingInputStream
- * @run testng IdGeneratorTest
+ * @run junit IdGeneratorTest
  */
 
 import java.io.ByteArrayOutputStream;
@@ -38,14 +38,13 @@
 import jdk.jshell.SnippetEvent;
 import jdk.jshell.UnresolvedReferenceException;
 import jdk.jshell.VarSnippet;
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-@Test
 public class IdGeneratorTest {
 
+    @Test
     public JShell.Builder getBuilder() {
         TestingInputStream inStream = new TestingInputStream();
         ByteArrayOutputStream outStream = new ByteArrayOutputStream();
@@ -57,6 +56,7 @@ public JShell.Builder getBuilder() {
                 .executionEngine(Presets.TEST_DEFAULT_EXECUTION);
     }
 
+    @Test
     public void testTempNameGenerator() {
         JShell.Builder builder = getBuilder().tempVariableNameGenerator(new Supplier() {
             int count = 0;
@@ -69,11 +69,12 @@ public String get() {
         try (JShell jShell = builder.build()) {
             for (int i = 0; i < 3; ++i) {
                 VarSnippet v = (VarSnippet) jShell.eval("2 + " + (i + 1)).get(0).snippet();
-                assertEquals("temp" + (i + 1), v.name(), "Custom id: ");
+                assertEquals(v.name(), "temp" + (i + 1), "Custom id: ");
             }
         }
     }
 
+    @Test
     public void testResetTempNameGenerator() {
         JShell.Builder builder = getBuilder().tempVariableNameGenerator(() -> {
             throw new AssertionError("Should not be called");
@@ -83,6 +84,7 @@ public void testResetTempNameGenerator() {
         }
     }
 
+    @Test
     public void testIdGenerator() {
         JShell.Builder builder = getBuilder().idGenerator(((snippet, id) -> "custom" + id));
         try (JShell jShell = builder.build()) {
@@ -99,6 +101,7 @@ private void checkIds(List events) {
         }
     }
 
+    @Test
     public void testIdInException() {
         JShell.Builder builder = getBuilder().idGenerator(((snippet, id) -> "custom" + id));
         try (JShell jShell = builder.build()) {
@@ -116,6 +119,7 @@ public void testIdInException() {
         }
     }
 
+    @Test
     public void testResetIdGenerator() {
         JShell.Builder builder = getBuilder().idGenerator((sn, id) -> {
             throw new AssertionError("Should not be called");
diff --git a/test/langtools/jdk/jshell/IgnoreTest.java b/test/langtools/jdk/jshell/IgnoreTest.java
index 023b5c99ac89..4350ce0cac30 100644
--- a/test/langtools/jdk/jshell/IgnoreTest.java
+++ b/test/langtools/jdk/jshell/IgnoreTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -26,20 +26,20 @@
  * @bug 8129559 8246353 8247456
  * @summary Test the ignoring of comments and certain modifiers
  * @build KullaTesting TestingInputStream
- * @run testng IgnoreTest
+ * @run junit IgnoreTest
  */
 
-import org.testng.annotations.Test;
 
 import jdk.jshell.MethodSnippet;
 import jdk.jshell.TypeDeclSnippet;
 import jdk.jshell.VarSnippet;
 import static jdk.jshell.Snippet.Status.VALID;
 import static jdk.jshell.Snippet.SubKind.*;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class IgnoreTest extends KullaTesting {
 
+    @Test
     public void testComment() {
         assertVarKeyMatch("//t1\n int//t2\n x//t3\n =//t4\n 12//t5\n ;//t6\n",
                 true, "x", VAR_DECLARATION_WITH_INITIALIZER_SUBKIND, "int", added(VALID));
@@ -58,6 +58,7 @@ public void testComment() {
                 false, "f", METHOD_SUBKIND, added(VALID));
     }
 
+    @Test
     public void testVarModifier() {
         VarSnippet x1 = varKey(assertEval("public int x1;"));
         assertVariableDeclSnippet(x1, "x1", "int", VALID, VAR_DECLARATION_SUBKIND, 0, 0);
@@ -71,6 +72,7 @@ public void testVarModifier() {
         assertVariableDeclSnippet(x5, "x5", "int", VALID, VAR_DECLARATION_SUBKIND, 0, 0);
     }
 
+    @Test
     public void testVarModifierAnnotation() {
         assertEval("@interface A { int value() default 0; }");
         VarSnippet x1 = varKey(assertEval("@A public int x1;"));
@@ -85,6 +87,7 @@ public void testVarModifierAnnotation() {
         assertVariableDeclSnippet(x5, "x5", "int", VALID, VAR_DECLARATION_SUBKIND, 0, 0);
     }
 
+    @Test
     public void testVarModifierOtherModifier() {
         VarSnippet x1 = varKey(assertEval("volatile public int x1;"));
         assertVariableDeclSnippet(x1, "x1", "int", VALID, VAR_DECLARATION_SUBKIND, 0, 0);
@@ -98,12 +101,14 @@ public void testVarModifierOtherModifier() {
         assertVariableDeclSnippet(x5, "x5", "int", VALID, VAR_DECLARATION_SUBKIND, 0, 0);
     }
 
+    @Test
     public void testMisplacedIgnoredModifier() {
         assertEvalFail("int public y;");
         assertEvalFail("String private x;");
         assertEvalFail("(protected 34);");
     }
 
+    @Test
     public void testMethodModifier() {
         MethodSnippet m4 = methodKey(assertEval("static void m4() {}"));
         assertMethodDeclSnippet(m4, "m4", "()void", VALID, 0, 0);
@@ -111,6 +116,7 @@ public void testMethodModifier() {
         assertMethodDeclSnippet(m5, "m5", "()void", VALID, 0, 0);
     }
 
+    @Test
     public void testMethodModifierAnnotation() {
         assertEval("@interface A { int value() default 0; }");
         MethodSnippet m4 = methodKey(assertEval("@A static void m4() {}"));
@@ -119,6 +125,7 @@ public void testMethodModifierAnnotation() {
         assertMethodDeclSnippet(m5, "m5", "()void", VALID, 0, 0);
     }
 
+    @Test
     public void testClassModifier() {
         TypeDeclSnippet c4 = classKey(assertEval("static class C4 {}"));
         assertTypeDeclSnippet(c4, "C4", VALID, CLASS_SUBKIND, 0, 0);
@@ -126,6 +133,7 @@ public void testClassModifier() {
         assertTypeDeclSnippet(c5, "C5", VALID, CLASS_SUBKIND, 0, 0);
     }
 
+    @Test
     public void testInsideModifier() {
         assertEval("import static java.lang.reflect.Modifier.*;");
         assertEval("class C {"
diff --git a/test/langtools/jdk/jshell/IllegalArgumentExceptionTest.java b/test/langtools/jdk/jshell/IllegalArgumentExceptionTest.java
index 3ba5910e8b59..f43778bb4655 100644
--- a/test/langtools/jdk/jshell/IllegalArgumentExceptionTest.java
+++ b/test/langtools/jdk/jshell/IllegalArgumentExceptionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -25,7 +25,7 @@
  * @test
  * @summary Testing IllegalArgumentException.
  * @build KullaTesting TestingInputStream IllegalArgumentExceptionTest
- * @run testng IllegalArgumentExceptionTest
+ * @run junit IllegalArgumentExceptionTest
  */
 
 import java.util.function.Consumer;
@@ -33,12 +33,10 @@
 import jdk.jshell.DeclarationSnippet;
 import jdk.jshell.Snippet;
 import jdk.jshell.VarSnippet;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
 import static jdk.jshell.Snippet.Status.VALID;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class IllegalArgumentExceptionTest extends KullaTesting {
 
     private void testIllegalArgumentException(Consumer action) {
@@ -54,22 +52,27 @@ private void testIllegalArgumentException(Consumer action) {
         }
     }
 
+    @Test
     public void testVarValue() {
         testIllegalArgumentException((key) -> getState().varValue((VarSnippet) key));
     }
 
+    @Test
     public void testStatus() {
         testIllegalArgumentException((key) -> getState().status(key));
     }
 
+    @Test
     public void testDrop() {
         testIllegalArgumentException((key) -> getState().drop(key));
     }
 
+    @Test
     public void testUnresolved() {
         testIllegalArgumentException((key) -> getState().unresolvedDependencies((DeclarationSnippet) key));
     }
 
+    @Test
     public void testDiagnostics() {
         testIllegalArgumentException((key) -> getState().diagnostics(key));
     }
diff --git a/test/langtools/jdk/jshell/ImportTest.java b/test/langtools/jdk/jshell/ImportTest.java
index 80b28deed360..a3d61ed691b9 100644
--- a/test/langtools/jdk/jshell/ImportTest.java
+++ b/test/langtools/jdk/jshell/ImportTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -30,7 +30,7 @@
  *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib
  * @build KullaTesting TestingInputStream toolbox.Task.ExpectedDiagnostic
- * @run testng ImportTest
+ * @run junit ImportTest
  */
 
 import java.nio.file.Path;
@@ -39,7 +39,6 @@
 import javax.tools.Diagnostic;
 
 import jdk.jshell.Snippet;
-import org.testng.annotations.Test;
 
 import static jdk.jshell.Snippet.Status.VALID;
 import static jdk.jshell.Snippet.Status.OVERWRITTEN;
@@ -47,10 +46,13 @@
 import static jdk.jshell.Snippet.SubKind.SINGLE_STATIC_IMPORT_SUBKIND;
 import static jdk.jshell.Snippet.SubKind.TYPE_IMPORT_ON_DEMAND_SUBKIND;
 import static jdk.jshell.Snippet.SubKind.STATIC_IMPORT_ON_DEMAND_SUBKIND;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
 
-@Test
 public class ImportTest extends KullaTesting {
 
+    @Test
     public void testImport() {
         assertImportKeyMatch("import java.util.List;", "List", SINGLE_TYPE_IMPORT_SUBKIND, added(VALID));
         assertImportKeyMatch("import java.util.ArrayList;", "ArrayList", SINGLE_TYPE_IMPORT_SUBKIND, added(VALID));
@@ -59,6 +61,7 @@ public void testImport() {
         assertEval("list.size();", "1");
     }
 
+    @Test
     public void testImportOnDemand() {
         assertImportKeyMatch("import java.util.*;", "java.util.*", TYPE_IMPORT_ON_DEMAND_SUBKIND, added(VALID));
         assertEval("List list = new ArrayList<>();");
@@ -66,16 +69,19 @@ public void testImportOnDemand() {
         assertEval("list.size();", "1");
     }
 
+    @Test
     public void testImportStatic() {
         assertImportKeyMatch("import static java.lang.Math.PI;", "PI", SINGLE_STATIC_IMPORT_SUBKIND, added(VALID));
         assertEval("Double.valueOf(PI).toString().substring(0, 16).equals(\"3.14159265358979\");", "true");
     }
 
+    @Test
     public void testImportStaticOnDemand() {
         assertImportKeyMatch("import static java.lang.Math.*;", "java.lang.Math.*", STATIC_IMPORT_ON_DEMAND_SUBKIND, added(VALID));
         assertEval("abs(cos(PI / 2)) < 0.00001;", "true");
     }
 
+    @Test
     public void testUnknownPackage() {
         assertDeclareFail("import unknown.qqq;",
                 new ExpectedDiagnostic("compiler.err.doesnt.exist", 7, 18, 14, -1, -1, Diagnostic.Kind.ERROR));
@@ -83,22 +89,26 @@ public void testUnknownPackage() {
                 new ExpectedDiagnostic("compiler.err.doesnt.exist", 7, 14, 7, -1, -1, Diagnostic.Kind.ERROR));
     }
 
+    @Test
     public void testBogusImportIgnoredInFuture() {
         assertDeclareFail("import unknown.qqq;", "compiler.err.doesnt.exist");
         assertDeclareFail("import unknown.*;", "compiler.err.doesnt.exist");
         assertEval("2 + 2;");
     }
 
+    @Test
     public void testBadImport() {
         assertDeclareFail("import static java.lang.reflect.Modifier;",
                 new ExpectedDiagnostic("compiler.err.cant.resolve.location", 14, 31, 23, -1, -1, Diagnostic.Kind.ERROR));
     }
 
+    @Test
     public void testBadSyntaxImport() {
         assertDeclareFail("import not found.*;",
                 new ExpectedDiagnostic("compiler.err.expected", 10, 10, 10, -1, -1, Diagnostic.Kind.ERROR));
     }
 
+    @Test
     public void testImportRedefinition() {
         Compiler compiler = new Compiler();
         Path path = Paths.get("testImport");
@@ -139,6 +149,7 @@ public void testImportRedefinition() {
         assertEval("new ArrayList();", "MyInnerList");
     }
 
+    @Test
     public void testImportMemberRedefinition() {
         Compiler compiler = new Compiler();
         Path path = Paths.get("testImport");
@@ -163,6 +174,7 @@ public void testImportMemberRedefinition() {
         assertEval("method();", "\"A\"");
     }
 
+    @Test
     public void testImportWithComment() {
         assertImportKeyMatch("import java.util.List;//comment", "List", SINGLE_TYPE_IMPORT_SUBKIND, added(VALID));
         assertEval("List l = null;");
diff --git a/test/langtools/jdk/jshell/InaccessibleExpressionTest.java b/test/langtools/jdk/jshell/InaccessibleExpressionTest.java
index 9e6c95fd3f71..db82067d3dea 100644
--- a/test/langtools/jdk/jshell/InaccessibleExpressionTest.java
+++ b/test/langtools/jdk/jshell/InaccessibleExpressionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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,23 +29,21 @@
  *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib
  * @build KullaTesting Compiler
- * @run testng InaccessibleExpressionTest
+ * @run junit InaccessibleExpressionTest
  */
 
 
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
-import org.testng.annotations.BeforeMethod;
 import jdk.jshell.VarSnippet;
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static org.testng.Assert.assertEquals;
-
-@Test
 public class InaccessibleExpressionTest extends KullaTesting {
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         Path path = Paths.get("eit");
@@ -76,20 +74,22 @@ public void setUp() {
                 .compilerOptions("--class-path", tpath));
     }
 
+    @Test
     public void testExternal() {
         assertEval("import static priv.GetPriv.*;");
         VarSnippet down = varKey(assertEval("down()", "Packp"));
-        assertEquals(down.typeName(), "priv.Packp");
+        assertEquals("priv.Packp", down.typeName());
         assertEval(down.name() + ".get()", "5");
         VarSnippet list = varKey(assertEval("list()", "[]"));
-        assertEquals(list.typeName(), "priv.MyList");
+        assertEquals("priv.MyList", list.typeName());
         assertEval(list.name() + ".size()", "0");
         VarSnippet one = varKey(assertEval("priv()", "One"));
-        assertEquals(one.typeName(), "priv.GetPriv.Count");
+        assertEquals("priv.GetPriv.Count", one.typeName());
         assertEval("var v = down();", "Packp");
         assertDeclareFail("v.toString()", "compiler.err.not.def.access.class.intf.cant.access");
     }
 
+    @Test
     public void testInternal() {
         assertEval(
                 "class Top {" +
@@ -98,7 +98,7 @@ public void testInternal() {
                 "    }" +
                 "    Inner n = new Inner(); }");
         VarSnippet n = varKey(assertEval("new Top().n", "Inner"));
-        assertEquals(n.typeName(), "Top.Inner");
+        assertEquals("Top.Inner", n.typeName());
     }
 
 }
diff --git a/test/langtools/jdk/jshell/IndentUITest.java b/test/langtools/jdk/jshell/IndentUITest.java
index d7534b3e6b92..a771b9b10318 100644
--- a/test/langtools/jdk/jshell/IndentUITest.java
+++ b/test/langtools/jdk/jshell/IndentUITest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, 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
@@ -35,18 +35,18 @@
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build Compiler UITesting
  * @compile IndentUITest.java
- * @run testng IndentUITest
+ * @run junit IndentUITest
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class IndentUITest extends UITesting {
 
     public IndentUITest() {
         super(true);
     }
 
+    @Test
     public void testIdent() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("void test1() {\nSystem.err.println(1);\n}\n");
diff --git a/test/langtools/jdk/jshell/InferTypeTest.java b/test/langtools/jdk/jshell/InferTypeTest.java
index 080697666a29..a1455306f45e 100644
--- a/test/langtools/jdk/jshell/InferTypeTest.java
+++ b/test/langtools/jdk/jshell/InferTypeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -30,14 +30,14 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
  * @build KullaTesting TestingInputStream toolbox.ToolBox Compiler
- * @run testng InferTypeTest
+ * @run junit InferTypeTest
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class InferTypeTest extends KullaTesting {
 
+    @Test
     public void testTypeInference() {
         assertInferredType("1", "int");
         assertEval("import java.util.*;");
diff --git a/test/langtools/jdk/jshell/JShellQueryTest.java b/test/langtools/jdk/jshell/JShellQueryTest.java
index 352e639a29c4..e487c294f3b1 100644
--- a/test/langtools/jdk/jshell/JShellQueryTest.java
+++ b/test/langtools/jdk/jshell/JShellQueryTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -26,21 +26,21 @@
  * @bug 8143964
  * @summary test queries to the JShell that return Streams
  * @build KullaTesting
- * @run testng JShellQueryTest
+ * @run junit JShellQueryTest
  */
 import jdk.jshell.Snippet;
-import org.testng.annotations.Test;
 
 import jdk.jshell.ImportSnippet;
 import jdk.jshell.MethodSnippet;
 import jdk.jshell.TypeDeclSnippet;
 import jdk.jshell.VarSnippet;
 import static java.util.stream.Collectors.joining;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class JShellQueryTest extends KullaTesting {
 
+    @Test
     public void testSnippets() {
         assertStreamMatch(getState().snippets());
         VarSnippet sx = varKey(assertEval("int x = 5;"));
@@ -54,6 +54,7 @@ public void testSnippets() {
         assertStreamMatch(getState().snippets(), sx, sfoo, smm, svv, sc, si, simp);
     }
 
+    @Test
     public void testVars() {
         assertStreamMatch(getState().variables());
         VarSnippet sx = varKey(assertEval("int x = 5;"));
@@ -67,6 +68,7 @@ public void testVars() {
         assertStreamMatch(getState().variables(), sx, sfoo);
     }
 
+    @Test
     public void testMethods() {
         assertStreamMatch(getState().methods());
         VarSnippet sx = varKey(assertEval("int x = 5;"));
@@ -79,6 +81,7 @@ public void testMethods() {
         assertStreamMatch(getState().methods(), smm, svv);
     }
 
+    @Test
     public void testTypes() {
         assertStreamMatch(getState().types());
         VarSnippet sx = varKey(assertEval("int x = 5;"));
@@ -91,6 +94,7 @@ public void testTypes() {
         assertStreamMatch(getState().types(), sc, si);
     }
 
+    @Test
     public void testImports() {
         assertStreamMatch(getState().imports());
         VarSnippet sx = varKey(assertEval("int x = 5;"));
@@ -103,6 +107,7 @@ public void testImports() {
         assertStreamMatch(getState().imports(), simp);
     }
 
+    @Test
     public void testDiagnostics() {
         Snippet sx = varKey(assertEval("int x = 5;"));
         assertStreamMatch(getState().diagnostics(sx));
@@ -110,9 +115,10 @@ public void testDiagnostics() {
         String res = getState().diagnostics(broken)
                 .map(d -> d.getCode())
                 .collect(joining("+"));
-        assertEquals(res, "compiler.err.cant.resolve.location.args+compiler.err.prob.found.req");
+        assertEquals("compiler.err.cant.resolve.location.args+compiler.err.prob.found.req", res);
     }
 
+    @Test
     public void testUnresolvedDependencies() {
         VarSnippet sx = varKey(assertEval("int x = 5;"));
         assertStreamMatch(getState().unresolvedDependencies(sx));
diff --git a/test/langtools/jdk/jshell/JShellStateClosedTest.java b/test/langtools/jdk/jshell/JShellStateClosedTest.java
index 2f8d12156671..62044dc1f2f1 100644
--- a/test/langtools/jdk/jshell/JShellStateClosedTest.java
+++ b/test/langtools/jdk/jshell/JShellStateClosedTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -25,7 +25,7 @@
  * @test 8164277
  * @summary Testing IllegalStateException.
  * @build KullaTesting TestingInputStream JShellStateClosedTest
- * @run testng JShellStateClosedTest
+ * @run junit JShellStateClosedTest
  */
 
 import java.util.function.Consumer;
@@ -36,11 +36,9 @@
 import jdk.jshell.Snippet;
 import jdk.jshell.TypeDeclSnippet;
 import jdk.jshell.VarSnippet;
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Test;
 
-import static org.testng.Assert.fail;
-
-@Test
 public class JShellStateClosedTest extends KullaTesting {
 
     private void testStateClosedException(Runnable action) {
@@ -53,6 +51,7 @@ private void testStateClosedException(Runnable action) {
         }
     }
 
+    @Test
     public void testClasses() {
         TypeDeclSnippet sc = classKey(assertEval("class C { }"));
         TypeDeclSnippet si = classKey(assertEval("interface I { }"));
@@ -60,6 +59,7 @@ public void testClasses() {
         assertStreamMatch(getState().types(), sc, si);
     }
 
+    @Test
     public void testVariables() {
         VarSnippet sx = varKey(assertEval("int x = 5;"));
         VarSnippet sfoo = varKey(assertEval("String foo;"));
@@ -67,6 +67,7 @@ public void testVariables() {
         assertStreamMatch(getState().variables(), sx, sfoo);
     }
 
+    @Test
     public void testMethods() {
         MethodSnippet smm = methodKey(assertEval("int mm() { return 6; }"));
         MethodSnippet svv = methodKey(assertEval("void vv() { }"));
@@ -74,12 +75,14 @@ public void testMethods() {
         assertStreamMatch(getState().methods(), smm, svv);
     }
 
+    @Test
     public void testImports() {
         ImportSnippet simp = importKey(assertEval("import java.lang.reflect.*;"));
         getState().close();
         assertStreamMatch(getState().imports(), simp);
     }
 
+    @Test
     public void testSnippets() {
         VarSnippet sx = varKey(assertEval("int x = 5;"));
         VarSnippet sfoo = varKey(assertEval("String foo;"));
@@ -92,6 +95,7 @@ public void testSnippets() {
         assertStreamMatch(getState().snippets(), sx, sfoo, smm, svv, sc, si, simp);
     }
 
+    @Test
     public void testEval() {
         testStateClosedException(() -> getState().eval("int a;"));
     }
@@ -117,22 +121,27 @@ private void testStateClosedWithoutException(Consumer action) {
         }
     }
 
+    @Test
     public void testStatus() {
         testStateClosedWithoutException((key) -> getState().status(key));
     }
 
+    @Test
     public void testVarValue() {
         testStateClosedException((key) -> getState().varValue((VarSnippet) key));
     }
 
+    @Test
     public void testDrop() {
         testStateClosedException((key) -> getState().drop(key));
     }
 
+    @Test
     public void testUnresolved() {
         testStateClosedWithoutException((key) -> getState().unresolvedDependencies((DeclarationSnippet) key));
     }
 
+    @Test
     public void testDiagnostics() {
         testStateClosedWithoutException((key) -> getState().diagnostics(key));
     }
diff --git a/test/langtools/jdk/jshell/JavadocTest.java b/test/langtools/jdk/jshell/JavadocTest.java
index 184921adf9a9..463c23a4f31a 100644
--- a/test/langtools/jdk/jshell/JavadocTest.java
+++ b/test/langtools/jdk/jshell/JavadocTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -31,7 +31,7 @@
  *          jdk.jshell/jdk.jshell:open
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build KullaTesting TestingInputStream Compiler
- * @run testng JavadocTest
+ * @run junit JavadocTest
  */
 
 import java.io.IOException;
@@ -43,13 +43,13 @@
 import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class JavadocTest extends KullaTesting {
 
     private final Compiler compiler = new Compiler();
 
+    @Test
     public void testJavadoc() {
         prepareZip();
         assertJavadoc("test.Clazz|", "test.Clazz\n" +
@@ -65,6 +65,7 @@ public void testJavadoc() {
         assertJavadoc("clz.undef|");
     }
 
+    @Test
     public void testVariableInRepl() {
         assertEval("Object o;");
         assertSignature("o|", "o:java.lang.Object");
@@ -107,6 +108,7 @@ private void prepareZip() {
         addToClasspath(compiler.getClassDir());
     }
 
+    @Test
     public void testCollectionsMin() {
         prepareJavaUtilZip();
         assertJavadoc("java.util.Collections.min(|",
diff --git a/test/langtools/jdk/jshell/JdiBadOptionLaunchExecutionControlTest.java b/test/langtools/jdk/jshell/JdiBadOptionLaunchExecutionControlTest.java
index 199964abb0bf..c45370c1a549 100644
--- a/test/langtools/jdk/jshell/JdiBadOptionLaunchExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/JdiBadOptionLaunchExecutionControlTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -26,22 +26,22 @@
  * @bug 8169519 8166581
  * @summary Tests for JDI connector failure
  * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution
- * @run testng JdiBadOptionLaunchExecutionControlTest
+ * @run junit JdiBadOptionLaunchExecutionControlTest
  */
 
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import org.testng.annotations.Test;
 import jdk.jshell.JShell;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class JdiBadOptionLaunchExecutionControlTest {
 
     private static final String EXPECTED_ERROR =
             "Launching JShell execution engine threw: Failed remote launch: java.util.concurrent.ExecutionException: com.sun.jdi.connect.VMStartException: VM initialization failed";
 
+    @Test
     public void badOptionLaunchTest() {
         try {
             // turn on logging of launch failures
diff --git a/test/langtools/jdk/jshell/JdiBadOptionListenExecutionControlTest.java b/test/langtools/jdk/jshell/JdiBadOptionListenExecutionControlTest.java
index bdf05c7bd7fb..422c6c18b756 100644
--- a/test/langtools/jdk/jshell/JdiBadOptionListenExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/JdiBadOptionListenExecutionControlTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -26,22 +26,22 @@
  * @bug 8169519 8166581
  * @summary Tests for JDI connector failure
  * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution
- * @run testng JdiBadOptionListenExecutionControlTest
+ * @run junit JdiBadOptionListenExecutionControlTest
  */
 
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import org.testng.annotations.Test;
 import jdk.jshell.JShell;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class JdiBadOptionListenExecutionControlTest {
 
     private static final String EXPECTED_ERROR =
             "Unrecognized option: -BadBadOption";
 
+    @Test
     public void badOptionListenTest() {
         try {
             // turn on logging of launch failures
diff --git a/test/langtools/jdk/jshell/JdiBogusHostListenExecutionControlTest.java b/test/langtools/jdk/jshell/JdiBogusHostListenExecutionControlTest.java
index 03659952279e..7f0924229b73 100644
--- a/test/langtools/jdk/jshell/JdiBogusHostListenExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/JdiBogusHostListenExecutionControlTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -26,17 +26,16 @@
  * @bug 8169519 8168615 8176474
  * @summary Tests for JDI connector failure
  * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution
- * @run testng JdiBogusHostListenExecutionControlTest
+ * @run junit JdiBogusHostListenExecutionControlTest
  */
 
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import org.testng.annotations.Test;
 import jdk.jshell.JShell;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class JdiBogusHostListenExecutionControlTest {
 
     private static final String EXPECTED_ERROR =
@@ -44,6 +43,7 @@ public class JdiBogusHostListenExecutionControlTest {
     private static final String EXPECTED_LOCATION =
             "@ com.sun.jdi.SocketListen";
 
+    @Test
     public void badOptionListenTest() {
         try {
             // turn on logging of launch failures
diff --git a/test/langtools/jdk/jshell/JdiFailingLaunchExecutionControlTest.java b/test/langtools/jdk/jshell/JdiFailingLaunchExecutionControlTest.java
index 288983a05e52..6ce9df1ccf44 100644
--- a/test/langtools/jdk/jshell/JdiFailingLaunchExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/JdiFailingLaunchExecutionControlTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -27,19 +27,19 @@
  * @summary Tests for JDI connector failure
  * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution
  * @build DyingRemoteAgent
- * @run testng JdiFailingLaunchExecutionControlTest
+ * @run junit JdiFailingLaunchExecutionControlTest
  */
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class JdiFailingLaunchExecutionControlTest {
 
     private static final String EXPECTED_ERROR =
             "Launching JShell execution engine threw: Accept timed out";
 
+    @Test
     public void failLaunchTest() {
         try {
             System.err.printf("Unexpected return value: %s\n", DyingRemoteAgent.state(true, null).eval("33;"));
diff --git a/test/langtools/jdk/jshell/JdiFailingListenExecutionControlTest.java b/test/langtools/jdk/jshell/JdiFailingListenExecutionControlTest.java
index aaa3357a754f..d8b524585519 100644
--- a/test/langtools/jdk/jshell/JdiFailingListenExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/JdiFailingListenExecutionControlTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -27,19 +27,19 @@
  * @summary Tests for JDI connector failure
  * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution
  * @build DyingRemoteAgent
- * @run testng JdiFailingListenExecutionControlTest
+ * @run junit JdiFailingListenExecutionControlTest
  */
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class JdiFailingListenExecutionControlTest {
 
     private static final String EXPECTED_ERROR =
             "Launching JShell execution engine threw: Accept timed out";
 
+    @Test
     public void failListenTest() {
         try {
             System.err.printf("Unexpected return value: %s\n", DyingRemoteAgent.state(true, null).eval("33;"));
diff --git a/test/langtools/jdk/jshell/JdiHangingLaunchExecutionControlTest.java b/test/langtools/jdk/jshell/JdiHangingLaunchExecutionControlTest.java
index 577228d48209..a0c0751395d2 100644
--- a/test/langtools/jdk/jshell/JdiHangingLaunchExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/JdiHangingLaunchExecutionControlTest.java
@@ -27,19 +27,19 @@
  * @summary Tests for JDI connector timeout failure
  * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution
  * @build HangingRemoteAgent
- * @run testng JdiHangingLaunchExecutionControlTest
+ * @run junit JdiHangingLaunchExecutionControlTest
  */
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class JdiHangingLaunchExecutionControlTest {
 
     private static final String EXPECTED_ERROR =
             "Launching JShell execution engine threw: Accept timed out";
 
+    @Test
     public void hangLaunchTimeoutTest() {
         try {
             System.err.printf("Unexpected return value: %s\n",
diff --git a/test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java b/test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java
index 2e9b04a634b2..2013b0809a25 100644
--- a/test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java
@@ -27,20 +27,20 @@
  * @summary Tests for JDI connector timeout failure
  * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution
  * @build HangingRemoteAgent
- * @run testng JdiHangingListenExecutionControlTest
+ * @run junit JdiHangingListenExecutionControlTest
  * @key intermittent
  */
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class JdiHangingListenExecutionControlTest {
 
     private static final String EXPECTED_ERROR =
             "Launching JShell execution engine threw: Accept timed out";
 
+    @Test
     public void hangListenTimeoutTest() {
         try {
             System.err.printf("Unexpected return value: %s\n",
diff --git a/test/langtools/jdk/jshell/JdiLaunchingExecutionControlTest.java b/test/langtools/jdk/jshell/JdiLaunchingExecutionControlTest.java
index af9dce89bcf4..35261ff6fa1a 100644
--- a/test/langtools/jdk/jshell/JdiLaunchingExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/JdiLaunchingExecutionControlTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -27,18 +27,16 @@
  * @summary Tests for standard JDI connector (without failover) -- launching
  * @modules jdk.jshell/jdk.jshell.execution
  * @build KullaTesting ExecutionControlTestBase
- * @run testng JdiLaunchingExecutionControlTest
+ * @run junit JdiLaunchingExecutionControlTest
  * @key intermittent
  */
 
 
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
+import org.junit.jupiter.api.BeforeEach;
 
-@Test
 public class JdiLaunchingExecutionControlTest extends ExecutionControlTestBase {
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         setUp(builder -> builder.executionEngine("jdi:launch(true)"));
diff --git a/test/langtools/jdk/jshell/JdiListeningExecutionControlTest.java b/test/langtools/jdk/jshell/JdiListeningExecutionControlTest.java
index 700ec077e34f..3cc2a9785a3c 100644
--- a/test/langtools/jdk/jshell/JdiListeningExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/JdiListeningExecutionControlTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -27,18 +27,16 @@
  * @summary Tests for alternate JDI connector -- listening
  * @modules jdk.jshell/jdk.jshell.execution
  * @build KullaTesting ExecutionControlTestBase
- * @run testng JdiListeningExecutionControlTest
+ * @run junit JdiListeningExecutionControlTest
  * @key intermittent
  */
 
 
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
+import org.junit.jupiter.api.BeforeEach;
 
-@Test
 public class JdiListeningExecutionControlTest extends ExecutionControlTestBase {
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         setUp(builder -> builder.executionEngine("jdi"));
diff --git a/test/langtools/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java b/test/langtools/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java
index 241774d639e0..2e38e9f9aaef 100644
--- a/test/langtools/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -27,18 +27,16 @@
  * @summary Tests for alternate JDI connector -- listening to "localhost"
  * @modules jdk.jshell/jdk.jshell.execution
  * @build KullaTesting ExecutionControlTestBase
- * @run testng JdiListeningLocalhostExecutionControlTest
+ * @run junit JdiListeningLocalhostExecutionControlTest
  * @key intermittent
  */
 
 
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
+import org.junit.jupiter.api.BeforeEach;
 
-@Test
 public class JdiListeningLocalhostExecutionControlTest extends ExecutionControlTestBase {
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         setUp(builder -> builder.executionEngine("jdi:hostname(localhost)"));
diff --git a/test/langtools/jdk/jshell/KullaCompletenessStressTest.java b/test/langtools/jdk/jshell/KullaCompletenessStressTest.java
index e79e043dd10c..69830880dcba 100644
--- a/test/langtools/jdk/jshell/KullaCompletenessStressTest.java
+++ b/test/langtools/jdk/jshell/KullaCompletenessStressTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -26,16 +26,19 @@
  * @summary Test SourceCodeAnalysis
  * @modules jdk.compiler/com.sun.tools.javac.api
  * @build KullaTesting TestingInputStream KullaCompletenessStressTest CompletenessStressTest
- * @run testng KullaCompletenessStressTest
+ * @run junit KullaCompletenessStressTest
  */
 
 import java.io.File;
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
 
-@Test
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class KullaCompletenessStressTest extends CompletenessStressTest {
     @Override
+    @Test
     public File[] getDirectoriesToTest() {
         String src = System.getProperty("test.src");
         File file;
@@ -44,11 +47,10 @@ public File[] getDirectoriesToTest() {
         } else {
             file = new File(src, "../../../src/jdk.jshell/share/classes");
         }
-        if (!file.exists()) {
-            System.out.println("jdk.jshell sources are not exist. Test has been skipped. Path: " + file.toString());
-            return new File[]{};
-        }else {
-            return new File[]{file};
-        }
+
+        Assumptions.assumeTrue(file.exists(),
+                               "jdk.jshell sources are not exist. Test has been skipped. Path: " + file.toString());
+
+        return new File[]{file};
     }
 }
diff --git a/test/langtools/jdk/jshell/KullaTesting.java b/test/langtools/jdk/jshell/KullaTesting.java
index d74f3484f4bd..9689b812e0ae 100644
--- a/test/langtools/jdk/jshell/KullaTesting.java
+++ b/test/langtools/jdk/jshell/KullaTesting.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, 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
@@ -71,8 +71,6 @@
 import jdk.jshell.SourceCodeAnalysis.QualifiedNames;
 import jdk.jshell.SourceCodeAnalysis.Suggestion;
 import jdk.jshell.UnresolvedReferenceException;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
 
 import jdk.jshell.Diag;
 
@@ -80,9 +78,11 @@
 import static java.util.stream.Collectors.toSet;
 
 import static jdk.jshell.Snippet.Status.*;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
 import static jdk.jshell.Snippet.SubKind.METHOD_SUBKIND;
 import jdk.jshell.SourceCodeAnalysis.Documentation;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
 public class KullaTesting {
 
@@ -166,7 +166,7 @@ public void addToClasspath(Path path) {
         addToClasspath(path.toString());
     }
 
-    @BeforeMethod
+    @BeforeEach
     public void setUp() {
         setUp(b -> {});
     }
@@ -202,7 +202,7 @@ public int read(byte[] b, int off, int len) throws IOException {
         idToSnippet = new LinkedHashMap<>();
     }
 
-    @AfterMethod
+    @AfterEach
     public void tearDown() {
         if (state != null) state.close();
         state = null;
@@ -226,16 +226,16 @@ public ClassLoader createAndRunFromModule(String moduleName, Path modPath) {
 
     public List assertUnresolvedDependencies(DeclarationSnippet key, int unresolvedSize) {
         List unresolved = getState().unresolvedDependencies(key).collect(toList());
-        assertEquals(unresolved.size(), unresolvedSize, "Input: " + key.source() + ", checking unresolved: ");
+        assertEquals(unresolvedSize, unresolved.size(), "Input: " + key.source() + ", checking unresolved: ");
         return unresolved;
     }
 
     public DeclarationSnippet assertUnresolvedDependencies1(DeclarationSnippet key, Status status, String name) {
         List unresolved = assertUnresolvedDependencies(key, 1);
         String input = key.source();
-        assertEquals(unresolved.size(), 1, "Given input: " + input + ", checking unresolved");
-        assertEquals(unresolved.get(0), name, "Given input: " + input + ", checking unresolved: ");
-        assertEquals(getState().status(key), status, "Given input: " + input + ", checking status: ");
+        assertEquals(1, unresolved.size(), "Given input: " + input + ", checking unresolved");
+        assertEquals(name, unresolved.get(0), "Given input: " + input + ", checking unresolved: ");
+        assertEquals(status, getState().status(key), "Given input: " + input + ", checking status: ");
         return key;
     }
 
@@ -243,24 +243,24 @@ public DeclarationSnippet assertEvalUnresolvedException(String input, String nam
         List events = assertEval(input, null, UnresolvedReferenceException.class, DiagCheck.DIAG_OK, DiagCheck.DIAG_OK, null);
         SnippetEvent ste = events.get(0);
         DeclarationSnippet sn = ((UnresolvedReferenceException) ste.exception()).getSnippet();
-        assertEquals(sn.name(), name, "Given input: " + input + ", checking name");
-        assertEquals(getState().unresolvedDependencies(sn).count(), unresolvedSize, "Given input: " + input + ", checking unresolved");
-        assertEquals(getState().diagnostics(sn).count(), (long) diagnosticsSize, "Given input: " + input + ", checking diagnostics");
+        assertEquals(name, sn.name(), "Given input: " + input + ", checking name");
+        assertEquals(unresolvedSize, getState().unresolvedDependencies(sn).count(), "Given input: " + input + ", checking unresolved");
+        assertEquals((long) diagnosticsSize, getState().diagnostics(sn).count(), "Given input: " + input + ", checking diagnostics");
         return sn;
     }
 
     public Snippet assertKeyMatch(String input, boolean isExecutable, SubKind expectedSubKind, STEInfo mainInfo, STEInfo... updates) {
         Snippet key = key(assertEval(input, IGNORE_VALUE, mainInfo, updates));
         String source = key.source();
-        assertEquals(source, input, "Key \"" + input + "\" source mismatch, got: " + source + ", expected: " + input);
+        assertEquals(input, source, "Key \"" + input + "\" source mismatch, got: " + source + ", expected: " + input);
         SubKind subkind = key.subKind();
-        assertEquals(subkind, expectedSubKind, "Key \"" + input + "\" subkind mismatch, got: "
+        assertEquals(expectedSubKind, subkind, "Key \"" + input + "\" subkind mismatch, got: "
                 + subkind + ", expected: " + expectedSubKind);
-        assertEquals(subkind.isExecutable(), isExecutable, "Key \"" + input + "\", expected isExecutable: "
+        assertEquals(isExecutable, subkind.isExecutable(), "Key \"" + input + "\", expected isExecutable: "
                 + isExecutable + ", got: " + subkind.isExecutable());
         Snippet.Kind expectedKind = getKind(key);
-        assertEquals(key.kind(), expectedKind, "Checking kind: ");
-        assertEquals(expectedSubKind.kind(), expectedKind, "Checking kind: ");
+        assertEquals(expectedKind, key.kind(), "Checking kind: ");
+        assertEquals(expectedKind, expectedSubKind.kind(), "Checking kind: ");
         return key;
     }
 
@@ -309,9 +309,9 @@ public ImportSnippet assertImportKeyMatch(String input, String name, SubKind sub
 
         assertTrue(key instanceof ImportSnippet, "Expected an ImportKey, got: " + key.getClass().getName());
         ImportSnippet importKey = (ImportSnippet) key;
-        assertEquals(importKey.name(), name, "Input \"" + input +
+        assertEquals(name, importKey.name(), "Input \"" + input +
                 "\" name mismatch, got: " + importKey.name() + ", expected: " + name);
-        assertEquals(importKey.kind(), Kind.IMPORT, "Checking kind: ");
+        assertEquals(Kind.IMPORT, importKey.kind(), "Checking kind: ");
         return importKey;
     }
 
@@ -320,7 +320,7 @@ public DeclarationSnippet assertDeclarationKeyMatch(String input, boolean isExec
 
         assertTrue(key instanceof DeclarationSnippet, "Expected a DeclarationKey, got: " + key.getClass().getName());
         DeclarationSnippet declKey = (DeclarationSnippet) key;
-        assertEquals(declKey.name(), name, "Input \"" + input +
+        assertEquals(name, declKey.name(), "Input \"" + input +
                 "\" name mismatch, got: " + declKey.name() + ", expected: " + name);
         return declKey;
     }
@@ -330,9 +330,9 @@ public VarSnippet assertVarKeyMatch(String input, boolean isExecutable, String n
         assertTrue(sn instanceof VarSnippet, "Expected a VarKey, got: " + sn.getClass().getName());
         VarSnippet variableKey = (VarSnippet) sn;
         String signature = variableKey.typeName();
-        assertEquals(signature, typeName, "Key \"" + input +
+        assertEquals(typeName, signature, "Key \"" + input +
                 "\" typeName mismatch, got: " + signature + ", expected: " + typeName);
-        assertEquals(variableKey.kind(), Kind.VAR, "Checking kind: ");
+        assertEquals(Kind.VAR, variableKey.kind(), "Checking kind: ");
         return variableKey;
     }
 
@@ -340,11 +340,11 @@ public void assertExpressionKeyMatch(String input, String name, SubKind kind, St
         Snippet key = assertKeyMatch(input, true, kind, added(VALID));
         assertTrue(key instanceof ExpressionSnippet, "Expected a ExpressionKey, got: " + key.getClass().getName());
         ExpressionSnippet exprKey = (ExpressionSnippet) key;
-        assertEquals(exprKey.name(), name, "Input \"" + input +
+        assertEquals(name, exprKey.name(), "Input \"" + input +
                 "\" name mismatch, got: " + exprKey.name() + ", expected: " + name);
-        assertEquals(exprKey.typeName(), typeName, "Key \"" + input +
+        assertEquals(typeName, exprKey.typeName(), "Key \"" + input +
                 "\" typeName mismatch, got: " + exprKey.typeName() + ", expected: " + typeName);
-        assertEquals(exprKey.kind(), Kind.EXPRESSION, "Checking kind: ");
+        assertEquals(Kind.EXPRESSION, exprKey.kind(), "Checking kind: ");
     }
 
     // For expressions throwing an EvalException
@@ -402,7 +402,7 @@ public List assertEval(String input,
      void assertStreamMatch(Stream result, T... expected) {
         Set sns = result.collect(toSet());
         Set exp = Stream.of(expected).collect(toSet());
-        assertEquals(sns, exp);
+        assertEquals(exp, sns);
     }
 
     private Map closure(List events) {
@@ -483,9 +483,9 @@ private List checkEvents(Supplier> toTest,
         });
         List events = toTest.get();
         getState().unsubscribe(token);
-        assertEquals(dispatched.size(), events.size(), "dispatched event size not the same as event size");
+        assertEquals(events.size(), dispatched.size(), "dispatched event size not the same as event size");
         for (int i = events.size() - 1; i >= 0; --i) {
-            assertEquals(dispatched.get(i), events.get(i), "Event element " + i + " does not match");
+            assertEquals(events.get(i), dispatched.get(i), "Event element " + i + " does not match");
         }
         dispatched.add(null); // mark end of dispatchs
 
@@ -499,11 +499,11 @@ private List checkEvents(Supplier> toTest,
                 if (old != null) {
                     switch (evt.status()) {
                         case DROPPED:
-                            assertEquals(old, evt.snippet(),
+                            assertEquals(evt.snippet(), old,
                                     "Drop: Old snippet must be what is dropped -- input: " + descriptor);
                             break;
                         case OVERWRITTEN:
-                            assertEquals(old, evt.snippet(),
+                            assertEquals(evt.snippet(), old,
                                     "Overwrite: Old snippet (" + old
                                     + ") must be what is overwritten -- input: "
                                     + descriptor + " -- " + evt);
@@ -511,12 +511,12 @@ private List checkEvents(Supplier> toTest,
                         default:
                             if (evt.causeSnippet() == null) {
                                 // New source
-                                assertNotEquals(old, evt.snippet(),
+                                assertNotEquals(evt.snippet(), old,
                                         "New source: Old snippet must be different from the replacing -- input: "
                                         + descriptor);
                             } else {
                                 // An update (key Overwrite??)
-                                assertEquals(old, evt.snippet(),
+                                assertEquals(evt.snippet(), old,
                                         "Update: Old snippet must be equal to the replacing -- input: "
                                         + descriptor);
                             }
@@ -556,7 +556,7 @@ private List checkEvents(Supplier> toTest,
 
         int impactId = 0;
         Map> groupedEvents = groupByCauseSnippet(events);
-        assertEquals(groupedEvents.size(), eventChains.length, "Number of main events");
+        assertEquals(eventChains.length, groupedEvents.size(), "Number of main events");
         for (Map.Entry> entry : groupedEvents.entrySet()) {
             EventChain eventChain = eventChains[impactId++];
             SnippetEvent main = entry.getValue().get(0);
@@ -579,12 +579,12 @@ private List checkEvents(Supplier> toTest,
                 }
             }
             if (((Object) eventChain.value) != IGNORE_VALUE) {
-                assertEquals(main.value(), eventChain.value, "Expected execution value of: " + eventChain.value +
+                assertEquals(eventChain.value, main.value(), "Expected execution value of: " + eventChain.value +
                         ", but got: " + main.value());
             }
             if (eventChain.exceptionClass != IGNORE_EXCEPTION) {
                 if (main.exception() == null) {
-                    assertEquals(eventChain.exceptionClass, null, "Expected an exception of class "
+                    assertEquals(null, eventChain.exceptionClass, "Expected an exception of class "
                             + eventChain.exceptionClass + " got no exception");
                 } else if (eventChain.exceptionClass == null) {
                     fail("Expected no exception but got " + main.exception().toString());
@@ -597,7 +597,7 @@ private List checkEvents(Supplier> toTest,
             List diagnostics = getState().diagnostics(mainKey).collect(toList());
             switch (diagMain) {
                 case DIAG_OK:
-                    assertEquals(diagnostics.size(), 0, "Expected no diagnostics, got: " + diagnosticsToString(diagnostics));
+                    assertEquals(0, diagnostics.size(), "Expected no diagnostics, got: " + diagnosticsToString(diagnostics));
                     break;
                 case DIAG_WARNING:
                     assertFalse(hasFatalError(diagnostics), "Expected no errors, got: " + diagnosticsToString(diagnostics));
@@ -611,7 +611,7 @@ private List checkEvents(Supplier> toTest,
                     diagnostics = getState().diagnostics(ste.snippet()).collect(toList());
                     switch (diagUpdates) {
                         case DIAG_OK:
-                            assertEquals(diagnostics.size(), 0, "Expected no diagnostics, got: " + diagnosticsToString(diagnostics));
+                            assertEquals(0, diagnostics.size(), "Expected no diagnostics, got: " + diagnosticsToString(diagnostics));
                             break;
                         case DIAG_WARNING:
                             assertFalse(hasFatalError(diagnostics), "Expected no errors, got: " + diagnosticsToString(diagnostics));
@@ -626,7 +626,7 @@ private List checkEvents(Supplier> toTest,
     // Use this for all EMPTY calls to eval()
     public void assertEvalEmpty(String input) {
         List events = getState().eval(input);
-        assertEquals(events.size(), 0, "Expected no events, got: " + events.size());
+        assertEquals(0, events.size(), "Expected no events, got: " + events.size());
     }
 
     public VarSnippet varKey(List events) {
@@ -660,7 +660,7 @@ public Snippet key(List events) {
 
     public void assertVarValue(Snippet key, String expected) {
         String value = state.varValue((VarSnippet) key);
-        assertEquals(value, expected, "Expected var value of: " + expected + ", but got: " + value);
+        assertEquals(expected, value, "Expected var value of: " + expected + ", but got: " + value);
     }
 
     public Snippet assertDeclareFail(String input, String expectedErrorCode) {
@@ -684,7 +684,7 @@ public Snippet assertDeclareFail(String input, ExpectedDiagnostic expectedDiagno
                 DiagCheck.DIAG_ERROR, DiagCheck.DIAG_IGNORE, mainInfo, updates);
         SnippetEvent e = events.get(0);
         Snippet key = e.snippet();
-        assertEquals(getState().status(key), REJECTED);
+        assertEquals(REJECTED, getState().status(key));
         List diagnostics = getState().diagnostics(e.snippet()).collect(toList());
         assertTrue(diagnostics.size() > 0, "Expected diagnostics, got none");
         assertDiagnostic(input, diagnostics.get(0), expectedDiagnostic);
@@ -727,7 +727,7 @@ public void assertMethodDeclSnippet(MethodSnippet method,
         assertDeclarationSnippet(method, expectedName, expectedStatus,
                 METHOD_SUBKIND, unressz, othersz);
         String signature = method.signature();
-        assertEquals(signature, expectedSignature,
+        assertEquals(expectedSignature, signature,
                 "Expected " + method.source() + " to have the name: " +
                         expectedSignature + ", got: " + signature);
     }
@@ -739,7 +739,7 @@ public void assertVariableDeclSnippet(VarSnippet var,
         assertDeclarationSnippet(var, expectedName, expectedStatus,
                 expectedSubKind, unressz, othersz);
         String signature = var.typeName();
-        assertEquals(signature, expectedTypeName,
+        assertEquals(expectedTypeName, signature,
                 "Expected " + var.source() + " to have the type name: " +
                         expectedTypeName + ", got: " + signature);
     }
@@ -750,27 +750,27 @@ public void assertDeclarationSnippet(DeclarationSnippet declarationKey,
             int unressz, int othersz) {
         assertKey(declarationKey, expectedStatus, expectedSubKind);
         String source = declarationKey.source();
-        assertEquals(declarationKey.name(), expectedName,
+        assertEquals(expectedName, declarationKey.name(),
                 "Expected " + source + " to have the name: " + expectedName + ", got: " + declarationKey.name());
         long unresolved = getState().unresolvedDependencies(declarationKey).count();
-        assertEquals(unresolved, unressz, "Expected " + source + " to have " + unressz
+        assertEquals(unressz, unresolved, "Expected " + source + " to have " + unressz
                 + " unresolved symbols, got: " + unresolved);
         long otherCorralledErrorsCount = getState().diagnostics(declarationKey).count();
-        assertEquals(otherCorralledErrorsCount, othersz, "Expected " + source + " to have " + othersz
+        assertEquals(othersz, otherCorralledErrorsCount, "Expected " + source + " to have " + othersz
                 + " other errors, got: " + otherCorralledErrorsCount);
     }
 
     public void assertKey(Snippet key, Status expectedStatus, SubKind expectedSubKind) {
         String source = key.source();
         SubKind actualSubKind = key.subKind();
-        assertEquals(actualSubKind, expectedSubKind,
+        assertEquals(expectedSubKind, actualSubKind,
                 "Expected " + source + " to have the subkind: " + expectedSubKind + ", got: " + actualSubKind);
         Status status = getState().status(key);
-        assertEquals(status, expectedStatus, "Expected " + source + " to be "
+        assertEquals(expectedStatus, status, "Expected " + source + " to be "
                 + expectedStatus + ", but it is " + status);
         Snippet.Kind expectedKind = getKind(key);
-        assertEquals(key.kind(), expectedKind, "Checking kind: ");
-        assertEquals(expectedSubKind.kind(), expectedKind, "Checking kind: ");
+        assertEquals(expectedKind, key.kind(), "Checking kind: ");
+        assertEquals(expectedKind, expectedSubKind.kind(), "Checking kind: ");
     }
 
     public void assertDrop(Snippet key, STEInfo mainInfo, STEInfo... updates) {
@@ -795,36 +795,36 @@ public void assertAnalyze(String input, Completeness status, String source) {
 
     public void assertAnalyze(String input, Completeness status, String source, String remaining, Boolean isComplete) {
         CompletionInfo ci = getAnalysis().analyzeCompletion(input);
-        if (status != null) assertEquals(ci.completeness(), status, "Input : " + input + ", status: ");
-        assertEquals(ci.source(), source, "Input : " + input + ", source: ");
-        if (remaining != null) assertEquals(ci.remaining(), remaining, "Input : " + input + ", remaining: ");
+        if (status != null) assertEquals(status, ci.completeness(), "Input : " + input + ", status: ");
+        assertEquals(source, ci.source(), "Input : " + input + ", source: ");
+        if (remaining != null) assertEquals(remaining, ci.remaining(), "Input : " + input + ", remaining: ");
         if (isComplete != null) {
             boolean isExpectedComplete = isComplete;
-            assertEquals(ci.completeness().isComplete(), isExpectedComplete, "Input : " + input + ", isComplete: ");
+            assertEquals(isExpectedComplete, ci.completeness().isComplete(), "Input : " + input + ", isComplete: ");
         }
     }
 
     public void assertNumberOfActiveVariables(int cnt) {
-        assertEquals(getState().variables().count(), cnt, "Variables : " + getState().variables().collect(toList()));
+        assertEquals(cnt, getState().variables().count(), "Variables : " + getState().variables().collect(toList()));
     }
 
     public void assertNumberOfActiveMethods(int cnt) {
-        assertEquals(getState().methods().count(), cnt, "Methods : " + getState().methods().collect(toList()));
+        assertEquals(cnt, getState().methods().count(), "Methods : " + getState().methods().collect(toList()));
     }
 
     public void assertNumberOfActiveClasses(int cnt) {
-        assertEquals(getState().types().count(), cnt, "Types : " + getState().types().collect(toList()));
+        assertEquals(cnt, getState().types().count(), "Types : " + getState().types().collect(toList()));
     }
 
     public void assertKeys(MemberInfo... expected) {
         int index = 0;
         List snippets = getState().snippets().collect(toList());
-        assertEquals(allSnippets.size(), snippets.size());
+        assertEquals(snippets.size(), allSnippets.size());
         for (Snippet sn : snippets) {
             if (sn.kind().isPersistent() && getState().status(sn).isActive()) {
                 MemberInfo actual = getMemberInfo(sn);
                 MemberInfo exp = expected[index];
-                assertEquals(actual, exp, String.format("Difference in #%d. Expected: %s, actual: %s",
+                assertEquals(exp, actual, String.format("Difference in #%d. Expected: %s, actual: %s",
                         index, exp, actual));
                 ++index;
             }
@@ -840,7 +840,7 @@ public void assertActiveKeys(Snippet... expected) {
         int index = 0;
         for (Snippet key : getState().snippets().collect(toList())) {
             if (state.status(key).isActive()) {
-                assertEquals(expected[index], key, String.format("Difference in #%d. Expected: %s, actual: %s", index, key, expected[index]));
+                assertEquals(key, expected[index], String.format("Difference in #%d. Expected: %s, actual: %s", index, key, expected[index]));
                 ++index;
             }
         }
@@ -852,7 +852,7 @@ private void assertActiveSnippets(Stream snippets, Predicate<
                 .collect(Collectors.toSet());
         Set got = snippets
                 .collect(Collectors.toSet());
-        assertEquals(active, got, label);
+        assertEquals(got, active, label);
     }
 
     public void assertVariables() {
@@ -872,8 +872,8 @@ public void assertMembers(Stream members, MemberInfo...expect
         Set got = members
                         .map(this::getMemberInfo)
                         .collect(Collectors.toSet());
-        assertEquals(got.size(), expected.size(), "Expected : " + expected + ", actual : " + members);
-        assertEquals(got, expected);
+        assertEquals(expected.size(), got.size(), "Expected : " + expected + ", actual : " + members);
+        assertEquals(expected, got);
     }
 
     public void assertVariables(MemberInfo...expected) {
@@ -891,7 +891,7 @@ public void assertMethods(MemberInfo...expected) {
             }
             assertNotNull(expectedInfo, "Not found method: " + methodKey.name());
             int lastIndexOf = expectedInfo.type.lastIndexOf(')');
-            assertEquals(methodKey.parameterTypes(), expectedInfo.type.substring(1, lastIndexOf), "Parameter types");
+            assertEquals(expectedInfo.type.substring(1, lastIndexOf), methodKey.parameterTypes(), "Parameter types");
         });
     }
 
@@ -905,7 +905,7 @@ public void assertCompletion(String code, String... expected) {
 
     public void assertCompletion(String code, Boolean isSmart, String... expected) {
         List completions = computeCompletions(code, isSmart);
-        assertEquals(completions, Arrays.asList(expected), "Input: " + code + ", " + completions.toString());
+        assertEquals(Arrays.asList(expected), completions, "Input: " + code + ", " + completions.toString());
     }
 
     public void assertCompletionIncludesExcludes(String code, Set expected, Set notExpected) {
@@ -939,7 +939,7 @@ private List computeCompletions(String code, Boolean isSmart) {
     public void assertInferredType(String code, String expectedType) {
         String inferredType = getAnalysis().analyzeType(code, code.length());
 
-        assertEquals(inferredType, expectedType, "Input: " + code + ", " + inferredType);
+        assertEquals(expectedType, inferredType, "Input: " + code + ", " + inferredType);
     }
 
     public void assertInferredFQNs(String code, String... fqns) {
@@ -951,9 +951,9 @@ public void assertInferredFQNs(String code, int simpleNameLen, boolean resolvabl
 
         QualifiedNames candidates = getAnalysis().listQualifiedNames(code, code.length());
 
-        assertEquals(candidates.getNames(), Arrays.asList(fqns), "Input: " + code + ", candidates=" + candidates.getNames());
-        assertEquals(candidates.getSimpleNameLength(), simpleNameLen, "Input: " + code + ", simpleNameLen=" + candidates.getSimpleNameLength());
-        assertEquals(candidates.isResolvable(), resolvable, "Input: " + code + ", resolvable=" + candidates.isResolvable());
+        assertEquals(Arrays.asList(fqns), candidates.getNames(), "Input: " + code + ", candidates=" + candidates.getNames());
+        assertEquals(simpleNameLen, candidates.getSimpleNameLength(), "Input: " + code + ", simpleNameLen=" + candidates.getSimpleNameLength());
+        assertEquals(resolvable, candidates.isResolvable(), "Input: " + code + ", resolvable=" + candidates.isResolvable());
     }
 
     protected void waitIndexingFinished() {
@@ -974,7 +974,7 @@ public void assertSignature(String code, String... expected) {
         List documentation = getAnalysis().documentation(code, cursor, false);
         Set docSet = documentation.stream().map(doc -> doc.signature()).collect(Collectors.toSet());
         Set expectedSet = Stream.of(expected).collect(Collectors.toSet());
-        assertEquals(docSet, expectedSet, "Input: " + code);
+        assertEquals(expectedSet, docSet, "Input: " + code);
     }
 
     public void assertJavadoc(String code, String... expected) {
@@ -986,7 +986,7 @@ public void assertJavadoc(String code, String... expected) {
                                           .map(doc -> doc.signature() + "\n" + doc.javadoc())
                                           .collect(Collectors.toSet());
         Set expectedSet = Stream.of(expected).collect(Collectors.toSet());
-        assertEquals(docSet, expectedSet, "Input: " + code);
+        assertEquals(expectedSet, docSet, "Input: " + code);
     }
 
     public enum ClassType {
@@ -1182,7 +1182,7 @@ public void assertMatch(SnippetEvent ste, Snippet mainSnippet) {
             assertStatusMatch(ste, ste.previousStatus(), previousStatus());
             assertStatusMatch(ste, ste.status(), status());
             if (checkIsSignatureChange) {
-                assertEquals(ste.isSignatureChange(), isSignatureChange(),
+                assertEquals(isSignatureChange(), ste.isSignatureChange(),
                         "Expected " +
                                 (isSignatureChange()? "" : "no ") +
                                 "signature-change, got: " +
@@ -1205,10 +1205,10 @@ private void assertKeyMatch(SnippetEvent ste, Snippet sn, Snippet expected, Snip
                     assertTrue(sn != testKey,
                             "Main-event: Expected new snippet to be != : " + testKey
                             + "\n   got-event: " + toString(ste));
-                    assertEquals(sn.id(), testKey.id(), "Expected IDs to match: " + testKey + ", got: " + sn
+                    assertEquals(testKey.id(), sn.id(), "Expected IDs to match: " + testKey + ", got: " + sn
                             + "\n   expected-event: " + this + "\n   got-event: " + toString(ste));
                 } else {
-                    assertEquals(sn, testKey, "Expected key to be: " + testKey + ", got: " + sn
+                    assertEquals(testKey, sn, "Expected key to be: " + testKey + ", got: " + sn
                             + "\n   expected-event: " + this + "\n   got-event: " + toString(ste));
                 }
             }
@@ -1216,7 +1216,7 @@ private void assertKeyMatch(SnippetEvent ste, Snippet sn, Snippet expected, Snip
 
         private void assertStatusMatch(SnippetEvent ste, Status status, Status expected) {
             if (expected != null) {
-                assertEquals(status, expected, "Expected status to be: " + expected + ", got: " + status +
+                assertEquals(expected, status, "Expected status to be: " + expected + ", got: " + status +
                         "\n   expected-event: " + this + "\n   got-event: " + toString(ste));
             }
         }
diff --git a/test/langtools/jdk/jshell/MethodsTest.java b/test/langtools/jdk/jshell/MethodsTest.java
index 85f63f82f77d..9577f943c519 100644
--- a/test/langtools/jdk/jshell/MethodsTest.java
+++ b/test/langtools/jdk/jshell/MethodsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -26,7 +26,7 @@
  * @bug 8080357 8167643 8187359 8199762 8080353 8246353 8247456 8267221 8272135
  * @summary Tests for EvaluationState.methods
  * @build KullaTesting TestingInputStream ExpectedDiagnostic
- * @run testng MethodsTest
+ * @run junit MethodsTest
  */
 
 import javax.tools.Diagnostic;
@@ -34,21 +34,23 @@
 import jdk.jshell.Snippet;
 import jdk.jshell.MethodSnippet;
 import jdk.jshell.Snippet.Status;
-import org.testng.annotations.Test;
 
 import java.util.List;
 import java.util.stream.Collectors;
 
 import static jdk.jshell.Snippet.Status.*;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class MethodsTest extends KullaTesting {
 
+    @Test
     public void noMethods() {
         assertNumberOfActiveMethods(0);
     }
 
+    @Test
     public void testSignature1() {
         MethodSnippet m1 = methodKey(assertEval("void f() { g(); }", added(RECOVERABLE_DEFINED)));
         assertMethodDeclSnippet(m1, "f", "()void", RECOVERABLE_DEFINED, 1, 0);
@@ -58,6 +60,7 @@ public void testSignature1() {
         assertMethodDeclSnippet(m2, "g", "()void", VALID, 0, 0);
     }
 
+    @Test
     public void testSignature2() {
         MethodSnippet m1 = (MethodSnippet) assertDeclareFail("void f() { return g(); }", "compiler.err.prob.found.req");
         assertMethodDeclSnippet(m1, "f", "()void", REJECTED, 0, 2);
@@ -67,7 +70,8 @@ public void testSignature2() {
         assertMethodDeclSnippet(m2, "f", "()int", RECOVERABLE_DEFINED, 1, 0);
     }
 
-    @Test(enabled = false) // TODO 8081690
+    @Test // TODO 8081690
+    @Disabled
     public void testSignature3() {
         MethodSnippet m1 = methodKey(assertEval("void f(Bar b) { }", added(RECOVERABLE_NOT_DEFINED)));
         assertMethodDeclSnippet(m1, "f", "(Bar)void", RECOVERABLE_NOT_DEFINED, 1, 0);
@@ -79,6 +83,7 @@ public void testSignature3() {
     }
 
     // 8080357
+    @Test
     public void testNonReplUnresolved() {
         // internal case
         assertEval("class CCC {}", added(VALID));
@@ -87,6 +92,7 @@ public void testNonReplUnresolved() {
         assertDeclareFail("void f2() { System.xxxx(); }", "compiler.err.cant.resolve.location.args");
     }
 
+    @Test
     public void methods() {
         assertEval("int x() { return 10; }");
         assertEval("String y() { return null; }");
@@ -95,6 +101,7 @@ public void methods() {
         assertActiveKeys();
     }
 
+    @Test
     public void methodOverload() {
         assertEval("int m() { return 1; }");
         assertEval("int m(int x) { return 2; }");
@@ -139,6 +146,7 @@ public void methodOverloadDependent() {
     }
     ***/
 
+    @Test
     public void methodsRedeclaration1() {
         Snippet x = methodKey(assertEval("int x() { return 10; }"));
         Snippet y = methodKey(assertEval("String y() { return \"\"; }"));
@@ -158,6 +166,7 @@ public void methodsRedeclaration1() {
         assertActiveKeys();
     }
 
+    @Test
     public void methodsRedeclaration2() {
         assertEval("int a() { return 1; }");
         assertMethods(method("()int", "a"));
@@ -179,6 +188,7 @@ public void methodsRedeclaration2() {
         assertActiveKeys();
     }
 
+    @Test
     public void methodsRedeclaration3() {
         Snippet x = methodKey(assertEval("int x(Object...a) { return 10; }"));
         assertMethods(method("(Object...)int", "x"));
@@ -192,6 +202,7 @@ public void methodsRedeclaration3() {
     }
 
 
+    @Test
     public void methodsRedeclaration4() {
         Snippet a = methodKey(assertEval("int foo(int a) { return a; }"));
         assertEval("int x = foo(10);");
@@ -204,6 +215,7 @@ public void methodsRedeclaration4() {
     }
 
     // 8199762
+    @Test
     public void methodsRedeclaration5() {
         Snippet m1 = methodKey(assertEval("int m(Object o) { return 10; }"));
         assertMethods(method("(Object)int", "m"));
@@ -220,22 +232,23 @@ public void methodsRedeclaration5() {
         assertActiveKeys();
     }
 
+    @Test
     public void methodsAbstract() {
         MethodSnippet m1 = methodKey(assertEval("abstract String f();",
                 ste(MAIN_SNIPPET, NONEXISTENT, RECOVERABLE_DEFINED, true, null)));
-        assertEquals(getState().unresolvedDependencies(m1).collect(Collectors.toList()),
-                List.of("method f()"));
+        assertEquals(                List.of("method f()"), getState().unresolvedDependencies(m1).collect(Collectors.toList()));
         MethodSnippet m2 = methodKey(assertEval("abstract int mm(Blah b);",
                 ste(MAIN_SNIPPET, NONEXISTENT, RECOVERABLE_NOT_DEFINED, false, null)));
         List unr = getState().unresolvedDependencies(m2).collect(Collectors.toList());
-        assertEquals(unr.size(), 2);
+        assertEquals(2, unr.size());
         unr.remove("class Blah");
         unr.remove("method mm(Blah)");
-        assertEquals(unr.size(), 0, "unexpected entry: " + unr);
+        assertEquals(0, unr.size(), "unexpected entry: " + unr);
         assertNumberOfActiveMethods(2);
         assertActiveKeys();
     }
 
+    @Test
     public void methodsErrors() {
         assertDeclareFail("String f();",
                 new ExpectedDiagnostic("compiler.err.missing.meth.body.or.decl.abstract", 0, 11, 7, -1, -1, Diagnostic.Kind.ERROR));
@@ -267,6 +280,7 @@ public void methodsErrors() {
         assertActiveKeys();
     }
 
+    @Test
     public void objectMethodNamedMethodsErrors() {
         assertDeclareFail("boolean equals(double d1, double d2) {  return d1 == d2; }",
                 new ExpectedDiagnostic("jdk.eval.error.object.method", 8, 14, 8, -1, -1, Diagnostic.Kind.ERROR));
@@ -286,6 +300,7 @@ public void objectMethodNamedMethodsErrors() {
     }
 
 
+    @Test
     public void methodsAccessModifierIgnored() {
         Snippet f = methodKey(assertEval("public String f() {return null;}",
                 added(VALID)));
@@ -305,6 +320,7 @@ public void methodsAccessModifierIgnored() {
         assertActiveKeys();
     }
 
+    @Test
     public void methodsIgnoredModifiers() {
         Snippet f = methodKey(assertEval("static String f() {return null;}"));
         assertNumberOfActiveMethods(1);
@@ -318,6 +334,7 @@ public void methodsIgnoredModifiers() {
         assertActiveKeys();
     }
 
+    @Test
     public void methodSignatureUnresolved() {
         MethodSnippet key = (MethodSnippet) methodKey(assertEval("und m() { return new und(); }", added(RECOVERABLE_NOT_DEFINED)));
         assertMethodDeclSnippet(key, "m", "()und", RECOVERABLE_NOT_DEFINED, 1, 0);
@@ -330,7 +347,8 @@ public void methodSignatureUnresolved() {
         assertActiveKeys();
     }
 
-    @Test(enabled = false) // TODO 8081689
+    @Test // TODO 8081689
+    @Disabled
     public void classMethodsAreNotVisible() {
         assertEval(
             "class A {" +
@@ -351,6 +369,7 @@ public void classMethodsAreNotVisible() {
         assertActiveKeys();
     }
 
+    @Test
     public void lambdas() {
         assertEval("class Inner1 implements Runnable {" +
                 "public Runnable lambda1 = () -> {};" +
@@ -376,15 +395,17 @@ public void lambdas() {
     }
 
     //JDK-8267221:
+    @Test
     public void testMethodArrayParameters() {
         MethodSnippet m1 = methodKey(assertEval("void m1(int... p) { }", added(VALID)));
-        assertEquals(m1.parameterTypes(), "int...");
+        assertEquals("int...", m1.parameterTypes());
         MethodSnippet m2 = methodKey(assertEval("void m2(int[]... p) { }", added(VALID)));
-        assertEquals(m2.parameterTypes(), "int[]...");
+        assertEquals("int[]...", m2.parameterTypes());
         MethodSnippet m3 = methodKey(assertEval("void m3(int[][] p) { }", added(VALID)));
-        assertEquals(m3.parameterTypes(), "int[][]");
+        assertEquals("int[][]", m3.parameterTypes());
     }
 
+    @Test
     public void testOverloadCalls() {
         MethodSnippet orig = methodKey(assertEval("int m(String s) { return 0; }"));
         MethodSnippet overload = methodKey(assertEval("int m(int i) { return 1; }"));
diff --git a/test/langtools/jdk/jshell/ModifiersTest.java b/test/langtools/jdk/jshell/ModifiersTest.java
index 2cbebc8b5b87..2cdb5ce28b6f 100644
--- a/test/langtools/jdk/jshell/ModifiersTest.java
+++ b/test/langtools/jdk/jshell/ModifiersTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -25,7 +25,7 @@
  * @test 8167643 8129559 8247456
  * @summary Tests for modifiers
  * @build KullaTesting TestingInputStream ExpectedDiagnostic
- * @run testng ModifiersTest
+ * @run junit ModifiersTest
  */
 
 import java.util.ArrayList;
@@ -34,13 +34,14 @@
 import java.util.function.Consumer;
 import javax.tools.Diagnostic;
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-@Test
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class ModifiersTest extends KullaTesting {
 
-    @DataProvider(name = "ignoredModifiers")
     public Object[][] getTestCases() {
         List testCases = new ArrayList<>();
         String[] ignoredModifiers = new String[] {
@@ -77,7 +78,8 @@ public Object[][] getTestCases() {
         return testCases.toArray(new Object[testCases.size()][]);
     }
 
-    @Test(dataProvider = "ignoredModifiers")
+    @ParameterizedTest
+    @MethodSource("getTestCases")
     public void ignoredModifiers(String modifier, ClassType classType,
             Consumer eval, String preface, String context) {
         if (context != null) {
@@ -95,6 +97,7 @@ public void ignoredModifiers(String modifier, ClassType classType,
         assertActiveKeys();
     }
 
+    @Test
     public void accessToStaticFieldsOfClass() {
         assertEval("class A {" +
                 "int x = 14;" +
@@ -108,6 +111,7 @@ public void accessToStaticFieldsOfClass() {
         assertActiveKeys();
     }
 
+    @Test
     public void accessToStaticMethodsOfClass() {
         assertEval("class A {" +
                 "void x() {}" +
@@ -119,6 +123,7 @@ public void accessToStaticMethodsOfClass() {
         assertActiveKeys();
     }
 
+    @Test
     public void accessToStaticFieldsOfInterface() {
         assertEval("interface A {" +
                 "int x = 14;" +
@@ -134,12 +139,14 @@ public void accessToStaticFieldsOfInterface() {
         assertActiveKeys();
     }
 
+    @Test
     public void accessToStaticMethodsOfInterface() {
         assertEval("interface A { static void x() {} }");
         assertEval("A.x();");
         assertActiveKeys();
     }
 
+    @Test
     public void finalMethod() {
         assertEval("class A { final void f() {} }");
         assertDeclareFail("class B extends A { void f() {} }",
@@ -148,6 +155,7 @@ public void finalMethod() {
     }
 
     //TODO: is this the right semantics?
+    @Test
     public void finalConstructor() {
         assertDeclareFail("class A { final A() {} }",
                 new ExpectedDiagnostic("compiler.err.mod.not.allowed.here", 10, 22, 16, -1, -1, Diagnostic.Kind.ERROR));
@@ -155,6 +163,7 @@ public void finalConstructor() {
     }
 
     //TODO: is this the right semantics?
+    @Test
     public void finalDefaultMethod() {
         assertDeclareFail("interface A { final default void a() {} }",
                 new ExpectedDiagnostic("compiler.err.mod.not.allowed.here", 14, 39, 33, -1, -1, Diagnostic.Kind.ERROR));
diff --git a/test/langtools/jdk/jshell/MultipleDocumentationTest.java b/test/langtools/jdk/jshell/MultipleDocumentationTest.java
index 8037381ccc8d..d7894212016d 100644
--- a/test/langtools/jdk/jshell/MultipleDocumentationTest.java
+++ b/test/langtools/jdk/jshell/MultipleDocumentationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -26,8 +26,8 @@
 import java.util.List;
 import java.util.stream.Collectors;
 import jdk.jshell.JShell;
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
 
 /*
  * @test
@@ -39,11 +39,11 @@
  *          jdk.jdeps/com.sun.tools.javap
  *          jdk.jshell/jdk.internal.jshell.tool
  * @build Compiler toolbox.ToolBox
- * @run testng MultipleDocumentationTest
+ * @run junit MultipleDocumentationTest
  */
-@Test
 public class MultipleDocumentationTest {
 
+    @Test
     public void testMultipleDocumentation() {
         String input = "java.lang.String";
 
@@ -68,7 +68,7 @@ public void testMultipleDocumentation() {
                                              .map(d -> d.javadoc())
                                              .collect(Collectors.toList());
 
-                assertEquals(javadocs2, javadocs1);
+                assertEquals(javadocs1, javadocs2);
             }
         }
     }
diff --git a/test/langtools/jdk/jshell/MyExecutionControl.java b/test/langtools/jdk/jshell/MyExecutionControl.java
index 8493638db576..12a0ac6986d0 100644
--- a/test/langtools/jdk/jshell/MyExecutionControl.java
+++ b/test/langtools/jdk/jshell/MyExecutionControl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
 import jdk.jshell.spi.ExecutionControl;
 import jdk.jshell.spi.ExecutionControl.EngineTerminationException;
 import jdk.jshell.spi.ExecutionEnv;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
 import static jdk.jshell.execution.Util.remoteInputOutput;
 
 class MyExecutionControl extends JdiExecutionControl {
diff --git a/test/langtools/jdk/jshell/NullTest.java b/test/langtools/jdk/jshell/NullTest.java
index b365b5155f8c..c4759aca87fb 100644
--- a/test/langtools/jdk/jshell/NullTest.java
+++ b/test/langtools/jdk/jshell/NullTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, 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
@@ -25,14 +25,14 @@
  * @test
  * @summary null test
  * @build KullaTesting TestingInputStream
- * @run testng NullTest
+ * @run junit NullTest
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class NullTest extends KullaTesting {
 
+    @Test
     public void testNull() {
         assertEval("null;", "null");
         assertEval("(Object)null;", "null");
diff --git a/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java b/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java
index 8ec8ded1741c..350a6659c525 100644
--- a/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java
+++ b/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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
@@ -38,7 +38,7 @@
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build Compiler UITesting
  * @build PasteAndMeasurementsUITest
- * @run testng/othervm PasteAndMeasurementsUITest
+ * @run junit/othervm PasteAndMeasurementsUITest
  */
 
 import java.io.Console;
@@ -46,15 +46,15 @@
 import java.lang.reflect.Field;
 import jdk.internal.org.jline.reader.impl.LineReaderImpl;
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class PasteAndMeasurementsUITest extends UITesting {
 
     public PasteAndMeasurementsUITest() {
         super(true);
     }
 
+    @Test
     public void testPrevNextSnippet() throws Exception {
         Field cons = System.class.getDeclaredField("cons");
         cons.setAccessible(true);
@@ -77,6 +77,7 @@ public void testPrevNextSnippet() throws Exception {
     }
         private static final String LOC = "\033[12;1R";
 
+    @Test
     public void testBracketedPaste() throws Exception {
         Field cons = System.class.getDeclaredField("cons");
         cons.setAccessible(true);
@@ -91,6 +92,7 @@ public void testBracketedPaste() throws Exception {
         });
     }
 
+    @Test
     public void testBracketedPasteNonAscii() throws Exception {
         Field cons = System.class.getDeclaredField("cons");
         cons.setAccessible(true);
diff --git a/test/langtools/jdk/jshell/PipeInputStreamTest.java b/test/langtools/jdk/jshell/PipeInputStreamTest.java
index 867a1f254a49..0062c6006e11 100644
--- a/test/langtools/jdk/jshell/PipeInputStreamTest.java
+++ b/test/langtools/jdk/jshell/PipeInputStreamTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -26,7 +26,7 @@
  * @summary Verify PipeInputStream works.
  * @modules jdk.compiler/com.sun.tools.javac.util
  *          jdk.jshell/jdk.jshell.execution.impl:open
- * @run testng PipeInputStreamTest
+ * @run junit PipeInputStreamTest
  */
 
 import java.io.InputStream;
@@ -34,28 +34,28 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 
-import org.testng.annotations.Test;
 
 import com.sun.tools.javac.util.Pair;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class PipeInputStreamTest {
 
+    @Test
     public void testReadArrayNotBlocking() throws Exception {
         Pair streams = createPipeStream();
         InputStream in = streams.fst;
         OutputStream out = streams.snd;
         out.write('a');
         byte[] data = new byte[12];
-        assertEquals(in.read(data), 1);
-        assertEquals(data[0], 'a');
+        assertEquals(1, in.read(data));
+        assertEquals('a', data[0]);
         out.write('a'); out.write('b'); out.write('c');
-        assertEquals(in.read(data), 3);
-        assertEquals(data[0], 'a');
-        assertEquals(data[1], 'b');
-        assertEquals(data[2], 'c');
+        assertEquals(3, in.read(data));
+        assertEquals('a', data[0]);
+        assertEquals('b', data[1]);
+        assertEquals('c', data[2]);
     }
 
     private Pair createPipeStream() throws Exception {
diff --git a/test/langtools/jdk/jshell/RecordsTest.java b/test/langtools/jdk/jshell/RecordsTest.java
index 69aaae8e46f8..fdf75aed3ab9 100644
--- a/test/langtools/jdk/jshell/RecordsTest.java
+++ b/test/langtools/jdk/jshell/RecordsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, 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
@@ -27,27 +27,27 @@
  * @summary Tests for evalution of records
  * @modules jdk.jshell
  * @build KullaTesting TestingInputStream ExpectedDiagnostic
- * @run testng RecordsTest
+ * @run junit RecordsTest
  */
 
-import org.testng.annotations.Test;
 
 import javax.lang.model.SourceVersion;
 import jdk.jshell.Snippet.Status;
 import jdk.jshell.UnresolvedReferenceException;
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.BeforeMethod;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class RecordsTest extends KullaTesting {
 
+    @Test
     public void testRecordClass() {
         assertEval("record R(String s, int i) { }");
-        assertEquals(varKey(assertEval("R r = new R(\"r\", 42);")).name(), "r");
+        assertEquals("r", varKey(assertEval("R r = new R(\"r\", 42);")).name());
         assertEval("r.s()", "\"r\"");
         assertEval("r.i()", "42");
     }
 
+    @Test
     public void testRecordCorralling() {
         //simple record with a mistake that can be fixed by corralling:
         assertEval("record R1(int i) { int g() { return j; } }", ste(MAIN_SNIPPET, Status.NONEXISTENT, Status.RECOVERABLE_DEFINED, true, null));
@@ -66,13 +66,15 @@ public void testRecordCorralling() {
         assertEval("R5 r5 = new R5(1);", null, UnresolvedReferenceException.class, DiagCheck.DIAG_OK, DiagCheck.DIAG_OK, added(Status.VALID));
     }
 
+    @Test
     public void testRecordField() {
-        assertEquals(varKey(assertEval("String record = \"\";")).name(), "record");
+        assertEquals("record", varKey(assertEval("String record = \"\";")).name());
         assertEval("record.length()", "0");
     }
 
+    @Test
     public void testRecordMethod() {
-        assertEquals(methodKey(assertEval("String record(String record) { return record + record; }")).name(), "record");
+        assertEquals("record", methodKey(assertEval("String record(String record) { return record + record; }")).name());
         assertEval("record(\"r\")", "\"rr\"");
         assertEval("record(\"r\").length()", "2");
     }
diff --git a/test/langtools/jdk/jshell/RejectedFailedTest.java b/test/langtools/jdk/jshell/RejectedFailedTest.java
index 5411d5d8aee1..5e97a03d3994 100644
--- a/test/langtools/jdk/jshell/RejectedFailedTest.java
+++ b/test/langtools/jdk/jshell/RejectedFailedTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -25,13 +25,12 @@
  * @test 8080352
  * @summary Tests for hard errors, like syntax errors
  * @build KullaTesting
- * @run testng RejectedFailedTest
+ * @run junit RejectedFailedTest
  */
 
 import java.util.List;
 
 import jdk.jshell.Snippet.SubKind;
-import org.testng.annotations.Test;
 
 import jdk.jshell.Diag;
 import jdk.jshell.Snippet;
@@ -40,31 +39,31 @@
 
 import jdk.jshell.SnippetEvent;
 import static java.util.stream.Collectors.toList;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class RejectedFailedTest extends KullaTesting {
 
     private String bad(String input, Kind kind, String prevId) {
         List events = assertEvalFail(input);
-        assertEquals(events.size(), 1, "Expected one event, got: " + events.size());
+        assertEquals(1, events.size(), "Expected one event, got: " + events.size());
         SnippetEvent e = events.get(0);
         List diagnostics = getState().diagnostics(e.snippet()).collect(toList());
         assertTrue(diagnostics.size() > 0, "Expected diagnostics, got none");
-        assertEquals(e.exception(), null, "Expected exception to be null.");
-        assertEquals(e.value(), null, "Expected value to be null.");
+        assertEquals(null, e.exception(), "Expected exception to be null.");
+        assertEquals(null, e.value(), "Expected value to be null.");
 
         Snippet key = e.snippet();
         assertTrue(key != null, "key must be non-null, but was null.");
-        assertEquals(key.kind(), kind, "Expected kind: " + kind + ", got: " + key.kind());
+        assertEquals(kind, key.kind(), "Expected kind: " + kind + ", got: " + key.kind());
         SubKind expectedSubKind = kind == Kind.ERRONEOUS ? SubKind.UNKNOWN_SUBKIND : SubKind.METHOD_SUBKIND;
-        assertEquals(key.subKind(), expectedSubKind, "SubKind: ");
+        assertEquals(expectedSubKind, key.subKind(), "SubKind: ");
         assertTrue(key.id().compareTo(prevId) > 0, "Current id: " + key.id() + ", previous: " + prevId);
-        assertEquals(getState().diagnostics(key).collect(toList()), diagnostics, "Expected retrieved diagnostics to match, but didn't.");
-        assertEquals(key.source(), input, "Expected retrieved source: " +
+        assertEquals(diagnostics, getState().diagnostics(key).collect(toList()), "Expected retrieved diagnostics to match, but didn't.");
+        assertEquals(input, key.source(), "Expected retrieved source: " +
                 key.source() + " to match input: " + input);
-        assertEquals(getState().status(key), Status.REJECTED, "Expected status of REJECTED, got: " + getState().status(key));
+        assertEquals(Status.REJECTED, getState().status(key), "Expected status of REJECTED, got: " + getState().status(key));
         return key.id();
     }
 
@@ -75,6 +74,7 @@ private void checkByKind(String[] inputs, Kind kind) {
         }
     }
 
+    @Test
     public void testErroneous() {
         String[] inputsErroneous = {
                 "%&^%&",
@@ -86,6 +86,7 @@ public void testErroneous() {
         checkByKind(inputsErroneous, Kind.ERRONEOUS);
     }
 
+    @Test
     public void testBadMethod() {
         String[] inputsMethod = {
                 "transient int m() { return x; }",
diff --git a/test/langtools/jdk/jshell/ReplToolTesting.java b/test/langtools/jdk/jshell/ReplToolTesting.java
index 52eb2d5798c6..f6c15ca2d792 100644
--- a/test/langtools/jdk/jshell/ReplToolTesting.java
+++ b/test/langtools/jdk/jshell/ReplToolTesting.java
@@ -45,14 +45,14 @@
 import java.util.stream.Stream;
 
 
-import org.testng.annotations.BeforeMethod;
 
 import jdk.jshell.tool.JavaShellToolBuilder;
 import static java.util.stream.Collectors.toList;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.BeforeEach;
 
 public class ReplToolTesting {
 
@@ -142,7 +142,7 @@ public Consumer assertList() {
                     .filter(l -> !l.isEmpty())
                     .collect(Collectors.toList());
             int previousId = Integer.MIN_VALUE;
-            assertEquals(lines.size(), keys.size(), "Number of keys");
+            assertEquals(keys.size(), lines.size(), "Number of keys");
             for (int i = 0; i < lines.size(); ++i) {
                 String line = lines.get(i);
                 Matcher matcher = idPattern.matcher(line);
@@ -165,7 +165,7 @@ private Consumer assertMembers(String message, Map !l.isEmpty())
                     .filter(l -> !l.startsWith("|     ")) // error/unresolved info
                     .collect(Collectors.toList());
-            assertEquals(lines.size(), set.size(), message + " : expected: " + set.keySet() + "\ngot:\n" + lines);
+            assertEquals(set.size(), lines.size(), message + " : expected: " + set.keySet() + "\ngot:\n" + lines);
             for (String line : lines) {
                 Matcher matcher = extractPattern.matcher(line);
                 assertTrue(matcher.find(), line);
@@ -275,7 +275,7 @@ private void initSnippets() {
         }
     }
 
-    @BeforeMethod
+    @BeforeEach
     public void setUp() {
         prefsMap = new HashMap<>();
         prefsMap.put("INDENT", "0");
@@ -335,8 +335,7 @@ private void testRawCheck(Locale locale, String expectedErrorOutput) {
         String ueos = getUserErrorOutput();
         assertTrue((cos.isEmpty() || cos.startsWith("|  Goodbye") || !locale.equals(Locale.ROOT)),
                 "Expected a goodbye, but got: " + cos);
-        assertEquals(ceos,
-                     expectedErrorOutput,
+        assertEquals(                     expectedErrorOutput, ceos,
                      "Expected \"" + expectedErrorOutput +
                      "\" command error output, got: \"" + ceos + "\"");
         assertTrue(uos.isEmpty(), "Expected empty user output, got: " + uos);
@@ -560,7 +559,7 @@ public Consumer assertStartsWith(String prefix) {
 
     public void assertOutput(String got, String expected, String display) {
         if (expected != null) {
-            assertEquals(got, expected, display + ".\n");
+            assertEquals(expected, got, display + ".\n");
         }
     }
 
diff --git a/test/langtools/jdk/jshell/ReplaceTest.java b/test/langtools/jdk/jshell/ReplaceTest.java
index e4c2c8575c0c..02ebb27fcb9b 100644
--- a/test/langtools/jdk/jshell/ReplaceTest.java
+++ b/test/langtools/jdk/jshell/ReplaceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -25,7 +25,7 @@
  * @test 8080069 8152925
  * @summary Test of Snippet redefinition and replacement.
  * @build KullaTesting TestingInputStream
- * @run testng ReplaceTest
+ * @run junit ReplaceTest
  */
 
 import java.util.Iterator;
@@ -34,16 +34,16 @@
 import jdk.jshell.MethodSnippet;
 import jdk.jshell.TypeDeclSnippet;
 import jdk.jshell.VarSnippet;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static jdk.jshell.Snippet.Status.*;
 import static jdk.jshell.Snippet.SubKind.*;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ReplaceTest extends KullaTesting {
 
+    @Test
     public void testRedefine() {
         Snippet vx = varKey(assertEval("int x;"));
         Snippet mu = methodKey(assertEval("int mu() { return x * 4; }"));
@@ -69,6 +69,7 @@ public void testRedefine() {
         assertActiveKeys();
     }
 
+    @Test
     public void testReplaceClassToVar() {
         Snippet oldA = classKey(assertEval("class A { public String toString() { return \"old\"; } }"));
         Snippet v = varKey(assertEval("A a = new A();", "old"));
@@ -92,6 +93,7 @@ private  void identityMatch(Stream got, T expected) {
         assertFalse(it.hasNext(), "expected exactly one");
     }
 
+    @Test
     public void testReplaceVarToMethod() {
         Snippet x = varKey(assertEval("int x;"));
         MethodSnippet musn = methodKey(assertEval("double mu() { return x * 4; }"));
@@ -106,6 +108,7 @@ public void testReplaceVarToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testReplaceMethodToMethod() {
         Snippet a = methodKey(assertEval("double a() { return 2; }"));
         Snippet b = methodKey(assertEval("double b() { return a() * 10; }"));
@@ -119,6 +122,7 @@ public void testReplaceMethodToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testReplaceClassToMethod() {
         Snippet c = classKey(assertEval("class C { int f() { return 7; } }"));
         Snippet m = methodKey(assertEval("int m() { return new C().f(); }"));
@@ -130,6 +134,7 @@ public void testReplaceClassToMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testReplaceVarToClass() {
         Snippet x = varKey(assertEval("int x;"));
         TypeDeclSnippet c = classKey(assertEval("class A { double a = 4 * x; }"));
@@ -144,6 +149,7 @@ public void testReplaceVarToClass() {
         assertActiveKeys();
     }
 
+    @Test
     public void testReplaceMethodToClass() {
         Snippet x = methodKey(assertEval("int x() { return 0; }"));
         TypeDeclSnippet c = classKey(assertEval("class A { double a = 4 * x(); }"));
@@ -159,6 +165,7 @@ public void testReplaceMethodToClass() {
         assertActiveKeys();
     }
 
+    @Test
     public void testReplaceClassToClass() {
         TypeDeclSnippet a = classKey(assertEval("class A {}"));
         assertTypeDeclSnippet(a, "A", VALID, CLASS_SUBKIND, 0, 0);
@@ -178,6 +185,7 @@ public void testReplaceClassToClass() {
         assertActiveKeys();
     }
 
+    @Test
     public void testOverwriteReplaceMethod() {
         MethodSnippet k1 = methodKey(assertEval("String m(Integer i) { return i.toString(); }"));
         MethodSnippet k2 = methodKey(assertEval("String m(java.lang.Integer i) { return \"java.lang.\" + i.toString(); }",
@@ -193,6 +201,7 @@ public void testOverwriteReplaceMethod() {
         assertActiveKeys();
     }
 
+    @Test
     public void testImportDeclare() {
         Snippet singleImport = importKey(assertEval("import java.util.List;", added(VALID)));
         Snippet importOnDemand = importKey(assertEval("import java.util.*;", added(VALID)));
@@ -213,7 +222,8 @@ public void testImportDeclare() {
         assertActiveKeys();
     }
 
-    @Test(enabled = false) // TODO 8129420
+    @Test // TODO 8129420
+    @Disabled
     public void testLocalClassEvolve() {
         Snippet j = methodKey(assertEval("Object j() { return null; }", added(VALID)));
         assertEval("Object j() { class B {}; return null; }",
@@ -227,6 +237,7 @@ public void testLocalClassEvolve() {
         assertEval("j();", "Yep");
     }
 
+    @Test
     public void testReplaceCausesMethodReferenceError() {
         Snippet l = classKey(assertEval("interface Logger { public void log(String message); }", added(VALID)));
         Snippet v = varKey(assertEval("Logger l = System.out::println;", added(VALID)));
@@ -238,6 +249,7 @@ public void testReplaceCausesMethodReferenceError() {
                 ste(v, VALID, RECOVERABLE_NOT_DEFINED, true, MAIN_SNIPPET));
     }
 
+    @Test
     public void testReplaceCausesClassCompilationError() {
         Snippet l = classKey(assertEval("interface L { }", added(VALID)));
         Snippet c = classKey(assertEval("class C implements L { }", added(VALID)));
@@ -249,6 +261,7 @@ public void testReplaceCausesClassCompilationError() {
                 ste(c, VALID, RECOVERABLE_NOT_DEFINED, true, MAIN_SNIPPET));
     }
 
+    @Test
     public void testOverwriteNoUpdate() {
         String xsi = "int x = 5;";
         String xsd = "double x = 3.14159;";
diff --git a/test/langtools/jdk/jshell/SealedClassesTest.java b/test/langtools/jdk/jshell/SealedClassesTest.java
index ba4f8c8f008c..c45bc7677692 100644
--- a/test/langtools/jdk/jshell/SealedClassesTest.java
+++ b/test/langtools/jdk/jshell/SealedClassesTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, 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
@@ -27,7 +27,7 @@
  * @summary Test sealed class in jshell
  * @modules jdk.jshell
  * @build KullaTesting TestingInputStream ExpectedDiagnostic
- * @run testng SealedClassesTest
+ * @run junit SealedClassesTest
  */
 
 import javax.lang.model.SourceVersion;
@@ -35,14 +35,13 @@
 import jdk.jshell.TypeDeclSnippet;
 import jdk.jshell.Snippet.Status;
 
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
 
 import static jdk.jshell.Snippet.Status.VALID;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class SealedClassesTest extends KullaTesting {
 
+    @Test
     public void testSealed() {
         TypeDeclSnippet base = classKey(
                 assertEval("sealed class B permits I {}",
@@ -53,6 +52,7 @@ public void testSealed() {
         assertEval("new I()");
     }
 
+    @Test
     public void testInterface() {
         TypeDeclSnippet base = classKey(
                 assertEval("sealed interface I permits C {}",
@@ -63,6 +63,7 @@ public void testInterface() {
         assertEval("new C()");
     }
 
+    @Test
     public void testNonSealed() {
         TypeDeclSnippet base = classKey(
                 assertEval("sealed class B permits I {}",
@@ -74,6 +75,7 @@ public void testNonSealed() {
         assertEval("new I2()");
     }
 
+    @Test
     public void testNonSealedInterface() {
         TypeDeclSnippet base = classKey(
                 assertEval("sealed interface B permits C {}",
diff --git a/test/langtools/jdk/jshell/ShutdownTest.java b/test/langtools/jdk/jshell/ShutdownTest.java
index 45431f661620..9c3b084f6a3d 100644
--- a/test/langtools/jdk/jshell/ShutdownTest.java
+++ b/test/langtools/jdk/jshell/ShutdownTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -25,18 +25,21 @@
  * @test
  * @summary Shutdown tests
  * @build KullaTesting TestingInputStream
- * @run testng ShutdownTest
+ * @run junit ShutdownTest
  */
 
 import java.util.function.Consumer;
 
 import jdk.jshell.JShell;
 import jdk.jshell.JShell.Subscription;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Assertions;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
 
-import static org.testng.Assert.assertEquals;
-
-@Test
 public class ShutdownTest extends KullaTesting {
 
     int shutdownCount;
@@ -45,29 +48,33 @@ void shutdownCounter(JShell state) {
         ++shutdownCount;
     }
 
-    @Test(enabled = false) //TODO 8139873
+    @Test //TODO 8139873
+    @Disabled
     public void testExit() {
         shutdownCount = 0;
         getState().onShutdown(this::shutdownCounter);
         assertEval("System.exit(1);");
-        assertEquals(shutdownCount, 1);
+        assertEquals(1, shutdownCount);
     }
 
+    @Test
     public void testCloseCallback() {
         shutdownCount = 0;
         getState().onShutdown(this::shutdownCounter);
         getState().close();
-        assertEquals(shutdownCount, 1);
+        assertEquals(1, shutdownCount);
     }
 
+    @Test
     public void testCloseUnsubscribe() {
         shutdownCount = 0;
         Subscription token = getState().onShutdown(this::shutdownCounter);
         getState().unsubscribe(token);
         getState().close();
-        assertEquals(shutdownCount, 0);
+        assertEquals(0, shutdownCount);
     }
 
+    @Test
     public void testTwoShutdownListeners() {
         ShutdownListener listener1 = new ShutdownListener();
         ShutdownListener listener2 = new ShutdownListener();
@@ -76,46 +83,56 @@ public void testTwoShutdownListeners() {
         getState().unsubscribe(subscription1);
         getState().close();
 
-        assertEquals(listener1.getEvents(), 0, "Checking got events");
-        assertEquals(listener2.getEvents(), 1, "Checking got events");
+        assertEquals(0, listener1.getEvents(), "Checking got events");
+        assertEquals(1, listener2.getEvents(), "Checking got events");
 
         getState().close();
 
-        assertEquals(listener1.getEvents(), 0, "Checking got events");
-        assertEquals(listener2.getEvents(), 1, "Checking got events");
+        assertEquals(0, listener1.getEvents(), "Checking got events");
+        assertEquals(1, listener2.getEvents(), "Checking got events");
 
         getState().unsubscribe(subscription2);
     }
 
-    @Test(expectedExceptions = IllegalStateException.class)
+    @Test
     public void testCloseException() {
-        getState().close();
-        getState().eval("45");
+        Assertions.assertThrows(IllegalStateException.class, () -> {
+            getState().close();
+            getState().eval("45");
+        });
     }
 
-    @Test(expectedExceptions = IllegalStateException.class,
-          enabled = false) //TODO 8139873
+    @Test //TODO 8139873
+    @Disabled
     public void testShutdownException() {
-        assertEval("System.exit(0);");
-        getState().eval("45");
+        Assertions.assertThrows(IllegalStateException.class, () -> {
+            assertEval("System.exit(0);");
+            getState().eval("45");
+        });
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
+    @Test
     public void testNullCallback() {
-        getState().onShutdown(null);
+        Assertions.assertThrows(NullPointerException.class, () -> {
+            getState().onShutdown(null);
+        });
     }
 
-    @Test(expectedExceptions = IllegalStateException.class)
+    @Test
     public void testSubscriptionAfterClose() {
-        getState().close();
-        getState().onShutdown(e -> {});
+        Assertions.assertThrows(IllegalStateException.class, () -> {
+            getState().close();
+            getState().onShutdown(e -> {});
+        });
     }
 
-    @Test(expectedExceptions = IllegalStateException.class,
-          enabled = false) //TODO 8139873
+    @Test //TODO 8139873
+    @Disabled
     public void testSubscriptionAfterShutdown() {
-        assertEval("System.exit(0);");
-        getState().onShutdown(e -> {});
+        Assertions.assertThrows(IllegalStateException.class, () -> {
+            assertEval("System.exit(0);");
+            getState().onShutdown(e -> {});
+        });
     }
 
     private static class ShutdownListener implements Consumer {
diff --git a/test/langtools/jdk/jshell/SimpleRegressionTest.java b/test/langtools/jdk/jshell/SimpleRegressionTest.java
index 1e347cfd207e..4cd7c8b71eb1 100644
--- a/test/langtools/jdk/jshell/SimpleRegressionTest.java
+++ b/test/langtools/jdk/jshell/SimpleRegressionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -25,7 +25,7 @@
  * @test 8130450 8158906 8154374 8166400 8171892 8173807 8173848 8282434
  * @summary simple regression test
  * @build KullaTesting TestingInputStream
- * @run testng SimpleRegressionTest
+ * @run junit SimpleRegressionTest
  */
 
 
@@ -36,53 +36,56 @@
 import jdk.jshell.Snippet;
 import jdk.jshell.VarSnippet;
 import jdk.jshell.SnippetEvent;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static jdk.jshell.Snippet.Status.OVERWRITTEN;
 import static jdk.jshell.Snippet.SubKind.TEMP_VAR_EXPRESSION_SUBKIND;
 import static jdk.jshell.Snippet.Status.VALID;
-import org.testng.annotations.BeforeMethod;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class SimpleRegressionTest extends KullaTesting {
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         setUp(builder -> builder.executionEngine("local"));
     }
 
+    @Test
     public void testSnippetMemberAssignment() {
         assertEval("class C { int y; }");
         assertEval("C c = new C();");
         assertVarKeyMatch("c.y = 4;", true, "$1", TEMP_VAR_EXPRESSION_SUBKIND, "int", added(VALID));
     }
 
+    @Test
     public void testUserTakesTempVarName() {
         assertEval("int $2 = 4;");
         assertEval("String $1;");
         assertVarKeyMatch("1234;", true, "$3", TEMP_VAR_EXPRESSION_SUBKIND, "int", added(VALID));
     }
 
+    @Test
     public void testCompileThrow() {
         assertEvalException("throw new Exception();");
     }
 
+    @Test
     public void testMultiSnippetDependencies() {
         List events = assertEval("int a = 3, b = a+a, c = b *100;",
                 DiagCheck.DIAG_OK, DiagCheck.DIAG_OK,
                 chain(added(VALID)),
                 chain(added(VALID)),
                 chain(added(VALID)));
-        assertEquals(events.get(0).value(), "3");
-        assertEquals(events.get(1).value(), "6");
-        assertEquals(events.get(2).value(), "600");
+        assertEquals("3", events.get(0).value());
+        assertEquals("6", events.get(1).value());
+        assertEquals("600", events.get(2).value());
         assertEval("c;", "600");
     }
 
+    @Test
     public void testLessThanParsing() {
         assertEval("int x = 3;", "3");
         assertEval("int y = 4;", "4");
@@ -92,18 +95,22 @@ public void testLessThanParsing() {
         assertEval("x < y && y < z", "true");
     }
 
+    @Test
     public void testNotStmtCannotResolve() {
         assertDeclareFail("dfasder;", new ExpectedDiagnostic("compiler.err.cant.resolve.location", 0, 7, 0, -1, -1, Diagnostic.Kind.ERROR));
     }
 
+    @Test
     public void testNotStmtIncomparable() {
         assertDeclareFail("true == 5.0;", new ExpectedDiagnostic("compiler.err.incomparable.types", 0, 11, 5, -1, -1, Diagnostic.Kind.ERROR));
     }
 
+    @Test
     public void testStringAdd() {
         assertEval("String s = \"a\" + \"b\";", "\"ab\"");
     }
 
+    @Test
     public void testExprSanity() {
         assertEval("int x = 3;", "3");
         assertEval("int y = 4;", "4");
@@ -111,13 +118,15 @@ public void testExprSanity() {
         assertActiveKeys();
     }
 
+    @Test
     public void testGenericMethodCrash() {
         assertDeclareWarn1(" void f(T...a) {}", (ExpectedDiagnostic) null);
         Snippet sn = methodKey(assertEval(" R n(R x) { return x; }", added(VALID)));
         VarSnippet sne = varKey(assertEval("n(5)", added(VALID)));
-        assertEquals(sne.typeName(), "Integer");
+        assertEquals("Integer", sne.typeName());
     }
 
+    @Test
     public void testLongRemoteStrings() { //8158906
         assertEval("String m(int x) { byte[] b = new byte[x]; for (int i = 0; i < x; ++i) b[i] = (byte) 'a'; return new String(b); }");
         boolean[] shut = new boolean[1];
@@ -127,12 +136,13 @@ public void testLongRemoteStrings() { //8158906
         for (String len : new String[]{"12345", "64000", "65535", "65536", "120000"}) {
             List el = assertEval("m(" + len + ");");
             assertFalse(shut[0], "JShell died with long string");
-            assertEquals(el.size(), 1, "Excepted one event");
+            assertEquals(1, el.size(), "Excepted one event");
             assertTrue(el.get(0).value().length() > 10000,
                     "Expected truncated but long String, got: " + el.get(0).value().length());
         }
     }
 
+    @Test
     public void testLongRemoteJapaneseStrings() { //8158906
         assertEval("import java.util.stream.*;");
         assertEval("String m(int x) { return Stream.generate(() -> \"\u3042\").limit(x).collect(Collectors.joining()); }");
@@ -143,13 +153,14 @@ public void testLongRemoteJapaneseStrings() { //8158906
         for (String len : new String[]{"12345", "21843", "21844", "21845", "21846", "64000", "65535", "65536", "120000"}) {
             List el = assertEval("m(" + len + ");");
             assertFalse(shut[0], "JShell died with long string");
-            assertEquals(el.size(), 1, "Excepted one event");
+            assertEquals(1, el.size(), "Excepted one event");
             assertTrue(el.get(0).value().length() > 10000,
                     "Expected truncated but long String, got: " + el.get(0).value().length());
         }
     }
 
     // 8130450
+    @Test
     public void testDuplicate() {
         Snippet snm = methodKey(assertEval("void mm() {}", added(VALID)));
         assertEval("void mm() {}",
@@ -161,11 +172,13 @@ public void testDuplicate() {
                 ste(snv, VALID, OVERWRITTEN, false, MAIN_SNIPPET));
     }
 
+    @Test
     public void testContextClassLoader() {
         assertEval("class C {}");
         assertEval("C.class.getClassLoader() == Thread.currentThread().getContextClassLoader()", "true");
     }
 
+    @Test
     public void testArrayRepresentation() {
         assertEval("new int[4]", "int[4] { 0, 0, 0, 0 }");
         assertEval("new int[0]", "int[0] {  }");
@@ -183,6 +196,7 @@ public void testArrayRepresentation() {
                 "Object[3] { \"howdy\", int[3] { 33, 44, 55 }, String[2] { \"up\", \"down\" } }");
     }
 
+    @Test
     public void testMultiDimArrayRepresentation() {
         assertEval("new int[3][1]",
                 "int[3][] { int[1] { 0 }, int[1] { 0 }, int[1] { 0 } }");
@@ -199,6 +213,7 @@ public void testMultiDimArrayRepresentation() {
                 "boolean[2][][] { boolean[1][] { boolean[3] { false, false, false } }, boolean[1][] { boolean[3] { false, false, false } } }");
     }
 
+    @Test
     public void testStringRepresentation() {
         assertEval("\"A!\\rB!\"",
                    "\"A!\\rB!\"");
@@ -220,6 +235,7 @@ public void testStringRepresentation() {
                    "\"a\u032Ea\"");
     }
 
+    @Test
     public void testCharRepresentation() {
         for (String s : new String[]{"'A'", "'Z'", "'0'", "'9'",
             "'a'", "'z'", "'*'", "'%'",
diff --git a/test/langtools/jdk/jshell/SnippetEventToStringTest.java b/test/langtools/jdk/jshell/SnippetEventToStringTest.java
index 7d2de3879518..7dacafe93d22 100644
--- a/test/langtools/jdk/jshell/SnippetEventToStringTest.java
+++ b/test/langtools/jdk/jshell/SnippetEventToStringTest.java
@@ -25,7 +25,7 @@
  * @test
  * @bug 8350808
  * @summary Check for proper formatting of SnippetEvent.toString()
- * @run testng SnippetEventToStringTest
+ * @run junit SnippetEventToStringTest
  */
 
 import java.util.Map;
@@ -35,13 +35,14 @@
 import jdk.jshell.SnippetEvent;
 import jdk.jshell.execution.LocalExecutionControlProvider;
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class SnippetEventToStringTest {
 
-    @DataProvider(name = "cases")
     public String[][] sourceLevels() {
         return new String[][] {
             { "*",                              ",causeSnippet=null" },
@@ -50,11 +51,12 @@ public String[][] sourceLevels() {
         };
     }
 
-    @Test(dataProvider = "cases")
-    private void verifySnippetEvent(String source, String match) {
+    @ParameterizedTest
+    @MethodSource("sourceLevels")
+    void verifySnippetEvent(String source, String match) {
         try (JShell jsh = JShell.builder().executionEngine(new LocalExecutionControlProvider(), Map.of()).build()) {
             List result = jsh.eval(source);
-            assertEquals(result.size(), 1);
+            assertEquals(1, result.size());
             String string = result.get(0).toString();
             if (!string.contains(match))
                 throw new AssertionError(String.format("\"%s\" not found in \"%s\"", match, string));
diff --git a/test/langtools/jdk/jshell/SnippetHighlightTest.java b/test/langtools/jdk/jshell/SnippetHighlightTest.java
index 9c59a3d80163..fb954706aa8e 100644
--- a/test/langtools/jdk/jshell/SnippetHighlightTest.java
+++ b/test/langtools/jdk/jshell/SnippetHighlightTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, 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
@@ -32,22 +32,22 @@
  *          jdk.jshell/jdk.jshell:open
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build KullaTesting TestingInputStream Compiler
- * @run testng SnippetHighlightTest
+ * @run junit SnippetHighlightTest
  */
 
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
 
-import org.testng.annotations.Test;
 
 import jdk.jshell.SourceCodeAnalysis.Highlight;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class SnippetHighlightTest extends KullaTesting {
 
+    @Test
     public void testMemberExpr() {
         assertEval("@Deprecated class TestClass { }");
         assertEval("class TestConstructor { @Deprecated TestConstructor() {} }");
@@ -99,6 +99,7 @@ public void testMemberExpr() {
                          "Highlight[start=5, end=11, attributes=[DECLARATION]]");
     }
 
+    @Test
     public void testClassErrorRecovery() { //JDK-8301580
         assertHighlights("""
                          class C {
@@ -116,7 +117,7 @@ class C {
 
     private void assertHighlights(String code, String... expected) {
         List completions = computeHighlights(code);
-        assertEquals(completions, Arrays.asList(expected), "Input: " + code + ", " + completions.toString());
+        assertEquals(Arrays.asList(expected), completions, "Input: " + code + ", " + completions.toString());
     }
 
     private List computeHighlights(String code) {
diff --git a/test/langtools/jdk/jshell/SnippetStatusListenerTest.java b/test/langtools/jdk/jshell/SnippetStatusListenerTest.java
index 14ea0b956a70..205749af277e 100644
--- a/test/langtools/jdk/jshell/SnippetStatusListenerTest.java
+++ b/test/langtools/jdk/jshell/SnippetStatusListenerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -25,7 +25,7 @@
  * @test
  * @summary Subscribe tests
  * @build KullaTesting TestingInputStream
- * @run testng SnippetStatusListenerTest
+ * @run junit SnippetStatusListenerTest
  */
 
 import java.util.ArrayList;
@@ -37,14 +37,16 @@
 import jdk.jshell.JShell.Subscription;
 import jdk.jshell.SnippetEvent;
 import jdk.jshell.TypeDeclSnippet;
-import org.testng.annotations.Test;
 
 import static jdk.jshell.Snippet.Status.*;
-import static org.testng.Assert.assertEquals;
+import org.junit.jupiter.api.Assertions;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class SnippetStatusListenerTest extends KullaTesting {
 
+    @Test
     public void testTwoSnippetEventListeners() {
         SnippetListener listener1 = new SnippetListener();
         SnippetListener listener2 = new SnippetListener();
@@ -61,45 +63,52 @@ public void testTwoSnippetEventListeners() {
         assertEval("int a = 0;");
 
         List events1 = Collections.unmodifiableList(listener1.getEvents());
-        assertEquals(events1, listener2.getEvents(), "Checking got events");
+        assertEquals(listener2.getEvents(), events1, "Checking got events");
         getState().unsubscribe(subscription1);
 
         assertDrop(f, DiagCheck.DIAG_IGNORE, DiagCheck.DIAG_IGNORE, ste(f, REJECTED, DROPPED, false, null));
         assertEval("void f() { }", added(VALID));
         assertEvalException("throw new RuntimeException();");
-        assertEquals(listener1.getEvents(), events1, "Checking that unsubscribed listener does not get events");
+        assertEquals(events1, listener1.getEvents(), "Checking that unsubscribed listener does not get events");
 
         List events2 = new ArrayList<>(listener2.getEvents());
         events2.removeAll(events1);
 
-        assertEquals(events2.size(), 3, "The second listener got events");
+        assertEquals(3, events2.size(), "The second listener got events");
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
+    @Test
     public void testNullCallback() {
-        getState().onSnippetEvent(null);
+        Assertions.assertThrows(NullPointerException.class, () -> {
+            getState().onSnippetEvent(null);
+        });
     }
 
-    @Test(expectedExceptions = IllegalStateException.class)
+    @Test
     public void testSubscriptionAfterClose() {
-        getState().close();
-        getState().onSnippetEvent(e -> {});
+        Assertions.assertThrows(IllegalStateException.class, () -> {
+            getState().close();
+            getState().onSnippetEvent(e -> {});
+        });
     }
 
-    @Test(expectedExceptions = IllegalStateException.class,
-          enabled = false) //TODO 8139873
+    @Test //TODO 8139873
+    @Disabled
     public void testSubscriptionAfterShutdown() {
-        assertEval("System.exit(0);");
-        getState().onSnippetEvent(e -> {});
+        Assertions.assertThrows(IllegalStateException.class, () -> {
+            assertEval("System.exit(0);");
+            getState().onSnippetEvent(e -> {});
+        });
     }
 
+    @Test
     public void testSubscriptionToAnotherState() {
         SnippetListener listener = new SnippetListener();
         Subscription subscription = getState().onSnippetEvent(listener);
         tearDown();
         setUp();
         assertEval("int x;");
-        assertEquals(Collections.emptyList(), listener.getEvents(), "No events");
+        assertEquals(listener.getEvents(), Collections.emptyList(), "No events");
         getState().unsubscribe(subscription);
     }
 
diff --git a/test/langtools/jdk/jshell/SnippetTest.java b/test/langtools/jdk/jshell/SnippetTest.java
index 3ccd0e42f4b8..3e5bdbbf3242 100644
--- a/test/langtools/jdk/jshell/SnippetTest.java
+++ b/test/langtools/jdk/jshell/SnippetTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, 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
@@ -26,74 +26,86 @@
  * @bug 8139829
  * @summary test accessors of Snippet
  * @build KullaTesting TestingInputStream
- * @run testng SnippetTest
+ * @run junit SnippetTest
  */
 
 import jdk.jshell.Snippet;
 import jdk.jshell.DeclarationSnippet;
-import org.testng.annotations.Test;
 
 import jdk.jshell.MethodSnippet;
 import jdk.jshell.Snippet.Status;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static jdk.jshell.Snippet.Status.VALID;
 import static jdk.jshell.Snippet.Status.RECOVERABLE_DEFINED;
 import static jdk.jshell.Snippet.Status.OVERWRITTEN;
 import static jdk.jshell.Snippet.Status.RECOVERABLE_NOT_DEFINED;
 import static jdk.jshell.Snippet.SubKind.*;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class SnippetTest extends KullaTesting {
 
+    @Test
     public void testImportKey() {
         assertImportKeyMatch("import java.util.List;", "List", SINGLE_TYPE_IMPORT_SUBKIND, added(VALID));
         assertImportKeyMatch("import java.util.*;", "java.util.*", TYPE_IMPORT_ON_DEMAND_SUBKIND, added(VALID));
         assertImportKeyMatch("import static java.lang.String.*;", "java.lang.String.*", STATIC_IMPORT_ON_DEMAND_SUBKIND, added(VALID));
     }
 
+    @Test
     public void testClassKey() {
         assertDeclarationKeyMatch("class X {}", false, "X", CLASS_SUBKIND, added(VALID));
     }
 
+    @Test
     public void testInterfaceKey() {
         assertDeclarationKeyMatch("interface I {}", false, "I", INTERFACE_SUBKIND, added(VALID));
     }
 
+    @Test
     public void testEnumKey() {
         assertDeclarationKeyMatch("enum E {}", false, "E", ENUM_SUBKIND, added(VALID));
     }
 
+    @Test
     public void testAnnotationKey() {
         assertDeclarationKeyMatch("@interface A {}", false, "A", ANNOTATION_TYPE_SUBKIND, added(VALID));
     }
 
+    @Test
     public void testMethodKey() {
         assertDeclarationKeyMatch("void m() {}", false, "m", METHOD_SUBKIND, added(VALID));
     }
 
+    @Test
     public void testVarDeclarationKey() {
         assertVarKeyMatch("int a;", true, "a", VAR_DECLARATION_SUBKIND, "int", added(VALID));
     }
 
+    @Test
     public void testVarDeclarationWithInitializerKey() {
         assertVarKeyMatch("double b = 9.0;", true, "b", VAR_DECLARATION_WITH_INITIALIZER_SUBKIND, "double", added(VALID));
     }
 
+    @Test
     public void testTempVarExpressionKey() {
         assertVarKeyMatch("47;", true, "$1", TEMP_VAR_EXPRESSION_SUBKIND, "int", added(VALID));
     }
 
+    @Test
     public void testVarValueKey() {
         assertEval("double x = 4;", "4.0");
         assertExpressionKeyMatch("x;", "x", VAR_VALUE_SUBKIND, "double");
     }
 
+    @Test
     public void testAssignmentKey() {
         assertEval("int y;");
         assertExpressionKeyMatch("y = 4;", "y", ASSIGNMENT_SUBKIND, "int");
     }
 
+    @Test
     public void testStatementKey() {
         assertKeyMatch("if (true) {}", true, STATEMENT_SUBKIND, added(VALID));
         assertKeyMatch("while (true) { break; }", true, STATEMENT_SUBKIND, added(VALID));
@@ -101,10 +113,12 @@ public void testStatementKey() {
         assertKeyMatch("for (;;) { break; }", true, STATEMENT_SUBKIND, added(VALID));
     }
 
+    @Test
     public void noKeys() {
         assertActiveKeys(new DeclarationSnippet[0]);
     }
 
+    @Test
     public void testKeyId1() {
         Snippet a = classKey(assertEval("class A { }"));
         assertEval("void f() {  }");
@@ -116,7 +130,8 @@ public void testKeyId1() {
         assertActiveKeys();
     }
 
-    @Test(enabled = false) // TODO 8081689
+    @Test // TODO 8081689
+    @Disabled
     public void testKeyId2() {
         Snippet g = methodKey(assertEval("void g() { f(); }", added(RECOVERABLE_DEFINED)));
         Snippet f = methodKey(assertEval("void f() { }",
@@ -136,6 +151,7 @@ public void testKeyId2() {
         assertActiveKeys();
     }
 
+    @Test
     public void testKeyId3() {
         Snippet g = methodKey(assertEval("void g() { f(); }", added(RECOVERABLE_DEFINED)));
         Snippet f = methodKey(assertEval("void f() { }",
@@ -154,6 +170,7 @@ public void testKeyId3() {
         assertActiveKeys();
     }
 
+    @Test
     public void testBooleanSnippetQueries() {
         Snippet nd = varKey(assertEval("blort x;", added(RECOVERABLE_NOT_DEFINED)));
         assertTrue(nd.kind().isPersistent(), "nd.isPersistent");
diff --git a/test/langtools/jdk/jshell/SourceLevelTest.java b/test/langtools/jdk/jshell/SourceLevelTest.java
index ce5572e6f712..f1092a5d2e89 100644
--- a/test/langtools/jdk/jshell/SourceLevelTest.java
+++ b/test/langtools/jdk/jshell/SourceLevelTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -26,15 +26,16 @@
  * @bug 8259820
  * @summary Check JShell can handle -source 8
  * @modules jdk.jshell
- * @run testng SourceLevelTest
+ * @run junit SourceLevelTest
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class SourceLevelTest extends ReplToolTesting {
 
-    @DataProvider(name="sourceLevels")
     public Object[][] sourceLevels() {
         return new Object[][] {
             new Object[] {"8"},
@@ -42,7 +43,8 @@ public Object[][] sourceLevels() {
         };
     }
 
-    @Test(dataProvider="sourceLevels")
+    @ParameterizedTest
+    @MethodSource("sourceLevels")
     public void testSourceLevel(String sourceLevel) {
         test(new String[] {"-C", "-source", "-C", sourceLevel},
                 (a) -> assertCommand(a, "1 + 1", "$1 ==> 2"),
diff --git a/test/langtools/jdk/jshell/StartOptionTest.java b/test/langtools/jdk/jshell/StartOptionTest.java
index 3f4a86bff0a5..16d362dda2c1 100644
--- a/test/langtools/jdk/jshell/StartOptionTest.java
+++ b/test/langtools/jdk/jshell/StartOptionTest.java
@@ -31,7 +31,7 @@
  *          jdk.jshell/jdk.internal.jshell.tool.resources:+open
  * @library /tools/lib
  * @build Compiler toolbox.ToolBox
- * @run testng StartOptionTest
+ * @run junit StartOptionTest
  */
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -50,16 +50,15 @@
 import java.util.regex.Pattern;
 import jdk.jshell.JShell;
 
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
 import jdk.jshell.tool.JavaShellToolBuilder;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import org.junit.jupiter.api.AfterEach;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class StartOptionTest {
 
     protected ByteArrayOutputStream cmdout;
@@ -101,7 +100,7 @@ protected void check(ByteArrayOutputStream str, Consumer checkOut, Strin
         if (checkOut != null) {
             checkOut.accept(out);
         } else {
-            assertEquals(out, "", label + ": Expected empty -- ");
+            assertEquals("", out, label + ": Expected empty -- ");
         }
     }
 
@@ -109,7 +108,7 @@ protected void checkExit(int ec, Consumer checkCode) {
         if (checkCode != null) {
             checkCode.accept(ec);
         } else {
-            assertEquals(ec, 0, "Expected standard exit code (0), but found: " + ec);
+            assertEquals(0, ec, "Expected standard exit code (0), but found: " + ec);
         }
     }
 
@@ -140,8 +139,7 @@ protected void startCheckError(Consumer checkError,
 
     // Start with an exit code and command error check
     protected void startExCe(int eec, Consumer checkError, String... args) {
-        StartOptionTest.this.startExCoUoCeCn(
-                (Integer ec) -> assertEquals((int) ec, eec,
+        StartOptionTest.this.startExCoUoCeCn((Integer ec) -> assertEquals(eec, (int) ec,
                         "Expected error exit code (" + eec + "), but found: " + ec),
                 null, null, checkError, null, args);
     }
@@ -154,7 +152,7 @@ protected void startCo(Consumer checkCmdOutput, String... args) {
     private Consumer assertOrNull(String expected, String label) {
         return expected == null
                 ? null
-                : s -> assertEquals(s.replaceAll("\\r\\n?", "\n").trim(), expected.trim(), label);
+                : s -> assertEquals(expected.trim(), s.replaceAll("\\r\\n?", "\n").trim(), label);
     }
 
     // Start and check the resultant: exit code (Ex), command output (Co),
@@ -165,10 +163,9 @@ protected void startExCoUoCeCn(int expectedExitCode,
             String expectedError,
             String expectedConsole,
             String... args) {
-        startExCoUoCeCn(
-                expectedExitCode == 0
+        startExCoUoCeCn(expectedExitCode == 0
                         ? null
-                        : (Integer i) -> assertEquals((int) i, expectedExitCode,
+                        : (Integer i) -> assertEquals(expectedExitCode, (int) i,
                         "Expected exit code (" + expectedExitCode + "), but found: " + i),
                 assertOrNull(expectedCmdOutput, "cmdout: "),
                 assertOrNull(expectedUserOutput, "userout: "),
@@ -192,7 +189,7 @@ protected void startUo(String expectedUserOutput, String... args) {
         startExCoUoCeCn(0, null, expectedUserOutput, null, null, args);
     }
 
-    @BeforeMethod
+    @BeforeEach
     public void setUp() {
         cmdout = new ByteArrayOutputStream();
         cmderr = new ByteArrayOutputStream();
@@ -215,6 +212,7 @@ protected void setIn(String s) {
     }
 
     // Test load files
+    @Test
     public void testCommandFile() {
         String fn = writeToFile("String str = \"Hello \"\n" +
                 "/list\n" +
@@ -229,6 +227,7 @@ public void testCommandFile() {
     }
 
     // Test that the usage message is printed
+    @Test
     public void testUsage() {
         for (String opt : new String[]{"-?", "-h", "--help"}) {
             startCo(s -> {
@@ -241,6 +240,7 @@ public void testUsage() {
     }
 
     // Test the --help-extra message
+    @Test
     public void testHelpExtra() {
         for (String opt : new String[]{"-X", "--help-extra"}) {
             startCo(s -> {
@@ -253,12 +253,14 @@ public void testHelpExtra() {
     }
 
     // Test handling of bogus options
+    @Test
     public void testUnknown() {
         startExCe(1, "Unknown option: u", "-unknown");
         startExCe(1, "Unknown option: unknown", "--unknown");
     }
 
     // Test that input is read with "-" and there is no extra output.
+    @Test
     public void testHypenFile() {
         setIn("System.out.print(\"Hello\");\n");
         startUo("Hello", "-");
@@ -275,6 +277,7 @@ public void testHypenFile() {
     }
 
     // Test that user specified exit codes are propagated
+    @Test
     public void testExitCode() {
         setIn("/exit 57\n");
         startExCoUoCeCn(57, null, null, null, "-> /exit 57", "-s");
@@ -289,11 +292,13 @@ public void testExitCode() {
     }
 
     // Test that non-existent load file sends output to stderr and does not startExCe (no welcome).
+    @Test
     public void testUnknownLoadFile() {
         startExCe(1, "File 'UNKNOWN' for 'jshell' is not found.", "UNKNOWN");
     }
 
     // Test bad usage of the --startup option
+    @Test
     public void testStartup() {
         String fn = writeToFile("");
         startExCe(1, "Argument to startup missing.", "--startup");
@@ -303,18 +308,21 @@ public void testStartup() {
     }
 
     // Test an option that causes the back-end to fail is propagated
+    @Test
     public void testStartupFailedOption() {
         startExCe(1, s -> assertTrue(s.contains("Unrecognized option: -hoge-foo-bar"), "cmderr: " + s),
                 "-R-hoge-foo-bar");
     }
 
     // Test the use of non-existant files with the --startup option
+    @Test
     public void testStartupUnknown() {
         startExCe(1, "File 'UNKNOWN' for '--startup' is not found.", "--startup", "UNKNOWN");
         startExCe(1, "File 'UNKNOWN' for '--startup' is not found.", "--startup", "DEFAULT", "--startup", "UNKNOWN");
     }
 
     // Test bad usage of --class-path option
+    @Test
     public void testClasspath() {
         for (String cp : new String[]{"--class-path"}) {
             startExCe(1, "Only one --class-path option may be used.", cp, ".", "--class-path", ".");
@@ -323,12 +331,14 @@ public void testClasspath() {
     }
 
     // Test bogus module on --add-modules option
+    @Test
     public void testUnknownModule() {
         startExCe(1, s -> assertTrue(s.contains("rror") && s.contains("unKnown"), "cmderr: " + s),
                 "--add-modules", "unKnown");
     }
 
     // Test that muliple feedback options fail
+    @Test
     public void testFeedbackOptionConflict() {
         startExCe(1, "Only one feedback option (--feedback, -q, -s, or -v) may be used.",
                 "--feedback", "concise", "--feedback", "verbose");
@@ -343,12 +353,14 @@ public void testFeedbackOptionConflict() {
     }
 
     // Test bogus arguments to the --feedback option
+    @Test
     public void testNegFeedbackOption() {
         startExCe(1, "Argument to feedback missing.", "--feedback");
         startExCe(1, "Does not match any current feedback mode: blorp -- --feedback blorp", "--feedback", "blorp");
     }
 
     // Test --version
+    @Test
     public void testVersion() {
         startCo(s -> {
             assertTrue(s.startsWith("jshell"), "unexpected version: " + s);
@@ -358,6 +370,7 @@ public void testVersion() {
     }
 
     // Test --show-version
+    @Test
     public void testShowVersion() {
         startExCoUoCeCn(null,
                 s -> {
@@ -384,12 +397,12 @@ public void testErroneousFile() {
                               .getString("jshell.err.incomplete.input");
         String expectedError =
                 new MessageFormat(expectedErrorFormat).format(new Object[] {code});
-        startCheckError(s -> assertEquals(s, expectedError),
+        startCheckError(s -> assertEquals(expectedError, s),
                         readLinePrompt);
     }
 
 
-    @AfterMethod
+    @AfterEach
     public void tearDown() {
         cmdout = null;
         cmderr = null;
diff --git a/test/langtools/jdk/jshell/StopExecutionTest.java b/test/langtools/jdk/jshell/StopExecutionTest.java
index 389794d35d24..12f95ea99c0d 100644
--- a/test/langtools/jdk/jshell/StopExecutionTest.java
+++ b/test/langtools/jdk/jshell/StopExecutionTest.java
@@ -27,7 +27,7 @@
  * @summary Test JShell#stop
  * @modules jdk.jshell/jdk.internal.jshell.tool
  * @build KullaTesting TestingInputStream
- * @run testng StopExecutionTest
+ * @run junit StopExecutionTest
  */
 
 import java.io.IOException;
@@ -42,28 +42,30 @@
 import jdk.internal.jshell.tool.StopDetectingInputStream;
 import jdk.internal.jshell.tool.StopDetectingInputStream.State;
 import jdk.jshell.JShell;
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
-
-@Test
 public class StopExecutionTest extends KullaTesting {
 
     private final Object lock = new Object();
     private boolean isStopped;
 
-    @Test(enabled = false) // TODO 8129546
+    @Test // TODO 8129546
+    @Disabled
     public void testStopLoop() throws InterruptedException {
         scheduleStop("while (true) ;");
     }
 
-    @Test(enabled = false) // TODO 8129546
+    @Test // TODO 8129546
+    @Disabled
     public void testStopASleep() throws InterruptedException {
         scheduleStop("while (true) { try { Thread.sleep(100); } catch (InterruptedException ex) { } }");
     }
 
-    @Test(enabled = false) // TODO 8129546
+    @Test // TODO 8129546
+    @Disabled
     public void testScriptCatchesStop() throws Exception {
         scheduleStop("for (int i = 0; i < 30; i++) { try { Thread.sleep(100); } catch (Throwable ex) { } }");
     }
@@ -104,6 +106,7 @@ private void scheduleStop(String src) throws InterruptedException {
         t.join();
     }
 
+    @Test
     public void testStopDetectingInputRandom() throws IOException {
         long seed = System.nanoTime();
         Random r = new Random(seed);
@@ -129,10 +132,11 @@ private void doChunk(StopDetectingInputStream buffer, int chunkSize) throws IOEx
         for (int c = 0; c < chunkSize; c++) {
             int read = buffer.read();
 
-            assertEquals(read, c);
+            assertEquals(c, read);
         }
     }
 
+    @Test
     public void testStopDetectingInputBufferWaitStop() throws Exception {
         Runnable shouldNotHappenRun =
                 () -> { throw new AssertionError("Should not happen."); };
diff --git a/test/langtools/jdk/jshell/T8146368/JShellTest8146368.java b/test/langtools/jdk/jshell/T8146368/JShellTest8146368.java
index 8cf92545bb5c..21cb37e65b3a 100644
--- a/test/langtools/jdk/jshell/T8146368/JShellTest8146368.java
+++ b/test/langtools/jdk/jshell/T8146368/JShellTest8146368.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -27,14 +27,14 @@
  * @summary Test Smashing Error when user language is Japanese
  * @library /tools/lib /jdk/jshell
  * @build KullaTesting
- * @run testng/othervm -Duser.language=ja JShellTest8146368
+ * @run junit/othervm -Duser.language=ja JShellTest8146368
  */
 
 import static jdk.jshell.Snippet.Status.RECOVERABLE_NOT_DEFINED;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class JShellTest8146368 extends KullaTesting {
+    @Test
     public void test() {
         assertEval("class A extends B {}", added(RECOVERABLE_NOT_DEFINED));
         assertEval("und m() { return new und(); }", added(RECOVERABLE_NOT_DEFINED));
diff --git a/test/langtools/jdk/jshell/T8146368/JShellToolTest8146368.java b/test/langtools/jdk/jshell/T8146368/JShellToolTest8146368.java
index 101083c0e271..3a7db71be713 100644
--- a/test/langtools/jdk/jshell/T8146368/JShellToolTest8146368.java
+++ b/test/langtools/jdk/jshell/T8146368/JShellToolTest8146368.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -28,13 +28,13 @@
  * @modules jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib /jdk/jshell
  * @build ReplToolTesting
- * @run testng/othervm -Duser.language=ja JShellToolTest8146368
+ * @run junit/othervm -Duser.language=ja JShellToolTest8146368
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class JShellToolTest8146368 extends ReplToolTesting {
+    @Test
     public void test() {
         test(
                 a -> assertCommand(a, "class A extends B {}", "|  created class A, however, it cannot be referenced until class B is declared\n"),
diff --git a/test/langtools/jdk/jshell/Test8294583.java b/test/langtools/jdk/jshell/Test8294583.java
index 3d2ce2e36381..281911b71133 100644
--- a/test/langtools/jdk/jshell/Test8294583.java
+++ b/test/langtools/jdk/jshell/Test8294583.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, 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
@@ -26,22 +26,23 @@
  * @bug 8294583
  * @summary JShell: NPE in switch with non existing record pattern
  * @build KullaTesting TestingInputStream
- * @run testng Test8294583
+ * @run junit Test8294583
  */
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class Test8294583 extends KullaTesting {
 
+    @Test
     public void test() {
         assertEvalFail("switch (new Object()) {\n" +
                         "   case Foo() -> {}\n" +
                         "};");
     }
 
-    @org.testng.annotations.BeforeMethod
+    @BeforeEach
     public void setUp() {
         super.setUp(bc -> bc.compilerOptions("--source", System.getProperty("java.specification.version"), "--enable-preview").remoteVMOptions("--enable-preview"));
     }
diff --git a/test/langtools/jdk/jshell/Test8296012.java b/test/langtools/jdk/jshell/Test8296012.java
index 73e5cc06ae0a..4f08861b952d 100644
--- a/test/langtools/jdk/jshell/Test8296012.java
+++ b/test/langtools/jdk/jshell/Test8296012.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, 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
@@ -26,21 +26,22 @@
  * @bug 8296012
  * @summary jshell crashes on mismatched record pattern
  * @build KullaTesting TestingInputStream
- * @run testng Test8296012
+ * @run junit Test8296012
  */
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class Test8296012 extends KullaTesting {
 
+    @Test
     public void test() {
         assertEval("record Foo(int x, int y) {}");
         assertEvalFail("switch (new Foo(1, 2)) { case Foo(int z) -> z; }");
     }
 
-    @org.testng.annotations.BeforeMethod
+    @BeforeEach
     public void setUp() {
         super.setUp(bc -> bc.compilerOptions("--source", System.getProperty("java.specification.version"), "--enable-preview").remoteVMOptions("--enable-preview"));
     }
diff --git a/test/langtools/jdk/jshell/ToolBasicTest.java b/test/langtools/jdk/jshell/ToolBasicTest.java
index b5128de738a9..5015d1f64b12 100644
--- a/test/langtools/jdk/jshell/ToolBasicTest.java
+++ b/test/langtools/jdk/jshell/ToolBasicTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -32,7 +32,7 @@
  * @library /tools/lib
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build KullaTesting TestingInputStream Compiler
- * @run testng/timeout=600 ToolBasicTest
+ * @run junit/timeout=600 ToolBasicTest
  * @key intermittent
  */
 
@@ -57,19 +57,18 @@
 import java.util.stream.Stream;
 
 import com.sun.net.httpserver.HttpServer;
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.fail;
-
-@Test
 public class ToolBasicTest extends ReplToolTesting {
 
+    @Test
     public void elideStartUpFromList() {
-        test(
-                (a) -> assertCommandOutputContains(a, "123", "==> 123"),
+        test((a) -> assertCommandOutputContains(a, "123", "==> 123"),
                 (a) -> assertCommandCheckOutput(a, "/list", (s) -> {
                     int cnt;
                     try (Scanner scanner = new Scanner(s)) {
@@ -81,11 +80,12 @@ public void elideStartUpFromList() {
                             }
                         }
                     }
-                    assertEquals(cnt, 1, "Expected only one listed line");
+                    assertEquals(1, cnt, "Expected only one listed line");
                 })
         );
     }
 
+    @Test
     public void elideStartUpFromSave() throws IOException {
         Compiler compiler = new Compiler();
         Path path = compiler.getPath("myfile");
@@ -94,10 +94,11 @@ public void elideStartUpFromSave() throws IOException {
                 (a) -> assertCommand(a, "/save " + path.toString(), "")
         );
         try (Stream lines = Files.lines(path)) {
-            assertEquals(lines.count(), 1, "Expected only one saved line");
+            assertEquals(1, lines.count(), "Expected only one saved line");
         }
     }
 
+    @Test
     public void testInterrupt() {
         ReplTest interrupt = (a) -> assertCommand(a, "\u0003", "");
         for (String s : new String[] { "", "\u0003" }) {
@@ -132,6 +133,7 @@ public void testInterrupt() {
         }
     }
 
+    @Test
     public void testCtrlD() {
         test(false, new String[]{"--no-startup"},
                 a -> {
@@ -193,6 +195,7 @@ private void assertStop(boolean after, String cmd, String output) {
         }
     }
 
+    @Test
     public void testStop() {
         test(
                 (a) -> assertStop(a, "while (true) {}", ""),
@@ -200,6 +203,7 @@ public void testStop() {
         );
     }
 
+    @Test
     public void testRerun() {
         test(false, new String[] {"--no-startup"},
                 (a) -> assertCommand(a, "/0", "|  No snippet with ID: 0"),
@@ -221,7 +225,7 @@ public void testRerun() {
             final int finalI = i;
             Consumer check = (s) -> {
                 String[] ss = s.split("\n");
-                assertEquals(ss[0], codes[finalI]);
+                assertEquals(codes[finalI], ss[0]);
                 assertTrue(ss.length > 1, s);
             };
             tests.add((a) -> assertCommandCheckOutput(a, "/" + (finalI + 1), check));
@@ -231,7 +235,7 @@ public void testRerun() {
             final int finalI = i;
             Consumer check = (s) -> {
                 String[] ss = s.split("\n");
-                assertEquals(ss[0], codes[codes.length - finalI - 1]);
+                assertEquals(codes[codes.length - finalI - 1], ss[0]);
                 assertTrue(ss.length > 1, s);
             };
             tests.add((a) -> assertCommandCheckOutput(a, "/-" + (2 * finalI + 1), check));
@@ -241,11 +245,12 @@ public void testRerun() {
                 tests.toArray(new ReplTest[tests.size()]));
     }
 
+    @Test
     public void test8142447() {
         Function> assertRerun = cmd -> (code, assertionCount) ->
                 (a) -> assertCommandCheckOutput(a, cmd, s -> {
                             String[] ss = s.split("\n");
-                            assertEquals(ss[0], code);
+                            assertEquals(code, ss[0]);
                             loadVariable(a, "int", "assertionCount", Integer.toString(assertionCount), Integer.toString(assertionCount));
                         });
         ReplTest assertVariables = (a) -> assertCommandCheckOutput(a, "/v", assertVariables());
@@ -256,7 +261,7 @@ public void test8142447() {
                 "void add(int n) { assertionCount += n; }");
         test(new String[]{"--startup", startup.toString()},
                 (a) -> assertCommand(a, "add(1)", ""), // id: 1
-                (a) -> assertCommandCheckOutput(a, "add(ONE)", s -> assertEquals(s.split("\n")[0], "|  Error:")), // id: e1
+                (a) -> assertCommandCheckOutput(a, "add(ONE)", s -> assertEquals("|  Error:", s.split("\n")[0])), // id: e1
                 (a) -> assertVariable(a, "int", "ONE", "1", "1"),
                 assertRerun.apply("/1").apply("add(1)", 2), assertVariables,
                 assertRerun.apply("/e1").apply("add(ONE)", 3), assertVariables,
@@ -270,6 +275,7 @@ public void test8142447() {
         );
     }
 
+    @Test
     public void testClasspathDirectory() {
         Compiler compiler = new Compiler();
         Path outDir = Paths.get("testClasspathDirectory");
@@ -285,6 +291,7 @@ public void testClasspathDirectory() {
         );
     }
 
+    @Test
     public void testEnvInStartUp() {
         Compiler compiler = new Compiler();
         Path outDir = Paths.get("testClasspathDirectory");
@@ -320,6 +327,7 @@ private String makeSimpleJar() {
         return compiler.getPath(outDir).resolve(jarName).toString();
     }
 
+    @Test
     public void testClasspathJar() {
         String jarPath = makeSimpleJar();
         test(
@@ -332,6 +340,7 @@ public void testClasspathJar() {
         );
     }
 
+    @Test
     public void testClasspathUserHomeExpansion() {
         String jarPath = makeSimpleJar();
         String tilde = "~" + File.separator;
@@ -346,6 +355,7 @@ public void testClasspathUserHomeExpansion() {
         );
     }
 
+    @Test
     public void testBadClasspath() {
         String jarPath = makeSimpleJar();
         Compiler compiler = new Compiler();
@@ -373,6 +383,7 @@ private String makeBadSourceJar() {
         return compiler.getPath(outDir).resolve(jarName).toString();
     }
 
+    @Test
     public void testBadSourceJarClasspath() {
         String jarPath = makeBadSourceJar();
         test(
@@ -391,6 +402,7 @@ public void testBadSourceJarClasspath() {
         );
     }
 
+    @Test
     public void testModulePath() {
         Compiler compiler = new Compiler();
         Path modsDir = Paths.get("mods");
@@ -406,6 +418,7 @@ public void testModulePath() {
         );
     }
 
+    @Test
     public void testModulePathUserHomeExpansion() {
         String tilde = "~" + File.separatorChar;
         test(
@@ -415,6 +428,7 @@ public void testModulePathUserHomeExpansion() {
         );
     }
 
+    @Test
     public void testBadModulePath() {
         Compiler compiler = new Compiler();
         Path t1 = compiler.getPath("whatever/thing.zip");
@@ -425,6 +439,7 @@ public void testBadModulePath() {
         );
     }
 
+    @Test
     public void testStartupFileOption() {
         Compiler compiler = new Compiler();
         Path startup = compiler.getPath("StartupFileOption/startup.txt");
@@ -440,6 +455,7 @@ public void testStartupFileOption() {
         );
     }
 
+    @Test
     public void testLoadingFromArgs() {
         Compiler compiler = new Compiler();
         Path path = compiler.getPath("loading.repl");
@@ -450,6 +466,7 @@ public void testLoadingFromArgs() {
         );
     }
 
+    @Test
     public void testReset() {
         test(
                 (a) -> assertReset(a, "/res"),
@@ -470,6 +487,7 @@ public void testReset() {
         );
     }
 
+    @Test
     public void testOpen() {
         Compiler compiler = new Compiler();
         Path path = compiler.getPath("testOpen.repl");
@@ -504,6 +522,7 @@ public void testOpen() {
         }
     }
 
+    @Test
     public void testOpenLocalFileUrl() {
         Compiler compiler = new Compiler();
         Path path = compiler.getPath("testOpen.repl");
@@ -518,6 +537,7 @@ public void testOpenLocalFileUrl() {
         }
     }
 
+    @Test
     public void testOpenFileOverHttp() throws IOException {
         var script = "int a = 10;int b = 20;int c = a + b;";
 
@@ -549,6 +569,7 @@ public void testOpenFileOverHttp() throws IOException {
         }
     }
 
+    @Test
     public void testOpenResource() {
         test(new String[]{"-R", "-Duser.language=en", "-R", "-Duser.country=US"},
                 (a) -> assertCommand(a, "/open PRINTING", ""),
@@ -559,6 +580,7 @@ public void testOpenResource() {
         );
     }
 
+    @Test
     public void testSave() throws IOException {
         Compiler compiler = new Compiler();
         Path path = compiler.getPath("testSave.repl");
@@ -573,7 +595,7 @@ public void testSave() throws IOException {
                     (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"),
                     (a) -> assertCommand(a, "/save " + path.toString(), "")
             );
-            assertEquals(Files.readAllLines(path), list);
+            assertEquals(list, Files.readAllLines(path));
         }
         {
             List output = new ArrayList<>();
@@ -589,7 +611,7 @@ public void testSave() throws IOException {
                             .collect(Collectors.toList()))),
                     (a) -> assertCommand(a, "/save -all " + path.toString(), "")
             );
-            assertEquals(Files.readAllLines(path), output);
+            assertEquals(output, Files.readAllLines(path));
         }
         {
             List output = new ArrayList<>();
@@ -606,7 +628,7 @@ public void testSave() throws IOException {
                             .collect(Collectors.toList()))),
                     (a) -> assertCommand(a, "/save 2-3 1 4 " + path.toString(), "")
             );
-            assertEquals(Files.readAllLines(path), output);
+            assertEquals(output, Files.readAllLines(path));
         }
         {
             List output = new ArrayList<>();
@@ -621,10 +643,11 @@ public void testSave() throws IOException {
                     (a) -> assertCommand(a, "/save -history " + path.toString(), "")
             );
             output.add("/save -history " + path.toString());
-            assertEquals(Files.readAllLines(path), output);
+            assertEquals(output, Files.readAllLines(path));
         }
     }
 
+    @Test
     public void testStartRetain() {
         Compiler compiler = new Compiler();
         Path startUpFile = compiler.getPath("startUp.txt");
@@ -655,6 +678,7 @@ public void testStartRetain() {
         );
     }
 
+    @Test
     public void testStartSave() throws IOException {
         Compiler compiler = new Compiler();
         Path startSave = compiler.getPath("startSave.txt");
@@ -662,9 +686,10 @@ public void testStartSave() throws IOException {
         List lines = Files.lines(startSave)
                 .filter(s -> !s.isEmpty())
                 .collect(Collectors.toList());
-        assertEquals(lines, START_UP);
+        assertEquals(START_UP, lines);
     }
 
+    @Test
     public void testConstrainedUpdates() {
         test(
                 a -> assertClass(a, "class XYZZY { }", "class", "XYZZY"),
@@ -674,6 +699,7 @@ public void testConstrainedUpdates() {
         );
     }
 
+    @Test
     public void testRemoteExit() {
         test(
                 a -> assertVariable(a, "int", "x"),
@@ -686,11 +712,13 @@ public void testRemoteExit() {
         );
     }
 
+    @Test
     public void testFeedbackNegative() {
         test(a -> assertCommandCheckOutput(a, "/set feedback aaaa",
                 assertStartsWith("|  Does not match any current feedback mode")));
     }
 
+    @Test
     public void testFeedbackSilent() {
         for (String off : new String[]{"s", "silent"}) {
             test(
@@ -702,6 +730,7 @@ public void testFeedbackSilent() {
         }
     }
 
+    @Test
     public void testFeedbackNormal() {
         Compiler compiler = new Compiler();
         Path testNormalFile = compiler.getPath("testConciseNormal");
@@ -728,6 +757,7 @@ public void testFeedbackNormal() {
         }
     }
 
+    @Test
     public void testVarsWithNotActive() {
         test(
                 a -> assertVariable(a, "Blath", "x"),
@@ -735,6 +765,7 @@ public void testVarsWithNotActive() {
         );
     }
 
+    @Test
     public void testHistoryReference() {
         test(false, new String[]{"--no-startup"},
                 a -> assertCommand(a, "System.err.println(99)", "", "", null, "", "99\n"),
@@ -767,6 +798,7 @@ public void testHistoryReference() {
         );
     }
 
+    @Test
     public void testRerunIdRange() {
         Compiler compiler = new Compiler();
         Path startup = compiler.getPath("rangeStartup");
@@ -825,7 +857,8 @@ public void testRerunIdRange() {
         );
     }
 
-    @Test(enabled = false) // TODO 8158197
+    @Test // TODO 8158197
+    @Disabled
     public void testHeadlessEditPad() {
         String prevHeadless = System.getProperty("java.awt.headless");
         try {
@@ -838,6 +871,7 @@ public void testHeadlessEditPad() {
         }
     }
 
+    @Test
     public void testAddExports() {
         test(false, new String[]{"--no-startup"},
                 a -> assertCommandOutputStartsWith(a, "import jdk.internal.misc.VM;", "|  Error:")
@@ -854,6 +888,7 @@ public void testAddExports() {
         );
     }
 
+    @Test
     public void testRedeclareVariableNoInit() {
         test(
                 a -> assertCommand(a, "Integer a;", "a ==> null"),
@@ -865,6 +900,7 @@ public void testRedeclareVariableNoInit() {
         );
      }
 
+    @Test
     public void testWarningUnchecked() { //8223688
         test(false, new String[]{"--no-startup"},
                 a -> assertCommand(a, "abstract class A { A(T t){} }", "|  created class A"),
@@ -876,6 +912,7 @@ public void testWarningUnchecked() { //8223688
         );
     }
 
+    @Test
     public void testIndent() { //8223688
         prefsMap.remove("INDENT");
         test(false, new String[]{"--no-startup"},
@@ -887,6 +924,7 @@ public void testIndent() { //8223688
         );
     }
 
+    @Test
     public void testSystemExitStartUp() {
         Compiler compiler = new Compiler();
         Path startup = compiler.getPath("SystemExitStartUp/startup.txt");
diff --git a/test/langtools/jdk/jshell/ToolCommandOptionTest.java b/test/langtools/jdk/jshell/ToolCommandOptionTest.java
index ec137a3ec608..d647c28c20cf 100644
--- a/test/langtools/jdk/jshell/ToolCommandOptionTest.java
+++ b/test/langtools/jdk/jshell/ToolCommandOptionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -30,16 +30,16 @@
  *          jdk.compiler/com.sun.tools.javac.main
  * @library /tools/lib
  * @build ToolCommandOptionTest ReplToolTesting
- * @run testng ToolCommandOptionTest
+ * @run junit ToolCommandOptionTest
  */
 import java.nio.file.Path;
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ToolCommandOptionTest extends ReplToolTesting {
 
+    @Test
     public void listTest() {
         test(
                 (a) -> assertCommand(a, "int x;",
@@ -67,6 +67,7 @@ public void listTest() {
         );
     }
 
+    @Test
     public void typesTest() {
         test(
                 (a) -> assertCommand(a, "int x",
@@ -92,6 +93,7 @@ public void typesTest() {
         );
     }
 
+    @Test
     public void dropTest() {
         test(false, new String[]{"--no-startup"},
                 (a) -> assertCommand(a, "int x = 5;",
@@ -120,6 +122,7 @@ public void dropTest() {
         );
     }
 
+    @Test
     public void setEditorTest() {
         test(
                 (a) -> assertCommand(a, "/set editor -furball",
@@ -157,6 +160,7 @@ public void setEditorTest() {
         );
     }
 
+    @Test
     public void retainEditorTest() {
         test(
                 (a) -> assertCommand(a, "/set editor -retain -furball",
@@ -211,6 +215,7 @@ public void retainEditorTest() {
         );
     }
 
+    @Test
     public void setEditorEnvTest() {
         setEnvVar("EDITOR", "best one");
         setEditorEnvSubtest();
@@ -244,6 +249,7 @@ private void setEditorEnvSubtest() {
         );
     }
 
+    @Test
     public void setStartTest() {
         Compiler compiler = new Compiler();
         Path startup = compiler.getPath("StartTest/startup.txt");
@@ -288,6 +294,7 @@ public void setStartTest() {
         );
     }
 
+    @Test
     public void retainStartTest() {
         Compiler compiler = new Compiler();
         Path startup = compiler.getPath("StartTest/startup.txt");
@@ -337,6 +344,7 @@ public void retainStartTest() {
         );
     }
 
+    @Test
     public void setModeTest() {
         test(
                 (a) -> assertCommandOutputContains(a, "/set mode",
@@ -399,6 +407,7 @@ public void setModeTest() {
         );
     }
 
+    @Test
     public void setModeSmashTest() {
         test(
                 (a) -> assertCommand(a, "/set mode mymode -command",
@@ -428,6 +437,7 @@ public void setModeSmashTest() {
         );
     }
 
+    @Test
     public void retainModeTest() {
         test(
                 (a) -> assertCommandOutputStartsWith(a, "/set mode -retain",
@@ -531,6 +541,7 @@ public void retainModeTest() {
         );
     }
 
+    @Test
     public void retainModeDeleteLocalTest() {
         test(
                 (a) -> assertCommand(a, "/set mode rmdlt normal -command",
diff --git a/test/langtools/jdk/jshell/ToolEnableNativeAccessTest.java b/test/langtools/jdk/jshell/ToolEnableNativeAccessTest.java
index 212301c0fd83..54cae875d893 100644
--- a/test/langtools/jdk/jshell/ToolEnableNativeAccessTest.java
+++ b/test/langtools/jdk/jshell/ToolEnableNativeAccessTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, 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
@@ -26,12 +26,11 @@
  * @bug 8268725
  * @summary Tests for the --enable-native-access option
  * @modules jdk.jshell
- * @run testng ToolEnableNativeAccessTest
+ * @run junit ToolEnableNativeAccessTest
  */
 
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
 public class ToolEnableNativeAccessTest extends ReplToolTesting {
 
diff --git a/test/langtools/jdk/jshell/ToolEnablePreviewTest.java b/test/langtools/jdk/jshell/ToolEnablePreviewTest.java
index 61a54254455e..6e5d63eade9f 100644
--- a/test/langtools/jdk/jshell/ToolEnablePreviewTest.java
+++ b/test/langtools/jdk/jshell/ToolEnablePreviewTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, 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
@@ -25,12 +25,11 @@
  * @test
  * @bug 8199193
  * @summary Tests for the --enable-preview option
- * @run testng ToolEnablePreviewTest
+ * @run junit ToolEnablePreviewTest
  */
 
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
 public class ToolEnablePreviewTest extends ReplToolTesting {
 
diff --git a/test/langtools/jdk/jshell/ToolFormatTest.java b/test/langtools/jdk/jshell/ToolFormatTest.java
index 3aaf5e79ea5f..5d25fb99928b 100644
--- a/test/langtools/jdk/jshell/ToolFormatTest.java
+++ b/test/langtools/jdk/jshell/ToolFormatTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -31,21 +31,22 @@
  *          jdk.jdeps/com.sun.tools.javap
  *          jdk.jshell/jdk.internal.jshell.tool
  * @build KullaTesting TestingInputStream toolbox.ToolBox Compiler
- * @run testng ToolFormatTest
+ * @run junit ToolFormatTest
  */
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.List;
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ToolFormatTest extends ReplToolTesting {
 
+    @Test
     public void testSetFormat() {
         try {
             test(
@@ -86,6 +87,7 @@ public void testSetFormat() {
         }
     }
 
+    @Test
     public void testSetFormatOverride() {
         test(
                 (a) -> assertCommand(a, "/set mode tm -c", "|  Created new feedback mode: tm"),
@@ -138,6 +140,7 @@ public void testSetFormatOverride() {
         );
     }
 
+    @Test
     public void testSetFormatSelectorSample() {
         test(
                 (a) -> assertCommandOutputStartsWith(a, "/set mode ate -quiet",
@@ -197,7 +200,8 @@ public void testSetFormatSelectorSample() {
     // A sampling of these has been added (above: testSetFormatSelectorSample).
     // See 8173007
     // Save for possible future deep testing or debugging
-    @Test(enabled = false)
+    @Test
+    @Disabled
     public void testSetFormatSelector() {
         List tests = new ArrayList<>();
         tests.add((a) -> assertCommandOutputStartsWith(a, "/set mode ate -quiet",
@@ -278,6 +282,7 @@ boolean append(boolean ahead) {
         }
     }
 
+    @Test
     public void testSetTruncation() {
         try {
             test(
@@ -309,6 +314,7 @@ public void testSetTruncation() {
         }
     }
 
+    @Test
     public void testDefaultTruncation() {
         test(
                     (a) -> assertCommand(a, "char[] cs = new char[2000];", null),
@@ -331,9 +337,9 @@ public void testDefaultTruncation() {
         );
     }
 
+    @Test
     public void testPrompt() {
-        test(
-                (a) -> assertCommand(a, "/set mode tp -quiet", "|  Created new feedback mode: tp"),
+        test((a) -> assertCommand(a, "/set mode tp -quiet", "|  Created new feedback mode: tp"),
                 (a) -> assertCommand(a, "/set prompt tp 'aaa' 'bbb'", ""),
                 (a) -> assertCommand(a, "/set prompt tp",
                         "|  /set prompt tp \"aaa\" \"bbb\""),
@@ -347,21 +353,21 @@ public void testPrompt() {
                         (s) -> {
                             try {
                                 BufferedReader rdr = new BufferedReader(new StringReader(s));
-                                assertEquals(rdr.readLine(), "|  /set mode tp -quiet",
+                                assertEquals("|  /set mode tp -quiet", rdr.readLine(),
                                         "|  /set mode tp -quiet");
-                                assertEquals(rdr.readLine(), "|  /set prompt tp \"aaa\" \"bbb\"",
+                                assertEquals("|  /set prompt tp \"aaa\" \"bbb\"", rdr.readLine(),
                                         "|  /set prompt tp \"aaa\" \"bbb\"");
                                 String l = rdr.readLine();
                                 while (l.startsWith("|  /set format tp ")) {
                                     l = rdr.readLine();
                                 }
-                                assertEquals(l, "|  /set mode -retain tp",
+                                assertEquals("|  /set mode -retain tp", l,
                                         "|  /set mode -retain tp");
-                                assertEquals(rdr.readLine(), "|  ",
+                                assertEquals("|  ", rdr.readLine(),
                                         "|  ");
-                                assertEquals(rdr.readLine(), "|  /set mode tp -quiet",
+                                assertEquals("|  /set mode tp -quiet", rdr.readLine(),
                                         "|  /set mode tp -quiet");
-                                assertEquals(rdr.readLine(), "|  /set prompt tp \"ccc\" \"ddd\"",
+                                assertEquals("|  /set prompt tp \"ccc\" \"ddd\"", rdr.readLine(),
                                         "|  /set prompt tp \"ccc\" \"ddd\"");
                             } catch (IOException ex) {
                                 fail("threw " + ex);
@@ -370,12 +376,14 @@ public void testPrompt() {
         );
     }
 
+    @Test
     public void testShowFeedbackModes() {
         test(
                 (a) -> assertCommandOutputContains(a, "/set feedback", "normal")
         );
     }
 
+    @Test
     public void testSetNewModeQuiet() {
         try {
             test(
@@ -396,6 +404,7 @@ public void testSetNewModeQuiet() {
         }
     }
 
+    @Test
     public void testSetError() {
         try {
             test(
@@ -473,6 +482,7 @@ public void testSetError() {
         }
     }
 
+    @Test
     public void testSetHelp() {
         try {
             test(
diff --git a/test/langtools/jdk/jshell/ToolLocalSimpleTest.java b/test/langtools/jdk/jshell/ToolLocalSimpleTest.java
index 6221f2951036..bb0273a2123d 100644
--- a/test/langtools/jdk/jshell/ToolLocalSimpleTest.java
+++ b/test/langtools/jdk/jshell/ToolLocalSimpleTest.java
@@ -30,12 +30,12 @@
  *          jdk.jdeps/com.sun.tools.javap
  *          jdk.jshell/jdk.internal.jshell.tool
  * @build KullaTesting TestingInputStream ToolSimpleTest
- * @run testng/othervm ToolLocalSimpleTest
+ * @run junit/othervm ToolLocalSimpleTest
  */
 
 import java.util.Locale;
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
 
 public class ToolLocalSimpleTest extends ToolSimpleTest {
 
@@ -51,12 +51,12 @@ public void test(Locale locale, boolean isDefaultStartUp, String[] args, String
     @Test
     public void verifyLocal() {
         System.setProperty("LOCAL_CHECK", "Here");
-        assertEquals(System.getProperty("LOCAL_CHECK"), "Here");
+        assertEquals("Here", System.getProperty("LOCAL_CHECK"));
         test(new String[]{"--no-startup"},
                 a -> assertCommand(a, "System.getProperty(\"LOCAL_CHECK\")", "$1 ==> \"Here\""),
                 a -> assertCommand(a, "System.setProperty(\"LOCAL_CHECK\", \"After\")", "$2 ==> \"Here\"")
         );
-        assertEquals(System.getProperty("LOCAL_CHECK"), "After");
+        assertEquals("After", System.getProperty("LOCAL_CHECK"));
     }
 
     @Override
diff --git a/test/langtools/jdk/jshell/ToolLocaleMessageTest.java b/test/langtools/jdk/jshell/ToolLocaleMessageTest.java
index 6111320f1af4..c3e4a4211437 100644
--- a/test/langtools/jdk/jshell/ToolLocaleMessageTest.java
+++ b/test/langtools/jdk/jshell/ToolLocaleMessageTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -31,16 +31,15 @@
  *          jdk.jdeps/com.sun.tools.javap
  *          jdk.jshell/jdk.internal.jshell.tool
  * @build KullaTesting TestingInputStream toolbox.ToolBox Compiler
- * @run testng ToolLocaleMessageTest
+ * @run junit ToolLocaleMessageTest
  * @key intermittent
  */
 
 import java.util.Locale;
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ToolLocaleMessageTest extends ReplToolTesting {
 
     void testLocale(ReplTest... tests) {
@@ -67,12 +66,14 @@ void assertCommandFail(boolean after, String cmd, String... contains) {
         });
     }
 
+    @Test
     public void testTerminate() {
         testLocale(
                 (a) -> assertCommandOK(a, "System.exit(1)", "/reload")
         );
     }
 
+    @Test
     public void testSample() {
         try {
             testLocale(
@@ -98,6 +99,7 @@ public void testSample() {
         }
     }
 
+    @Test
     public void testCommand() {
         try {
             testLocale(
@@ -132,6 +134,7 @@ public void testCommand() {
         }
     }
 
+    @Test
     public void testHelp() {
         testLocale(
                 (a) -> assertCommandOK(a, "/help", "/list", "/save", "/set", "[-restore]"),
@@ -153,6 +156,7 @@ public void testHelp() {
         );
     }
 
+    @Test
     public void testFeedbackError() {
         try {
             testLocale(
diff --git a/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java b/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java
index 1850f6c36395..e3cbba3f20d4 100644
--- a/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java
+++ b/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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
@@ -31,18 +31,18 @@
  *     jdk.jshell/jdk.jshell:open
  * @build UITesting
  * @build ToolMultilineSnippetHistoryTest
- * @run testng ToolMultilineSnippetHistoryTest
+ * @run junit ToolMultilineSnippetHistoryTest
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ToolMultilineSnippetHistoryTest extends UITesting {
 
     public ToolMultilineSnippetHistoryTest() {
         super(true);
     }
 
+    @Test
     public void testUpArrow() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("int x=\n44\n");
diff --git a/test/langtools/jdk/jshell/ToolProviderTest.java b/test/langtools/jdk/jshell/ToolProviderTest.java
index 2209b08a0e1a..b8e9f8e0f4e0 100644
--- a/test/langtools/jdk/jshell/ToolProviderTest.java
+++ b/test/langtools/jdk/jshell/ToolProviderTest.java
@@ -23,8 +23,8 @@
 
 import java.util.ServiceLoader;
 import javax.tools.Tool;
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
 /*
  * @test
@@ -37,9 +37,8 @@
  *          jdk.jshell/jdk.internal.jshell.tool.resources:+open
  * @library /tools/lib
  * @build Compiler toolbox.ToolBox
- * @run testng ToolProviderTest
+ * @run junit ToolProviderTest
  */
-@Test
 public class ToolProviderTest extends StartOptionTest {
 
     // Through the provider, the console and console go to command out (we assume,
@@ -72,6 +71,7 @@ protected int runShell(String... args) {
 
     // Test --show-version
     @Override
+    @Test
     public void testShowVersion() {
         startCo(s -> {
             assertTrue(s.startsWith("jshell "), "unexpected version: " + s);
diff --git a/test/langtools/jdk/jshell/ToolReloadTest.java b/test/langtools/jdk/jshell/ToolReloadTest.java
index 4709584cd126..c4193f602bef 100644
--- a/test/langtools/jdk/jshell/ToolReloadTest.java
+++ b/test/langtools/jdk/jshell/ToolReloadTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -32,20 +32,20 @@
  *          jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib
  * @build KullaTesting TestingInputStream toolbox.ToolBox Compiler
- * @run testng ToolReloadTest
+ * @run junit ToolReloadTest
  */
 
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.function.Function;
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
 
-@Test
 public class ToolReloadTest extends ReplToolTesting {
 
+    @Test
     public void testReloadSnippets() {
         test(
                 (a) -> assertVariable(a, "int", "x", "5", "5"),
@@ -63,6 +63,7 @@ public void testReloadSnippets() {
         );
     }
 
+    @Test
     public void testReloadClasspath() {
         Function prog = (s) -> String.format(
                 "package pkg; public class A { public String toString() { return \"%s\"; } }\n", s);
@@ -89,6 +90,7 @@ public void testReloadClasspath() {
         );
     }
 
+    @Test
     public void testReloadDrop() {
         test(false, new String[]{"--no-startup"},
                 a -> assertVariable(a, "int", "a"),
@@ -112,6 +114,7 @@ public void testReloadDrop() {
         );
     }
 
+    @Test
     public void testReloadQuiet() {
         test(false, new String[]{"--no-startup"},
                 a -> assertVariable(a, "int", "a"),
@@ -129,6 +132,7 @@ public void testReloadQuiet() {
         );
     }
 
+    @Test
     public void testReloadRepeat() {
         test(false, new String[]{"--no-startup"},
                 (a) -> assertVariable(a, "int", "c", "7", "7"),
@@ -149,6 +153,7 @@ public void testReloadRepeat() {
         );
     }
 
+    @Test
     public void testReloadIgnore() {
         test(false, new String[]{"--no-startup"},
                 (a) -> assertCommand(a, "(-)", null),
@@ -162,6 +167,7 @@ public void testReloadIgnore() {
         );
     }
 
+    @Test
     public void testReloadResetRestore() {
         test(
                 (a) -> assertVariable(a, "int", "x", "5", "5"),
@@ -180,6 +186,7 @@ public void testReloadResetRestore() {
         );
     }
 
+    @Test
     public void testReloadCrashRestore() {
         test(
                 (a) -> assertVariable(a, "int", "x", "5", "5"),
@@ -200,6 +207,7 @@ public void testReloadCrashRestore() {
         );
     }
 
+    @Test
     public void testEnvBadModule() {
         test(new String[] {"--execution", Presets.TEST_STANDARD_EXECUTION},
                 (a) -> assertVariable(a, "int", "x", "5", "5"),
@@ -221,6 +229,7 @@ public void testEnvBadModule() {
         );
     }
 
+    @Test
     public void testReloadExitRestore() {
         test(false, new String[]{"--no-startup"},
                 (a) -> assertVariable(a, "int", "x", "5", "5"),
diff --git a/test/langtools/jdk/jshell/ToolRetainTest.java b/test/langtools/jdk/jshell/ToolRetainTest.java
index 452a3d8dac2c..adf3dd0343e2 100644
--- a/test/langtools/jdk/jshell/ToolRetainTest.java
+++ b/test/langtools/jdk/jshell/ToolRetainTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -27,15 +27,15 @@
  * @summary Tests of what information is retained across jshell tool runs
  * @modules jdk.jshell/jdk.internal.jshell.tool
  * @build ToolRetainTest ReplToolTesting
- * @run testng ToolRetainTest
+ * @run junit ToolRetainTest
  */
 
 import java.util.Locale;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ToolRetainTest extends ReplToolTesting {
 
+    @Test
     public void testRetainMode() {
         test(
                 (a) -> assertCommand(a, "/set mode trm -quiet", "|  Created new feedback mode: trm"),
@@ -53,6 +53,7 @@ public void testRetainMode() {
         );
     }
 
+    @Test
     public void testRetain2Mode() {
         test(
                 (a) -> assertCommand(a, "/set mode trm1 -quiet", "|  Created new feedback mode: trm1"),
@@ -81,6 +82,7 @@ public void testRetain2Mode() {
         );
     }
 
+    @Test
     public void testRetainFeedback() {
         test(
                 (a) -> assertCommand(a, "/set feedback -retain verbose", "|  Feedback mode: verbose"),
@@ -95,6 +97,7 @@ public void testRetainFeedback() {
         );
     }
 
+    @Test
     public void testRetainFeedbackBlank() {
         String feedbackOut =
                         "|  /set feedback -retain verbose\n" +
@@ -116,6 +119,7 @@ public void testRetainFeedbackBlank() {
         );
     }
 
+    @Test
     public void testRetainEditor() {
         test(
                 (a) -> assertCommand(a, "/set editor -retain nonexistent",
@@ -130,6 +134,7 @@ public void testRetainEditor() {
         );
     }
 
+    @Test
     public void testRetainEditorBlank() {
         test(
                 (a) -> assertCommand(a, "/set editor nonexistent", "|  Editor set to: nonexistent"),
@@ -142,6 +147,7 @@ public void testRetainEditorBlank() {
         );
     }
 
+    @Test
     public void testRetainModeNeg() {
         test(
                 (a) -> assertCommandOutputStartsWith(a, "/set mode -retain verbose",
@@ -151,6 +157,7 @@ public void testRetainModeNeg() {
         );
     }
 
+    @Test
     public void testRetainFeedbackNeg() {
         test(
                 (a) -> assertCommandOutputStartsWith(a, "/set feedback -retain babble1",
@@ -167,6 +174,7 @@ public void testRetainFeedbackNeg() {
         );
     }
 
+    @Test
     public void testNoRetainMode() {
         test(
                 (a) -> assertCommand(a, "/set mode trm -quiet", "|  Created new feedback mode: trm"),
@@ -182,6 +190,7 @@ public void testNoRetainMode() {
         );
     }
 
+    @Test
     public void testNoRetainFeedback() {
         test(
                 (a) -> assertCommand(a, "/set feedback verbose", "|  Feedback mode: verbose"),
diff --git a/test/langtools/jdk/jshell/ToolShiftTabTest.java b/test/langtools/jdk/jshell/ToolShiftTabTest.java
index 87f616678cb9..84f1a65c67be 100644
--- a/test/langtools/jdk/jshell/ToolShiftTabTest.java
+++ b/test/langtools/jdk/jshell/ToolShiftTabTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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
@@ -31,18 +31,18 @@
  *     jdk.jshell/jdk.jshell:open
  * @build UITesting
  * @build ToolShiftTabTest
- * @run testng/timeout=300 ToolShiftTabTest
+ * @run junit/timeout=300 ToolShiftTabTest
  */
 
 import java.util.regex.Pattern;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ToolShiftTabTest extends UITesting {
 
     // Shift-tab as escape sequence
     private String FIX = "\033\133\132";
 
+    @Test
     public void testFixVariable() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("3+4");
@@ -54,6 +54,7 @@ public void testFixVariable() throws Exception {
         });
     }
 
+    @Test
     public void testFixMethod() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("5.5 >= 3.1415926535");
@@ -68,6 +69,7 @@ public void testFixMethod() throws Exception {
         });
     }
 
+    @Test
     public void testFixMethodVoid() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("System.out.println(\"Testing\")");
@@ -81,6 +83,7 @@ public void testFixMethodVoid() throws Exception {
         });
     }
 
+    @Test
     public void testFixMethodNoLeaks() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("4");
@@ -106,6 +109,7 @@ public void testFixMethodNoLeaks() throws Exception {
         });
     }
 
+    @Test
     public void testFixImport() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("Frame");
@@ -126,6 +130,7 @@ public void testFixImport() throws Exception {
         });
     }
 
+    @Test
     public void testFixBad() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("123");
diff --git a/test/langtools/jdk/jshell/ToolSimpleTest.java b/test/langtools/jdk/jshell/ToolSimpleTest.java
index 222acb5291c7..668da9605788 100644
--- a/test/langtools/jdk/jshell/ToolSimpleTest.java
+++ b/test/langtools/jdk/jshell/ToolSimpleTest.java
@@ -34,7 +34,7 @@
  *          jdk.jdeps/com.sun.tools.javap
  *          jdk.jshell/jdk.internal.jshell.tool
  * @build KullaTesting TestingInputStream
- * @run testng ToolSimpleTest
+ * @run junit ToolSimpleTest
  */
 
 import java.util.ArrayList;
@@ -46,10 +46,9 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
 
 public class ToolSimpleTest extends ReplToolTesting {
 
@@ -542,7 +541,7 @@ private void checkLineToList(String in, List match) {
         String[] res = trimmed.isEmpty()
                 ? new String[0]
                 : trimmed.split("\n");
-        assertEquals(res.length, match.size(), "Got: " + Arrays.asList(res));
+        assertEquals(match.size(), res.length, "Got: " + Arrays.asList(res));
         for (int i = 0; i < match.size(); ++i) {
             assertTrue(res[i].contains(match.get(i)));
         }
@@ -618,7 +617,7 @@ public void testMethodsArgs() {
                 a -> assertCommandCheckOutput(a, "/methods print println printf",
                         s -> checkLineToList(s, printingMethodList)),
                 a -> assertCommandCheckOutput(a, "/methods println",
-                        s -> assertEquals(s.trim().split("\n").length, 10)),
+                        s -> assertEquals(10, s.trim().split("\n").length)),
                 a -> assertCommandCheckOutput(a, "/methods",
                         s -> checkLineToList(s, printingMethodList)),
                 a -> assertCommandOutputStartsWith(a, "/methods " + arg,
diff --git a/test/langtools/jdk/jshell/ToolTabCommandTest.java b/test/langtools/jdk/jshell/ToolTabCommandTest.java
index f2f3111c4faa..3dcc81e77bea 100644
--- a/test/langtools/jdk/jshell/ToolTabCommandTest.java
+++ b/test/langtools/jdk/jshell/ToolTabCommandTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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
@@ -34,18 +34,18 @@
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build Compiler UITesting
  * @build ToolTabCommandTest
- * @run testng ToolTabCommandTest
+ * @run junit ToolTabCommandTest
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ToolTabCommandTest extends UITesting {
 
     public ToolTabCommandTest() {
         super(true);
     }
 
+    @Test
     public void testCommand() throws Exception {
         // set terminal height so that help output won't hit page breaks
         System.setProperty("test.terminal.height", "1000000");
@@ -133,6 +133,7 @@ public void testCommand() throws Exception {
         });
     }
 
+    @Test
     public void testRerunCommands() throws Exception {
         // set terminal height so that help output won't hit page breaks
         System.setProperty("test.terminal.height", "1000000");
@@ -170,6 +171,7 @@ public void testRerunCommands() throws Exception {
         });
     }
 
+    @Test
     public void testHelp() throws Exception {
         // set terminal height so that help output won't hit page breaks
         System.setProperty("test.terminal.height", "1000000");
diff --git a/test/langtools/jdk/jshell/ToolTabSnippetTest.java b/test/langtools/jdk/jshell/ToolTabSnippetTest.java
index 252d57f4a6f6..39189da86865 100644
--- a/test/langtools/jdk/jshell/ToolTabSnippetTest.java
+++ b/test/langtools/jdk/jshell/ToolTabSnippetTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, 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
@@ -34,7 +34,7 @@
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build Compiler UITesting
  * @build ToolTabSnippetTest
- * @run testng/timeout=300 ToolTabSnippetTest
+ * @run junit/timeout=300 ToolTabSnippetTest
  */
 
 import java.io.IOException;
@@ -48,15 +48,15 @@
 import java.util.jar.JarOutputStream;
 
 import jdk.internal.jshell.tool.ConsoleIOContextTestSupport;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class ToolTabSnippetTest extends UITesting {
 
     public ToolTabSnippetTest() {
         super(true);
     }
 
+    @Test
     public void testExpression() throws Exception {
         Path classes = prepareZip();
         doRunTest((inputSink, out) -> {
@@ -208,6 +208,7 @@ public void testExpression() throws Exception {
         });
     }
 
+    @Test
     public void testCleaningCompletionTODO() throws Exception {
         doRunTest((inputSink, out) -> {
             CountDownLatch testCompleteComputationStarted = new CountDownLatch(1);
@@ -241,6 +242,7 @@ protected void willComputeCompletionCallback() {
         });
     }
 
+    @Test
     public void testNoRepeat() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("String xyzAA;\n");
@@ -266,6 +268,7 @@ public void testNoRepeat() throws Exception {
         });
     }
 
+    @Test
     public void testCrash8221759() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("java.io.File.path" + TAB);
@@ -331,6 +334,7 @@ private Path prepareZip() {
     //where:
         private final Compiler compiler = new Compiler();
 
+    @Test
     public void testDocumentationAfterInsert() throws Exception {
         doRunTest((inputSink, out) -> {
             inputSink.write("import java.time.*\n");
diff --git a/test/langtools/jdk/jshell/ToolingTest.java b/test/langtools/jdk/jshell/ToolingTest.java
index b36fdc03c190..1f514caf2e39 100644
--- a/test/langtools/jdk/jshell/ToolingTest.java
+++ b/test/langtools/jdk/jshell/ToolingTest.java
@@ -30,11 +30,10 @@
  *          jdk.jdeps/com.sun.tools.javap
  *          jdk.jshell/jdk.internal.jshell.tool
  * @build KullaTesting TestingInputStream
- * @run testng ToolingTest
+ * @run junit ToolingTest
  */
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
 public class ToolingTest extends ReplToolTesting {
     @Test
diff --git a/test/langtools/jdk/jshell/TypeNameTest.java b/test/langtools/jdk/jshell/TypeNameTest.java
index dc2b2152ca81..cbcde20a5413 100644
--- a/test/langtools/jdk/jshell/TypeNameTest.java
+++ b/test/langtools/jdk/jshell/TypeNameTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -26,14 +26,12 @@
  * @bug 8144903 8171981 8191802 8191842
  * @summary Tests for determining the type from the expression
  * @build KullaTesting TestingInputStream
- * @run testng TypeNameTest
+ * @run junit TypeNameTest
  */
 
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
 
-import static org.testng.Assert.assertEquals;
-
-@Test
 public class TypeNameTest extends KullaTesting {
 
 
@@ -42,10 +40,11 @@ private void assertType(String expr, String type) {
     }
 
     private void assertType(String expr, String type, String inferType) {
-        assertEquals(varKey(assertEval(expr)).typeName(), type);
+        assertEquals(type, varKey(assertEval(expr)).typeName());
         assertInferredType(expr, inferType);
     }
 
+    @Test
     public void testTypeInference() {
         assertEval("import java.util.List;");
         assertEval("import java.util.ArrayList;");
@@ -75,6 +74,7 @@ public void testTypeInference() {
         assertType("(P) null", "P");
     }
 
+    @Test
     public void testConditionals() {
         assertEval("import java.util.List;");
         assertEval("import java.util.ArrayList;");
@@ -95,6 +95,7 @@ public void testConditionals() {
         assertType("b? new B() : new C()", "X");
     }
 
+    @Test
     public void testJEP286NonDenotable() {
         assertEval("import java.util.List;");
         assertEval("import java.util.Arrays;");
@@ -144,6 +145,7 @@ public void testJEP286NonDenotable() {
         assertType("unbStringIter().iterator().next().get(0)", "Object");
     }
 
+    @Test
     public void testJEP286NonDenotable2() {
         assertEval("import java.util.List;");
         assertEval("import java.util.Arrays;");
@@ -197,6 +199,7 @@ public void testJEP286NonDenotable2() {
                 "Number");
     }
 
+    @Test
     public void testVariableTypeName() {
         assertType("\"x\"", "String");
 
@@ -213,30 +216,36 @@ public void testVariableTypeName() {
         assertType("java.util.Locale.Category.FORMAT", "Category");
     }
 
+    @Test
     public void testReplNestedClassName() {
         assertEval("class D { static class E {} }");
         assertType("new D.E();", "D.E");
     }
 
+    @Test
     public void testAnonymousClassName() {
         assertEval("class C {}");
         assertType("new C();", "C");
         assertType("new C() { int x; };", "", "C");
     }
 
+    @Test
     public void testCapturedTypeName() {
         assertType("\"\".getClass();", "Class");
         assertType("\"\".getClass().getEnumConstants();", "String[]");
     }
 
+    @Test
     public void testJavaLang() {
         assertType("\"\";", "String");
     }
 
+    @Test
     public void testNotOverEagerPackageEating() {
         assertType("\"\".getClass().getDeclaredMethod(\"hashCode\");", "java.lang.reflect.Method");
     }
 
+    @Test
     public void testBounds() {
         assertEval("java.util.List list1 = java.util.Arrays.asList(\"\");");
         assertType("list1.iterator().next()", "String");
diff --git a/test/langtools/jdk/jshell/UITesting.java b/test/langtools/jdk/jshell/UITesting.java
index 473ba36c5aed..b9bfd994fc85 100644
--- a/test/langtools/jdk/jshell/UITesting.java
+++ b/test/langtools/jdk/jshell/UITesting.java
@@ -61,7 +61,7 @@ public UITesting(boolean laxLineEndings) {
         this.laxLineEndings = laxLineEndings;
     }
 
-    protected void doRunTest(Test test) throws Exception {
+    protected void doRunTest(UITest test) throws Exception {
         // turn on logging of launch failures
         Logger.getLogger("jdk.jshell.execution").setLevel(Level.ALL);
 
@@ -127,7 +127,7 @@ public void write(String str) throws IOException {
         }
     }
 
-    protected interface Test {
+    protected interface UITest {
         public void test(Writer inputSink, StringBuilder out) throws Exception;
     }
 
diff --git a/test/langtools/jdk/jshell/UndefinedClassTest.java b/test/langtools/jdk/jshell/UndefinedClassTest.java
index eb0cf3699cff..3891aa7b4cd3 100644
--- a/test/langtools/jdk/jshell/UndefinedClassTest.java
+++ b/test/langtools/jdk/jshell/UndefinedClassTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 2025, 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
@@ -35,18 +35,18 @@
  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @build Compiler UITesting
  * @build UndefinedClassTest
- * @run testng UndefinedClassTest
+ * @run junit UndefinedClassTest
  */
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class UndefinedClassTest extends UITesting {
 
     public UndefinedClassTest() {
         super(true);
     }
 
+    @Test
     public void testUndefinedClassWithStaticAccess() throws Exception{
         String code = "@FunctionalInterface\n" +
                 "interface RunnableWithThrowable {\n" +
@@ -62,6 +62,7 @@ public void testUndefinedClassWithStaticAccess() throws Exception{
         });
     }
 
+    @Test
     public void testUndefinedClassWithDefaultAccess() throws Exception{
         String code = "@FunctionalInterface\n" +
                 "interface RunnableWithThrowable {\n" +
diff --git a/test/langtools/jdk/jshell/UnicodeTest.java b/test/langtools/jdk/jshell/UnicodeTest.java
index 6812dcf1a50e..13dd30f0975d 100644
--- a/test/langtools/jdk/jshell/UnicodeTest.java
+++ b/test/langtools/jdk/jshell/UnicodeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, 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
@@ -26,27 +26,28 @@
  * @bug 8248157
  * @summary test Unicode characters in Snippets
  * @build KullaTesting TestingInputStream
- * @run testng UnicodeTest
+ * @run junit UnicodeTest
  */
 
 import jdk.jshell.Snippet;
 import jdk.jshell.DeclarationSnippet;
-import org.testng.annotations.Test;
 
 import jdk.jshell.Snippet.Status;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static jdk.jshell.Snippet.Status.VALID;
 import static jdk.jshell.Snippet.SubKind.*;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class UnicodeTest extends KullaTesting {
 
+    @Test
     public void testVarDeclarationKey() {
         assertVarKeyMatch("int \\u00aa;", true, "\u00aa", VAR_DECLARATION_SUBKIND, "int", added(VALID));
         assertEval("\\u00aa", "0");
     }
 
+    @Test
     public void testVarDeclarationWithInitializerKey() {
         assertVarKeyMatch("double \\u00ba\\u0044\\u0577 = 9.4;", true, "\u00ba\u0044\u0577",
                           VAR_DECLARATION_WITH_INITIALIZER_SUBKIND, "double", added(VALID));
diff --git a/test/langtools/jdk/jshell/UnnamedTest.java b/test/langtools/jdk/jshell/UnnamedTest.java
index 9c7bb6ba5a23..65d2b83c8562 100644
--- a/test/langtools/jdk/jshell/UnnamedTest.java
+++ b/test/langtools/jdk/jshell/UnnamedTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 2025, 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
@@ -30,20 +30,20 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jshell
  * @build Compiler KullaTesting TestingInputStream ExpectedDiagnostic
- * @run testng UnnamedTest
+ * @run junit UnnamedTest
  */
 
 import java.util.function.Consumer;
 
 import jdk.jshell.SourceCodeAnalysis;
 import jdk.jshell.VarSnippet;
-import org.testng.Assert;
-import org.testng.annotations.Test;
 
 import jdk.jshell.JShell;
 
 import static jdk.jshell.SourceCodeAnalysis.Completeness.COMPLETE;
 import static jdk.jshell.SourceCodeAnalysis.Completeness.DEFINITELY_INCOMPLETE;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 public class UnnamedTest extends KullaTesting {
 
@@ -51,8 +51,8 @@ public class UnnamedTest extends KullaTesting {
     public void unnamed() {
         VarSnippet sn1 = varKey(assertEval("int _ = 0;"));
         VarSnippet sn2 = varKey(assertEval("String _ = \"x\";"));
-        Assert.assertEquals(getState().varValue(sn1), "0");
-        Assert.assertEquals(getState().varValue(sn2), "\"x\"");
+        Assertions.assertEquals("0", getState().varValue(sn1));
+        Assertions.assertEquals("\"x\"", getState().varValue(sn2));
     }
 
     static final String[] definitely_incomplete = new String[]{
diff --git a/test/langtools/jdk/jshell/UserExecutionControlTest.java b/test/langtools/jdk/jshell/UserExecutionControlTest.java
index 90c99db4a8fb..41719f9ff2ab 100644
--- a/test/langtools/jdk/jshell/UserExecutionControlTest.java
+++ b/test/langtools/jdk/jshell/UserExecutionControlTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -26,29 +26,29 @@
  * @bug 8156101 8159935 8159122 8168615
  * @summary Tests for ExecutionControl SPI
  * @build KullaTesting ExecutionControlTestBase
- * @run testng UserExecutionControlTest
+ * @run junit UserExecutionControlTest
  */
 
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.BeforeMethod;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class UserExecutionControlTest extends ExecutionControlTestBase {
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         setUp(builder -> builder.executionEngine("local"));
     }
 
+    @Test
     public void verifyLocal() throws ClassNotFoundException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
         System.setProperty("LOCAL_CHECK", "TBD");
-        assertEquals(System.getProperty("LOCAL_CHECK"), "TBD");
+        assertEquals("TBD", System.getProperty("LOCAL_CHECK"));
         assertEval("System.getProperty(\"LOCAL_CHECK\")", "\"TBD\"");
         assertEval("System.setProperty(\"LOCAL_CHECK\", \"local\")");
-        assertEquals(System.getProperty("LOCAL_CHECK"), "local");
+        assertEquals("local", System.getProperty("LOCAL_CHECK"));
     }
 
 }
diff --git a/test/langtools/jdk/jshell/UserInputTest.java b/test/langtools/jdk/jshell/UserInputTest.java
index 392278abef19..c0246acdf63e 100644
--- a/test/langtools/jdk/jshell/UserInputTest.java
+++ b/test/langtools/jdk/jshell/UserInputTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -26,18 +26,18 @@
  * @bug 8131023 8167461
  * @summary Verify that the user's code can read System.in
  * @build KullaTesting TestingInputStream
- * @run testng UserInputTest
+ * @run junit UserInputTest
  * @key intermittent
  */
 
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class UserInputTest extends KullaTesting {
 
+    @Test
     public void testReadInput() {
         setInput("AB\n");
         assertEval("System.in.read()", "65");
@@ -45,6 +45,7 @@ public void testReadInput() {
         assertEval("System.in.read()", "67");
     }
 
+    @Test
     public void testScanner() {
         assertEval("import java.util.Scanner;");
         assertEval("Scanner s = new Scanner(System.in);");
@@ -52,6 +53,7 @@ public void testScanner() {
         assertEval("s.nextInt();", "12");
     }
 
+    @Test
     public void testClose() {
         setInput(new InputStream() {
             private final byte[] data = new byte[] {0, 1, 2};
@@ -73,6 +75,7 @@ public void testClose() {
         assertEval("System.in.read();", "-1");
     }
 
+    @Test
     public void testException() {
         setInput(new InputStream() {
             private final int[] data = new int[] {0, 1, -2, 2};
@@ -99,6 +102,7 @@ public void testException() {
         assertEval("System.in.read();", "-1");
     }
 
+    @Test
     public void testNoConsole() {
         assertEval("System.console()", "null");
     }
diff --git a/test/langtools/jdk/jshell/UserJdiUserRemoteTest.java b/test/langtools/jdk/jshell/UserJdiUserRemoteTest.java
index 02c725cffa41..094c705bce64 100644
--- a/test/langtools/jdk/jshell/UserJdiUserRemoteTest.java
+++ b/test/langtools/jdk/jshell/UserJdiUserRemoteTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -26,46 +26,48 @@
  * @bug 8160128 8159935 8168615
  * @summary Tests for Aux channel, custom remote agents, custom JDI implementations.
  * @build KullaTesting ExecutionControlTestBase MyExecutionControl MyRemoteExecutionControl MyExecutionControlProvider
- * @run testng UserJdiUserRemoteTest
+ * @run junit UserJdiUserRemoteTest
  * @key intermittent
  */
 import java.io.ByteArrayOutputStream;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
 import jdk.jshell.Snippet;
 import static jdk.jshell.Snippet.Status.OVERWRITTEN;
 import static jdk.jshell.Snippet.Status.VALID;
 import jdk.jshell.VarSnippet;
 import jdk.jshell.spi.ExecutionControl;
 import jdk.jshell.spi.ExecutionControl.ExecutionControlException;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class UserJdiUserRemoteTest extends ExecutionControlTestBase {
 
     ExecutionControl currentEC;
     ByteArrayOutputStream auxStream;
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         auxStream = new ByteArrayOutputStream();
         setUp(builder -> builder.executionEngine(new MyExecutionControlProvider(this), null));
     }
 
+    @Test
     public void testVarValue() {
         VarSnippet dv = varKey(assertEval("double aDouble = 1.5;"));
         String vd = getState().varValue(dv);
-        assertEquals(vd, "1.5");
-        assertEquals(auxStream.toString(), "aDouble");
+        assertEquals("1.5", vd);
+        assertEquals("aDouble", auxStream.toString());
     }
 
+    @Test
     public void testExtension() throws ExecutionControlException {
         assertEval("42;");
         Object res = currentEC.extensionCommand("FROG", "test");
-        assertEquals(res, "ribbit");
+        assertEquals("ribbit", res);
     }
 
+    @Test
     public void testRedefine() {
         Snippet vx = varKey(assertEval("int x;"));
         Snippet mu = methodKey(assertEval("int mu() { return x * 4; }"));
diff --git a/test/langtools/jdk/jshell/VariablesTest.java b/test/langtools/jdk/jshell/VariablesTest.java
index 56546955e082..46ddc699d13e 100644
--- a/test/langtools/jdk/jshell/VariablesTest.java
+++ b/test/langtools/jdk/jshell/VariablesTest.java
@@ -30,7 +30,7 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jshell
  * @build Compiler KullaTesting TestingInputStream ExpectedDiagnostic
- * @run testng VariablesTest
+ * @run junit VariablesTest
  */
 
 import java.nio.file.Path;
@@ -44,18 +44,19 @@
 import jdk.jshell.VarSnippet;
 import jdk.jshell.Snippet.SubKind;
 import jdk.jshell.SnippetEvent;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
 
 import static java.util.stream.Collectors.toList;
 import static jdk.jshell.Snippet.Status.*;
 import static jdk.jshell.Snippet.SubKind.VAR_DECLARATION_SUBKIND;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class VariablesTest extends KullaTesting {
 
+    @Test
     public void noVariables() {
         assertNumberOfActiveVariables(0);
     }
@@ -69,6 +70,7 @@ private void badVarValue(VarSnippet key) {
         }
     }
 
+    @Test
     public void testVarValue1() {
         VarSnippet v1 = varKey(assertEval("und1 a;", added(RECOVERABLE_NOT_DEFINED)));
         badVarValue(v1);
@@ -89,6 +91,7 @@ public void testVarValue1() {
         badVarValue(v2);
     }
 
+    @Test
     public void testVarValue2() {
         VarSnippet v1 = (VarSnippet) assertDeclareFail("int a = 0.0;", "compiler.err.prob.found.req");
         badVarValue(v1);
@@ -97,6 +100,7 @@ public void testVarValue2() {
         badVarValue(v2);
     }
 
+    @Test
     public void testSignature1() {
         VarSnippet v1 = varKey(assertEval("und1 a;", added(RECOVERABLE_NOT_DEFINED)));
         assertVariableDeclSnippet(v1, "a", "und1", RECOVERABLE_NOT_DEFINED, VAR_DECLARATION_SUBKIND, 1, 0);
@@ -116,6 +120,7 @@ public void testSignature1() {
         assertVariableDeclSnippet(v2, "a", "und2", RECOVERABLE_NOT_DEFINED, VAR_DECLARATION_SUBKIND, 1, 0);
     }
 
+    @Test
     public void testSignature2() {
         VarSnippet v1 = (VarSnippet) assertDeclareFail("int a = 0.0;", "compiler.err.prob.found.req");
         assertVariableDeclSnippet(v1, "a", "int", REJECTED, SubKind.VAR_DECLARATION_WITH_INITIALIZER_SUBKIND, 0, 1);
@@ -126,6 +131,7 @@ public void testSignature2() {
         assertVariableDeclSnippet(v2, "a", "int", DROPPED, SubKind.VAR_DECLARATION_WITH_INITIALIZER_SUBKIND, 0, 0);
     }
 
+    @Test
     public void variables() {
         VarSnippet snx = varKey(assertEval("int x = 10;"));
         VarSnippet sny = varKey(assertEval("String y = \"hi\";"));
@@ -137,22 +143,25 @@ public void variables() {
         assertActiveKeys();
     }
 
+    @Test
     public void variablesArray() {
         VarSnippet sn = varKey(assertEval("int[] a = new int[12];"));
-        assertEquals(sn.typeName(), "int[]");
+        assertEquals("int[]", sn.typeName());
         assertEval("int len = a.length;", "12");
         assertVariables(variable("int[]", "a"), variable("int", "len"));
         assertActiveKeys();
     }
 
+    @Test
     public void variablesArrayOld() {
         VarSnippet sn = varKey(assertEval("int a[] = new int[12];"));
-        assertEquals(sn.typeName(), "int[]");
+        assertEquals("int[]", sn.typeName());
         assertEval("int len = a.length;", "12");
         assertVariables(variable("int[]", "a"), variable("int", "len"));
         assertActiveKeys();
     }
 
+    @Test
     public void variablesRedefinition() {
         Snippet x = varKey(assertEval("int x = 10;"));
         Snippet y = varKey(assertEval("String y = \"\";", added(VALID)));
@@ -170,6 +179,7 @@ public void variablesRedefinition() {
         assertActiveKeys();
     }
 
+    @Test
     public void variablesTemporary() {
         assertEval("int $1 = 10;", added(VALID));
         assertEval("2 * $1;", added(VALID));
@@ -180,6 +190,7 @@ public void variablesTemporary() {
         assertActiveKeys();
     }
 
+    @Test
     public void variablesTemporaryNull() {
         assertEval("null;", added(VALID));
         assertVariables(variable("Object", "$1"));
@@ -194,6 +205,7 @@ public void variablesTemporaryNull() {
         assertActiveKeys();
     }
 
+    @Test
     public void variablesTemporaryArrayOfCapturedType() {
         assertEval("class Test { T[][] get() { return null; } }", added(VALID));
         assertEval("Test test() { return new Test<>(); }", added(VALID));
@@ -204,6 +216,7 @@ public void variablesTemporaryArrayOfCapturedType() {
         assertActiveKeys();
     }
 
+    @Test
     public void variablesClassReplace() {
         assertEval("import java.util.*;", added(VALID));
         Snippet var = varKey(assertEval("List list = new ArrayList<>();", "[]",
@@ -223,12 +236,14 @@ public void variablesClassReplace() {
         assertActiveKeys();
     }
 
+    @Test
     public void variablesErrors() {
         assertDeclareFail("String;", new ExpectedDiagnostic("compiler.err.cant.resolve.location", 0, 6, 0, -1, -1, Diagnostic.Kind.ERROR));
         assertNumberOfActiveVariables(0);
         assertActiveKeys();
     }
 
+    @Test
     public void variablesUnresolvedActiveFailed() {
         VarSnippet key = varKey(assertEval("und x;", added(RECOVERABLE_NOT_DEFINED)));
         assertVariableDeclSnippet(key, "x", "und", RECOVERABLE_NOT_DEFINED, VAR_DECLARATION_SUBKIND, 1, 0);
@@ -237,12 +252,14 @@ public void variablesUnresolvedActiveFailed() {
         assertActiveKeys();
     }
 
+    @Test
     public void variablesUnresolvedError() {
         assertDeclareFail("und y = null;", new ExpectedDiagnostic("compiler.err.cant.resolve.location", 0, 3, 0, -1, -1, Diagnostic.Kind.ERROR));
         assertNumberOfActiveVariables(0);
         assertActiveKeys();
     }
 
+    @Test
     public void variablesMultiByteCharacterType() {
         assertEval("class \u3042 {}");
         assertEval("\u3042 \u3042 = null;", added(VALID));
@@ -261,7 +278,8 @@ public void variablesMultiByteCharacterType() {
         assertActiveKeys();
     }
 
-    @Test(enabled = false) // TODO 8081689
+    @Test // TODO 8081689
+    @Disabled
     public void methodVariablesAreNotVisible() {
         Snippet foo = varKey(assertEval("int foo() {" +
                         "int x = 10;" +
@@ -283,7 +301,8 @@ public void methodVariablesAreNotVisible() {
         assertActiveKeys();
     }
 
-    @Test(enabled = false) // TODO 8081689
+    @Test // TODO 8081689
+    @Disabled
     public void classFieldsAreNotVisible() {
         Snippet key = classKey(assertEval("class clazz {" +
                         "int x = 10;" +
@@ -303,6 +322,7 @@ public void classFieldsAreNotVisible() {
         assertActiveKeys();
     }
 
+    @Test
     public void multiVariables() {
         List abc = assertEval("int a, b, c = 10;",
                 DiagCheck.DIAG_OK, DiagCheck.DIAG_OK,
@@ -324,12 +344,14 @@ public void multiVariables() {
         assertActiveKeys();
     }
 
+    @Test
     public void syntheticVariables() {
         assertEval("assert false;");
         assertNumberOfActiveVariables(0);
         assertActiveKeys();
     }
 
+    @Test
     public void undefinedReplaceVariable() {
         Snippet key = varKey(assertEval("int d = 234;", "234"));
         assertVariables(variable("int", "d"));
@@ -339,13 +361,14 @@ public void undefinedReplaceVariable() {
                 ste(key, VALID, OVERWRITTEN, false, MAIN_SNIPPET)));
         //assertEquals(getState().source(snippet), src);
         //assertEquals(snippet, undefKey);
-        assertEquals(getState().status(undefKey), RECOVERABLE_NOT_DEFINED);
+        assertEquals(RECOVERABLE_NOT_DEFINED, getState().status(undefKey));
         List unr = getState().unresolvedDependencies((VarSnippet) undefKey).collect(toList());
-        assertEquals(unr.size(), 1);
-        assertEquals(unr.get(0), "class undefined");
+        assertEquals(1, unr.size());
+        assertEquals("class undefined", unr.get(0));
         assertVariables(variable("undefined", "d"));
     }
 
+    @Test
     public void lvti() {
         assertEval("var d = 234;", "234");
         assertEval("class Test { T[][] get() { return null; } }", added(VALID));
@@ -410,12 +433,14 @@ public void lvti() {
         assertEval("var r16d = r16d();");
     }
 
+    @Test
     public void test8191842() {
         assertEval("import java.util.stream.*;");
         assertEval("var list = Stream.of(1, 2, 3).map(j -> new Object() { int i = j; }).collect(Collectors.toList());");
         assertEval("list.stream().map(a -> String.valueOf(a.i)).collect(Collectors.joining(\", \"));", "\"1, 2, 3\"");
     }
 
+    @Test
     public void lvtiRecompileDependentsWithIntersectionTypes() {
         assertEval(" Z get1() { return null; }", added(VALID));
         assertEval("var i1 = get1();", added(VALID));
@@ -428,27 +453,32 @@ public void lvtiRecompileDependentsWithIntersectionTypes() {
         assertEval("void t2() { i2.run(); i2.count(); }", added(VALID));
     }
 
+    @Test
     public void arrayInit() {
         assertEval("int[] d = {1, 2, 3};");
     }
 
+    @Test
     public void testAnonymousVar() {
         assertEval("new Object() { public String get() { return \"a\"; } }");
         assertEval("$1.get()", "\"a\"");
     }
 
+    @Test
     public void testIntersectionVar() {
         assertEval(" Z get() { return null; }", added(VALID));
         assertEval("get();", added(VALID));
         assertEval("void t1() { $1.run(); $1.length(); }", added(VALID));
     }
 
+    @Test
     public void multipleCaptures() {
         assertEval("class D { D(int foo, String bar) { this.foo = foo; this.bar = bar; } int foo; String bar; } ");
         assertEval("var d = new D(34, \"hi\") { String z = foo + bar; };");
         assertEval("d.z", "\"34hi\"");
     }
 
+    @Test
     public void multipleAnonymous() {
         VarSnippet v1 = varKey(assertEval("new Object() { public int i = 42; public int i1 = i; public int m1() { return i1; } };"));
         VarSnippet v2 = varKey(assertEval("new Object() { public int i = 42; public int i2 = i; public int m2() { return i2; } };"));
@@ -466,6 +496,7 @@ public void multipleAnonymous() {
                                                  -1, -1, Diagnostic.Kind.ERROR));
     }
 
+    @Test
     public void displayName() {
         assertVarDisplayName("var v1 = 234;", "int");
         assertVarDisplayName("var v2 = new int[] {234};", "int[]");
@@ -478,6 +509,7 @@ public void displayName() {
         assertVarDisplayName("var v6 = new Runnable() { public void run() { } };", "");
     }
 
+    @Test
     public void varType() {
         assertEval("import java.util.*;");
         var firstVar = varKey(assertEval("var v1 = List.of(1);", added(VALID)));
@@ -487,6 +519,7 @@ public void varType() {
         assertEval("v2", "[1]");
     }
 
+    @Test
     public void varDeclNoInit() {
         assertVarDeclNoInit("byte", "b",  "0");
         assertVarDeclNoInit("short", "h",  "0");
@@ -500,6 +533,7 @@ public void varDeclNoInit() {
         assertVarDeclNoInit("String", "s", "null");
     }
 
+    @Test
     public void varDeclRedefNoInit() {
         assertVarDeclRedefNoInit("byte", "b", "1", "0");
         assertVarDeclRedefNoInit("short", "h", "2", "0");
@@ -513,6 +547,7 @@ public void varDeclRedefNoInit() {
         assertVarDeclRedefNoInit("String", "s", "\"hi\"", "null");
     }
 
+    @Test
     public void badPkgVarDecl() {
         Compiler compiler = new Compiler();
         Path nopkgdirpath = Paths.get("cp", "xyz");
@@ -545,16 +580,16 @@ private VarSnippet assertVarDeclNoInit(String typeName, String name, String dval
 
     private VarSnippet assertVarDeclNoInit(String typeName, String name, String dvalue, STEInfo mainInfo, STEInfo... updates) {
         VarSnippet vs = varKey(assertEval(typeName + " " + name + ";", dvalue, mainInfo, updates));
-        assertEquals(vs.typeName(), typeName);
+        assertEquals(typeName, vs.typeName());
         assertEval(name, dvalue, added(VALID));
         return vs;
     }
 
     private void assertVarDisplayName(String var, String typeName) {
-        assertEquals(varKey(assertEval(var)).typeName(), typeName);
+        assertEquals(typeName, varKey(assertEval(var)).typeName());
     }
 
-    @BeforeMethod
+    @BeforeEach
     @Override
     public void setUp() {
         Path path = Paths.get("cp");
@@ -611,16 +646,19 @@ public void setUp() {
                 .compilerOptions("--class-path", tpath));
     }
 
+    @Test
     public void varIntersection() {
         assertEval("interface Marker {}");
         assertEval("var v = (Marker & Runnable) () -> {};", added(VALID));
         assertEval("v.run()");
     }
 
+    @Test
     public void varAnonymousClassAndStaticField() { //JDK-8294431
         assertEval("var obj = new Object() { public static final String msg = \"hello\"; };");
     }
 
+    @Test
     public void underscoreAsLambdaParameter() { //JDK-8322532
         assertAnalyze("Func f = _ -> 0; int i;",
                       "Func f = _ -> 0;",
diff --git a/test/langtools/jdk/jshell/WrapperTest.java b/test/langtools/jdk/jshell/WrapperTest.java
index 8986c99b4b3d..9903f04676fa 100644
--- a/test/langtools/jdk/jshell/WrapperTest.java
+++ b/test/langtools/jdk/jshell/WrapperTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, 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
@@ -27,28 +27,28 @@
  * @summary test wrappers and dependencies
  * @modules jdk.jshell/jdk.jshell
  * @build KullaTesting
- * @run testng WrapperTest
+ * @run junit WrapperTest
  */
 
 import java.util.Collection;
 import java.util.List;
-import org.testng.annotations.Test;
 import jdk.jshell.ErroneousSnippet;
 import jdk.jshell.Snippet;
 import jdk.jshell.Snippet.Kind;
 import jdk.jshell.SourceCodeAnalysis.SnippetWrapper;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static jdk.jshell.Snippet.Status.RECOVERABLE_DEFINED;
 import static jdk.jshell.Snippet.Status.VALID;
+import org.junit.jupiter.api.Test;
 
-@Test
 public class WrapperTest extends KullaTesting {
 
+    @Test
     public void testMethod() {
         String src = "void glib() { System.out.println(\"hello\"); }";
         List swl = getState().sourceCodeAnalysis().wrappers(src);
-        assertEquals(swl.size(), 1, "unexpected list length");
+        assertEquals(1, swl.size(), "unexpected list length");
         assertWrapperHas(swl.get(0), src, Kind.METHOD, "void", "glib", "println");
         assertPosition(swl.get(0), src, 0, 4);
         assertPosition(swl.get(0), src, 5, 4);
@@ -63,6 +63,7 @@ public void testMethod() {
     }
 
     // test 8159740
+    @Test
     public void testMethodCorralled() {
         String src = "void glib() { f(); }";
         //            _123456789_123456789
@@ -75,6 +76,7 @@ public void testMethodCorralled() {
     }
 
     // test 8159740
+    @Test
     public void testClassCorralled0() {
         String src = "class AAA { float mmm(double d1234) { return (float) (f0 * d1234); } }";
         //            _123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
@@ -91,6 +93,7 @@ public void testClassCorralled0() {
     }
 
     // test 8159740
+    @Test
     public void testClassCorralled() {
         String src = "class AAA { int xxx = x0 + 4; float mmm(float ffff) { return f0 * ffff; } }";
         //            _123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
@@ -109,6 +112,7 @@ public void testClassCorralled() {
     }
 
     // test 8159740
+    @Test
     public void testClassWithConstructorCorralled() {
         String src = "public class AAA { AAA(String b) {} int xxx = x0 + 4; float mmm(float ffff) { return f0 * ffff; } }";
         //            _123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
@@ -130,6 +134,7 @@ public void testClassWithConstructorCorralled() {
     }
 
     // test 8159740
+    @Test
     public void testInterfaceCorralled() {
         String src = "interface AAA { default float mmm(double d1234) { return (float) (f0 * d1234); } }";
         //            _123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
@@ -147,6 +152,7 @@ public void testInterfaceCorralled() {
     }
 
     // test 8159740
+    @Test
     public void testEnumCorralled() {
         String src =
                 "public enum Planet {\n" +
@@ -182,25 +188,27 @@ public void testEnumCorralled() {
                 "radius", "surfaceGravity", "surfaceWeight");
     }
 
+    @Test
     public void testMethodBad() {
         String src = "void flob() { ?????; }";
         List swl = getState().sourceCodeAnalysis().wrappers(src);
-        assertEquals(swl.size(), 1, "unexpected list length");
+        assertEquals(1, swl.size(), "unexpected list length");
         assertWrapperHas(swl.get(0), src, Kind.METHOD, "void", "flob", "?????");
         assertPosition(swl.get(0), src, 9, 2);
 
         Snippet f = key(assertEvalFail(src));
-        assertEquals(f.kind(), Kind.ERRONEOUS);
-        assertEquals(((ErroneousSnippet)f).probableKind(), Kind.METHOD);
+        assertEquals(Kind.ERRONEOUS, f.kind());
+        assertEquals(Kind.METHOD, ((ErroneousSnippet)f).probableKind());
         SnippetWrapper sw = getState().sourceCodeAnalysis().wrapper(f);
         assertWrapperHas(sw, src, Kind.METHOD, "void", "flob", "?????");
         assertPosition(swl.get(0), src, 14, 5);
     }
 
+    @Test
     public void testVar() {
         String src = "int gx = 1234;";
         List swl = getState().sourceCodeAnalysis().wrappers(src);
-        assertEquals(swl.size(), 1, "unexpected list length");
+        assertEquals(1, swl.size(), "unexpected list length");
         assertWrapperHas(swl.get(0), src, Kind.VAR, "int", "gx", "1234");
         assertPosition(swl.get(0), src, 4, 2);
 
@@ -210,25 +218,27 @@ public void testVar() {
         assertPosition(swg, src, 0, 3);
     }
 
+    @Test
     public void testVarBad() {
         String src = "double dd = ?????;";
         List swl = getState().sourceCodeAnalysis().wrappers(src);
-        assertEquals(swl.size(), 1, "unexpected list length");
+        assertEquals(1, swl.size(), "unexpected list length");
         assertWrapperHas(swl.get(0), src, Kind.VAR, "double", "dd", "?????");
         assertPosition(swl.get(0), src, 9, 2);
 
         Snippet f = key(assertEvalFail(src));
-        assertEquals(f.kind(), Kind.ERRONEOUS);
-        assertEquals(((ErroneousSnippet)f).probableKind(), Kind.VAR);
+        assertEquals(Kind.ERRONEOUS, f.kind());
+        assertEquals(Kind.VAR, ((ErroneousSnippet)f).probableKind());
         SnippetWrapper sw = getState().sourceCodeAnalysis().wrapper(f);
         assertWrapperHas(sw, src, Kind.VAR, "double", "dd", "?????");
         assertPosition(swl.get(0), src, 12, 5);
     }
 
+    @Test
     public void testImport() {
         String src = "import java.lang.*;";
         List swl = getState().sourceCodeAnalysis().wrappers(src);
-        assertEquals(swl.size(), 1, "unexpected list length");
+        assertEquals(1, swl.size(), "unexpected list length");
         assertWrapperHas(swl.get(0), src, Kind.IMPORT, "import", "java.lang");
         assertPosition(swl.get(0), src, 7, 4);
 
@@ -238,61 +248,65 @@ public void testImport() {
         assertPosition(swg, src, 0, 6);
     }
 
+    @Test
     public void testImportBad() {
         String src = "import java.?????;";
         List swl = getState().sourceCodeAnalysis().wrappers(src);
-        assertEquals(swl.size(), 1, "unexpected list length");
+        assertEquals(1, swl.size(), "unexpected list length");
         assertWrapperHas(swl.get(0), src, Kind.IMPORT, "import", "?????");
         assertPosition(swl.get(0), src, 7, 4);
 
         Snippet f = key(assertEvalFail(src));
-        assertEquals(f.kind(), Kind.ERRONEOUS);
-        assertEquals(((ErroneousSnippet)f).probableKind(), Kind.IMPORT);
+        assertEquals(Kind.ERRONEOUS, f.kind());
+        assertEquals(Kind.IMPORT, ((ErroneousSnippet)f).probableKind());
         SnippetWrapper sw = getState().sourceCodeAnalysis().wrapper(f);
         assertWrapperHas(sw, src, Kind.IMPORT, "import", "?????");
         assertPosition(swl.get(0), src, 0, 6);
     }
 
+    @Test
     public void testErroneous() {
         String src = "@@@@@@@@@@";
         List swl = getState().sourceCodeAnalysis().wrappers(src);
-        assertEquals(swl.size(), 1, "unexpected list length");
+        assertEquals(1, swl.size(), "unexpected list length");
         assertWrapperHas(swl.get(0), src, Kind.ERRONEOUS, "@@@@@@@@@@");
         assertPosition(swl.get(0), src, 0, 10);
 
         Snippet f = key(assertEvalFail(src));
-        assertEquals(f.kind(), Kind.ERRONEOUS);
-        assertEquals(((ErroneousSnippet)f).probableKind(), Kind.ERRONEOUS);
+        assertEquals(Kind.ERRONEOUS, f.kind());
+        assertEquals(Kind.ERRONEOUS, ((ErroneousSnippet)f).probableKind());
         SnippetWrapper sw = getState().sourceCodeAnalysis().wrapper(f);
         assertWrapperHas(sw, src, Kind.ERRONEOUS, "@@@@@@@@@@");
         assertPosition(swl.get(0), src, 0, 10);
     }
 
+    @Test
     public void testEmpty() {
         String src = "";
         List swl = getState().sourceCodeAnalysis().wrappers(src);
-        assertEquals(swl.size(), 0, "expected empty list");
+        assertEquals(0, swl.size(), "expected empty list");
     }
 
+    @Test
     public void testDependencies() {
         Snippet a = key(assertEval("int aaa = 6;", added(VALID)));
         Snippet b = key(assertEval("class B { B(int x) { aaa = x; } }", added(VALID)));
         Snippet c = key(assertEval("B ccc() { return new B(aaa); }", added(VALID)));
         Collection dep;
         dep = getState().sourceCodeAnalysis().dependents(c);
-        assertEquals(dep.size(), 0);
+        assertEquals(0, dep.size());
         dep = getState().sourceCodeAnalysis().dependents(b);
-        assertEquals(dep.size(), 1);
+        assertEquals(1, dep.size());
         assertTrue(dep.contains(c));
         dep = getState().sourceCodeAnalysis().dependents(a);
-        assertEquals(dep.size(), 2);
+        assertEquals(2, dep.size());
         assertTrue(dep.contains(c));
         assertTrue(dep.contains(b));
     }
 
     private void assertWrapperHas(SnippetWrapper sw, String source, Kind kind, String... has) {
-        assertEquals(sw.source(), source);
-        assertEquals(sw.kind(), kind);
+        assertEquals(source, sw.source());
+        assertEquals(kind, sw.kind());
         String s = sw.wrapped();
         if (kind == Kind.IMPORT) {
             assertHas(s, "import");
@@ -322,8 +336,8 @@ private void assertPosition(SnippetWrapper sw, String source, int start, int len
         //System.err.printf("#  wrapped @ wrappedPos: %s\n", wrappedPart);
         //System.err.printf("#  source @ start: %s\n", sourcePart);
 
-        assertEquals(wrappedPart, sourcePart,
+        assertEquals(sourcePart, wrappedPart,
                 "position " + wpg + " in " + sw.wrapped());
-        assertEquals(sw.wrappedToSourcePosition(wpg), start);
+        assertEquals(start, sw.wrappedToSourcePosition(wpg));
     }
 }

From 2379003250c52a1a6476f66a66eab4dd217cbf39 Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Tue, 21 Apr 2026 07:00:02 +0000
Subject: [PATCH 199/223] 8373928: 4 Dangling pointer defect groups in java.c

Backport-of: 5dfda66e13df5a88a66a6e4b1ae1bcd4e20ac674
---
 src/java.base/share/native/libjli/java.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/java.base/share/native/libjli/java.c b/src/java.base/share/native/libjli/java.c
index cc3af9ce17d5..1afdb5f40ac7 100644
--- a/src/java.base/share/native/libjli/java.c
+++ b/src/java.base/share/native/libjli/java.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2026, 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
@@ -1512,6 +1512,7 @@ InitializeJVM(JavaVM **pvm, JNIEnv **penv, InvocationFunctions *ifn)
 
     r = ifn->CreateJavaVM(pvm, (void **)penv, &args);
     JLI_MemFree(options);
+    options = NULL;
     return r == JNI_OK;
 }
 
@@ -2199,6 +2200,7 @@ FreeKnownVMs()
         knownVMs[i].name = NULL;
     }
     JLI_MemFree(knownVMs);
+    knownVMs = NULL;
 }
 
 /*
@@ -2272,8 +2274,9 @@ ShowSplashScreen()
     (void)UnsetEnv(SPLASH_JAR_ENV_ENTRY);
 
     JLI_MemFree(splash_jar_entry);
+    splash_jar_entry = NULL;
     JLI_MemFree(splash_file_entry);
-
+    splash_file_entry = NULL;
 }
 
 static const char* GetFullVersion()

From 2ad2bcef94ca48ab8c7d6a85c1459498cd67046b Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Tue, 21 Apr 2026 10:18:39 +0000
Subject: [PATCH 200/223] 8374434: Several JShell tests report JUnit discovery
 warnings

Backport-of: e6abf98e35079ed1b5547f2cc0ac6f518b78d67b
---
 test/langtools/jdk/jshell/ErrorTranslationTest.java        | 3 +--
 test/langtools/jdk/jshell/IdGeneratorTest.java             | 3 +--
 test/langtools/jdk/jshell/KullaCompletenessStressTest.java | 4 +---
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/test/langtools/jdk/jshell/ErrorTranslationTest.java b/test/langtools/jdk/jshell/ErrorTranslationTest.java
index 1aa1b2c41ddb..235f4443004c 100644
--- a/test/langtools/jdk/jshell/ErrorTranslationTest.java
+++ b/test/langtools/jdk/jshell/ErrorTranslationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2026, 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
@@ -149,7 +149,6 @@ private String createMarkingLine(int start, int end) {
         return sb.toString();
     }
 
-    @Test
     public String getKind(Diagnostic.Kind kind) {
         switch (kind) {
             case WARNING:
diff --git a/test/langtools/jdk/jshell/IdGeneratorTest.java b/test/langtools/jdk/jshell/IdGeneratorTest.java
index 6c7f6177e039..521c87b02657 100644
--- a/test/langtools/jdk/jshell/IdGeneratorTest.java
+++ b/test/langtools/jdk/jshell/IdGeneratorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2026, 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
@@ -44,7 +44,6 @@
 
 public class IdGeneratorTest {
 
-    @Test
     public JShell.Builder getBuilder() {
         TestingInputStream inStream = new TestingInputStream();
         ByteArrayOutputStream outStream = new ByteArrayOutputStream();
diff --git a/test/langtools/jdk/jshell/KullaCompletenessStressTest.java b/test/langtools/jdk/jshell/KullaCompletenessStressTest.java
index 69830880dcba..16274fa924e0 100644
--- a/test/langtools/jdk/jshell/KullaCompletenessStressTest.java
+++ b/test/langtools/jdk/jshell/KullaCompletenessStressTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2026, 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
@@ -32,13 +32,11 @@
 import java.io.File;
 
 import org.junit.jupiter.api.Assumptions;
-import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.TestInstance;
 
 @TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class KullaCompletenessStressTest extends CompletenessStressTest {
     @Override
-    @Test
     public File[] getDirectoriesToTest() {
         String src = System.getProperty("test.src");
         File file;

From 71397879cdd35ef3d990c6bda9883493477e7da4 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Wed, 22 Apr 2026 19:18:59 +0000
Subject: [PATCH 201/223] 8341376: Open some TextArea awt tests 4

Backport-of: 236c71cad9fa269518456c11edcfb353bbfc084d
---
 .../TextArea/ScrollBarArrowScrollTest.java    | 65 ++++++++++++++++++
 .../java/awt/TextArea/WordWrappingTest.java   | 66 +++++++++++++++++++
 2 files changed, 131 insertions(+)
 create mode 100644 test/jdk/java/awt/TextArea/ScrollBarArrowScrollTest.java
 create mode 100644 test/jdk/java/awt/TextArea/WordWrappingTest.java

diff --git a/test/jdk/java/awt/TextArea/ScrollBarArrowScrollTest.java b/test/jdk/java/awt/TextArea/ScrollBarArrowScrollTest.java
new file mode 100644
index 000000000000..cf54bd575855
--- /dev/null
+++ b/test/jdk/java/awt/TextArea/ScrollBarArrowScrollTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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
+ * 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.awt.Frame;
+import java.awt.TextArea;
+
+/*
+ * @test
+ * @bug 6175401
+ * @summary Keeping the left arrow pressedon horiz scrollbar
+ *          does not scroll the text in TextArea, XToolkit
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual ScrollBarArrowScrollTest
+*/
+
+
+public class ScrollBarArrowScrollTest extends Frame {
+    private static final String INSTRUCTIONS = """
+                1) Make sure, that the TextArea component has focus.
+                2) Press 'END' key in order to keep cursor at the end
+                   of the text of the TextArea component.
+                3) Click on the left arrow on the horizontal scrollbar
+                   of the TextArea component and keep it pressed.
+                4) If the text just scrolls once and stops, the test failed.
+                   Otherwise, the test passed.
+                """;
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("ScrollBarArrowScrollTest")
+                .instructions(INSTRUCTIONS)
+                .columns(40)
+                .testUI(ScrollBarArrowScrollTest::new)
+                .build()
+                .awaitAndCheck();
+    }
+
+    public ScrollBarArrowScrollTest() {
+        TextArea textarea = new TextArea("Very very very long string !!!! ", 10, 3);
+        add(textarea);
+        pack();
+
+    }
+}
diff --git a/test/jdk/java/awt/TextArea/WordWrappingTest.java b/test/jdk/java/awt/TextArea/WordWrappingTest.java
new file mode 100644
index 000000000000..7309bc510082
--- /dev/null
+++ b/test/jdk/java/awt/TextArea/WordWrappingTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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
+ * 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.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.TextArea;
+
+/*
+ * @test
+ * @bug 4992455
+ * @summary REGRESSION: TextArea does not wrap text in JDK 1.5 as JDK 1.4.x
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual WordWrappingTest
+*/
+
+public class WordWrappingTest {
+    private static final String INSTRUCTIONS = """
+                Please look at the frame 'WordWrappingTest'
+                It contains two TextAreas that have text 'This text should be wrapped.'
+                One of them has a vertical scrollbar only. Another has no
+                scrollbars at all.
+                If their text is not wrapped at word boundaries and you partially see
+                mentioned text, the test failed.
+                """;
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("WordWrappingTest")
+                .instructions(INSTRUCTIONS)
+                .testUI(WordWrappingTest::createGUI)
+                .build()
+                .awaitAndCheck();
+    }
+
+    public static Frame createGUI() {
+        Frame f = new Frame("WordWrappingTest");
+        f.setLayout(new FlowLayout());
+        f.add(new TextArea("This text should be wrapped.", 5, 10,
+                TextArea.SCROLLBARS_VERTICAL_ONLY));
+        f.add(new TextArea("This text should be wrapped.", 5, 10,
+                TextArea.SCROLLBARS_NONE));
+        f.pack();
+        return f;
+    }
+}

From 31b0f5aeef9ab21c4c461fc447f6439b11b4234b Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Wed, 22 Apr 2026 19:19:24 +0000
Subject: [PATCH 202/223] 8355179: Reinstate
 javax/swing/JScrollBar/4865918/bug4865918.java headful and macos run

Backport-of: 8c89fb95351ea0bc5ffdd920c18f9e820231f233
---
 .../swing/JScrollBar/4865918/bug4865918.java  | 47 ++++++++++++-------
 1 file changed, 31 insertions(+), 16 deletions(-)

diff --git a/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java b/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java
index 96b1034c943d..d68f1bff5971 100644
--- a/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java
+++ b/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java
@@ -24,14 +24,16 @@
 /*
  * @test
  * @bug 4865918
- * @requires (os.family != "mac")
+ * @key headful
  * @summary REGRESSION:JCK1.4a-runtime api/javax_swing/interactive/JScrollBarTests.html#JScrollBar
  * @run main bug4865918
  */
 
 import java.awt.Dimension;
+import java.awt.Robot;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+import javax.swing.JFrame;
 import javax.swing.JScrollBar;
 import javax.swing.SwingUtilities;
 import java.util.concurrent.CountDownLatch;
@@ -41,24 +43,33 @@
 
 public class bug4865918 {
 
+    private static JFrame frame;
     private static TestScrollBar sbar;
     private static final CountDownLatch mousePressLatch = new CountDownLatch(1);
 
     public static void main(String[] argv) throws Exception {
-        String osName = System.getProperty("os.name");
-        if (osName.toLowerCase().contains("os x")) {
-            System.out.println("This test is not for MacOS, considered passed.");
-            return;
-        }
-        SwingUtilities.invokeAndWait(() -> setupTest());
+        try {
+            Robot robot = new Robot();
+            SwingUtilities.invokeAndWait(() -> createAndShowGUI());
 
-        SwingUtilities.invokeAndWait(() -> sbar.pressMouse());
-        if (!mousePressLatch.await(2, TimeUnit.SECONDS)) {
-            throw new RuntimeException("Timed out waiting for mouse press");
-        }
+            robot.waitForIdle();
+            robot.delay(1000);
+
+            SwingUtilities.invokeAndWait(() -> sbar.pressMouse());
+            if (!mousePressLatch.await(2, TimeUnit.SECONDS)) {
+                throw new RuntimeException("Timed out waiting for mouse press");
+            }
 
-        if (getValue() != 9) {
-            throw new RuntimeException("The scrollbar block increment is incorrect");
+            if (getValue() != 9) {
+                throw new RuntimeException("The scrollbar block increment " +
+                                            getValue() + " is incorrect");
+            }
+        } finally {
+            SwingUtilities.invokeAndWait(() -> {
+                if (frame != null) {
+                    frame.dispose();
+                }
+            });
         }
     }
 
@@ -73,8 +84,8 @@ private static int getValue() throws Exception {
         return result[0];
     }
 
-    private static void setupTest() {
-
+    private static void createAndShowGUI() {
+        frame = new JFrame("bug4865918");
         sbar = new TestScrollBar(JScrollBar.HORIZONTAL, -1, 10, -100, 100);
         sbar.setPreferredSize(new Dimension(200, 20));
         sbar.setBlockIncrement(10);
@@ -83,7 +94,11 @@ public void mousePressed(MouseEvent e) {
                 mousePressLatch.countDown();
             }
         });
-
+        frame.getContentPane().add(sbar);
+        frame.pack();
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+        frame.toFront();
     }
 
     static class TestScrollBar extends JScrollBar {

From a989140ab52364002c7528cdd38596b099299539 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Wed, 22 Apr 2026 19:19:51 +0000
Subject: [PATCH 203/223] 8341055: Open some TextArea awt tests 2

Backport-of: 9a94884e428f9a6fee1aac2af0d0d057aef77e1b
---
 .../awt/TextArea/TextAreaHScrollbarTest.java  |  60 +++++++++
 .../TextArea/TextAreaLineScrollWrapTest.java  |  65 ++++++++++
 .../awt/TextArea/TextAreaScrollbarTest.java   | 116 ++++++++++++++++++
 .../jdk/java/awt/TextArea/TextScrollTest.java |  69 +++++++++++
 4 files changed, 310 insertions(+)
 create mode 100644 test/jdk/java/awt/TextArea/TextAreaHScrollbarTest.java
 create mode 100644 test/jdk/java/awt/TextArea/TextAreaLineScrollWrapTest.java
 create mode 100644 test/jdk/java/awt/TextArea/TextAreaScrollbarTest.java
 create mode 100644 test/jdk/java/awt/TextArea/TextScrollTest.java

diff --git a/test/jdk/java/awt/TextArea/TextAreaHScrollbarTest.java b/test/jdk/java/awt/TextArea/TextAreaHScrollbarTest.java
new file mode 100644
index 000000000000..3bf1c6997638
--- /dev/null
+++ b/test/jdk/java/awt/TextArea/TextAreaHScrollbarTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2002, 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.awt.Frame;
+import java.awt.TextArea;
+
+/*
+ * @test
+ * @bug 4648702
+ * @summary TextArea horizontal scrollbar behavior is incorrect
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual TextAreaHScrollbarTest
+ */
+
+public class TextAreaHScrollbarTest {
+    private static final String INSTRUCTIONS = """
+                Please look at the frame.
+                If the vertical and horizontal scrollbars are visible
+                the test passed else failed.
+                """;
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("TextAreaHScrollbarTest")
+                .instructions(INSTRUCTIONS)
+                .columns(40)
+                .testUI(TextAreaHScrollbarTest::createGUI)
+                .build()
+                .awaitAndCheck();
+    }
+
+    public static Frame createGUI() {
+        Frame test = new Frame();
+        test.add(new TextArea("TextAreaHScrollbarTest", 5, 60,
+                TextArea.SCROLLBARS_BOTH));
+        test.setSize(200, 100);
+        return test;
+    }
+}
diff --git a/test/jdk/java/awt/TextArea/TextAreaLineScrollWrapTest.java b/test/jdk/java/awt/TextArea/TextAreaLineScrollWrapTest.java
new file mode 100644
index 000000000000..72ec7c08a6ce
--- /dev/null
+++ b/test/jdk/java/awt/TextArea/TextAreaLineScrollWrapTest.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2002, 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.awt.Frame;
+import java.awt.TextArea;
+
+/*
+ * @test
+ * @bug 4776535
+ * @summary Regression: line should not wrap around into multi lines in TextArea.
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual TextAreaLineScrollWrapTest
+ */
+
+public class TextAreaLineScrollWrapTest {
+    private static final String INSTRUCTIONS = """
+            You should see a frame "TextAreaLineScrollWrapTest" with
+            a TextArea that contains a very long line.
+            If the line is wrapped the test is failed.
+
+            Insert a lot of text lines and move a caret to the last one.
+            If a caret hides and a content of the TextArea
+            does not scroll the test is failed
+            else the test is passed.
+            """;
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("TextAreaLineScrollWrapTest")
+                .instructions(INSTRUCTIONS)
+                .columns(40)
+                .testUI(TextAreaLineScrollWrapTest::createGUI)
+                .build()
+                .awaitAndCheck();
+    }
+
+    public static Frame createGUI() {
+        Frame f = new Frame("TextAreaLineScrollWrapTest");
+        f.add(new TextArea("long long long long long long long line...........",
+                3, 4));
+        f.setSize(100, 100);
+        return f;
+    }
+}
diff --git a/test/jdk/java/awt/TextArea/TextAreaScrollbarTest.java b/test/jdk/java/awt/TextArea/TextAreaScrollbarTest.java
new file mode 100644
index 000000000000..ee61922fdb16
--- /dev/null
+++ b/test/jdk/java/awt/TextArea/TextAreaScrollbarTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 1998, 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.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.Label;
+import java.awt.TextArea;
+
+/*
+ * @test
+ * @bug 4158997
+ * @key headful
+ * @summary Make sure that the TextArea has both horizontal and
+ * vertical scrollbars when bad scrollbar arguments are passed
+ * into the constructor.
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual TextAreaScrollbarTest
+ */
+
+public class TextAreaScrollbarTest {
+    private static final String INSTRUCTIONS = """
+            Check to see that each TextArea has the specified
+            number and placement of scrollbars, i.e., both scrollbars,
+            horizontal only, vertical only, or no scrollbars at all.
+            """;
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("TextAreaScrollbarTest")
+                .instructions(INSTRUCTIONS)
+                .columns(35)
+                .testUI(TestFrame::new)
+                .build()
+                .awaitAndCheck();
+    }
+}
+
+class TestFrame extends Frame {
+    private String both = "Both Scrollbars  Both Scrollbars  Both Scrollbars\n";
+    private String horiz = "Horizontal Scrollbar Only  Horizontal Scrollbar Only\n";
+    private String vert = "Vertical Scrollbar Only  Vertical Scrollbar Only\n";
+    private String none = "No Scrollbars  No Scrollbars  No Scrollbars  No Scrollbars\n";
+
+    public TestFrame() {
+        super("Test frame");
+
+        // sets a GridLayout w/ 2 columns and an unspecified # of rows
+        setLayout(new GridLayout(0, 2, 15, 5));
+
+        TextArea t1 = new TextArea(both + both + both + both + both + both, 3, 8, 0);
+        add(new Label("TA should have both scrollbars: arg = 0"));
+        add(t1);
+
+        TextArea t2 = new TextArea(both + both + both + both + both + both, 3, 8, -1);
+        add(new Label("TA should have both scrollbars: arg = -1"));
+        add(t2);
+
+        TextArea t3 = new TextArea(both + both + both + both + both + both, 3, 8, 4);
+        add(new Label("TA should have both scrollbars: arg = 4"));
+        add(t3);
+
+        TextArea t4 = new TextArea(horiz + horiz + horiz + horiz + horiz + horiz, 3, 8, 2);
+        add(new Label("TA should have horizontal scrollbar: arg = 2"));
+        add(t4);
+
+        TextArea t5 = new TextArea(vert + vert + vert + vert + vert + vert, 3, 8, 1);
+        add(new Label("TA should have vertical scrollbar: arg = 1"));
+        add(t5);
+
+        TextArea t6 = new TextArea(none + none + none + none + none + none, 3, 8, 3);
+        add(new Label("TA should have no scrollbars: arg = 3"));
+        add(t6);
+
+        TextArea t7 = new TextArea();
+        t7.setText(both + both + both + both + both + both);
+        add(new Label("Both scrollbars: TextArea()"));
+        add(t7);
+
+        TextArea t8 = new TextArea(both + both + both + both + both + both);
+        add(new Label("Both scrollbars: TextArea(String text)"));
+        add(t8);
+
+        TextArea t9 = new TextArea(3, 8);
+        t9.setText(both + both + both + both + both + both);
+        add(new Label("Both scrollbars: TextArea(int rows, int columns)"));
+        add(t9);
+
+        TextArea t10 = new TextArea(both + both + both + both + both + both, 3, 8);
+        add(new Label("Both scrollbars: TextArea(text, rows, columns)"));
+        add(t10);
+
+        setSize(600, 600);
+    }
+}
+
diff --git a/test/jdk/java/awt/TextArea/TextScrollTest.java b/test/jdk/java/awt/TextArea/TextScrollTest.java
new file mode 100644
index 000000000000..4a92391e7af5
--- /dev/null
+++ b/test/jdk/java/awt/TextArea/TextScrollTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 1998, 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.awt.BorderLayout;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.TextArea;
+
+/*
+ * @test
+ * @bug 4127272
+ * @summary TextArea displays head of text when scrolling horizontal bar.
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual TextScrollTest
+ */
+
+public class TextScrollTest extends Frame {
+    private static final String INSTRUCTIONS = """
+            1. A TextArea whose content starts with the text ",
+               'Scroll till the' will appear on the applet ",
+            2. Use the Horizontal thumb button of the TextArea to view the entire",
+               content of the TextArea",
+            3. While scrolling, if the text 'Scroll till the' appears repeatedly, Click Fail  ",
+               else Click Pass"
+            """;
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("TextScrollTest")
+                .instructions(INSTRUCTIONS)
+                .columns(40)
+                .testUI(TextScrollTest::new)
+                .build()
+                .awaitAndCheck();
+    }
+
+    public TextScrollTest() {
+        this.setLayout(new BorderLayout());
+
+        Panel p = new Panel();
+        TextArea ta = new TextArea("Scroll till the right end of the " +
+                "TextArea is reached. Action Done?\n", 10, 20);
+
+        p.add(ta);
+        add("Center", p);
+        setSize(200, 200);
+    }
+}

From cbab1db4f3dc45aca4e1bccd3a1eb55a1f0f5232 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Wed, 22 Apr 2026 19:20:28 +0000
Subject: [PATCH 204/223] 8352685: Opensource JInternalFrame tests - series2

Backport-of: da3bb06797f9550d204b2623481ef757ae941bbd
---
 test/jdk/ProblemList.txt                      |   1 +
 .../swing/JInternalFrame/bug4130806.java      |  72 ++++++++++
 .../swing/JInternalFrame/bug4134077.java      | 132 ++++++++++++++++++
 .../swing/JInternalFrame/bug4193070.java      |  87 ++++++++++++
 .../swing/JInternalFrame/bug4225701.java      |  87 ++++++++++++
 5 files changed, 379 insertions(+)
 create mode 100644 test/jdk/javax/swing/JInternalFrame/bug4130806.java
 create mode 100644 test/jdk/javax/swing/JInternalFrame/bug4134077.java
 create mode 100644 test/jdk/javax/swing/JInternalFrame/bug4193070.java
 create mode 100644 test/jdk/javax/swing/JInternalFrame/bug4225701.java

diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
index ed665db4007a..18f9f0d36dfa 100644
--- a/test/jdk/ProblemList.txt
+++ b/test/jdk/ProblemList.txt
@@ -799,6 +799,7 @@ javax/swing/JFileChooser/6698013/bug6698013.java 8024419 macosx-all
 javax/swing/JColorChooser/8065098/bug8065098.java 8065647 macosx-all
 javax/swing/JTabbedPane/bug4499556.java 8267500 macosx-all
 javax/swing/SwingUtilities/TestTextPosInPrint.java 8227025 windows-all
+javax/swing/JInternalFrame/bug4134077.java 8184985 windows-all
 
 java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_1.java 7131438,8022539 generic-all
 java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_2.java 7131438,8022539 generic-all
diff --git a/test/jdk/javax/swing/JInternalFrame/bug4130806.java b/test/jdk/javax/swing/JInternalFrame/bug4130806.java
new file mode 100644
index 000000000000..10814740b2e4
--- /dev/null
+++ b/test/jdk/javax/swing/JInternalFrame/bug4130806.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1999, 2025, 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 4130806
+ * @summary JInternalFrame's setIcon(true) works correctly
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual bug4130806
+ */
+
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import java.beans.PropertyVetoException;
+
+public class bug4130806 {
+
+    private static final String INSTRUCTIONS = """
+        If an icon is visible for the iconified internalframe, the test passes.
+        Otherwise, the test fails.""";
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("bug4130806 Instructions")
+                .instructions(INSTRUCTIONS)
+                .columns(35)
+                .testUI(bug4130806::createTestUI)
+                .build()
+                .awaitAndCheck();
+    }
+
+    private static JFrame createTestUI() {
+        JFrame frame = new JFrame("bug4130806");
+        JDesktopPane mDesktop = new JDesktopPane();
+        frame.add(mDesktop);
+        frame.pack();
+        JInternalFrame jif = new JInternalFrame("My Frame");
+        jif.setIconifiable(true);
+        mDesktop.add(jif);
+        jif.setBounds(50,50,100,100);
+        try {
+            jif.setIcon(true);
+        } catch (PropertyVetoException e) {
+            throw new RuntimeException("PropertyVetoException received");
+        }
+        jif.setVisible(true);
+        frame.setSize(200, 200);
+        return frame;
+    }
+}
diff --git a/test/jdk/javax/swing/JInternalFrame/bug4134077.java b/test/jdk/javax/swing/JInternalFrame/bug4134077.java
new file mode 100644
index 000000000000..db609d5a425d
--- /dev/null
+++ b/test/jdk/javax/swing/JInternalFrame/bug4134077.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2000, 2025, 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 4134077
+ * @requires (os.family == "windows")
+ * @summary Metal,Window:If JInternalFrame's title text is long last must be ellipsis
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual bug4134077
+ */
+
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.JButton;
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+public class bug4134077 {
+
+    private static JFrame frame;
+
+    private static final String INSTRUCTIONS = """
+        Try to resize internal frame with diferrent combinations of
+        LookAndFeels and title pane's buttons and orientation.
+
+        The internal frame's title should clip if its too long to
+        be entierly visible (ends by "...")
+        and window can never be
+        smaller than the width of the first two letters of the title
+        plus "...".""";
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("bug4134077 Instructions")
+                .instructions(INSTRUCTIONS)
+                .columns(35)
+                .testUI(bug4134077::createTestUI)
+                .build()
+                .awaitAndCheck();
+    }
+
+    private static void setLF(ActionEvent e) {
+        try {
+            UIManager.setLookAndFeel(((JButton)e.getSource()).getActionCommand());
+            SwingUtilities.updateComponentTreeUI(frame);
+        } catch (ClassNotFoundException | InstantiationException
+                 | UnsupportedLookAndFeelException
+                 | IllegalAccessException ex) {
+             throw new RuntimeException(ex);
+        }
+    }
+
+    private static JFrame createTestUI() {
+        frame = new JFrame("bug4134077");
+        JDesktopPane jdp = new JDesktopPane();
+        frame.add(jdp);
+
+        final JInternalFrame jif =
+                new JInternalFrame("Very Long Title For Internal Frame", true);
+        jdp.add(jif);
+        jif.setSize(150,150);
+        jif.setLocation(150, 50);
+        jif.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        jif.setVisible(true);
+
+        JPanel p = new JPanel();
+
+        JButton metal = new JButton("Metal");
+        metal.setActionCommand("javax.swing.plaf.metal.MetalLookAndFeel");
+        metal.addActionListener((ActionEvent e) -> setLF(e));
+        p.add(metal);
+
+        JButton windows = new JButton("Windows");
+        windows.setActionCommand("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+        windows.addActionListener((ActionEvent e) -> setLF(e));
+        p.add(windows);
+
+        JButton orientation = new JButton("Change orientation");
+        orientation.addActionListener(e -> {
+            jif.setComponentOrientation(
+                jif.getComponentOrientation() == ComponentOrientation.LEFT_TO_RIGHT
+                    ? ComponentOrientation.RIGHT_TO_LEFT
+                    : ComponentOrientation.LEFT_TO_RIGHT);
+        });
+        p.add(orientation);
+
+        JButton clo = new JButton("Closable");
+        clo.addActionListener(e -> jif.setClosable(!jif.isClosable()));
+        p.add(clo);
+
+        JButton ico = new JButton("Iconifiable");
+        ico.addActionListener(e -> jif.setIconifiable(!jif.isIconifiable()));
+        p.add(ico);
+
+        JButton max = new JButton("Maximizable");
+        max.addActionListener(e -> jif.setMaximizable(!jif.isMaximizable()));
+        p.add(max);
+
+        frame.add(p, BorderLayout.SOUTH);
+        frame.setSize(700, 300);
+        return frame;
+    }
+}
diff --git a/test/jdk/javax/swing/JInternalFrame/bug4193070.java b/test/jdk/javax/swing/JInternalFrame/bug4193070.java
new file mode 100644
index 000000000000..320b2e6e5633
--- /dev/null
+++ b/test/jdk/javax/swing/JInternalFrame/bug4193070.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2000, 2025, 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 4193070
+ * @summary Tests correct mouse pointer shape
+ * @requires (os.family != "mac")
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual bug4193070
+ */
+
+import java.awt.Dimension;
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+
+public class bug4193070 {
+
+    private static final String INSTRUCTIONS = """
+        Two internal frame will be shown. Select any internal frame;
+        Move mouse pointer inside the selected internal frame,
+            then to border of internal frame.
+        Mouse pointer should take the shape of resize cursor.
+        Now slowly move the mouse back inside the internal frame.
+        If mouse pointer shape does not change back to
+            normal shape of mouse pointer, then test failed.
+        Now try fast resizing an internal frame.
+        Check that mouse pointer always has resize shape,
+            even when it goes over other internal frame.
+        If during resizing mouse pointer shape changes,
+            then test failed. Otherwise test succeded.""";
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("bug4193070 Instructions")
+                .instructions(INSTRUCTIONS)
+                .columns(35)
+                .testUI(bug4193070::createTestUI)
+                .build()
+                .awaitAndCheck();
+    }
+
+    private static JFrame createTestUI() {
+        JFrame f = new JFrame("bug4193070");
+        JDesktopPane dp = new JDesktopPane();
+
+        JInternalFrame intFrm1 = new JInternalFrame();
+        intFrm1.setResizable(true);
+        dp.add(intFrm1);
+
+        JInternalFrame intFrm2 = new JInternalFrame();
+        intFrm2.setResizable(true);
+        dp.add(intFrm2);
+
+        f.setContentPane(dp);
+        f.setSize(new Dimension(500, 275));
+
+        intFrm1.setBounds(25, 25, 200, 200);
+        intFrm1.show();
+
+        intFrm2.setBounds(275, 25, 200, 200);
+        intFrm2.show();
+        return f;
+    }
+}
diff --git a/test/jdk/javax/swing/JInternalFrame/bug4225701.java b/test/jdk/javax/swing/JInternalFrame/bug4225701.java
new file mode 100644
index 000000000000..808ebb503baf
--- /dev/null
+++ b/test/jdk/javax/swing/JInternalFrame/bug4225701.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2000, 2025, 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 4225701
+ * @summary Verifies MetalInternalFrameUI.installKeyboardActions
+ *          doesn't install listener
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual bug4225701
+ */
+
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+
+public class bug4225701 {
+
+    private static final String INSTRUCTIONS = """
+        Give a focus to the internal frame "Frame 4" and press Ctrl-F4.
+        The "Frame 4" should be closed. Give a focus to the internal
+        frame "Frame 1" and press Ctrl-F4.
+        If "Frame 4" and "Frame 1" is not closed, then press Fail else press Pass.""";
+
+    public static void main(String[] args) throws Exception {
+         PassFailJFrame.builder()
+                .title("bug4225701 Instructions")
+                .instructions(INSTRUCTIONS)
+                .columns(35)
+                .testUI(bug4225701::createTestUI)
+                .build()
+                .awaitAndCheck();
+    }
+
+    private static JFrame createTestUI() {
+
+        JFrame frame = new JFrame("bug4225701");
+        JInternalFrame jif1 = new JInternalFrame("Frame 1", true, true, true, true);
+        JInternalFrame jif2 = new JInternalFrame("Frame 2", false);
+        JInternalFrame jif3 = new JInternalFrame("Frame 3", false);
+        JInternalFrame jif4 = new JInternalFrame("Frame 4", true, true, true, true);
+        JDesktopPane jdp = new JDesktopPane();
+
+        frame.setContentPane(jdp);
+
+        jdp.add(jif1);
+        jif1.setBounds(0, 150, 150, 150);
+        jif1.setVisible(true);
+
+        jdp.add(jif2);
+        jif2.setBounds(100, 100, 150, 150);
+        jif2.setVisible(true);
+
+        jdp.add(jif3);
+        jif3.setBounds(200, 50, 150, 150);
+        jif3.setVisible(true);
+
+        jdp.add(jif4);
+        jif4.setBounds(300, 0, 150, 150);
+        jif4.setVisible(true);
+
+        frame.setSize(500, 500);
+        return frame;
+    }
+
+}

From bcb6b44fb826cba5aeb650b10c58e8c73ebff3cf Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Wed, 22 Apr 2026 19:21:20 +0000
Subject: [PATCH 205/223] 8340987: Open some TextArea awt tests 1

Backport-of: 7e98f5905b313f4e9bf638f87392b6a1b01df1f8
---
 .../TextArea/TextAreaAppendScrollTest2.java   |  68 +++++++++++
 .../java/awt/TextArea/TextAreaAppendTest.java |  68 +++++++++++
 .../TextAreaCRLFAutoDetectManualTest.java     | 106 ++++++++++++++++++
 test/jdk/java/awt/TextArea/TextAreaLimit.java |  70 ++++++++++++
 4 files changed, 312 insertions(+)
 create mode 100644 test/jdk/java/awt/TextArea/TextAreaAppendScrollTest2.java
 create mode 100644 test/jdk/java/awt/TextArea/TextAreaAppendTest.java
 create mode 100644 test/jdk/java/awt/TextArea/TextAreaCRLFAutoDetectManualTest.java
 create mode 100644 test/jdk/java/awt/TextArea/TextAreaLimit.java

diff --git a/test/jdk/java/awt/TextArea/TextAreaAppendScrollTest2.java b/test/jdk/java/awt/TextArea/TextAreaAppendScrollTest2.java
new file mode 100644
index 000000000000..2f0e44b415e1
--- /dev/null
+++ b/test/jdk/java/awt/TextArea/TextAreaAppendScrollTest2.java
@@ -0,0 +1,68 @@
+/*
+ * 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
+ * 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.awt.BorderLayout;
+import java.awt.Frame;
+import java.awt.TextArea;
+
+/*
+ * @test
+ * @bug 6192116
+ * @summary Auto-scrolling does not work properly for TextArea when appending some text, on XToolkit
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual TextAreaAppendScrollTest2
+ */
+
+public class TextAreaAppendScrollTest2 extends Frame {
+    TextArea area;
+    private static final String INSTRUCTIONS = """
+            Press pass if you see exclamation marks in the bottom of textarea.
+            Press fail if you don't.
+            """;
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("TextAreaAppendScrollTest2")
+                .instructions(INSTRUCTIONS)
+                .rows((int) INSTRUCTIONS.lines().count() + 2)
+                .columns(40)
+                .testUI(TextAreaAppendScrollTest2::new)
+                .build()
+                .awaitAndCheck();
+    }
+
+    public TextAreaAppendScrollTest2() {
+        setLayout(new BorderLayout());
+        area = new TextArea("AWT is cool ", 3, 3, TextArea.SCROLLBARS_NONE);
+        add("Center", area);
+        setSize(200, 200);
+        StringBuilder coolStr = new StringBuilder("");
+        // I count 15 lines with 12 cools per line
+        for (int i = 0; i < 12 * 15; i++) {
+            coolStr.append("cool ");
+        }
+        coolStr.append("!!!!!!!");
+        area.append(coolStr.toString());
+    }
+}
diff --git a/test/jdk/java/awt/TextArea/TextAreaAppendTest.java b/test/jdk/java/awt/TextArea/TextAreaAppendTest.java
new file mode 100644
index 000000000000..c47d621e788a
--- /dev/null
+++ b/test/jdk/java/awt/TextArea/TextAreaAppendTest.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1998, 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.awt.Frame;
+import java.awt.TextArea;
+
+/*
+ * @test
+ * @bug 4118915
+ * @summary Test appending to a TextArea after the peer is created
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual TextAreaAppendTest
+ */
+
+public class TextAreaAppendTest {
+    private static final String INSTRUCTIONS = """
+            If all four lines are visible in TextArea, the test passed.
+            If the last two lines have only one character visible, the test failed.
+            """;
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("TextAreaAppendTest")
+                .instructions(INSTRUCTIONS)
+                .rows((int) INSTRUCTIONS.lines().count() + 2)
+                .columns(40)
+                .testUI(TextAreaAppendTest::createGUI)
+                .build()
+                .awaitAndCheck();
+    }
+
+    public static Frame createGUI() {
+        Frame f = new Frame("TextAreaAppendTest");
+        TextArea ta = new TextArea();
+        f.add(ta);
+        ta.append("line 1 (added before drawing)\n");
+        ta.append("line 2 (added before drawing)\n");
+
+        f.pack();
+        f.show();
+
+        ta.append("line 3 (added after drawing)\n");
+        ta.append("line 4 (added after drawing)\n");
+
+        return f;
+    }
+}
diff --git a/test/jdk/java/awt/TextArea/TextAreaCRLFAutoDetectManualTest.java b/test/jdk/java/awt/TextArea/TextAreaCRLFAutoDetectManualTest.java
new file mode 100644
index 000000000000..c8c3f0662a5c
--- /dev/null
+++ b/test/jdk/java/awt/TextArea/TextAreaCRLFAutoDetectManualTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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
+ * 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.awt.Button;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.Panel;
+import java.awt.TextArea;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/*
+ * @test
+ * @bug 4800187
+ * @summary REGRESSION:show the wrong selection when there are \r characters in the text
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual TextAreaCRLFAutoDetectManualTest
+ */
+
+public class TextAreaCRLFAutoDetectManualTest {
+    static int flag = 1;
+
+    private static final String INSTRUCTIONS = """
+                Please click the button several times.
+                If you see the text '679' selected on the left TextArea
+                and the same text on the right TextArea
+                each time you press the button,
+                the test passed, else failed.
+                """;
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("TextAreaCRLFAutoDetectManualTest")
+                .instructions(INSTRUCTIONS)
+                .rows((int) INSTRUCTIONS.lines().count() + 2)
+                .columns(40)
+                .testUI(TextAreaCRLFAutoDetectManualTest::createGUI)
+                .build()
+                .awaitAndCheck();
+    }
+
+    public static Frame createGUI() {
+        Frame f = new Frame("TextAreaCRLFAutoDetectManualTest");
+
+        TextArea ta1 = new TextArea(5, 20);
+        TextArea ta2 = new TextArea(5, 20);
+
+        TextField tf1 = new TextField("123", 20);
+        TextField tf2 = new TextField("567", 20);
+        TextField tf3 = new TextField("90", 20);
+
+        Button b = new Button("Click Me Several Times");
+
+        b.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent evt) {
+                ta1.setText("");
+                ta2.setText("");
+                flag++;
+                String eoln = ((flag % 2) != 0) ? "\r\n" : "\n";
+                ta1.setText(eoln + tf1.getText() + eoln + tf2.getText() + eoln + tf3.getText() + eoln);
+                ta1.select(6, 10);
+                ta2.setText(ta1.getSelectedText());
+                ta1.requestFocus();
+            }
+        });
+
+        f.setLayout(new FlowLayout());
+
+        Panel tfpanel = new Panel();
+        tfpanel.setLayout(new GridLayout(3, 1));
+        tfpanel.add(tf1);
+        tfpanel.add(tf2);
+        tfpanel.add(tf3);
+        f.add(tfpanel);
+
+        f.add(ta1);
+        f.add(ta2);
+        f.add(b);
+
+        f.pack();
+        return f;
+    }
+}
diff --git a/test/jdk/java/awt/TextArea/TextAreaLimit.java b/test/jdk/java/awt/TextArea/TextAreaLimit.java
new file mode 100644
index 000000000000..424305c90ead
--- /dev/null
+++ b/test/jdk/java/awt/TextArea/TextAreaLimit.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2000, 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.awt.BorderLayout;
+import java.awt.Frame;
+import java.awt.TextArea;
+
+/*
+ * @test
+ * @bug 4341196
+ * @summary Tests that TextArea can handle more than 64K of text
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual TextAreaLimit
+ */
+
+public class TextAreaLimit extends Frame {
+    static TextArea text;
+    private static final String INSTRUCTIONS = """
+            You will see a text area with 40000 lines of text
+            each with its own line number. If you see the caret after line 39999
+            then test passes. Otherwise it fails.
+            """;
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("TextAreaLimit")
+                .instructions(INSTRUCTIONS)
+                .rows((int) INSTRUCTIONS.lines().count() + 2)
+                .columns(40)
+                .testUI(TextAreaLimit::new)
+                .build()
+                .awaitAndCheck();
+    }
+
+    public TextAreaLimit() {
+        setLayout(new BorderLayout());
+
+        text = new TextArea();
+        add(text);
+        StringBuffer buf = new StringBuffer();
+        for (int i = 0; i < 40000; i++) {
+            buf.append(i + "\n");
+        }
+        text.setText(buf.toString());
+        text.setCaretPosition(buf.length());
+        text.requestFocus();
+        setSize(200, 200);
+    }
+}

From 41b89184bfa7951af73f08e5eda649134a3fc771 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Wed, 22 Apr 2026 19:21:56 +0000
Subject: [PATCH 206/223] 8347836: Disabled PopupMenu shows shortcuts on Mac

Backport-of: 379c3f99665829c5d8c373d1fb324dc7ef4d84cf
---
 .../java/awt/PopupMenu/PopupMenuVisuals.java  | 24 +++++++++++--------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java b/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java
index 3aa437e48454..966ce30593e1 100644
--- a/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java
+++ b/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2025, 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
@@ -20,12 +20,13 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 /*
  * @test
  * @bug 6180413 6184485 6267144
  * @summary test for popup menu visual bugs in XAWT
- * @library /java/awt/regtesthelpers
- * @build PassFailJFrame
+ * @library /java/awt/regtesthelpers /test/lib
+ * @build PassFailJFrame jdk.test.lib.Platform
  * @run main/manual PopupMenuVisuals
 */
 
@@ -40,16 +41,20 @@
 import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
 
+import jdk.test.lib.Platform;
+
 public class PopupMenuVisuals {
     private static final String INSTRUCTIONS = """
          This test should show a button 'Popup'.
          Click on the button. A popup menu should be shown.
          If following conditions are met:
-          - Menu is disabled
-          - Menu has caption 'Popup menu' (only applicable for linux)
-          - Menu items don't show shortcuts
+          - Menu is disabled %s%s
 
-         Click Pass else click Fail.""";
+         Click Pass else click Fail."""
+            .formatted(
+                    Platform.isLinux() ? "\n - Menu has caption 'Popup menu'" : "",
+                    !Platform.isOSX() ? "\n - Menu items don't show shortcuts" : ""
+            );
 
     static PopupMenu pm;
     static Frame frame;
@@ -58,7 +63,6 @@ public static void main(String[] args) throws Exception {
         PassFailJFrame.builder()
                 .title("PopupMenu Instructions")
                 .instructions(INSTRUCTIONS)
-                .rows((int) INSTRUCTIONS.lines().count() + 2)
                 .columns(35)
                 .testUI(PopupMenuVisuals::createTestUI)
                 .build()
@@ -79,9 +83,9 @@ private static Frame createTestUI() {
         CheckboxMenuItem mi3 = new CheckboxMenuItem("Item 3");
         Menu sm = new Menu("Submenu");
 
-        //Get things going.  Request focus, set size, et cetera
+        // Get things going.  Request focus, set size, et cetera
         frame = new Frame("PopupMenuVisuals");
-        frame.setSize (200,200);
+        frame.setSize(200, 200);
         frame.validate();
 
         frame.add(b);

From b8c22743a25ccc74fa3c0786b00b74280405d3c9 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Wed, 22 Apr 2026 19:22:23 +0000
Subject: [PATCH 207/223] 8341292: Open some TextArea awt tests 3

Backport-of: f7e8f5064a405e46db722ec47bfd86a43408b328
---
 test/jdk/java/awt/TextArea/PrintTextTest.java | 98 +++++++++++++++++++
 1 file changed, 98 insertions(+)
 create mode 100644 test/jdk/java/awt/TextArea/PrintTextTest.java

diff --git a/test/jdk/java/awt/TextArea/PrintTextTest.java b/test/jdk/java/awt/TextArea/PrintTextTest.java
new file mode 100644
index 000000000000..8cf147747328
--- /dev/null
+++ b/test/jdk/java/awt/TextArea/PrintTextTest.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 1997, 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.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.PrintJob;
+import java.awt.TextArea;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/*
+ * @test
+ * @bug 4075786
+ * @key printer
+ * @summary Test that container prints multiline text properly
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual PrintTextTest
+*/
+
+public class PrintTextTest extends Frame implements ActionListener {
+    Panel p;
+
+    static final String INSTRUCTIONS = """
+                Press "Print" button and check that multiline test
+                printed correctly. If so press Pass, otherwise Fail.
+                """;
+
+    public static void main(String[] args) throws Exception {
+        PassFailJFrame.builder()
+                .title("PrintTextTest")
+                .instructions(INSTRUCTIONS)
+                .rows((int) INSTRUCTIONS.lines().count() + 2)
+                .columns(35)
+                .testUI(PrintTextTest::new)
+                .build()
+                .awaitAndCheck();
+    }
+
+    public PrintTextTest() {
+        p = new Panel();
+        p.setLayout(new BorderLayout());
+        TextArea text_area = new TextArea("multi\nline\ntext\nfield\nis \nhere\n!!!!\n");
+
+        TextField text_field = new TextField("single line textfield");
+        Button button = new Button("button");
+        Label label = new Label("single line label");
+        p.add("South", text_area);
+        p.add("North", new TextArea("one single line of textarea"));
+        p.add("Center", text_field);
+        p.add("West", button);
+
+        add("North", p);
+
+        Button b = new Button("Print");
+        b.addActionListener(this);
+        add("South", b);
+        pack();
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        PrintJob pjob = getToolkit().getPrintJob(this, "Print", null);
+        if (pjob != null) {
+            Graphics pg = pjob.getGraphics();
+
+            if (pg != null) {
+                p.printAll(pg);
+                pg.dispose();  //flush page
+            }
+            pjob.end();
+        }
+    }
+}

From 7ebcb8fa4c7fdea70b38cb0523051b5866d3fdf8 Mon Sep 17 00:00:00 2001
From: Martin Doerr 
Date: Thu, 23 Apr 2026 08:48:36 +0000
Subject: [PATCH 208/223] 8380565: PPC64: deoptimization stub should save
 vector registers 8381315: compiler/vectorapi/TestVectorReallocation.java
 fails with -XX:UseAVX=1 after JDK-8380565

Reviewed-by: rrich
Backport-of: 29e1ee2eccd59e665827e0d42c490261002cf99e
---
 src/hotspot/cpu/ppc/registerMap_ppc.cpp       |  46 ++
 src/hotspot/cpu/ppc/registerMap_ppc.hpp       |   8 +-
 src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp     |  24 +-
 src/hotspot/cpu/ppc/vm_version_ppc.cpp        |   3 +-
 .../vectorapi/TestVectorReallocation.java     | 414 ++++++++++++++++++
 5 files changed, 481 insertions(+), 14 deletions(-)
 create mode 100644 src/hotspot/cpu/ppc/registerMap_ppc.cpp
 create mode 100644 test/hotspot/jtreg/compiler/vectorapi/TestVectorReallocation.java

diff --git a/src/hotspot/cpu/ppc/registerMap_ppc.cpp b/src/hotspot/cpu/ppc/registerMap_ppc.cpp
new file mode 100644
index 000000000000..e26e85df555f
--- /dev/null
+++ b/src/hotspot/cpu/ppc/registerMap_ppc.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2026 SAP SE. 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 "runtime/registerMap.hpp"
+
+address RegisterMap::pd_location(VMReg base_reg, int slot_idx) const {
+  if (base_reg->is_VectorSRegister()) {
+    // Not all physical slots belonging to a VectorRegister have corresponding
+    // valid VMReg locations in the RegisterMap.
+    // (See RegisterSaver::push_frame_reg_args_and_save_live_registers.)
+    // However, the slots are always saved to the stack in a contiguous region
+    // of memory so we can calculate the address of the upper slots by
+    // offsetting from the base address.
+    assert(base_reg->is_concrete(), "must pass base reg");
+    address base_location = location(base_reg, nullptr);
+    if (base_location != nullptr) {
+      intptr_t offset_in_bytes = slot_idx * VMRegImpl::stack_slot_size;
+      return base_location + offset_in_bytes;
+    } else {
+      return nullptr;
+    }
+  } else {
+    return location(base_reg->next(slot_idx), nullptr);
+  }
+}
diff --git a/src/hotspot/cpu/ppc/registerMap_ppc.hpp b/src/hotspot/cpu/ppc/registerMap_ppc.hpp
index 01eb642107cb..607c712d10f2 100644
--- a/src/hotspot/cpu/ppc/registerMap_ppc.hpp
+++ b/src/hotspot/cpu/ppc/registerMap_ppc.hpp
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2013 SAP SE. All rights reserved.
+ * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2026 SAP SE. 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
@@ -35,9 +35,7 @@
   // Since there is none, we just return null.
   address pd_location(VMReg reg) const { return nullptr; }
 
-  address pd_location(VMReg base_reg, int slot_idx) const {
-    return location(base_reg->next(slot_idx), nullptr);
-  }
+  address pd_location(VMReg base_reg, int slot_idx) const;
 
   // no PD state to clear or copy:
   void pd_clear() {}
diff --git a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
index 2281c083b98c..0790eceddc25 100644
--- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
+++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
@@ -105,7 +105,7 @@ class RegisterSaver {
 
   // During deoptimization only the result registers need to be restored
   // all the other values have already been extracted.
-  static void restore_result_registers(MacroAssembler* masm, int frame_size_in_bytes);
+  static void restore_result_registers(MacroAssembler* masm, int frame_size_in_bytes, bool save_vectors);
 
   // Constants and data structures:
 
@@ -355,6 +355,7 @@ OopMap* RegisterSaver::push_frame_reg_args_and_save_live_registers(MacroAssemble
     __ li(R30, offset);
     __ stxvd2x(as_VectorSRegister(reg_num), R30, R1_SP);
 
+    // RegisterMap::pd_location only uses the first VMReg for each VectorRegister.
     if (generate_oop_map) {
       map->set_callee_saved(VMRegImpl::stack2reg(offset>>2),
                             RegisterSaver_LiveVSRegs[i].vmreg);
@@ -528,10 +529,14 @@ void RegisterSaver::restore_argument_registers_and_pop_frame(MacroAssembler*masm
 }
 
 // Restore the registers that might be holding a result.
-void RegisterSaver::restore_result_registers(MacroAssembler* masm, int frame_size_in_bytes) {
+void RegisterSaver::restore_result_registers(MacroAssembler* masm, int frame_size_in_bytes, bool save_vectors) {
   const int regstosave_num       = sizeof(RegisterSaver_LiveRegs) /
                                    sizeof(RegisterSaver::LiveRegType);
-  const int register_save_size   = regstosave_num * reg_size; // VS registers not relevant here.
+  const int vecregstosave_num    = save_vectors ? (sizeof(RegisterSaver_LiveVSRegs) /
+                                                   sizeof(RegisterSaver::LiveRegType))
+                                                : 0;
+  const int register_save_size   = regstosave_num * reg_size + vecregstosave_num * vs_reg_size;
+
   const int register_save_offset = frame_size_in_bytes - register_save_size;
 
   // restore all result registers (ints and floats)
@@ -560,7 +565,7 @@ void RegisterSaver::restore_result_registers(MacroAssembler* masm, int frame_siz
     offset += reg_size;
   }
 
-  assert(offset == frame_size_in_bytes, "consistency check");
+  assert(offset == frame_size_in_bytes - (save_vectors ? vecregstosave_num * vs_reg_size : 0), "consistency check");
 }
 
 // Is vector's size (in bytes) bigger than a size saved by default?
@@ -2984,7 +2989,8 @@ void SharedRuntime::generate_deopt_blob() {
                                                                    &first_frame_size_in_bytes,
                                                                    /*generate_oop_map=*/ true,
                                                                    return_pc_adjustment_no_exception,
-                                                                   RegisterSaver::return_pc_is_lr);
+                                                                   RegisterSaver::return_pc_is_lr,
+                                                                   /*save_vectors*/ SuperwordUseVSX);
   assert(map != nullptr, "OopMap must have been created");
 
   __ li(exec_mode_reg, Deoptimization::Unpack_deopt);
@@ -3019,7 +3025,8 @@ void SharedRuntime::generate_deopt_blob() {
                                                              &first_frame_size_in_bytes,
                                                              /*generate_oop_map=*/ false,
                                                              /*return_pc_adjustment_exception=*/ 0,
-                                                             RegisterSaver::return_pc_is_pre_saved);
+                                                             RegisterSaver::return_pc_is_pre_saved,
+                                                             /*save_vectors*/ SuperwordUseVSX);
 
   // Deopt during an exception. Save exec mode for unpack_frames.
   __ li(exec_mode_reg, Deoptimization::Unpack_exception);
@@ -3037,7 +3044,8 @@ void SharedRuntime::generate_deopt_blob() {
                                                              &first_frame_size_in_bytes,
                                                              /*generate_oop_map=*/ false,
                                                              /*return_pc_adjustment_reexecute=*/ 0,
-                                                             RegisterSaver::return_pc_is_pre_saved);
+                                                             RegisterSaver::return_pc_is_pre_saved,
+                                                             /*save_vectors*/ SuperwordUseVSX);
   __ li(exec_mode_reg, Deoptimization::Unpack_reexecute);
 #endif
 
@@ -3063,7 +3071,7 @@ void SharedRuntime::generate_deopt_blob() {
 
   // Restore only the result registers that have been saved
   // by save_volatile_registers(...).
-  RegisterSaver::restore_result_registers(masm, first_frame_size_in_bytes);
+  RegisterSaver::restore_result_registers(masm, first_frame_size_in_bytes, /*save_vectors*/ SuperwordUseVSX);
 
   // reload the exec mode from the UnrollBlock (it might have changed)
   __ lwz(exec_mode_reg, in_bytes(Deoptimization::UnrollBlock::unpack_kind_offset()), unroll_block_reg);
diff --git a/src/hotspot/cpu/ppc/vm_version_ppc.cpp b/src/hotspot/cpu/ppc/vm_version_ppc.cpp
index e5037482c447..0543885a4752 100644
--- a/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+++ b/src/hotspot/cpu/ppc/vm_version_ppc.cpp
@@ -26,6 +26,7 @@
 #include "precompiled.hpp"
 #include "asm/assembler.inline.hpp"
 #include "asm/macroAssembler.inline.hpp"
+#include "compiler/compilerDefinitions.inline.hpp"
 #include "compiler/disassembler.hpp"
 #include "jvm.h"
 #include "memory/resourceArea.hpp"
@@ -130,7 +131,7 @@ void VM_Version::initialize() {
   }
 
   if (PowerArchitecturePPC64 >= 8) {
-    if (FLAG_IS_DEFAULT(SuperwordUseVSX)) {
+    if (FLAG_IS_DEFAULT(SuperwordUseVSX) && CompilerConfig::is_c2_enabled()) {
       FLAG_SET_ERGO(SuperwordUseVSX, true);
     }
   } else {
diff --git a/test/hotspot/jtreg/compiler/vectorapi/TestVectorReallocation.java b/test/hotspot/jtreg/compiler/vectorapi/TestVectorReallocation.java
new file mode 100644
index 000000000000..6b21b693d1ed
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/vectorapi/TestVectorReallocation.java
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 2026 SAP SE. 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.
+ *
+ */
+
+package compiler.vectorapi;
+
+import java.util.Arrays;
+
+import compiler.lib.ir_framework.*;
+
+import jdk.incubator.vector.ByteVector;
+import jdk.incubator.vector.ShortVector;
+import jdk.incubator.vector.IntVector;
+import jdk.incubator.vector.LongVector;
+import jdk.incubator.vector.FloatVector;
+import jdk.incubator.vector.DoubleVector;
+import jdk.incubator.vector.VectorSpecies;
+
+import static jdk.test.lib.Asserts.*;
+
+/**
+ * @test
+ * @bug 8380565
+ * @library /test/lib /
+ * @summary Test deoptimization involving vector reallocation
+ * @modules jdk.incubator.vector
+ * @requires vm.opt.final.MaxVectorSize == null | vm.opt.final.MaxVectorSize >= 16
+ *
+ * @run driver compiler.vectorapi.TestVectorReallocation
+ */
+
+public class TestVectorReallocation {
+
+    private static final VectorSpecies    B_SPECIES = ByteVector.SPECIES_PREFERRED;
+    private static final VectorSpecies   S_SPECIES = ShortVector.SPECIES_PREFERRED;
+    private static final VectorSpecies I_SPECIES = IntVector.SPECIES_PREFERRED;
+    private static final VectorSpecies    L_SPECIES = LongVector.SPECIES_PREFERRED;
+    private static final VectorSpecies   F_SPECIES = FloatVector.SPECIES_PREFERRED;
+    private static final VectorSpecies  D_SPECIES = DoubleVector.SPECIES_PREFERRED;
+    private static final int B_LENGTH = B_SPECIES.length();
+    private static final int S_LENGTH = S_SPECIES.length();
+    private static final int I_LENGTH = I_SPECIES.length();
+    private static final int L_LENGTH = L_SPECIES.length();
+    private static final int F_LENGTH = F_SPECIES.length();
+    private static final int D_LENGTH = D_SPECIES.length();
+
+    // The input arrays for the @Test methods match the length of the preferred species for each type
+    private static byte[]   b_a;
+    private static short[]  s_a;
+    private static int[]    i_a;
+    private static long[]   l_a;
+    private static float[]  f_a;
+    private static double[] d_a;
+
+    // The output arrays for the @Test methods
+    private static byte[]   b_r;
+    private static short[]  s_r;
+    private static int[]    i_r;
+    private static long[]   l_r;
+    private static float[]  f_r;
+    private static double[] d_r;
+
+    public static void main(String[] args) {
+        TestFramework.runWithFlags("--add-modules=jdk.incubator.vector");
+    }
+
+    // The test methods annotated with @Test are warmed up by the framework. The calls are indirect
+    // through the runner methods annotated with @Run. Note that each @Test method has its own instance of
+    // the test class TestVectorReallocation as receiver of the calls.
+    //
+    // The @Test methods just copy the elements of the input array (0, 1, 2, 3, ...) to the output array
+    // by means of a vector add operation. The added value is computed but actually always zero. The
+    // computation is done in a loop with a virtual call that is inlined based on class hierarchy analysis
+    // when the method gets compiled.
+    //
+    // The final call after warmup of the now compiled @Test method is performed concurrently in a second
+    // thread. Before the variable `loopIterations` is set very high such that the loop runs practically
+    // infinitely. While the loop is running, a class with an overridden version of the method `value`
+    // (called in the loop) is loaded. This invalidates the result of the class hierarchy analysis that
+    // there is just one implementation of the method and causes deoptimization where the vector `v0` used
+    // in the @Test method is reallocated from a register to the java heap. Finally it is verified that
+    // input and ouput arrays are equal.
+    //
+    // NB: each @Test needs its own Zero class for the desired result of the class hierarchy analysis.
+
+    volatile boolean enteredLoop;
+    volatile long loopIterations;
+
+    void sharedRunner(RunInfo runInfo, Runnable test, Runnable loadOverridingClass, Runnable verify) {
+        enteredLoop = false;
+        if (runInfo.isWarmUp()) {
+            loopIterations = 100;
+            test.run();
+        } else {
+            loopIterations = 1L << 60; // basically infinite
+            Thread t = Thread.ofPlatform().start(test);
+            waitUntilLoopEntered();
+            loadOverridingClass.run(); // invalidates inlining causing deoptimization/reallocation of v0
+            loopIterations = 0;
+            waitUntilLoopLeft();
+            joinThread(t);
+            verify.run();              // verify that input and ouput arrays are equal
+        }
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    // byte
+
+    static class ByteZero {
+        volatile byte zero;
+        byte value() {
+            return zero;
+        }
+    }
+    volatile ByteZero byteZero = new ByteZero();
+
+    @Run(test = "byteIdentityWithReallocation")
+    void byteIdentityWithReallocation_runner(RunInfo runInfo) {
+        sharedRunner(runInfo, () -> byteIdentityWithReallocation(), () -> {
+            // Loading the class with the overridden method will cause deoptimization and reallocation of v0
+            byteZero = new ByteZero() {
+                    @Override
+                    byte value() {
+                        return super.value(); // override but doing the same
+                    }
+                };
+            },
+            () -> assertTrue(Arrays.equals(b_a, b_r), "Input/Output arrays differ"));
+    }
+
+    @Test
+    @IR(counts = {IRNode.ADD_VB, " >0 "})
+    void byteIdentityWithReallocation() {
+        ByteVector v0 = ByteVector.fromArray(B_SPECIES, b_a, 0);
+        byte zeroSum = 0;
+        enteredLoop = true;
+        for (long i = 0; i < loopIterations; i++) {
+            zeroSum += byteZero.value(); // inlined based on class hierarchy analysis
+        }
+        v0.add(zeroSum).intoArray(b_r, 0);
+        enteredLoop = false;
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    // short
+
+    static class ShortZero {
+        volatile short zero;
+        short value() {
+            return zero;
+        }
+    }
+    volatile ShortZero shortZero = new ShortZero();
+
+    @Run(test = "shortIdentityWithReallocation")
+    void shortIdentityWithReallocation_runner(RunInfo runInfo) {
+        sharedRunner(runInfo, () -> shortIdentityWithReallocation(), () -> {
+            // Loading the class with the overridden method will cause deoptimization and reallocation of v0
+            shortZero = new ShortZero() {
+                    @Override
+                    short value() {
+                        return super.value(); // override but doing the same
+                    }
+                };
+            },
+            () -> assertTrue(Arrays.equals(s_a, s_r), "Input/Output arrays differ"));
+    }
+
+    @Test
+    @IR(counts = {IRNode.ADD_VS, " >0 "})
+    void shortIdentityWithReallocation() {
+        ShortVector v0 = ShortVector.fromArray(S_SPECIES, s_a, 0);
+        short zeroSum = 0;
+        enteredLoop = true;
+        for (long i = 0; i < loopIterations; i++) {
+            zeroSum += shortZero.value(); // inlined based on class hierarchy analysis
+        }
+        v0.add(zeroSum).intoArray(s_r, 0);
+        enteredLoop = false;
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    // int
+
+    static class IntZero {
+        volatile int zero;
+        int value() {
+            return zero;
+        }
+    }
+    volatile IntZero intZero = new IntZero();
+
+    @Run(test = "intIdentityWithReallocation")
+    void intIdentityWithReallocation_runner(RunInfo runInfo) {
+        sharedRunner(runInfo, () -> intIdentityWithReallocation(), () -> {
+            // Loading the class with the overridden method will cause deoptimization and reallocation of v0
+            intZero = new IntZero() {
+                    @Override
+                    int value() {
+                        return super.value(); // override but doing the same
+                    }
+                };
+            },
+            () -> assertTrue(Arrays.equals(i_a, i_r), "Input/Output arrays differ"));
+    }
+
+    @Test
+    @IR(counts = {IRNode.ADD_VI, " >0 "})
+    void intIdentityWithReallocation() {
+        IntVector v0 = IntVector.fromArray(I_SPECIES, i_a, 0);
+        int zeroSum = 0;
+        enteredLoop = true;
+        for (long i = 0; i < loopIterations; i++) {
+            zeroSum += intZero.value(); // inlined based on class hierarchy analysis
+        }
+        v0.add(zeroSum).intoArray(i_r, 0);
+        enteredLoop = false;
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    // long
+
+    static class LongZero {
+        volatile long zero;
+        long value() {
+            return zero;
+        }
+    }
+    volatile LongZero longZero = new LongZero();
+
+    @Run(test = "longIdentityWithReallocation")
+    void longIdentityWithReallocation_runner(RunInfo runInfo) {
+        sharedRunner(runInfo, () -> longIdentityWithReallocation(), () -> {
+            // Loading the class with the overridden method will cause deoptimization and reallocation of v0
+            longZero = new LongZero() {
+                    @Override
+                    long value() {
+                        return super.value(); // override but doing the same
+                    }
+                };
+            },
+            () -> assertTrue(Arrays.equals(l_a, l_r), "Input/Output arrays differ"));
+    }
+
+    @Test
+    @IR(counts = {IRNode.ADD_VL, " >0 "})
+    void longIdentityWithReallocation() {
+        LongVector v0 = LongVector.fromArray(L_SPECIES, l_a, 0);
+        long zeroSum = 0;
+        enteredLoop = true;
+        for (long i = 0; i < loopIterations; i++) {
+            zeroSum += longZero.value(); // inlined based on class hierarchy analysis
+        }
+        v0.add(zeroSum).intoArray(l_r, 0);
+        enteredLoop = false;
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    // float
+
+    static class FloatZero {
+        volatile float zero;
+        float value() {
+            return zero;
+        }
+    }
+    volatile FloatZero floatZero = new FloatZero();
+
+    @Run(test = "floatIdentityWithReallocation")
+    void floatIdentityWithReallocation_runner(RunInfo runInfo) {
+        sharedRunner(runInfo, () -> floatIdentityWithReallocation(), () -> {
+            // Loading the class with the overridden method will cause deoptimization and reallocation of v0
+            floatZero = new FloatZero() {
+                    @Override
+                    float value() {
+                        return super.value(); // override but doing the same
+                    }
+                };
+            },
+            () -> assertTrue(Arrays.equals(f_a, f_r), "Input/Output arrays differ"));
+    }
+
+    @Test
+    @IR(counts = {IRNode.ADD_VF, IRNode.VECTOR_SIZE_ANY, " >0 "})
+    void floatIdentityWithReallocation() {
+        FloatVector v0 = FloatVector.fromArray(F_SPECIES, f_a, 0);
+        float zeroSum = 0;
+        enteredLoop = true;
+        for (long i = 0; i < loopIterations; i++) {
+            zeroSum += floatZero.value(); // inlined based on class hierarchy analysis
+        }
+        v0.add(zeroSum).intoArray(f_r, 0);
+        enteredLoop = false;
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    // double
+
+    static class DoubleZero {
+        volatile double zero;
+        double value() {
+            return zero;
+        }
+    }
+    volatile DoubleZero doubleZero = new DoubleZero();
+
+    @Run(test = "doubleIdentityWithReallocation")
+    void doubleIdentityWithReallocation_runner(RunInfo runInfo) {
+        sharedRunner(runInfo, () -> doubleIdentityWithReallocation(), () -> {
+            // Loading the class with the overridden method will cause deoptimization and reallocation of v0
+            doubleZero = new DoubleZero() {
+                    @Override
+                    double value() {
+                        return super.value(); // override but doing the same
+                    }
+                };
+            },
+            () -> assertTrue(Arrays.equals(d_a, d_r), "Input/Output arrays differ"));
+    }
+
+    @Test
+    @IR(counts = {IRNode.ADD_VD, IRNode.VECTOR_SIZE_ANY, " >0 "})
+    void doubleIdentityWithReallocation() {
+        DoubleVector v0 = DoubleVector.fromArray(D_SPECIES, d_a, 0);
+        double zeroSum = 0;
+        enteredLoop = true;
+        for (long i = 0; i < loopIterations; i++) {
+            zeroSum += doubleZero.value(); // inlined based on class hierarchy analysis
+        }
+        v0.add(zeroSum).intoArray(d_r, 0);
+        enteredLoop = false;
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+
+    private void waitUntilLoopEntered() {
+        while (!enteredLoop) {
+            sleep(10);
+        }
+    }
+
+    private void waitUntilLoopLeft() {
+        while (enteredLoop) {
+            sleep(10);
+        }
+    }
+
+    private static void sleep(int ms) {
+        try {
+            Thread.sleep(ms);
+        } catch (InterruptedException e) { /* ignore */ }
+    }
+
+    private static void joinThread(Thread t) {
+        try {
+            t.join();
+        } catch (InterruptedException e) { /* ignore */ }
+    }
+
+    static {
+        b_a = new byte[B_LENGTH];
+        s_a = new short[S_LENGTH];
+        i_a = new int[I_LENGTH];
+        l_a = new long[L_LENGTH];
+        f_a = new float[F_LENGTH];
+        d_a = new double[D_LENGTH];
+
+        b_r = new byte[B_LENGTH];
+        s_r = new short[S_LENGTH];
+        i_r = new int[I_LENGTH];
+        l_r = new long[L_LENGTH];
+        f_r = new float[F_LENGTH];
+        d_r = new double[D_LENGTH];
+
+        for (int i = 0; i < b_a.length ; i++) {
+            b_a[i] = (byte)i;
+        }
+        for (int i = 0; i < s_a.length ; i++) {
+            s_a[i] = (short)i;
+        }
+        for (int i = 0; i < i_a.length ; i++) {
+            i_a[i] = i;
+        }
+        for (int i = 0; i < l_a.length ; i++) {
+            l_a[i] = i;
+        }
+        for (int i = 0; i < f_a.length ; i++) {
+            f_a[i] = i;
+        }
+        for (int i = 0; i < d_a.length ; i++) {
+            d_a[i] = i;
+        }
+    }
+}

From d858b0c7f18751bedc6a51a4db07e8ce773aa0e0 Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Thu, 23 Apr 2026 13:17:43 +0000
Subject: [PATCH 209/223] 8338103: Stabilize and open source a Swing OGL
 ButtonResizeTest

Backport-of: 3d49fb8a17ceec6e23595bc8affc89765899f72b
---
 .../SwingButtonResizeTestWithOpenGL.java      | 352 ++++++++++++++++++
 1 file changed, 352 insertions(+)
 create mode 100644 test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java

diff --git a/test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java b/test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java
new file mode 100644
index 000000000000..96ef9edc5710
--- /dev/null
+++ b/test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 2015, 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.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.Raster;
+import java.io.File;
+import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.imageio.ImageIO;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+/*
+ * @test
+ * @bug 8338103
+ * @key headful
+ * @summary Verifies that the OpenGL pipeline does not create artifacts
+ * with swing components after window is zoomed to maximum size and then
+ * resized back to normal. The test case simulates this operation using
+ * a JButton. A file image of the component will be saved before and after
+ * the window resize if the test fails. The test passes if both the button
+ * images are the same.
+ * @run main/othervm -Dsun.java2d.opengl=true -Dsun.java2d.opengl.fbobject=false SwingButtonResizeTestWithOpenGL
+ * @run main/othervm -Dsun.java2d.opengl=true -Dsun.java2d.opengl.fbobject=true SwingButtonResizeTestWithOpenGL
+ * @run main/othervm -Dsun.java2d.opengl=false SwingButtonResizeTestWithOpenGL
+ * @run main/othervm SwingButtonResizeTestWithOpenGL
+ */
+/*
+ * @test
+ * @key headful
+ * @requires (os.family == "windows")
+ * @run main/othervm -Dsun.java2d.d3d=false SwingButtonResizeTestWithOpenGL
+ * @run main/othervm -Dsun.java2d.d3d=true SwingButtonResizeTestWithOpenGL
+ */
+/*
+ * @test
+ * @key headful
+ * @requires (os.family == "linux")
+ * @run main/othervm -Dsun.java2d.xrender=false SwingButtonResizeTestWithOpenGL
+ * @run main/othervm -Dsun.java2d.xrender=true SwingButtonResizeTestWithOpenGL
+ */
+/*
+ * @test
+ * @key headful
+ * @requires (os.family == "mac")
+ * @run main/othervm -Dsun.java2d.metal=false SwingButtonResizeTestWithOpenGL
+ * @run main/othervm -Dsun.java2d.metal=true SwingButtonResizeTestWithOpenGL
+ */
+public class SwingButtonResizeTestWithOpenGL {
+    private static Robot robot;
+    private static CountDownLatch focusGainedLatch;
+    private JFrame frame;
+    private JButton button;
+
+    public SwingButtonResizeTestWithOpenGL() {
+
+        try {
+            SwingUtilities.invokeAndWait(() -> createGUI());
+        } catch (Exception e) {
+            throw new RuntimeException("Problems creating GUI");
+        }
+    }
+
+    private void createGUI() {
+        frame = new JFrame("SwingButtonResizeTestWithOpenGL");
+        button = new JButton("Button A");
+        frame.setLocation(200, 200);
+        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+        button.setPreferredSize(new Dimension(300, 300));
+        button.addFocusListener(new FocusAdapter() {
+            public void focusGained(FocusEvent fe) {
+                focusGainedLatch.countDown();
+            }
+        });
+        frame.getContentPane().setLayout(new FlowLayout());
+        frame.getContentPane().add(button);
+        frame.pack();
+        frame.setVisible(true);
+        frame.toFront();
+    }
+
+    public static void main(String[] args) throws Exception {
+        focusGainedLatch = new CountDownLatch(1);
+        SwingButtonResizeTestWithOpenGL test =
+                new SwingButtonResizeTestWithOpenGL();
+        test.runTest();
+    }
+
+    public void runTest() throws Exception {
+        BufferedImage bimage1;
+        BufferedImage bimage2;
+
+        try {
+            robot = new Robot();
+            robot.setAutoWaitForIdle(true);
+            robot.setAutoDelay(200);
+
+            if (focusGainedLatch.await(3, TimeUnit.SECONDS)) {
+                System.out.println("Button focus gained...");
+            } else {
+                System.out.println("Button focus not gained...");
+                throw new RuntimeException(
+                        "Can't gain focus on button even after waiting " +
+                        "too long..");
+            }
+
+            System.out.println("Getting initial button image..image1");
+            bimage1 = getButtonImage();
+
+            // some platforms may not support maximize frame
+            if (frame.getToolkit().isFrameStateSupported(
+                    JFrame.MAXIMIZED_BOTH)) {
+                robot.waitForIdle();
+                // maximize frame from normal size
+                frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
+                System.out.println("Frame is maximized");
+                robot.waitForIdle();
+
+                if (frame.getToolkit().isFrameStateSupported(JFrame.NORMAL)) {
+                    System.out.println("Frame is back to normal");
+                    // resize from maximum size to normal
+                    frame.setExtendedState(JFrame.NORMAL);
+
+                    // capture image of JButton after resize
+                    System.out.println(
+                            "Getting image of JButton after resize..image2");
+                    bimage2 = getButtonImage();
+
+                    // compare button images from before and after frame resize
+                    DiffImage di = new DiffImage(bimage1.getWidth(),
+                                                 bimage1.getHeight());
+                    System.out.println(
+                            "Taking the diff of two images, image1 and image2");
+                    if (!di.compare(bimage1, bimage2)) {
+                        throw new RuntimeException(
+                                "Button renderings are different after window "
+                                + "resize, num of Diff Pixels="
+                                + di.getNumDiffPixels());
+                    } else {
+                        System.out.println("Test passed...");
+                    }
+
+                } else {
+                    System.out.println(
+                            "Test skipped: JFrame.NORMAL resize is " +
+                            "not supported");
+                }
+
+            } else {
+                System.out.println(
+                        "Test skipped: JFrame.MAXIMIZED_BOTH resize is " +
+                        "not supported");
+            }
+        } finally {
+            SwingUtilities.invokeAndWait(() -> disposeFrame());
+        }
+    }
+
+    // Capture button rendering as a BufferedImage
+    private BufferedImage getButtonImage() {
+        try {
+            robot.waitForIdle();
+            robot.delay(500);
+
+            AtomicReference buttonLocRef = new AtomicReference<>();
+            SwingUtilities.invokeAndWait(
+                    () -> buttonLocRef.set(button.getLocationOnScreen()));
+            Point buttonLoc = buttonLocRef.get();
+            System.out.println("Button loc: " + buttonLoc);
+            return robot.createScreenCapture(
+                    new Rectangle(buttonLoc.x, buttonLoc.y, button.getWidth(),
+                                  button.getHeight()));
+        } catch (Exception e) {
+            throw new RuntimeException(
+                    "Problems capturing button image from Robot", e);
+        }
+    }
+
+    private void disposeFrame() {
+        if (frame != null) {
+            frame.dispose();
+            frame = null;
+        }
+    }
+
+    // Save BufferedImage to PNG file
+    private void saveButtonImage(BufferedImage image, File file) {
+        if (image != null) {
+            try {
+                System.out.println(
+                        "Saving button image to " + file.getAbsolutePath());
+                ImageIO.write(image, "PNG", file);
+            } catch (Exception e) {
+                throw new RuntimeException("Could not write image file");
+            }
+        } else {
+            throw new RuntimeException("BufferedImage was set to null");
+        }
+    }
+
+    private class DiffImage extends BufferedImage {
+
+        public boolean diff = false;
+        public int nDiff = -1;
+
+        Color bgColor;
+
+        int threshold = 0;
+
+        public DiffImage(int w, int h) {
+            super(w, h, BufferedImage.TYPE_INT_ARGB);
+            bgColor = Color.LIGHT_GRAY;
+        }
+
+        public int getNumDiffPixels() {
+            return nDiff;
+        }
+
+        public boolean compare(BufferedImage img1, BufferedImage img2)
+                throws IOException {
+
+            int minx1 = img1.getMinX();
+            int minx2 = img2.getMinX();
+            int miny1 = img1.getMinY();
+            int miny2 = img2.getMinY();
+
+            int w1 = img1.getWidth();
+            int w2 = img2.getWidth();
+            int h1 = img1.getHeight();
+            int h2 = img2.getHeight();
+
+            if ((minx1 != minx2) || (miny1 != miny2) || (w1 != w2)
+                || (h1 != h2)) {
+                // image sizes are different
+                throw new RuntimeException(
+                        "img1: <" + minx1 + "," + miny1 + "," + w1 + "x" + h1
+                        + ">" + " img2: " + minx2 + "," + miny2 + "," + w2 + "x"
+                        + h2 + ">" + " are different sizes");
+            }
+            // Get the actual data behind the images
+            Raster ras1 = img1.getData();
+            Raster ras2 = img2.getData();
+
+            ColorModel cm1 = img1.getColorModel();
+            ColorModel cm2 = img2.getColorModel();
+
+            int r1, r2;  // red
+            int g1, g2;  // green
+            int b1, b2;  // blue
+
+            Object o1 = null;
+            Object o2 = null;
+            nDiff = 0;
+            for (int x = minx1; x < (minx1 + w1); x++) {
+                for (int y = miny1; y < (miny1 + h1); y++) {
+                    // Causes rasters to allocate data
+                    o1 = ras1.getDataElements(x, y, o1);
+                    // and we reuse the data on every loop
+                    o2 = ras2.getDataElements(x, y, o2);
+
+                    r1 = cm1.getRed(o1);
+                    r2 = cm2.getRed(o2);
+                    g1 = cm1.getGreen(o1);
+                    g2 = cm2.getGreen(o2);
+                    b1 = cm1.getBlue(o1);
+                    b2 = cm2.getBlue(o2);
+
+                    int redAbs = Math.abs(r1 - r2);
+                    int greenAbs = Math.abs(g1 - g2);
+                    int blueAbs = Math.abs(b1 - b2);
+                    if ((redAbs > threshold)
+                        || (greenAbs > threshold)
+                        || (blueAbs > threshold)) {
+                        // pixel is different
+                        setDiffPixel(x, y, redAbs, greenAbs, blueAbs);
+                        nDiff++;
+                    } else {
+                        setSamePixel(x, y);
+                    }
+
+                }
+            }
+            if (nDiff != 0) {
+                ImageIO.write(this, "png",
+                              new File("diffImage.png"));
+                saveButtonImage(img1, new File("image1.png"));
+                saveButtonImage(img2, new File("image2.png"));
+            }
+            return nDiff == 0;
+        }
+
+        void setDiffPixel(int x, int y, int r, int g, int b) {
+            diff = true;
+            setPixelValue(x, y, 255, r, g, b);
+        }
+
+        void setSamePixel(int x, int y) {
+            if (bgColor != null) {
+                setPixelValue(x, y, 255, bgColor.getRed(),
+                              bgColor.getGreen(),
+                              bgColor.getBlue());
+            } else {
+                setPixelValue(x, y, 255, Color.black.getRed(),
+                              Color.black.getGreen(), Color.black.getBlue());
+            }
+        }
+
+        void setPixelValue(int x, int y, int a, int r, int g, int b) {
+            // setRGB uses BufferedImage.TYPE_INT_ARGB format
+            int pixel =
+                    ((a & 0xff) << 24) + ((r & 0xff) << 16) + ((g & 0xff) << 8)
+                    + ((b & 0xff));
+            setRGB(x, y, pixel);
+        }
+
+    }
+
+}
+
+

From 0f72d345087ca8fb881656576b179c495cc6a28c Mon Sep 17 00:00:00 2001
From: Roland Mesde 
Date: Thu, 23 Apr 2026 13:37:29 +0000
Subject: [PATCH 210/223] 8339233: Test
 javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java#id failed: Button
 renderings are different after window resize

Backport-of: b8d560b6cd9ea35c747487017107a6caeacf8a98
---
 .../JButton/SwingButtonResizeTestWithOpenGL.java   | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java b/test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java
index 96ef9edc5710..5b21c07f71e3 100644
--- a/test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java
+++ b/test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java
@@ -99,6 +99,7 @@ private void createGUI() {
         frame.setLocation(200, 200);
         frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
         button.setPreferredSize(new Dimension(300, 300));
+        button.setFocusPainted(false);
         button.addFocusListener(new FocusAdapter() {
             public void focusGained(FocusEvent fe) {
                 focusGainedLatch.countDown();
@@ -124,9 +125,8 @@ public void runTest() throws Exception {
 
         try {
             robot = new Robot();
-            robot.setAutoWaitForIdle(true);
-            robot.setAutoDelay(200);
-
+            robot.waitForIdle();
+            robot.delay(1000);
             if (focusGainedLatch.await(3, TimeUnit.SECONDS)) {
                 System.out.println("Button focus gained...");
             } else {
@@ -142,17 +142,18 @@ public void runTest() throws Exception {
             // some platforms may not support maximize frame
             if (frame.getToolkit().isFrameStateSupported(
                     JFrame.MAXIMIZED_BOTH)) {
-                robot.waitForIdle();
                 // maximize frame from normal size
                 frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
                 System.out.println("Frame is maximized");
                 robot.waitForIdle();
+                robot.delay(100);
 
                 if (frame.getToolkit().isFrameStateSupported(JFrame.NORMAL)) {
                     System.out.println("Frame is back to normal");
                     // resize from maximum size to normal
                     frame.setExtendedState(JFrame.NORMAL);
-
+                    robot.waitForIdle();
+                    robot.delay(100);
                     // capture image of JButton after resize
                     System.out.println(
                             "Getting image of JButton after resize..image2");
@@ -209,9 +210,8 @@ private BufferedImage getButtonImage() {
     }
 
     private void disposeFrame() {
-        if (frame != null) {
+        if(frame != null) {
             frame.dispose();
-            frame = null;
         }
     }
 

From 63a0797c28cbe07c1b77edba32e0bb247d9aae27 Mon Sep 17 00:00:00 2001
From: Arno Zeller 
Date: Thu, 23 Apr 2026 13:43:43 +0000
Subject: [PATCH 211/223] 8382018:
 test/jdk/java/nio/file/spi/SetDefaultProvider.java leaves a directory in /tmp

Reviewed-by: phh
Backport-of: 1e2b0d2b67c7ae0843c9adbc641471040fbe7d71
---
 test/jdk/java/nio/file/spi/m/p/Main.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/jdk/java/nio/file/spi/m/p/Main.java b/test/jdk/java/nio/file/spi/m/p/Main.java
index 4704c6790216..9f80d08347c4 100644
--- a/test/jdk/java/nio/file/spi/m/p/Main.java
+++ b/test/jdk/java/nio/file/spi/m/p/Main.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, 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
@@ -41,7 +41,7 @@ public static void main(String[] args) throws Exception {
             throw new RuntimeException("FileSystemProvider not overridden");
 
         // exercise the file system
-        Path dir = Files.createTempDirectory("tmp");
+        Path dir = Files.createTempDirectory(Path.of(""), "tmp");
         if (dir.getFileSystem() != fs)
             throw new RuntimeException("'dir' not in default file system");
         System.out.println("created: " + dir);

From 675381f82440bc1509eb6b01fd22c19bfb657779 Mon Sep 17 00:00:00 2001
From: Arno Zeller 
Date: Mon, 27 Apr 2026 06:22:51 +0000
Subject: [PATCH 212/223] 8383185: [21u] Backport of JDK-8382925 causes test
 failure in SetDefaultProvider

Reviewed-by: goetz
---
 test/jdk/java/nio/file/spi/fs.policy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/jdk/java/nio/file/spi/fs.policy b/test/jdk/java/nio/file/spi/fs.policy
index 15032c70ba8d..0dcfe8b2789a 100644
--- a/test/jdk/java/nio/file/spi/fs.policy
+++ b/test/jdk/java/nio/file/spi/fs.policy
@@ -1,3 +1,3 @@
 grant codeBase "file:${test.classes}${/}-" {
-    permission java.io.FilePermission "${java.io.tmpdir}${/}-", "write";
+    permission java.io.FilePermission "${user.dir}${/}-", "write";
 };

From d1d2f252d0476648ee4cc29c6e2a900da4c1270e Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Mon, 27 Apr 2026 06:24:56 +0000
Subject: [PATCH 213/223] 8382242: JFR: Metadata reconstruction invalidates
 ConstantMap for java.lang.String

Backport-of: ca643010a27292b99c6f2182764bc7cd4ac93b02
---
 .../jfr/internal/consumer/ParserFactory.java  |   9 +-
 ...aReconstructionWithRetainedStringPool.java | 106 ++++++++++++++++++
 2 files changed, 112 insertions(+), 3 deletions(-)
 create mode 100644 test/jdk/jdk/jfr/api/consumer/streaming/TestMetadataReconstructionWithRetainedStringPool.java

diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ParserFactory.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ParserFactory.java
index e7dd234ca8d0..c973dadb3b7f 100644
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ParserFactory.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ParserFactory.java
@@ -132,9 +132,12 @@ private Parser createPrimitiveParser(Type type, boolean event) throws IOExceptio
             case "short" -> new ShortParser();
             case "byte" ->  new ByteParser();
             case "java.lang.String" -> {
-                ConstantMap pool = new ConstantMap(ObjectFactory.create(type, timeConverter), type);
-                ConstantLookup lookup = new ConstantLookup(pool, type);
-                constantLookups.put(type.getId(), lookup);
+                ConstantLookup lookup = constantLookups.get(type.getId());
+                if (lookup == null) {
+                    ConstantMap pool = new ConstantMap(ObjectFactory.create(type, timeConverter), type);
+                    lookup = new ConstantLookup(pool, type);
+                    constantLookups.put(type.getId(), lookup);
+                }
                 yield new StringParser(lookup, event);
             }
             default ->  throw new IOException("Unknown primitive type " + type.getName());
diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestMetadataReconstructionWithRetainedStringPool.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestMetadataReconstructionWithRetainedStringPool.java
new file mode 100644
index 000000000000..8bbadc6db290
--- /dev/null
+++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestMetadataReconstructionWithRetainedStringPool.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2026, 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.
+ */
+
+package jdk.jfr.api.consumer.streaming;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.CountDownLatch;
+
+import jdk.jfr.Event;
+import jdk.jfr.consumer.RecordingStream;
+
+/**
+ * @test
+ * @summary Test that it is possible to register new metadata in a new segment while retaining the string pool.
+ * @requires vm.flagless
+ * @requires vm.hasJFR
+ * @library /test/lib
+ * @run main/othervm jdk.jfr.api.consumer.streaming.TestMetadataReconstructionWithRetainedStringPool
+ */
+public class TestMetadataReconstructionWithRetainedStringPool {
+    /// Minimum string length required to trigger StringPool usage.
+    /// Mirrors `jdk.jfr.internal.StringPool.MIN_LIMIT`.
+    private static final int STRING_POOL_MIN_LIMIT = 16;
+    private static final int EXPECTED_EVENTS = 3;
+
+    // Condition 1: String length > STRING_POOL_MIN_LIMIT triggers CONSTANT_POOL encoding.
+    private static final String TEXT = "a".repeat(STRING_POOL_MIN_LIMIT + 1);;
+
+    static final class EventA extends Event {
+        String text = TEXT;
+    }
+
+    static final class EventB extends Event {
+        String text = TEXT;
+    }
+
+    public static void main(String... args) throws InterruptedException {
+        var aEventsPosted = new CountDownLatch(1);
+        var readyToPostEventB = new CountDownLatch(1);
+        var remaining = new CountDownLatch(EXPECTED_EVENTS);
+
+        try (var rs = new RecordingStream()) {
+            rs.onEvent(e -> {
+                String textValue = e.getValue("text");
+                if (textValue == null) {
+                    throw new RuntimeException("e.getValue(\"text\") returned null");
+                }
+                remaining.countDown();
+                System.out.printf("Event #%d [%s]: text=%s%n",
+                        EXPECTED_EVENTS - remaining.getCount(),
+                        e.getEventType().getName(),
+                        textValue);
+            });
+
+            rs.onFlush(() -> {
+                if (aEventsPosted.getCount() == 0) {
+                    readyToPostEventB.countDown();
+                }
+            });
+
+            rs.startAsync();
+
+            // Condition 2: Two distinct event types are required.
+            //              First, load EventA as the initial event type and emit its first event.
+            //              This first event looks into the StringPool pre-cache. Although the
+            //              string length qualifies for pooling, because it isn't pre-cached,
+            //              the first event encodes the string inline.
+            //              The second event finds the string in the pre-cache and adds it to the
+            //              pool. A constant pool ID to the pooled string is encoded in the event.
+            //
+            new EventA().commit();
+            new EventA().commit();
+            aEventsPosted.countDown();
+
+            // Condition 3: Wait for JFR flush.
+            //              The default flush period is ~1 second.
+            readyToPostEventB.await();
+
+            // Load the second event type, EventB, AFTER the flush segment containing the two events of type EventA.
+            // A new metadata description will be constructed, and we verify that the StringPool added in the previous
+            // segment is still available for the EventB string pool reference to be resolved correctly.
+            new EventB().commit();
+            remaining.await();
+        }
+    }
+}

From 5631eeb76f8832ef5ab6df8cae7c60420ff1e887 Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Tue, 28 Apr 2026 09:03:22 +0000
Subject: [PATCH 214/223] 8340818: Add a new jtreg test root to test the
 generated documentation 8344128: Regression: make help broken after
 JDK-8340818

Reviewed-by: mbaesken
Backport-of: 07f550b85a3910edd28d8761e2adfb8d6a1352f6
---
 make/Global.gmk                       |  1 +
 make/InitSupport.gmk                  |  2 +-
 make/Main.gmk                         | 10 +++---
 make/RunTests.gmk                     |  3 ++
 make/common/FindTests.gmk             |  4 +--
 make/conf/jib-profiles.js             | 39 +++++++++++++-------
 test/docs/ProblemList.txt             | 41 +++++++++++++++++++++
 test/docs/TEST.ROOT                   | 51 +++++++++++++++++++++++++++
 test/docs/TEST.groups                 | 29 +++++++++++++++
 test/docs/jdk/javadoc/TestDocs.java   | 44 +++++++++++++++++++++++
 test/docs/tools/tester/DocTester.java | 47 ++++++++++++++++++++++++
 11 files changed, 251 insertions(+), 20 deletions(-)
 create mode 100644 test/docs/ProblemList.txt
 create mode 100644 test/docs/TEST.ROOT
 create mode 100644 test/docs/TEST.groups
 create mode 100644 test/docs/jdk/javadoc/TestDocs.java
 create mode 100644 test/docs/tools/tester/DocTester.java

diff --git a/make/Global.gmk b/make/Global.gmk
index e5e76b475b94..fae21f0b4280 100644
--- a/make/Global.gmk
+++ b/make/Global.gmk
@@ -103,6 +103,7 @@ help:
 	$(info $(_)                        # method is 'auto', 'ignore' or 'fail' (default))
 	$(info $(_) TEST="test1 ..."       # Use the given test descriptor(s) for testing, e.g.)
 	$(info $(_)                        # make test TEST="jdk_lang gtest:all")
+	$(info $(_) TEST_DEPS="dependency1 ..." # Specify additional dependencies for running tests, e.g docs-jdk)
 	$(info $(_) JTREG="OPT1=x;OPT2=y"  # Control the JTREG test harness, use 'help' to list)
 	$(info $(_) GTEST="OPT1=x;OPT2=y"  # Control the GTEST test harness, use 'help' to list)
 	$(info $(_) MICRO="OPT1=x;OPT2=y"  # Control the MICRO test harness, use 'help' to list)
diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk
index 31c80e2f7267..e38f9e105475 100644
--- a/make/InitSupport.gmk
+++ b/make/InitSupport.gmk
@@ -50,7 +50,7 @@ ifeq ($(HAS_SPEC),)
 
   # Make control variables, handled by Init.gmk
   INIT_CONTROL_VARIABLES += LOG CONF CONF_NAME SPEC JOBS TEST_JOBS CONF_CHECK \
-      COMPARE_BUILD JTREG GTEST MICRO TEST_OPTS TEST_VM_OPTS
+      COMPARE_BUILD JTREG GTEST MICRO TEST_OPTS TEST_VM_OPTS TEST_DEPS
 
   # All known make control variables
   MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER SPEC_FILTER
diff --git a/make/Main.gmk b/make/Main.gmk
index dd2a8e42f281..c028da6615d2 100644
--- a/make/Main.gmk
+++ b/make/Main.gmk
@@ -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
@@ -774,13 +774,13 @@ $(eval $(call SetupTarget, build-microbenchmark, \
 $(eval $(call SetupTarget, test, \
     MAKEFILE := RunTests, \
     ARGS := TEST="$(TEST)", \
-    DEPS := jdk-image test-image, \
+    DEPS := jdk-image test-image $(TEST_DEPS), \
 ))
 
 $(eval $(call SetupTarget, exploded-test, \
     MAKEFILE := RunTests, \
     ARGS := TEST="$(TEST)" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR), \
-    DEPS := exploded-image test-image, \
+    DEPS := exploded-image test-image $(TEST_DEPS), \
 ))
 
 ifeq ($(JCOV_ENABLED), true)
@@ -1061,8 +1061,8 @@ else
   test-make-compile-commands: compile-commands
 
   # Declare dependency for all generated test targets
-  $(foreach t, $(filter-out test-make%, $(ALL_TEST_TARGETS)), $(eval $t: jdk-image test-image))
-  $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image))
+  $(foreach t, $(filter-out test-make%, $(ALL_TEST_TARGETS)), $(eval $t: jdk-image test-image $(TEST_DEPS)))
+  $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image $(TEST_DEPS)))
 
   interim-image: $(INTERIM_JMOD_TARGETS)
 
diff --git a/make/RunTests.gmk b/make/RunTests.gmk
index b490f9f77489..f61125f53315 100644
--- a/make/RunTests.gmk
+++ b/make/RunTests.gmk
@@ -263,6 +263,7 @@ jaxp_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jaxp/ProblemList.txt
 langtools_JTREG_PROBLEM_LIST += $(TOPDIR)/test/langtools/ProblemList.txt
 hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt
 lib-test_JTREG_PROBLEM_LIST += $(TOPDIR)/test/lib-test/ProblemList.txt
+docs_JTREG_PROBLEM_LIST += $(TOPDIR)/test/docs/ProblemList.txt
 
 ################################################################################
 # Parse test selection
@@ -866,6 +867,8 @@ define SetupRunJtregTestBody
 
   $1_JTREG_BASIC_OPTIONS += -e:TEST_IMAGE_DIR=$(TEST_IMAGE_DIR)
 
+  $1_JTREG_BASIC_OPTIONS += -e:DOCS_JDK_IMAGE_DIR=$$(DOCS_JDK_IMAGE_DIR)
+
   ifneq ($$(JTREG_FAILURE_HANDLER_OPTIONS), )
     $1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)"
   endif
diff --git a/make/common/FindTests.gmk b/make/common/FindTests.gmk
index b12630349c0d..5bdce82efa3c 100644
--- a/make/common/FindTests.gmk
+++ b/make/common/FindTests.gmk
@@ -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
@@ -43,7 +43,7 @@ $(eval $(call IncludeCustomExtension, common/FindTests.gmk))
 TEST_BASEDIRS += $(TOPDIR)/test $(TOPDIR)
 
 # JTREG_TESTROOTS might have been set by a custom extension
-JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools jaxp lib-test)
+JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools jaxp lib-test docs)
 
 # Extract the names of the Jtreg group files from the TEST.ROOT files. The
 # TEST.ROOT files being properties files can be interpreted as makefiles so
diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js
index 62559c10c8b1..1aa445d88e9b 100644
--- a/make/conf/jib-profiles.js
+++ b/make/conf/jib-profiles.js
@@ -952,7 +952,7 @@ var getJibProfilesProfiles = function (input, common, data) {
 
     // Profiles used to run tests using Jib for internal dependencies.
     var testedProfile = input.testedProfile;
-    if (testedProfile == null) {
+    if (testedProfile == null || testedProfile == "docs") {
         testedProfile = input.build_os + "-" + input.build_cpu;
     }
     var testedProfileJdk = testedProfile + ".jdk";
@@ -994,25 +994,38 @@ var getJibProfilesProfiles = function (input, common, data) {
         testOnlyProfilesPrebuilt["run-test-prebuilt"]["dependencies"].push(testedProfile + ".jdk_symbols");
     }
 
+    var testOnlyProfilesPrebuiltDocs = {
+        "run-test-prebuilt-docs": clone(testOnlyProfilesPrebuilt["run-test-prebuilt"])
+    };
+
+    testOnlyProfilesPrebuiltDocs["run-test-prebuilt-docs"].dependencies.push("docs.doc_api_spec", "tidy");
+    testOnlyProfilesPrebuiltDocs["run-test-prebuilt-docs"].environment["DOCS_JDK_IMAGE_DIR"]
+        = input.get("docs.doc_api_spec", "install_path");
+    testOnlyProfilesPrebuiltDocs["run-test-prebuilt-docs"].environment["TIDY"]
+        = input.get("tidy", "home_path") + "/bin/tidy";
+    testOnlyProfilesPrebuiltDocs["run-test-prebuilt-docs"].labels = "test-docs";
+
     // If actually running the run-test-prebuilt profile, verify that the input
     // variable is valid and if so, add the appropriate target_* values from
     // the tested profile. Use testImageProfile value as backup.
-    if (input.profile == "run-test-prebuilt") {
+    if (input.profile == "run-test-prebuilt" || input.profile == "run-test-prebuilt-docs") {
         if (profiles[testedProfile] == null && profiles[testImageProfile] == null) {
             error("testedProfile is not defined: " + testedProfile + " " + testImageProfile);
         }
     }
-    if (profiles[testedProfile] != null) {
-        testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_os"]
-            = profiles[testedProfile]["target_os"];
-        testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_cpu"]
-            = profiles[testedProfile]["target_cpu"];
-    } else if (profiles[testImageProfile] != null) {
-        testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_os"]
-            = profiles[testImageProfile]["target_os"];
-        testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_cpu"]
-            = profiles[testImageProfile]["target_cpu"];
+    function updateProfileTargets(profiles, testedProfile, testImageProfile, targetProfile, runTestProfile) {
+        var profileToCheck = profiles[testedProfile] || profiles[testImageProfile];
+
+        if (profileToCheck != null) {
+            targetProfile[runTestProfile]["target_os"] = profileToCheck["target_os"];
+            targetProfile[runTestProfile]["target_cpu"] = profileToCheck["target_cpu"];
+        }
     }
+
+    updateProfileTargets(profiles, testedProfile, testImageProfile, testOnlyProfilesPrebuilt, "run-test-prebuilt");
+    updateProfileTargets(profiles, testedProfile, testImageProfile, testOnlyProfilesPrebuiltDocs, "run-test-prebuilt-docs");
+
+    profiles = concatObjects(profiles, testOnlyProfilesPrebuiltDocs);
     profiles = concatObjects(profiles, testOnlyProfilesPrebuilt);
 
     // On macosx add the devkit bin dir to the path in all the run-test profiles.
@@ -1062,6 +1075,8 @@ var getJibProfilesProfiles = function (input, common, data) {
         }
         profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"],
             runTestPrebuiltSrcFullExtra);
+        profiles["run-test-prebuilt-docs"] = concatObjects(profiles["run-test-prebuilt-docs"],
+            runTestPrebuiltSrcFullExtra);
     }
 
     // Generate the missing platform attributes
diff --git a/test/docs/ProblemList.txt b/test/docs/ProblemList.txt
new file mode 100644
index 000000000000..914ae21d49fa
--- /dev/null
+++ b/test/docs/ProblemList.txt
@@ -0,0 +1,41 @@
+###########################################################################
+#
+# 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.
+#
+###########################################################################
+
+#############################################################################
+#
+# List of quarantined tests -- tests that should not be run by default, because
+# they may fail due to known reason. The reason (CR#) must be mandatory specified.
+#
+# List items are testnames followed by labels, all MUST BE commented
+#   as to why they are here and use a label:
+#     generic-all   Problems on all platforms
+#     generic-ARCH  Where ARCH is one of: x64, i586, ppc64, ppc64le, s390x etc.
+#     OSNAME-all    Where OSNAME is one of: linux, windows, macosx, aix
+#     OSNAME-ARCH   Specific on to one OSNAME and ARCH, e.g. macosx-x64
+#     OSNAME-REV    Specific on to one OSNAME and REV, e.g. macosx-10.7.4
+#
+# More than one label is allowed but must be on the same line.
+#
+#############################################################################
diff --git a/test/docs/TEST.ROOT b/test/docs/TEST.ROOT
new file mode 100644
index 000000000000..af2e58967795
--- /dev/null
+++ b/test/docs/TEST.ROOT
@@ -0,0 +1,51 @@
+#
+# 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.
+#
+
+#
+
+# This file identifies the root of the test-suite hierarchy.
+# It also contains test-suite configuration information.
+
+# The list of keywords supported in the entire test suite.  The
+# "intermittent" keyword marks tests known to fail intermittently.
+# The "randomness" keyword marks tests using randomness with test
+# cases differing from run to run. (A test using a fixed random seed
+# would not count as "randomness" by this definition.) Extra care
+# should be taken to handle test failures of intermittent or
+# randomness tests.
+
+# Group definitions
+groups=TEST.groups
+
+# Minimum jtreg version
+requiredVersion=7.4+1
+
+# Use new module options
+useNewOptions=true
+
+# Use --patch-module instead of -Xmodule:
+useNewPatchModule=true
+
+# Path to libraries in the topmost test directory. This is needed so @library
+# does not need ../../ notation to reach them
+external.lib.roots = ../../
diff --git a/test/docs/TEST.groups b/test/docs/TEST.groups
new file mode 100644
index 000000000000..e7c2215dc695
--- /dev/null
+++ b/test/docs/TEST.groups
@@ -0,0 +1,29 @@
+#  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.
+#
+
+# Docs-specific test groups
+
+docs_all = \
+    /
+
+tier2 = \
+    :docs_all
diff --git a/test/docs/jdk/javadoc/TestDocs.java b/test/docs/jdk/javadoc/TestDocs.java
new file mode 100644
index 000000000000..3ccd89ab2e05
--- /dev/null
+++ b/test/docs/jdk/javadoc/TestDocs.java
@@ -0,0 +1,44 @@
+/*
+ * 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 ../../tools/tester
+ * @build jtreg.SkippedException
+ * @summary example of a test on the generated documentation
+ * @run main TestDocs
+ */
+
+import java.nio.file.Files;
+
+public class TestDocs {
+    public static void main(String... args) throws Exception {
+        var docs = DocTester.resolveDocs();
+        System.err.println("Path to the docs is: " + docs);
+        System.err.println("Do docs exits?");
+        System.err.println(Files.exists(docs));
+        System.err.println("tidy location");
+        System.err.println(System.getProperty("tidy"));
+        System.err.println("End of test");
+    }
+}
diff --git a/test/docs/tools/tester/DocTester.java b/test/docs/tools/tester/DocTester.java
new file mode 100644
index 000000000000..11364ce9f4f5
--- /dev/null
+++ b/test/docs/tools/tester/DocTester.java
@@ -0,0 +1,47 @@
+/*
+ * 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 jtreg.SkippedException;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+/**
+ * Test framework for performing tests on the generated documentation.
+ */
+public class DocTester {
+    private final static String DIR = System.getenv("DOCS_JDK_IMAGE_DIR");
+    private static final Path firstCandidate = Path.of(System.getProperty("test.jdk"))
+            .getParent().resolve("docs");
+
+    public static Path resolveDocs() {
+        if (DIR != null && !DIR.isBlank() && Files.exists(Path.of(DIR))) {
+            return Path.of(DIR);
+        } else if (Files.exists(firstCandidate)) {
+            return firstCandidate;
+        }else {
+            throw new SkippedException("docs folder not found in either location");
+        }
+    }
+}

From 4b5596a58ac7648946962e450feb5f9bdb3e2ad3 Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier 
Date: Tue, 28 Apr 2026 09:05:53 +0000
Subject: [PATCH 215/223] 8352020: [CompileFramework] enable compilation for
 VectorAPI

Backport-of: 3ed010ab7cf5b8c9bf8fa000e88ea95285351982
---
 .../lib/compile_framework/Compile.java        | 14 ++-
 .../compile_framework/CompileFramework.java   |  7 +-
 .../IRFrameworkWithVectorAPIExample.java      | 90 +++++++++++++++++++
 3 files changed, 105 insertions(+), 6 deletions(-)
 create mode 100644 test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/IRFrameworkWithVectorAPIExample.java

diff --git a/test/hotspot/jtreg/compiler/lib/compile_framework/Compile.java b/test/hotspot/jtreg/compiler/lib/compile_framework/Compile.java
index b69258e4a18f..e7f9b949a6d1 100644
--- a/test/hotspot/jtreg/compiler/lib/compile_framework/Compile.java
+++ b/test/hotspot/jtreg/compiler/lib/compile_framework/Compile.java
@@ -30,6 +30,7 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.concurrent.TimeUnit;
 import java.util.List;
 import jdk.test.lib.JDKToolFinder;
@@ -48,7 +49,7 @@ class Compile {
      * Compile all sources in {@code javaSources}. First write them to the {@code sourceDir},
      * then compile them to class-files which are stored in {@code classesDir}.
      */
-    public static void compileJavaSources(List javaSources, Path sourceDir, Path classesDir) {
+    public static void compileJavaSources(List javaSources, Path sourceDir, Path classesDir, String[] javacFlags) {
         if (javaSources.isEmpty()) {
             Utils.printlnVerbose("No java sources to compile.");
             return;
@@ -56,7 +57,7 @@ public static void compileJavaSources(List javaSources, Path sourceD
         Utils.printlnVerbose("Compiling Java sources: " + javaSources.size());
 
         List javaFilePaths = writeSourcesToFiles(javaSources, sourceDir);
-        compileJavaFiles(javaFilePaths, classesDir);
+        compileJavaFiles(javaFilePaths, classesDir, javacFlags);
         Utils.printlnVerbose("Java sources compiled.");
     }
 
@@ -64,10 +65,13 @@ public static void compileJavaSources(List javaSources, Path sourceD
      * Compile a list of files (i.e. {@code paths}) using javac and store
      * them in {@code classesDir}.
      */
-    private static void compileJavaFiles(List paths, Path classesDir) {
+    private static void compileJavaFiles(List paths, Path classesDir, String[] javacFlags) {
         List command = new ArrayList<>();
 
         command.add(JAVAC_PATH);
+        if (javacFlags != null) {
+            command.addAll(Arrays.asList(javacFlags));
+        }
         command.add("-classpath");
         // Note: the backslashes from windows paths must be escaped!
         command.add(Utils.getEscapedClassPathAndClassesDir(classesDir));
@@ -194,8 +198,10 @@ private static void executeCompileCommand(List command) {
             throw new CompileFrameworkException("InterruptedException during compilation", e);
         }
 
-        if (exitCode != 0 || !output.isEmpty()) {
+        // Note: the output can be non-empty even if the compilation succeeds, e.g. for warnings.
+        if (exitCode != 0) {
             System.err.println("Compilation failed.");
+            System.err.println("Command: " + command);
             System.err.println("Exit code: " + exitCode);
             System.err.println("Output: '" + output + "'");
             throw new CompileFrameworkException("Compilation failed.");
diff --git a/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFramework.java b/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFramework.java
index fe23d596f3c6..b86d30ab5280 100644
--- a/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFramework.java
+++ b/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFramework.java
@@ -71,8 +71,11 @@ public void addJasmSourceCode(String className, String code) {
      * Compile all sources: store the sources to the {@link sourceDir} directory, compile
      * Java and Jasm sources and store the generated class-files in the {@link classesDir}
      * directory.
+     *
+     * @param javacFlags: optional, list of additional flags for javac, e.g. to make modules
+     *                    visible.
      */
-    public void compile() {
+    public void compile(String... javacFlags) {
         if (classLoader != null) {
             throw new CompileFrameworkException("Cannot compile twice!");
         }
@@ -86,7 +89,7 @@ public void compile() {
         System.out.println("Classes directory: " + classesDir);
 
         Compile.compileJasmSources(jasmSources, sourceDir, classesDir);
-        Compile.compileJavaSources(javaSources, sourceDir, classesDir);
+        Compile.compileJavaSources(javaSources, sourceDir, classesDir, javacFlags);
         classLoader = ClassLoaderBuilder.build(classesDir);
     }
 
diff --git a/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/IRFrameworkWithVectorAPIExample.java b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/IRFrameworkWithVectorAPIExample.java
new file mode 100644
index 000000000000..7e1f289792b5
--- /dev/null
+++ b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/IRFrameworkWithVectorAPIExample.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2025, 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
+ * @summary Example test to use the Compile Framework together with the IR Framework (i.e. TestFramework),
+ *          and the VectorAPI.
+ * @modules java.base/jdk.internal.misc
+ * @modules jdk.incubator.vector
+ * @library /test/lib /
+ * @compile ../../../compiler/lib/ir_framework/TestFramework.java
+ * @run driver compile_framework.examples.IRFrameworkWithVectorAPIExample
+ */
+
+package compile_framework.examples;
+
+import compiler.lib.compile_framework.*;
+import jdk.test.lib.Utils;
+import jdk.incubator.vector.IntVector;
+import jdk.test.lib.Platform;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * This test shows that the IR verification can be done on code compiled by the Compile Framework.
+ * The "@compile" command for JTREG is required so that the IRFramework is compiled, other javac
+ * might not compile it because it is not present in the class, only in the dynamically compiled
+ * code.
+ * 

+ * Additionally, we must set the classpath for the Test-VM, so that it has access to all compiled + * classes (see {@link CompileFramework#getEscapedClassPathOfCompiledClasses}). + */ +public class IRFrameworkWithVectorAPIExample { + + public static void main(String[] args) { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Add a java source file. + comp.addJavaSourceCode("InnerTest", generateInnerTest(comp)); + + // Compile the source file. "javac" needs to know that it is ok to compile with the + // VectorAPI module. + comp.compile("--add-modules=jdk.incubator.vector"); + + // InnerTest.main(); + comp.invoke("InnerTest", "main", new Object[] {null}); + } + + // Generate a source java file as String + public static String generateInnerTest(CompileFramework comp) { + return String.format(""" + import compiler.lib.ir_framework.*; + import jdk.incubator.vector.*; + + public class InnerTest { + public static void main(String args[]) { + TestFramework framework = new TestFramework(InnerTest.class); + // Also the TestFramework must allow the test VM to see the VectorAPI module. + framework.addFlags("-classpath", "%s", "--add-modules=jdk.incubator.vector"); + framework.start(); + } + + @Test + static Object test() { + return IntVector.broadcast(IntVector.SPECIES_64, 42); + } + } + """, comp.getEscapedClassPathOfCompiledClasses()); + } +} From 4caf45365eba197100940f36b37a60b71ad02df9 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Wed, 29 Apr 2026 09:35:38 +0000 Subject: [PATCH 216/223] 8374322: TestMemoryWithSubgroups.java fails Permission denied Backport-of: 18ac17236f29367ef2ee502436560e1832e28013 --- .../docker/TestMemoryWithSubgroups.java | 74 +++++++------------ 1 file changed, 28 insertions(+), 46 deletions(-) diff --git a/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java b/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java index fe976291c8a0..f449008bf44e 100644 --- a/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java +++ b/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java @@ -64,66 +64,48 @@ public static void main(String[] args) throws Exception { Common.prepareWhiteBox(); DockerTestUtils.buildJdkContainerImage(imageName); - if ("cgroupv1".equals(metrics.getProvider())) { - try { - testMemoryLimitSubgroupV1("200m", "100m", "104857600", false); - testMemoryLimitSubgroupV1("1g", "500m", "524288000", false); - testMemoryLimitSubgroupV1("200m", "100m", "104857600", true); - testMemoryLimitSubgroupV1("1g", "500m", "524288000", true); - } finally { - DockerTestUtils.removeDockerImage(imageName); - } - } else if ("cgroupv2".equals(metrics.getProvider())) { - try { - testMemoryLimitSubgroupV2("200m", "100m", "104857600", false); - testMemoryLimitSubgroupV2("1g", "500m", "524288000", false); - testMemoryLimitSubgroupV2("200m", "100m", "104857600", true); - testMemoryLimitSubgroupV2("1g", "500m", "524288000", true); - } finally { - DockerTestUtils.removeDockerImage(imageName); - } - } else { + String provider = metrics.getProvider(); + if (!"cgroupv1".equals(provider) && !"cgroupv2".equals(provider)) { throw new SkippedException("Metrics are from neither cgroup v1 nor v2, skipped for now."); } - } - - private static void testMemoryLimitSubgroupV1(String containerMemorySize, String valueToSet, String expectedValue, boolean privateNamespace) - throws Exception { - - Common.logNewTestCase("Cgroup V1 subgroup memory limit: " + valueToSet); - DockerRunOptions opts = new DockerRunOptions(imageName, "sh", "-c"); - opts.javaOpts = new ArrayList<>(); - opts.appendTestJavaOptions = false; - opts.addDockerOpts("--privileged") - .addDockerOpts("--cgroupns=" + (privateNamespace ? "private" : "host")) - .addDockerOpts("--memory", containerMemorySize); - opts.addClassOptions("mkdir -p /sys/fs/cgroup/memory/test ; " + - "echo " + valueToSet + " > /sys/fs/cgroup/memory/test/memory.limit_in_bytes ; " + - "echo $$ > /sys/fs/cgroup/memory/test/cgroup.procs ; " + - "/jdk/bin/java -Xlog:os+container=trace -version"); - - Common.run(opts) - .shouldMatch("Lowest limit was:.*" + expectedValue); + try { + testMemoryLimitSubgroup(provider, "200m", "100m", "104857600", false); + testMemoryLimitSubgroup(provider, "1g", "500m", "524288000", false); + testMemoryLimitSubgroup(provider, "200m", "100m", "104857600", true); + testMemoryLimitSubgroup(provider, "1g", "500m", "524288000", true); + } finally { + DockerTestUtils.removeDockerImage(imageName); + } } - private static void testMemoryLimitSubgroupV2(String containerMemorySize, String valueToSet, String expectedValue, boolean privateNamespace) + private static void testMemoryLimitSubgroup(String cgroupVersion, String containerMemorySize, + String valueToSet, String expectedValue, boolean privateNamespace) throws Exception { - Common.logNewTestCase("Cgroup V2 subgroup memory limit: " + valueToSet); + final String upperVersion = "cgroupv1".equals(cgroupVersion) ? "V1" : "V2"; + Common.logNewTestCase("Cgroup " + upperVersion + " subgroup memory limit: " + valueToSet); DockerRunOptions opts = new DockerRunOptions(imageName, "sh", "-c"); opts.javaOpts = new ArrayList<>(); opts.appendTestJavaOptions = false; opts.addDockerOpts("--privileged") + .addDockerOpts("--user", "root") .addDockerOpts("--cgroupns=" + (privateNamespace ? "private" : "host")) .addDockerOpts("--memory", containerMemorySize); - opts.addClassOptions("mkdir -p /sys/fs/cgroup/memory/test ; " + - "echo $$ > /sys/fs/cgroup/memory/test/cgroup.procs ; " + - "echo '+memory' > /sys/fs/cgroup/cgroup.subtree_control ; " + - "echo '+memory' > /sys/fs/cgroup/memory/cgroup.subtree_control ; " + - "echo " + valueToSet + " > /sys/fs/cgroup/memory/test/memory.max ; " + - "/jdk/bin/java -Xlog:os+container=trace -version"); + if ("cgroupv1".equals(cgroupVersion)) { + opts.addClassOptions("mkdir -p /sys/fs/cgroup/memory/test ; " + + "echo " + valueToSet + " > /sys/fs/cgroup/memory/test/memory.limit_in_bytes ; " + + "echo $$ > /sys/fs/cgroup/memory/test/cgroup.procs ; " + + "/jdk/bin/java -Xlog:os+container=trace -version"); + } else { + opts.addClassOptions("mkdir -p /sys/fs/cgroup/memory/test ; " + + "echo $$ > /sys/fs/cgroup/memory/test/cgroup.procs ; " + + "echo '+memory' > /sys/fs/cgroup/cgroup.subtree_control ; " + + "echo '+memory' > /sys/fs/cgroup/memory/cgroup.subtree_control ; " + + "echo " + valueToSet + " > /sys/fs/cgroup/memory/test/memory.max ; " + + "/jdk/bin/java -Xlog:os+container=trace -version"); + } Common.run(opts) .shouldMatch("Lowest limit was:.*" + expectedValue); From fa1253b464b368d9d3358db6e0d734b3abad85d4 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Wed, 29 Apr 2026 13:26:45 +0000 Subject: [PATCH 217/223] 8366852: java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java test is failing Backport-of: 3db3c06218f37ed4f14d4f53538663d2a5547095 --- test/jdk/ProblemList.txt | 1 - .../ChoiceMouseWheelTest.java | 168 ++++++++++-------- 2 files changed, 92 insertions(+), 77 deletions(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 18f9f0d36dfa..a72f9aecf8fe 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -261,7 +261,6 @@ java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java 8169469,8273617 java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java 8273617 macosx-all java/awt/print/PrinterJob/PSQuestionMark.java 7003378 generic-all java/awt/print/PrinterJob/GlyphPositions.java 7003378 generic-all -java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java 8366852 generic-all java/awt/Component/GetScreenLocTest/GetScreenLocTest.java 4753654 generic-all java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java 8165863 macosx-all java/awt/Clipboard/PasteNullToTextComponentsTest.java 8234140 macosx-all,windows-all diff --git a/test/jdk/java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java b/test/jdk/java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java index 6426a3779108..3a94680b7237 100644 --- a/test/jdk/java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java +++ b/test/jdk/java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, 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 @@ -22,58 +22,66 @@ */ /* - @test - @key headful - @bug 7050935 - @summary closed/java/awt/Choice/WheelEventsConsumed/WheelEventsConsumed.html fails on win32 - @library ../../regtesthelpers - @author Oleg Pekhovskiy: area=awt-choice - @build Util - @run main ChoiceMouseWheelTest -*/ + * @test + * @key headful + * @bug 7050935 + * @summary closed/java/awt/Choice/WheelEventsConsumed/WheelEventsConsumed.html fails on win32 + * @library /java/awt/regtesthelpers + * @build Util + * @run main ChoiceMouseWheelTest + */ import test.java.awt.regtesthelpers.Util; -import java.awt.*; -import java.awt.event.*; +import java.awt.Choice; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; public class ChoiceMouseWheelTest extends Frame { private volatile boolean itemChanged = false; private volatile boolean wheelMoved = false; private volatile boolean frameExited = false; + private final Choice choice; - public static void main(String[] args) { - new ChoiceMouseWheelTest(); + public static void main(String[] args) throws Exception { + ChoiceMouseWheelTest test = Util.invokeOnEDT(ChoiceMouseWheelTest::new); + try { + test.test(); + } finally { + EventQueue.invokeAndWait(test::dispose); + } } ChoiceMouseWheelTest() { super("ChoiceMouseWheelTest"); setLayout(new FlowLayout()); - Choice choice = new Choice(); - addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { - System.exit(0); + e.getWindow().dispose(); } }); - for(Integer i = 0; i < 50; i++) { - choice.add(i.toString()); + choice = new Choice(); + for(int i = 0; i < 50; i++) { + choice.add(Integer.toString(i)); } - choice.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { - itemChanged = true; - } - }); - choice.addMouseWheelListener(new MouseWheelListener() { - public void mouseWheelMoved(MouseWheelEvent e) { - wheelMoved = true; - } - }); + choice.addItemListener(e -> itemChanged = true); + choice.addMouseWheelListener(e -> wheelMoved = true); addMouseListener(new MouseAdapter() { @Override @@ -84,71 +92,79 @@ public void mouseExited(MouseEvent e) { add(choice); setSize(200, 300); + setLocationRelativeTo(null); setVisible(true); toFront(); + } - try { - Robot robot = new Robot(); - robot.setAutoDelay(20); - Util.waitForIdle(robot); + private void test() throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(20); + robot.waitForIdle(); + robot.delay(500); + Rectangle choiceBounds = Util.invokeOnEDT(() -> { Point pt = choice.getLocationOnScreen(); Dimension size = choice.getSize(); - int x = pt.x + size.width / 3; - robot.mouseMove(x, pt.y + size.height / 2); + return new Rectangle(pt, size); + }); + + int x = choiceBounds.x + choiceBounds.width / 3; + robot.mouseMove(x, choiceBounds.y + choiceBounds.height / 2); - // Test mouse wheel over the choice - String name = Toolkit.getDefaultToolkit().getClass().getName(); + // Test mouse wheel over the choice + String name = Toolkit.getDefaultToolkit().getClass().getName(); + boolean isXtoolkit = name.equals("sun.awt.X11.XToolkit"); + boolean isLWCToolkit = name.equals("sun.lwawt.macosx.LWCToolkit"); - // mouse wheel doesn't work for the choice on X11 and Mac, so skip it - if(!name.equals("sun.awt.X11.XToolkit") - && !name.equals("sun.lwawt.macosx.LWCToolkit")) { - robot.mouseWheel(1); - Util.waitForIdle(robot); + // mouse wheel doesn't work for the choice on X11 and Mac, so skip it + if (!isXtoolkit && !isLWCToolkit) { + robot.mouseWheel(1); + robot.waitForIdle(); - if(!wheelMoved || !itemChanged) { - throw new RuntimeException("Mouse Wheel over the choice failed!"); - } + if (!wheelMoved || !itemChanged) { + throw new RuntimeException("Mouse Wheel over the choice failed!"); } + } - // Test mouse wheel over the drop-down list - robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); - Util.waitForIdle(robot); - robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); - Util.waitForIdle(robot); + // Test mouse wheel over the drop-down list + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); - int y = getLocationOnScreen().y + getSize().height; - while(!frameExited && y >= 0) { // move to the bottom of drop-down list - robot.mouseMove(x, --y); - Util.waitForIdle(robot); - } + frameExited = false; - if(x < 0) { - throw new RuntimeException("Could not enter drop-down list!"); - } + Rectangle frameBounds = Util.invokeOnEDT(this::getBounds); - y -= choice.getHeight() / 2; - robot.mouseMove(x, y); // move to the last visible item in the drop-down list - Util.waitForIdle(robot); + int y = frameBounds.y + frameBounds.height; + while (!frameExited && y >= frameBounds.y) { // move to the bottom of drop-down list + robot.mouseMove(x, --y); + robot.waitForIdle(); + } - robot.mouseWheel(choice.getItemCount()); // wheel to the last item - Util.waitForIdle(robot); + if (y < frameBounds.y) { + throw new RuntimeException("Could not enter drop-down list!"); + } - // click the last item - itemChanged = false; - robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); - Util.waitForIdle(robot); - robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); - Util.waitForIdle(robot); + y -= choiceBounds.height / 2; + robot.mouseMove(x, y); // move to the last visible item in the drop-down list + robot.waitForIdle(); - if(!itemChanged || choice.getSelectedIndex() != choice.getItemCount() - 1) { - throw new RuntimeException("Mouse Wheel scroll position error!"); - } + int scrollDirection = isLWCToolkit ? -1 : 1; + // wheel to the last item + robot.mouseWheel(scrollDirection * choice.getItemCount()); + robot.waitForIdle(); - dispose(); - } catch (AWTException e) { - throw new RuntimeException("AWTException occurred - problem creating robot!"); + // click the last item + itemChanged = false; + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + + if (!itemChanged || choice.getSelectedIndex() != choice.getItemCount() - 1) { + throw new RuntimeException("Mouse Wheel scroll position error!"); } } } - From e32014e788abb7517e17547f4338d01959102529 Mon Sep 17 00:00:00 2001 From: Roland Mesde Date: Wed, 29 Apr 2026 13:31:35 +0000 Subject: [PATCH 218/223] 8380222: Refactor test/jdk/java/lang/Character TestNG tests to JUnit Backport-of: 7d805e113948196ac4e45ac05e09413e63b9bb46 --- .../lang/Character/Latin1CaseConversion.java | 47 +++++++++---------- .../UnicodeBlock/NumberEntities.java | 17 +++---- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/test/jdk/java/lang/Character/Latin1CaseConversion.java b/test/jdk/java/lang/Character/Latin1CaseConversion.java index a176bd4b002e..436193c5f168 100644 --- a/test/jdk/java/lang/Character/Latin1CaseConversion.java +++ b/test/jdk/java/lang/Character/Latin1CaseConversion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2026, 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 @@ -21,17 +21,16 @@ * questions. */ -import org.testng.annotations.Test; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; /** * @test * @bug 8302877 * @summary Provides exhaustive verification of Character.toUpperCase and Character.toLowerCase * for all code points in the latin1 range 0-255. - * @run testng Latin1CaseConversion + * @run junit Latin1CaseConversion */ public class Latin1CaseConversion { @@ -44,41 +43,41 @@ public void shouldUpperCaseAndLowerCaseLatin1() { if (c < 0x41) { // Before A assertUnchanged(upper, lower, c); } else if (c <= 0x5A) { // A-Z - assertEquals(upper, c); - assertEquals(lower, c + 32); + assertEquals(c, upper); + assertEquals(c + 32, lower); } else if (c < 0x61) { // Between Z and a assertUnchanged(upper, lower, c); } else if (c <= 0x7A) { // a-z - assertEquals(upper, c - 32); - assertEquals(lower, c); + assertEquals(c - 32, upper); + assertEquals(c, lower); } else if (c < 0xB5) { // Between z and Micro Sign assertUnchanged(upper, lower, c); } else if (c == 0xB5) { // Special case for Micro Sign - assertEquals(upper, 0x39C); - assertEquals(lower, c); + assertEquals(0x39C, upper); + assertEquals(c, lower); } else if (c < 0xC0) { // Between my and A-grave assertUnchanged(upper, lower, c); } else if (c < 0xD7) { // A-grave - O with Diaeresis - assertEquals(upper, c); - assertEquals(lower, c + 32); + assertEquals(c, upper); + assertEquals(c + 32, lower); } else if (c == 0xD7) { // Multiplication assertUnchanged(upper, lower, c); } else if (c <= 0xDE) { // O with slash - Thorn - assertEquals(upper, c); - assertEquals(lower, c + 32); + assertEquals(c, upper); + assertEquals(c + 32, lower); } else if (c == 0xDF) { // Sharp s assertUnchanged(upper, lower, c); } else if (c < 0xF7) { // a-grave - divsion - assertEquals(upper, c - 32); - assertEquals(lower, c); + assertEquals(c - 32, upper); + assertEquals(c, lower); } else if (c == 0xF7) { // Division assertUnchanged(upper, lower, c); } else if (c < 0xFF) { // o with slash - thorn - assertEquals(upper, c - 32); - assertEquals(lower, c); + assertEquals(c - 32, upper); + assertEquals(c, lower); } else if (c == 0XFF) { // Special case for y with Diaeresis - assertEquals(upper, 0x178); - assertEquals(lower, c); + assertEquals(0x178, upper); + assertEquals(c, lower); } else { fail("Uncovered code point: " + Integer.toHexString(c)); } @@ -86,7 +85,7 @@ public void shouldUpperCaseAndLowerCaseLatin1() { } private static void assertUnchanged(int upper, int lower, int c) { - assertEquals(upper, c); - assertEquals(lower, c); + assertEquals(c, upper); + assertEquals(c, lower); } } diff --git a/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java b/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java index 30382c3cfe39..86b9fe6ea692 100644 --- a/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java +++ b/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, 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 @@ -28,17 +28,17 @@ * of Character.UnicodeBlock constants. Also checks the size of * Character.UnicodeScript's "aliases" map. * @modules java.base/java.lang:open - * @run testng NumberEntities + * @run junit NumberEntities */ -import static org.testng.Assert.assertEquals; -import org.testng.annotations.Test; - import java.lang.reflect.Field; import java.util.Map; -@Test +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class NumberEntities { + @Test public void test_UnicodeBlock_NumberEntities() throws Throwable { // The number of entries in Character.UnicodeBlock.map. // See src/java.base/share/classes/java/lang/Character.java @@ -46,13 +46,14 @@ public void test_UnicodeBlock_NumberEntities() throws Throwable { Field m = Character.UnicodeBlock.class.getDeclaredField("map"); n.setAccessible(true); m.setAccessible(true); - assertEquals(((Map)m.get(null)).size(), n.getInt(null)); + assertEquals(n.getInt(null), ((Map)m.get(null)).size()); } + @Test public void test_UnicodeScript_aliases() throws Throwable { // The number of entries in Character.UnicodeScript.aliases. // See src/java.base/share/classes/java/lang/Character.java Field aliases = Character.UnicodeScript.class.getDeclaredField("aliases"); aliases.setAccessible(true); - assertEquals(((Map)aliases.get(null)).size(), Character.UnicodeScript.UNKNOWN.ordinal() + 1); + assertEquals(Character.UnicodeScript.UNKNOWN.ordinal() + 1, ((Map)aliases.get(null)).size()); } } From de66b7fd7ffe4469c9f0df078bf00fa56d9cb9e3 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 30 Apr 2026 12:58:56 +0000 Subject: [PATCH 219/223] 8374888: Implement internal test cache to help UserIterCount test performance Backport-of: 99c2cd01c3f82b37ef7faac38a1b92a083c1ab91 --- .../sun/security/krb5/auto/UserIterCount.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/jdk/sun/security/krb5/auto/UserIterCount.java b/test/jdk/sun/security/krb5/auto/UserIterCount.java index a90da012a061..f972e20ee1e1 100644 --- a/test/jdk/sun/security/krb5/auto/UserIterCount.java +++ b/test/jdk/sun/security/krb5/auto/UserIterCount.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, 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 @@ -30,11 +30,19 @@ * @run main jdk.test.lib.FileInstaller TestHosts TestHosts * @run main/othervm -Djdk.net.hosts.file=TestHosts UserIterCount */ + +import java.util.HashMap; + +import sun.security.krb5.EncryptionKey; +import sun.security.krb5.KrbException; import sun.security.krb5.PrincipalName; public class UserIterCount { static class MyKDC extends OneKDC { + static final HashMap CACHE + = new HashMap<>(); + public MyKDC() throws Exception { super(null); } @@ -51,6 +59,18 @@ protected byte[] getParams(PrincipalName p, int etype) { return super.getParams(p, etype); } } + + @Override + EncryptionKey keyForUser(PrincipalName p, int etype, boolean server) + throws KrbException { + var key = p.toString() + etype + server; + var v = CACHE.get(key); + if (v == null) { + v = super.keyForUser(p, etype, server); + CACHE.put(key, v); + } + return v; + } } public static void main(String[] args) throws Exception { From 03ae80f969306abbb7340e833c90ceac57baf950 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 30 Apr 2026 13:01:53 +0000 Subject: [PATCH 220/223] 8342836: Automatically determine that a test in the docs test root is requested Backport-of: a491564001724da07ecb7d2e4a070c4abbd92cf5 --- make/Main.gmk | 6 +++++- make/MainSupport.gmk | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/make/Main.gmk b/make/Main.gmk index c028da6615d2..f470feb6bfef 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -1293,9 +1293,13 @@ test-hotspot-jtreg-native: test-hotspot_native_sanity test-hotspot-gtest: exploded-test-gtest test-jdk-jtreg-native: test-jdk_native_sanity +# Set dependencies for doc tests +$(eval $(call AddTestDependency, docs_all, docs-jdk)) +test-docs: test-docs_all + ALL_TARGETS += $(RUN_TEST_TARGETS) run-test exploded-run-test check \ test-hotspot-jtreg test-hotspot-jtreg-native test-hotspot-gtest \ - test-jdk-jtreg-native + test-jdk-jtreg-native test-docs ################################################################################ ################################################################################ diff --git a/make/MainSupport.gmk b/make/MainSupport.gmk index 34137c502d4a..aa0bf8f8ac8f 100644 --- a/make/MainSupport.gmk +++ b/make/MainSupport.gmk @@ -132,6 +132,15 @@ define CleanModule $(call Clean-include, $1) endef +define AddTestDependency + test-$(strip $1): $2 + + exploded-test-$(strip $1): $2 + + ifneq ($(filter $(TEST), $1), ) + TEST_DEPS += $2 + endif +endef ################################################################################ From 18d1877d6e8081caebf8eb9f9a89564305b78bfc Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Mon, 4 May 2026 07:43:48 +0000 Subject: [PATCH 221/223] 8382419: Add missed @key randomness after JDK-8370489 Backport-of: e7ee8cd39de1843f4d4e1d7c331846b0460436cd --- .../compiler/loopopts/superword/TestDependencyOffsets.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java index 323da99ad34f..4b543d7fdc13 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2026, 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 @@ -158,6 +158,7 @@ /* * @test id=sse4-v004-A * @bug 8298935 8310308 8312570 + * @key randomness * @summary Test SuperWord: vector size, offsets, dependencies, alignment. * @requires vm.compiler2.enabled * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64") From af282dd1ab622ba90e804d92b8e6895d97dc97ea Mon Sep 17 00:00:00 2001 From: Philippe Marschall Date: Tue, 5 May 2026 05:54:36 +0000 Subject: [PATCH 222/223] 8212084: G1: Implement UseGCOverheadLimit Reviewed-by: phh, rrich --- src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 89 ++++++++++++++--- src/hotspot/share/gc/g1/g1CollectedHeap.hpp | 11 +++ src/hotspot/share/gc/shared/gc_globals.hpp | 2 +- .../jtreg/gc/TestUseGCOverheadLimit.java | 97 +++++++++++++++++++ 4 files changed, 183 insertions(+), 16 deletions(-) create mode 100644 test/hotspot/jtreg/gc/TestUseGCOverheadLimit.java diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index 80d6493963fa..db7b849993d0 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -30,6 +30,7 @@ #include "code/icBuffer.hpp" #include "compiler/oopMap.hpp" #include "gc/g1/g1Allocator.inline.hpp" +#include "gc/g1/g1Analytics.hpp" #include "gc/g1/g1Arguments.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BatchedTask.hpp" @@ -492,6 +493,13 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(uint node_index, size_t word_ gclocker_retry_count += 1; } + // Has the gc overhead limit been reached in the meantime? If so, this mutator + // should receive null even when unsuccessfully scheduling a collection as well + // for global consistency. + if (gc_overhead_limit_exceeded()) { + return nullptr; + } + // We can reach here if we were unsuccessful in scheduling a // collection (because another thread beat us to it) or if we were // stalled due to the GC locker. In either can we should retry the @@ -760,7 +768,12 @@ HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size) { GCLocker::stall_until_clear(); gclocker_retry_count += 1; } - + // Has the gc overhead limit been reached in the meantime? If so, this mutator + // should receive null even when unsuccessfully scheduling a collection as well + // for global consistency. + if (gc_overhead_limit_exceeded()) { + return nullptr; + } // We can reach here if we were unsuccessful in scheduling a // collection (because another thread beat us to it) or if we were @@ -981,27 +994,64 @@ void G1CollectedHeap::resize_heap_if_necessary() { } } +void G1CollectedHeap::update_gc_overhead_counter() { + assert(SafepointSynchronize::is_at_safepoint(), "precondition"); + + if (!UseGCOverheadLimit) { + return; + } + + bool gc_time_over_limit = (_policy->analytics()->long_term_pause_time_ratio() * 100) >= GCTimeLimit; + double free_space_percent = percent_of(num_free_or_available_regions() * HeapRegion::GrainBytes, max_capacity()); + bool free_space_below_limit = free_space_percent < GCHeapFreeLimit; + + log_debug(gc)("GC Overhead Limit: GC Time %f Free Space %f Counter %zu", + (_policy->analytics()->long_term_pause_time_ratio() * 100), + free_space_percent, + _gc_overhead_counter); + + if (gc_time_over_limit && free_space_below_limit) { + _gc_overhead_counter++; + } else { + _gc_overhead_counter = 0; + } +} + +bool G1CollectedHeap::gc_overhead_limit_exceeded() { + return _gc_overhead_counter >= GCOverheadLimitThreshold; +} + HeapWord* G1CollectedHeap::satisfy_failed_allocation_helper(size_t word_size, bool do_gc, bool maximal_compaction, bool expect_null_mutator_alloc_region, bool* gc_succeeded) { *gc_succeeded = true; - // Let's attempt the allocation first. - HeapWord* result = - attempt_allocation_at_safepoint(word_size, - expect_null_mutator_alloc_region); - if (result != nullptr) { - return result; - } + // Skip allocation if GC overhead limit has been exceeded to let the mutator run + // into an OOME. It can either exit "gracefully" or try to free up memory asap. + // For the latter situation, keep running GCs. If the mutator frees up enough + // memory quickly enough, the overhead(s) will go below the threshold(s) again + // and the VM may continue running. + // If we did not continue garbage collections, the (gc overhead) limit may decrease + // enough by itself to not count as exceeding the limit any more, in the worst + // case bouncing back-and-forth all the time. + if (!gc_overhead_limit_exceeded()) { + // Let's attempt the allocation first. + HeapWord* result = + attempt_allocation_at_safepoint(word_size, + expect_null_mutator_alloc_region); + if (result != nullptr) { + return result; + } - // In a G1 heap, we're supposed to keep allocation from failing by - // incremental pauses. Therefore, at least for now, we'll favor - // expansion over collection. (This might change in the future if we can - // do something smarter than full collection to satisfy a failed alloc.) - result = expand_and_allocate(word_size); - if (result != nullptr) { - return result; + // In a G1 heap, we're supposed to keep allocation from failing by + // incremental pauses. Therefore, at least for now, we'll favor + // expansion over collection. (This might change in the future if we can + // do something smarter than full collection to satisfy a failed alloc.) + result = expand_and_allocate(word_size); + if (result != nullptr) { + return result; + } } if (do_gc) { @@ -1025,6 +1075,10 @@ HeapWord* G1CollectedHeap::satisfy_failed_allocation(size_t word_size, bool* succeeded) { assert_at_safepoint_on_vm_thread(); + // Update GC overhead limits after the initial garbage collection leading to this + // allocation attempt. + update_gc_overhead_counter(); + // Attempts to allocate followed by Full GC. HeapWord* result = satisfy_failed_allocation_helper(word_size, @@ -1062,6 +1116,10 @@ HeapWord* G1CollectedHeap::satisfy_failed_allocation(size_t word_size, assert(!soft_ref_policy()->should_clear_all_soft_refs(), "Flag should have been handled and cleared prior to this point"); + if (gc_overhead_limit_exceeded()) { + log_info(gc)("GC Overhead Limit exceeded too often (%zu).", GCOverheadLimitThreshold); + } + // What else? We might try synchronous finalization later. If the total // space available is large enough for the allocation, then a more // complete compaction phase than we've tried so far might be @@ -1230,6 +1288,7 @@ class HumongousRegionSetChecker : public HeapRegionSetChecker { G1CollectedHeap::G1CollectedHeap() : CollectedHeap(), + _gc_overhead_counter(0), _service_thread(nullptr), _periodic_gc_task(nullptr), _free_arena_memory_task(nullptr), diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index bd521c347bf7..de0de0339ec5 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -169,6 +169,17 @@ class G1CollectedHeap : public CollectedHeap { friend class G1CheckRegionAttrTableClosure; private: + // GC Overhead Limit functionality related members. + // + // The goal is to return null for allocations prematurely (before really going + // OOME) in case both GC CPU usage (>= GCTimeLimit) and not much available free + // memory (<= GCHeapFreeLimit) so that applications can exit gracefully or try + // to keep running by easing off memory. + uintx _gc_overhead_counter; // The number of consecutive garbage collections we were over the limits. + + void update_gc_overhead_counter(); + bool gc_overhead_limit_exceeded(); + G1ServiceThread* _service_thread; G1ServiceTask* _periodic_gc_task; G1MonotonicArenaFreeMemoryTask* _free_arena_memory_task; diff --git a/src/hotspot/share/gc/shared/gc_globals.hpp b/src/hotspot/share/gc/shared/gc_globals.hpp index 5d7202685401..98cd6137e985 100644 --- a/src/hotspot/share/gc/shared/gc_globals.hpp +++ b/src/hotspot/share/gc/shared/gc_globals.hpp @@ -477,7 +477,7 @@ "Estimate of footprint other than Java Heap") \ range(0, max_uintx) \ \ - product(bool, UseGCOverheadLimit, true, \ + product(bool, UseGCOverheadLimit, falseInDebug, \ "Use policy to limit of proportion of time spent in GC " \ "before an OutOfMemory error is thrown") \ \ diff --git a/test/hotspot/jtreg/gc/TestUseGCOverheadLimit.java b/test/hotspot/jtreg/gc/TestUseGCOverheadLimit.java new file mode 100644 index 000000000000..de885584afcd --- /dev/null +++ b/test/hotspot/jtreg/gc/TestUseGCOverheadLimit.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2025, 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. + */ + +package gc; + +/* + * @test id=Parallel + * @requires vm.gc.Parallel & false + * @requires !vm.debug + * @summary Verifies that the UseGCOverheadLimit functionality works in Parallel GC. + * @library /test/lib + * @run driver gc.TestUseGCOverheadLimit Parallel + */ + +/* + * @test id=G1 + * @requires vm.gc.G1 + * @requires !vm.debug + * @summary Verifies that the UseGCOverheadLimit functionality works in G1 GC. + * @library /test/lib + * @run driver gc.TestUseGCOverheadLimit G1 + */ + +import java.util.Arrays; +import java.util.stream.Stream; + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class TestUseGCOverheadLimit { + public static void main(String args[]) throws Exception { + String[] parallelArgs = { + "-XX:+UseParallelGC", + "-XX:NewSize=122m", + "-XX:SurvivorRatio=99", + "-XX:GCHeapFreeLimit=10" + }; + String[] g1Args = { + "-XX:+UseG1GC", + "-XX:GCHeapFreeLimit=5" + }; + + String[] selectedArgs = args[0].equals("G1") ? g1Args : parallelArgs; + + final String[] commonArgs = { + "-XX:ParallelGCThreads=1", // Make GCs take longer. + "-XX:+UseGCOverheadLimit", + "-Xlog:gc=debug", + "-XX:GCTimeLimit=90", // Ease the CPU requirement a little. + "-Xmx128m", + Allocating.class.getName() + }; + + String[] vmArgs = Stream.concat(Arrays.stream(selectedArgs), Arrays.stream(commonArgs)).toArray(String[]::new); + OutputAnalyzer output = ProcessTools.executeLimitedTestJava(vmArgs); + output.shouldNotHaveExitValue(0); + + System.out.println(output.getStdout()); + + output.stdoutShouldContain("GC Overhead Limit exceeded too often (5)."); + } + + static class Allocating { + public static void main(String[] args) { + Object[] cache = new Object[1024 * 1024 * 2]; + + // Allocate random objects, keeping around data, causing garbage + // collections. + for (int i = 0; i < 1024* 1024 * 30; i++) { + Object[] obj = new Object[10]; + cache[i % cache.length] = obj; + } + + System.out.println(cache); + } + } +} From 57b3005fc5e8d02ebaa778116ed69af180673c31 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Tue, 5 May 2026 06:07:27 +0000 Subject: [PATCH 223/223] 8371895: Lower GCTimeLimit in TestUseGCOverheadLimit.java Backport-of: eeb7c3f2e8e645938d9db0cf61c1d98d751f2845 --- test/hotspot/jtreg/gc/TestUseGCOverheadLimit.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/gc/TestUseGCOverheadLimit.java b/test/hotspot/jtreg/gc/TestUseGCOverheadLimit.java index de885584afcd..9de4cbf4cfac 100644 --- a/test/hotspot/jtreg/gc/TestUseGCOverheadLimit.java +++ b/test/hotspot/jtreg/gc/TestUseGCOverheadLimit.java @@ -66,7 +66,7 @@ public static void main(String args[]) throws Exception { "-XX:ParallelGCThreads=1", // Make GCs take longer. "-XX:+UseGCOverheadLimit", "-Xlog:gc=debug", - "-XX:GCTimeLimit=90", // Ease the CPU requirement a little. + "-XX:GCTimeLimit=80", // Ease the CPU requirement. "-Xmx128m", Allocating.class.getName() };