diff --git a/bin/idea.sh b/bin/idea.sh index 1ebe9d96c7f..eb37964f396 100644 --- a/bin/idea.sh +++ b/bin/idea.sh @@ -99,7 +99,7 @@ if [ "$VERBOSE" = "true" ] ; then echo "idea template dir: $IDEA_TEMPLATE" fi -cd $TOP ; make idea-gen-config IDEA_OUTPUT=$IDEA_OUTPUT MODULES="$*" $CONF_ARG || exit 1 +cd $TOP ; make idea-gen-config ALLOW=IDEA_OUTPUT,MODULES IDEA_OUTPUT=$IDEA_OUTPUT MODULES="$*" $CONF_ARG || exit 1 cd $SCRIPT_DIR . $IDEA_OUTPUT/env.cfg diff --git a/doc/hotspot-style.html b/doc/hotspot-style.html index 0305bfeca03..9f26fc66362 100644 --- a/doc/hotspot-style.html +++ b/doc/hotspot-style.html @@ -217,10 +217,10 @@

Source Files

should be put in the .hpp file, and not in the .inline.hpp file. This rule exists to resolve problems with circular dependencies between .inline.hpp files.

-
  • All .cpp files include precompiled.hpp as the first include -line.

  • -
  • precompiled.hpp is just a build time optimization, so don't rely -on it to resolve include problems.

  • +
  • Some build configurations use precompiled headers to speed up the +build times. The precompiled headers are included in the precompiled.hpp +file. Note that precompiled.hpp is just a build time optimization, so +don't rely on it to resolve include problems.

  • Keep the include lines alphabetically sorted.

  • Put conditional inclusions (#if ...) at the end of the include list.

  • diff --git a/doc/hotspot-style.md b/doc/hotspot-style.md index f5e59648cb2..01506629817 100644 --- a/doc/hotspot-style.md +++ b/doc/hotspot-style.md @@ -150,10 +150,10 @@ the first include line. Declarations needed by other files should be put in the .hpp file, and not in the .inline.hpp file. This rule exists to resolve problems with circular dependencies between .inline.hpp files. -* All .cpp files include precompiled.hpp as the first include line. - -* precompiled.hpp is just a build time optimization, so don't rely on -it to resolve include problems. +* Some build configurations use precompiled headers to speed up the +build times. The precompiled headers are included in the precompiled.hpp +file. Note that precompiled.hpp is just a build time optimization, so +don't rely on it to resolve include problems. * Keep the include lines alphabetically sorted. diff --git a/make/Global.gmk b/make/Global.gmk index 86487c1c2fc..25753f1ae57 100644 --- a/make/Global.gmk +++ b/make/Global.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2024, 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 @@ -108,6 +108,7 @@ help: $(info $(_) MICRO="OPT1=x;OPT2=y" # Control the MICRO test harness, use 'make test-only MICRO=help' to list) $(info $(_) TEST_OPTS="OPT1=x;..." # Generic control of all test harnesses) $(info $(_) TEST_VM_OPTS="ARG ..." # Same as setting TEST_OPTS to VM_OPTIONS="ARG ...") + $(info $(_) ALLOW="FOO,BAR" # Do not warn that FOO and BAR are non-control variables) $(info ) $(if $(all_confs), $(info Available configurations in $(build_dir):) $(foreach var,$(all_confs),$(info * $(var))), \ $(info No configurations were found in $(build_dir).) $(info Run 'bash configure' to create a configuration.)) diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk index eea593a80db..baee52a888e 100644 --- a/make/InitSupport.gmk +++ b/make/InitSupport.gmk @@ -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 @@ -48,12 +48,15 @@ ifeq ($(HAS_SPEC), ) # from the command-line. ############################################################################## - # 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 TEST_DEPS + # Essential control variables that are handled by Init.gmk + INIT_CONTROL_VARIABLES := LOG CONF CONF_NAME SPEC JOBS CONF_CHECK ALLOW \ + COMPARE_BUILD - # All known make control variables - MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER SPEC_FILTER + # All known make control variables; these are handled in other makefiles + MAKE_CONTROL_VARIABLES += JDK_FILTER SPEC_FILTER \ + TEST TEST_JOBS JTREG GTEST MICRO TEST_OPTS TEST_VM_OPTS TEST_DEPS + + ALL_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) $(MAKE_CONTROL_VARIABLES) # Define a simple reverse function. # Should maybe move to MakeBase.gmk, but we can't include that file now. @@ -87,8 +90,10 @@ ifeq ($(HAS_SPEC), ) command_line_variables := $$(strip $$(foreach var, \ $$(subst \ ,_,$$(MAKEOVERRIDES)), \ $$(firstword $$(subst =, , $$(var))))) + allowed_command_line_variables := $$(strip $$(subst $$(COMMA), , $$(ALLOW))) unknown_command_line_variables := $$(strip \ - $$(filter-out $$(MAKE_CONTROL_VARIABLES), $$(command_line_variables))) + $$(filter-out $$(ALL_CONTROL_VARIABLES) $$(allowed_command_line_variables), \ + $$(command_line_variables))) ifneq ($$(unknown_command_line_variables), ) $$(info Note: Command line contains non-control variables:) $$(foreach var, $$(unknown_command_line_variables), $$(info * $$(var)=$$($$(var)))) @@ -211,13 +216,15 @@ ifeq ($(HAS_SPEC), ) $$(if $$(findstring $$(CONF), $$(var)), $$(var)))) endif ifneq ($$(filter $$(CONF), $$(matching_confs)), ) + ifneq ($$(word 2, $$(matching_confs)), ) + # Don't repeat this output on make restarts caused by including + # generated files. + ifeq ($$(MAKE_RESTARTS), ) + $$(info Using exact match for CONF=$$(CONF) (other matches are possible)) + endif + endif # If we found an exact match, use that matching_confs := $$(CONF) - # Don't repeat this output on make restarts caused by including - # generated files. - ifeq ($$(MAKE_RESTARTS), ) - $$(info Using exact match for CONF=$$(CONF) (other matches are possible)) - endif endif endif ifeq ($$(matching_confs), ) diff --git a/make/RunTests.gmk b/make/RunTests.gmk index 636d1ed18b2..27a3c9b8b45 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -78,6 +78,9 @@ $(eval $(call IncludeCustomExtension, RunTests.gmk)) # This is the JDK that we will test JDK_UNDER_TEST := $(JDK_IMAGE_DIR) +# The JDK used to compile jtreg test code. By default it is the same as +# JDK_UNDER_TEST. +JDK_FOR_COMPILE := $(JDK_IMAGE_DIR) TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support @@ -979,6 +982,7 @@ define SetupRunJtregTestBody $$(JTREG_JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \ -Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \ $$($1_JTREG_BASIC_OPTIONS) \ + -compilejdk:$$(JDK_FOR_COMPILE) \ -testjdk:$$(JDK_UNDER_TEST) \ -dir:$$(JTREG_TOPDIR) \ -reportDir:$$($1_TEST_RESULTS_DIR) \ diff --git a/make/autoconf/basic.m4 b/make/autoconf/basic.m4 index f574174a12e..35eb63bea0c 100644 --- a/make/autoconf/basic.m4 +++ b/make/autoconf/basic.m4 @@ -84,9 +84,15 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS], # We get the top-level directory from the supporting wrappers. BASIC_WINDOWS_VERIFY_DIR($TOPDIR, source) + orig_topdir="$TOPDIR" UTIL_FIXUP_PATH(TOPDIR) AC_MSG_CHECKING([for top-level directory]) AC_MSG_RESULT([$TOPDIR]) + if test "x$TOPDIR" != "x$orig_topdir"; then + AC_MSG_WARN([Your top dir was originally represented as $orig_topdir,]) + AC_MSG_WARN([but after rewriting it became $TOPDIR.]) + AC_MSG_WARN([This typically means you have characters like space in the path, which can cause all kind of trouble.]) + fi AC_SUBST(TOPDIR) if test "x$CUSTOM_ROOT" != x; then diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index 729e508cc26..d0a74cadff3 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -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 @@ -235,9 +235,10 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS], CFLAGS_WARNINGS_ARE_ERRORS="-Werror" # Additional warnings that are not activated by -Wall and -Wextra - WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wreturn-type -Wsign-compare \ - -Wtrampolines -Wundef -Wunused-const-variable=1 -Wunused-function \ - -Wunused-result -Wunused-value -Wtype-limits -Wuninitialized" + WARNINGS_ENABLE_ADDITIONAL="-Winvalid-pch -Wpointer-arith -Wreturn-type \ + -Wsign-compare -Wtrampolines -Wtype-limits -Wundef -Wuninitialized \ + -Wunused-const-variable=1 -Wunused-function -Wunused-result \ + -Wunused-value" WARNINGS_ENABLE_ADDITIONAL_CXX="-Woverloaded-virtual -Wreorder" WARNINGS_ENABLE_ALL_CFLAGS="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL" WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ALL_CFLAGS $WARNINGS_ENABLE_ADDITIONAL_CXX" @@ -277,7 +278,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS], AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS], [ # bounds, memory and behavior checking options - if test "x$TOOLCHAIN_TYPE" = xgcc; then + if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then case $DEBUG_LEVEL in release ) # no adjustment @@ -516,12 +517,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], -fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer" fi - if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then - # clang compiler on aix needs -ffunction-sections - TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -ftls-model -fno-math-errno -fstack-protector" - TOOLCHAIN_CFLAGS_JDK="-ffunction-sections -fsigned-char -fstack-protector" - fi - if test "x$TOOLCHAIN_TYPE" = xgcc; then TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fstack-protector" TOOLCHAIN_CFLAGS_JDK="-fvisibility=hidden -pipe -fstack-protector" @@ -541,7 +536,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], # Restrict the debug information created by Clang to avoid # too big object files and speed the build up a little bit # (see http://llvm.org/bugs/show_bug.cgi?id=7554) - TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info" + TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info -fstack-protector" # In principle the stack alignment below is cpu- and ABI-dependent and # should agree with values of StackAlignmentInBytes in various @@ -559,7 +554,13 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], TOOLCHAIN_CFLAGS_JDK="-pipe" TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX fi - TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -fvisibility=hidden" + + if test "x$OPENJDK_TARGET_OS" = xaix; then + TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -ftls-model -fno-math-errno" + TOOLCHAIN_CFLAGS_JDK="-ffunction-sections -fsigned-char" + fi + + TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -fvisibility=hidden -fstack-protector" elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then # The -utf-8 option sets source and execution character sets to UTF-8 to enable correct @@ -736,6 +737,11 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], # for all archs except arm and ppc, prevent gcc to omit frame pointer $1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer" fi + if test "x$FLAGS_CPU" = xppc64le; then + # Little endian machine uses ELFv2 ABI. + # Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI. + $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -DABI_ELFv2 -mcpu=power8 -mtune=power8" + fi fi if test "x$OPENJDK_TARGET_OS" = xaix; then $1_CFLAGS_CPU="-mcpu=pwr8" diff --git a/make/autoconf/util_paths.m4 b/make/autoconf/util_paths.m4 index 7717150dfd9..9e3e5472c9e 100644 --- a/make/autoconf/util_paths.m4 +++ b/make/autoconf/util_paths.m4 @@ -77,7 +77,10 @@ AC_DEFUN([UTIL_FIXUP_PATH], imported_path="" fi fi - if test "x$imported_path" != "x$path"; then + [ imported_path_lower=`$ECHO $imported_path | $TR '[:upper:]' '[:lower:]'` ] + [ orig_path_lower=`$ECHO $path | $TR '[:upper:]' '[:lower:]'` ] + # If only case differs, keep original path + if test "x$imported_path_lower" != "x$orig_path_lower"; then $1="$imported_path" fi else @@ -357,6 +360,8 @@ AC_DEFUN([UTIL_SETUP_TOOL], fi $1="$tool_command" fi + # Make sure we add fixpath if needed + UTIL_FIXUP_EXECUTABLE($1) if test "x$tool_args" != x; then # If we got arguments, re-append them to the command after the fixup. $1="[$]$1 $tool_args" diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index e6204d2995e..9f04fce2ca6 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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 @@ -1092,9 +1092,9 @@ var getJibProfilesDependencies = function (input, common) { windows_x64: "VS2022-17.6.5+1.0", linux_aarch64: "gcc13.2.0-OL7.6+1.0", linux_arm: "gcc8.2.0-Fedora27+1.0", - linux_ppc64le: "gcc8.2.0-Fedora27+1.0", - linux_s390x: "gcc8.2.0-Fedora27+1.0", - linux_riscv64: "gcc11.3.0-Fedora_rawhide_68692+1.1" + linux_ppc64le: "gcc13.2.0-Fedora_41+1.0", + linux_s390x: "gcc13.2.0-Fedora_41+1.0", + linux_riscv64: "gcc13.2.0-Fedora_41+1.0" }; var devkit_platform = (input.target_cpu == "x86" diff --git a/make/devkit/Tools.gmk b/make/devkit/Tools.gmk index 300501f5f35..249eaa66247 100644 --- a/make/devkit/Tools.gmk +++ b/make/devkit/Tools.gmk @@ -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 @@ -63,18 +63,14 @@ ifeq ($(BASE_OS), OL) LINUX_VERSION := OL6.4 endif else ifeq ($(BASE_OS), Fedora) + DEFAULT_OS_VERSION := 41 + ifeq ($(BASE_OS_VERSION), ) + BASE_OS_VERSION := $(DEFAULT_OS_VERSION) + endif ifeq ($(ARCH), riscv64) - DEFAULT_OS_VERSION := rawhide/68692 - ifeq ($(BASE_OS_VERSION), ) - BASE_OS_VERSION := $(DEFAULT_OS_VERSION) - endif - BASE_URL := http://fedora.riscv.rocks/repos-dist/$(BASE_OS_VERSION)/$(ARCH)/Packages/ + BASE_URL := http://fedora.riscv.rocks/repos-dist/f$(BASE_OS_VERSION)/latest/$(ARCH)/Packages/ else - DEFAULT_OS_VERSION := 27 LATEST_ARCHIVED_OS_VERSION := 35 - ifeq ($(BASE_OS_VERSION), ) - BASE_OS_VERSION := $(DEFAULT_OS_VERSION) - endif ifeq ($(filter x86_64 armhfp, $(ARCH)), ) FEDORA_TYPE := fedora-secondary else @@ -203,7 +199,7 @@ RPM_LIST := \ glibc glibc-headers glibc-devel \ cups-libs cups-devel \ libX11 libX11-devel \ - xorg-x11-proto-devel \ + libxcb xorg-x11-proto-devel \ alsa-lib alsa-lib-devel \ libXext libXext-devel \ libXtst libXtst-devel \ @@ -441,8 +437,9 @@ $(gcc) \ # wants. $(BUILDDIR)/$(binutils_ver)/Makefile : CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS)) -ifneq ($(ARCH), riscv64) - # gold is not available for riscv64 for some reason, +ifeq ($(filter $(ARCH), s390x riscv64 ppc64le), ) + # gold compiles but cannot link properly on s390x @ gcc 13.2 and Fedore 41 + # gold is not available for riscv64 and ppc64le, # and subsequent linking will fail if we try to enable it. LINKER_CONFIG := --enable-gold=default endif diff --git a/make/modules/java.desktop/lib/ClientLibraries.gmk b/make/modules/java.desktop/lib/ClientLibraries.gmk index 41f3040222c..221d7578980 100644 --- a/make/modules/java.desktop/lib/ClientLibraries.gmk +++ b/make/modules/java.desktop/lib/ClientLibraries.gmk @@ -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 @@ -360,8 +360,6 @@ else LIBFONTMANAGER_JDK_LIBS += libfreetype endif -LIBFONTMANAGER_OPTIMIZATION := HIGHEST - ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang), ) # gcc (and to an extent clang) is particularly bad at optimizing these files, # causing a massive spike in compile time. We don't care about these @@ -372,7 +370,6 @@ endif ifeq ($(call isTargetOs, windows), true) LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c X11TextRenderer.c - LIBFONTMANAGER_OPTIMIZATION := HIGHEST else ifeq ($(call isTargetOs, macosx), true) LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c X11TextRenderer.c \ fontpath.c lcdglyph.c @@ -393,7 +390,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \ AccelGlyphCache.c, \ CFLAGS := $(LIBFONTMANAGER_CFLAGS), \ CXXFLAGS := $(LIBFONTMANAGER_CFLAGS), \ - OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \ + OPTIMIZATION := HIGHEST, \ CFLAGS_windows = -DCC_NOEX, \ EXTRA_HEADER_DIRS := $(LIBFONTMANAGER_EXTRA_HEADER_DIRS), \ EXTRA_SRC := $(LIBFONTMANAGER_EXTRA_SRC), \ diff --git a/make/modules/jdk.incubator.vector/Lib.gmk b/make/modules/jdk.incubator.vector/Lib.gmk index 69da7ed059a..7d2ef440b67 100644 --- a/make/modules/jdk.incubator.vector/Lib.gmk +++ b/make/modules/jdk.incubator.vector/Lib.gmk @@ -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 @@ -64,7 +64,7 @@ ifeq ($(call isTargetOs, linux)+$(call isTargetCpu, aarch64)+$(INCLUDE_COMPILER2 EXTRA_SRC := libsleef/generated, \ DISABLED_WARNINGS_gcc := unused-function sign-compare tautological-compare ignored-qualifiers, \ DISABLED_WARNINGS_clang := unused-function sign-compare tautological-compare ignored-qualifiers, \ - CFLAGS := $(SVE_CFLAGS), \ + vector_math_sve.c_CFLAGS := $(SVE_CFLAGS), \ )) TARGETS += $(BUILD_LIBSLEEF) diff --git a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp index 31a775e4f03..0c11d26a476 100644 --- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp @@ -1217,15 +1217,24 @@ void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) { void LIR_Assembler::type_profile_helper(Register mdo, ciMethodData *md, ciProfileData *data, Register recv, Label* update_done) { + + // Given a profile data offset, generate an Address which points to + // the corresponding slot in mdo->data(). + // Clobbers rscratch2. + auto slot_at = [=](ByteSize offset) -> Address { + return __ form_address(rscratch2, mdo, + md->byte_offset_of_slot(data, offset), + LogBytesPerWord); + }; + for (uint i = 0; i < ReceiverTypeData::row_limit(); i++) { Label next_test; // See if the receiver is receiver[n]. - __ lea(rscratch2, Address(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)))); - __ ldr(rscratch1, Address(rscratch2)); + __ ldr(rscratch1, slot_at(ReceiverTypeData::receiver_offset(i))); __ cmp(recv, rscratch1); __ br(Assembler::NE, next_test); - Address data_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i))); - __ addptr(data_addr, DataLayout::counter_increment); + __ addptr(slot_at(ReceiverTypeData::receiver_count_offset(i)), + DataLayout::counter_increment); __ b(*update_done); __ bind(next_test); } @@ -1233,15 +1242,12 @@ void LIR_Assembler::type_profile_helper(Register mdo, // Didn't find receiver; find next empty slot and fill it in for (uint i = 0; i < ReceiverTypeData::row_limit(); i++) { Label next_test; - __ lea(rscratch2, - Address(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)))); - Address recv_addr(rscratch2); + Address recv_addr(slot_at(ReceiverTypeData::receiver_offset(i))); __ ldr(rscratch1, recv_addr); __ cbnz(rscratch1, next_test); __ str(recv, recv_addr); __ mov(rscratch1, DataLayout::counter_increment); - __ lea(rscratch2, Address(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i)))); - __ str(rscratch1, Address(rscratch2)); + __ str(rscratch1, slot_at(ReceiverTypeData::receiver_count_offset(i))); __ b(*update_done); __ bind(next_test); } @@ -1413,8 +1419,7 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) { // Object is null; update MDO and exit Address data_addr = __ form_address(rscratch2, mdo, - md->byte_offset_of_slot(data, DataLayout::flags_offset()), - 0); + md->byte_offset_of_slot(data, DataLayout::flags_offset()), 0); __ ldrb(rscratch1, data_addr); __ orr(rscratch1, rscratch1, BitData::null_seen_byte_constant()); __ strb(rscratch1, data_addr); @@ -2565,10 +2570,12 @@ void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) { for (i = 0; i < VirtualCallData::row_limit(); i++) { ciKlass* receiver = vc_data->receiver(i); if (receiver == nullptr) { - Address recv_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_offset(i))); __ mov_metadata(rscratch1, known_klass->constant_encoding()); - __ lea(rscratch2, recv_addr); - __ str(rscratch1, Address(rscratch2)); + Address recv_addr = + __ form_address(rscratch2, mdo, + md->byte_offset_of_slot(data, VirtualCallData::receiver_offset(i)), + LogBytesPerWord); + __ str(rscratch1, recv_addr); Address data_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i))); __ addptr(data_addr, DataLayout::counter_increment); return; diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp index 244de10d0e2..bd537af59e4 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp @@ -1173,7 +1173,10 @@ class MacroAssembler: public Assembler { // Arithmetics + // Clobber: rscratch1, rscratch2 void addptr(const Address &dst, int32_t src); + + // Clobber: rscratch1 void cmpptr(Register src1, Address src2); void cmpoop(Register obj1, Register obj2); diff --git a/src/hotspot/cpu/ppc/assembler_ppc.hpp b/src/hotspot/cpu/ppc/assembler_ppc.hpp index 68a0c78e7cf..11532edaad9 100644 --- a/src/hotspot/cpu/ppc/assembler_ppc.hpp +++ b/src/hotspot/cpu/ppc/assembler_ppc.hpp @@ -294,6 +294,8 @@ class Assembler : public AbstractAssembler { CLRRWI_OPCODE = RLWINM_OPCODE, CLRLWI_OPCODE = RLWINM_OPCODE, + RLWNM_OPCODE = (23u << OPCODE_SHIFT), + RLWIMI_OPCODE = (20u << OPCODE_SHIFT), SLW_OPCODE = (31u << OPCODE_SHIFT | 24u << 1), @@ -424,6 +426,9 @@ class Assembler : public AbstractAssembler { RLDIC_OPCODE = (30u << OPCODE_SHIFT | 2u << XO_27_29_SHIFT), // MD-FORM RLDIMI_OPCODE = (30u << OPCODE_SHIFT | 3u << XO_27_29_SHIFT), // MD-FORM + RLDCL_OPCODE = (30u << OPCODE_SHIFT | 8u << 1), + RLDCR_OPCODE = (30u << OPCODE_SHIFT | 9u << 1), + SRADI_OPCODE = (31u << OPCODE_SHIFT | 413u << XO_21_29_SHIFT), // XS-FORM SLD_OPCODE = (31u << OPCODE_SHIFT | 27u << 1), // X-FORM @@ -1696,6 +1701,14 @@ class Assembler : public AbstractAssembler { inline void insrdi( Register a, Register s, int n, int b); inline void insrwi( Register a, Register s, int n, int b); + // Rotate variable + inline void rlwnm( Register a, Register s, Register b, int mb, int me); + inline void rlwnm_(Register a, Register s, Register b, int mb, int me); + inline void rldcl( Register a, Register s, Register b, int mb); + inline void rldcl_(Register a, Register s, Register b, int mb); + inline void rldcr( Register a, Register s, Register b, int me); + inline void rldcr_(Register a, Register s, Register b, int me); + // PPC 1, section 3.3.2 Fixed-Point Load Instructions // 4 bytes inline void lwzx( Register d, Register s1, Register s2); diff --git a/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp b/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp index eae75da9fbf..6bef4ec4a7b 100644 --- a/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp +++ b/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp @@ -336,6 +336,13 @@ inline void Assembler::rldimi_( Register a, Register s, int sh6, int mb6) inline void Assembler::insrdi( Register a, Register s, int n, int b) { Assembler::rldimi(a, s, 64-(b+n), b); } inline void Assembler::insrwi( Register a, Register s, int n, int b) { Assembler::rlwimi(a, s, 32-(b+n), b, b+n-1); } +inline void Assembler::rlwnm( Register a, Register s, Register b, int mb, int me) { emit_int32(RLWNM_OPCODE | rta(a) | rs(s) | rb(b) | mb2125(mb) | me2630(me) | rc(0)); } +inline void Assembler::rlwnm_(Register a, Register s, Register b, int mb, int me) { emit_int32(RLWNM_OPCODE | rta(a) | rs(s) | rb(b) | mb2125(mb) | me2630(me) | rc(1)); } +inline void Assembler::rldcl( Register a, Register s, Register b, int mb) { emit_int32(RLDCL_OPCODE | rta(a) | rs(s) | rb(b) | mb2126(mb) | rc(0)); } +inline void Assembler::rldcl_( Register a, Register s, Register b, int mb) { emit_int32(RLDCL_OPCODE | rta(a) | rs(s) | rb(b) | mb2126(mb) | rc(1)); } +inline void Assembler::rldcr( Register a, Register s, Register b, int me) { emit_int32(RLDCR_OPCODE | rta(a) | rs(s) | rb(b) | me2126(me) | rc(0)); } +inline void Assembler::rldcr_( Register a, Register s, Register b, int me) { emit_int32(RLDCR_OPCODE | rta(a) | rs(s) | rb(b) | me2126(me) | rc(1)); } + // PPC 1, section 3.3.2 Fixed-Point Load Instructions inline void Assembler::lwzx( Register d, Register s1, Register s2) { emit_int32(LWZX_OPCODE | rt(d) | ra0mem(s1) | rb(s2));} inline void Assembler::lwz( Register d, Address &a) { diff --git a/src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp b/src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp index 41d2fcb5730..99e46a5cba5 100644 --- a/src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp @@ -602,10 +602,9 @@ OopMapSet* Runtime1::generate_code_for(C1StubId id, StubAssembler* sasm) { { // Support for uint StubRoutine::partial_subtype_check( Klass sub, Klass super ); const Register sub_klass = R5, super_klass = R4, - temp1_reg = R6, - temp2_reg = R0; - __ check_klass_subtype_slow_path(sub_klass, super_klass, temp1_reg, temp2_reg); // returns with CR0.eq if successful - __ crandc(CCR0, Assembler::equal, CCR0, Assembler::equal); // failed: CR0.ne + temp1_reg = R6; + __ check_klass_subtype_slow_path(sub_klass, super_klass, temp1_reg, noreg); + // Result is in CR0. __ blr(); } break; diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp index f73325b652e..e85f6c11229 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp @@ -2106,16 +2106,17 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass, #undef FINAL_JUMP } -void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, - Register super_klass, - Register temp1_reg, - Register temp2_reg, - Label* L_success, - Register result_reg) { +void MacroAssembler::check_klass_subtype_slow_path_linear(Register sub_klass, + Register super_klass, + Register temp1_reg, + Register temp2_reg, + Label* L_success, + Register result_reg) { const Register array_ptr = temp1_reg; // current value from cache array const Register temp = temp2_reg; assert_different_registers(sub_klass, super_klass, array_ptr, temp); + assert(L_success == nullptr || result_reg == noreg, "can't have both"); int source_offset = in_bytes(Klass::secondary_supers_offset()); int target_offset = in_bytes(Klass::secondary_super_cache_offset()); @@ -2130,7 +2131,7 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, // TODO: PPC port: assert(4 == arrayOopDesc::length_length_in_bytes(), "precondition violated."); lwz(temp, length_offset, array_ptr); cmpwi(CCR0, temp, 0); - beq(CCR0, result_reg!=noreg ? failure : fallthru); // length 0 + beq(CCR0, (L_success == nullptr) ? failure : fallthru); // indicate failure if length 0 mtctr(temp); // load ctr @@ -2143,18 +2144,111 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, bdnz(loop); bind(failure); - if (result_reg!=noreg) li(result_reg, 1); // load non-zero result (indicates a miss) + if (result_reg != noreg) { + li(result_reg, 1); // load non-zero result (indicates a miss) + } else if (L_success == nullptr) { + crandc(CCR0, Assembler::equal, CCR0, Assembler::equal); // miss indicated by CR0.ne + } b(fallthru); bind(hit); std(super_klass, target_offset, sub_klass); // save result to cache - if (result_reg != noreg) { li(result_reg, 0); } // load zero result (indicates a hit) - if (L_success != nullptr) { b(*L_success); } - else if (result_reg == noreg) { blr(); } // return with CR0.eq if neither label nor result reg provided + if (result_reg != noreg) { + li(result_reg, 0); // load zero result (indicates a hit) + } else if (L_success != nullptr) { + b(*L_success); + } bind(fallthru); } +Register MacroAssembler::allocate_if_noreg(Register r, + RegSetIterator &available_regs, + RegSet ®s_to_push) { + if (!r->is_valid()) { + r = *available_regs++; + regs_to_push += r; + } + return r; +} + +void MacroAssembler::push_set(RegSet set) +{ + int spill_offset = 0; + for (RegSetIterator it = set.begin(); *it != noreg; ++it) { + spill_offset += wordSize; + std(*it, -spill_offset, R1_SP); + } +} + +void MacroAssembler::pop_set(RegSet set) +{ + int spill_offset = 0; + for (RegSetIterator it = set.begin(); *it != noreg; ++it) { + spill_offset += wordSize; + ld(*it, -spill_offset, R1_SP); + } +} + +void MacroAssembler::check_klass_subtype_slow_path_table(Register sub_klass, + Register super_klass, + Register temp1_reg, + Register temp2_reg, + Label* L_success, + Register result_reg) { + RegSet temps = RegSet::of(temp1_reg, temp2_reg); + + assert_different_registers(sub_klass, super_klass, temp1_reg, temp2_reg, result_reg, R0); + + Register temp3_reg = noreg, temp4_reg = noreg; + bool result_reg_provided = (result_reg != noreg); // otherwise, result will be in CR0 + + BLOCK_COMMENT("check_klass_subtype_slow_path_table"); + + RegSetIterator available_regs + = (RegSet::range(R2, R12) - temps - sub_klass - super_klass).begin(); + + RegSet pushed_regs; + + temp1_reg = allocate_if_noreg(temp1_reg, available_regs, pushed_regs); + temp2_reg = allocate_if_noreg(temp2_reg, available_regs, pushed_regs); + temp3_reg = allocate_if_noreg(temp3_reg, available_regs, pushed_regs); + temp4_reg = allocate_if_noreg(temp4_reg, available_regs, pushed_regs); + result_reg = allocate_if_noreg(result_reg, available_regs, pushed_regs); + + push_set(pushed_regs); + + lookup_secondary_supers_table_var(sub_klass, super_klass, + temp1_reg, temp2_reg, temp3_reg, temp4_reg, + result_reg); + + if (L_success != nullptr || !result_reg_provided) { + // result_reg may get overwritten by pop_set + cmpdi(CCR0, result_reg, 0); + } + + // Unspill the temp. registers: + pop_set(pushed_regs); + + if (L_success != nullptr) { + beq(CCR0, *L_success); + } +} + +void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, + Register super_klass, + Register temp1_reg, + Register temp2_reg, + Label* L_success, + Register result_reg) { + if (UseSecondarySupersTable) { + check_klass_subtype_slow_path_table(sub_klass, super_klass, temp1_reg, temp2_reg, L_success, result_reg); + } else { + if (temp2_reg == noreg) temp2_reg = R0; + check_klass_subtype_slow_path_linear(sub_klass, super_klass, temp1_reg, temp2_reg, L_success, result_reg); + } +} + // Try fast path, then go to slow one if not successful void MacroAssembler::check_klass_subtype(Register sub_klass, Register super_klass, @@ -2207,19 +2301,19 @@ do { \ (result == R8_ARG6 || result == noreg), "registers must match ppc64.ad"); \ } while(0) -void MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass, - Register r_super_klass, - Register temp1, - Register temp2, - Register temp3, - Register temp4, - Register result, - u1 super_klass_slot) { +void MacroAssembler::lookup_secondary_supers_table_const(Register r_sub_klass, + Register r_super_klass, + Register temp1, + Register temp2, + Register temp3, + Register temp4, + Register result, + u1 super_klass_slot) { assert_different_registers(r_sub_klass, r_super_klass, temp1, temp2, temp3, temp4, result); Label L_done; - BLOCK_COMMENT("lookup_secondary_supers_table {"); + BLOCK_COMMENT("lookup_secondary_supers_table_const {"); const Register r_array_base = temp1, @@ -2227,7 +2321,7 @@ void MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass, r_array_index = temp3, r_bitmap = temp4; - LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; + LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; // Required for stub call below. ld(r_bitmap, in_bytes(Klass::secondary_supers_bitmap_offset()), r_sub_klass); @@ -2289,7 +2383,90 @@ void MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass, bctrl(); bind(L_done); - BLOCK_COMMENT("} lookup_secondary_supers_table"); + BLOCK_COMMENT("} lookup_secondary_supers_table_const"); + + if (VerifySecondarySupers) { + verify_secondary_supers_table(r_sub_klass, r_super_klass, result, + temp1, temp2, temp3); + } +} + +// At runtime, return 0 in result if r_super_klass is a superclass of +// r_sub_klass, otherwise return nonzero. Use this version of +// lookup_secondary_supers_table() if you don't know ahead of time +// which superclass will be searched for. Used by interpreter and +// runtime stubs. It is larger and has somewhat greater latency than +// the version above, which takes a constant super_klass_slot. +void MacroAssembler::lookup_secondary_supers_table_var(Register r_sub_klass, + Register r_super_klass, + Register temp1, + Register temp2, + Register temp3, + Register temp4, + Register result) { + assert_different_registers(r_sub_klass, r_super_klass, temp1, temp2, temp3, temp4, result, R0); + + Label L_done; + + BLOCK_COMMENT("lookup_secondary_supers_table_var {"); + + const Register + r_array_base = temp1, + slot = temp2, + r_array_index = temp3, + r_bitmap = temp4; + + lbz(slot, in_bytes(Klass::hash_slot_offset()), r_super_klass); + ld(r_bitmap, in_bytes(Klass::secondary_supers_bitmap_offset()), r_sub_klass); + + li(result, 1); // Make sure that result is nonzero if the test below misses. + + // First check the bitmap to see if super_klass might be present. If + // the bit is zero, we are certain that super_klass is not one of + // the secondary supers. + xori(R0, slot, Klass::SECONDARY_SUPERS_TABLE_SIZE - 1); // slot ^ 63 === 63 - slot (mod 64) + sld_(r_array_index, r_bitmap, R0); // shift left by 63-slot + + // We test the MSB of r_array_index, i.e. its sign bit + bge(CCR0, L_done); + + // We will consult the secondary-super array. + ld(r_array_base, in_bytes(Klass::secondary_supers_offset()), r_sub_klass); + + // The value i in r_array_index is >= 1, so even though r_array_base + // points to the length, we don't need to adjust it to point to the data. + assert(Array::base_offset_in_bytes() == wordSize, "Adjust this code"); + assert(Array::length_offset_in_bytes() == 0, "Adjust this code"); + + // Get the first array index that can contain super_klass into r_array_index. + popcntd(r_array_index, r_array_index); + + // NB! r_array_index is off by 1. It is compensated by keeping r_array_base off by 1 word. + sldi(r_array_index, r_array_index, LogBytesPerWord); // scale + + ldx(R0, r_array_base, r_array_index); + xor_(result, R0, r_super_klass); + beq(CCR0, L_done); // found a match, result is 0 in this case + + // Linear probe. Rotate the bitmap so that the next bit to test is + // in Bit 1. + neg(R0, slot); // rotate right + rldcl(r_bitmap, r_bitmap, R0, 0); + Register temp = slot; + andi_(temp, r_bitmap, 2); + beq(CCR0, L_done); // fail (result != 0) + + // The slot we just inspected is at secondary_supers[r_array_index - 1]. + // The next slot to be inspected, by the logic we're about to call, + // is secondary_supers[r_array_index]. Bits 0 and 1 in the bitmap + // have been checked. + lookup_secondary_supers_table_slow_path(r_super_klass, r_array_base, r_array_index, + r_bitmap, result, temp); + // return whatever we got from slow path + + bind(L_done); + + BLOCK_COMMENT("} lookup_secondary_supers_table_var"); if (VerifySecondarySupers) { verify_secondary_supers_table(r_sub_klass, r_super_klass, result, @@ -2312,8 +2489,6 @@ void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_kl r_array_length = temp1, r_sub_klass = noreg; - LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; - Label L_done; // Load the array length. @@ -2404,8 +2579,6 @@ void MacroAssembler::verify_secondary_supers_table(Register r_sub_klass, r_array_index = temp3, r_bitmap = noreg; // unused - LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; - BLOCK_COMMENT("verify_secondary_supers_table {"); Label passed, failure; @@ -2432,13 +2605,17 @@ void MacroAssembler::verify_secondary_supers_table(Register r_sub_klass, cmpd(CCR0, result, linear_result); beq(CCR0, passed); - assert_different_registers(R3_ARG1, r_sub_klass, linear_result, result); - mr_if_needed(R3_ARG1, r_super_klass); - assert_different_registers(R4_ARG2, linear_result, result); - mr_if_needed(R4_ARG2, r_sub_klass); - assert_different_registers(R5_ARG3, result); - neg(R5_ARG3, linear_result); - neg(R6_ARG4, result); + // report fatal error and terminate VM + + // Argument shuffle. Using stack to avoid clashes. + std(r_super_klass, -8, R1_SP); + std(r_sub_klass, -16, R1_SP); + std(linear_result, -24, R1_SP); + mr_if_needed(R6_ARG4, result); + ld(R3_ARG1, -8, R1_SP); + ld(R4_ARG2, -16, R1_SP); + ld(R5_ARG3, -24, R1_SP); + const char* msg = "mismatch"; load_const_optimized(R7_ARG5, (intptr_t)msg, R0); call_VM_leaf(CAST_FROM_FN_PTR(address, Klass::on_secondary_supers_verification_failure)); diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp index 3e82c1c6785..6ea3b853cd7 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp @@ -612,6 +612,20 @@ class MacroAssembler: public Assembler { // The temp_reg can be noreg, if no temps are available. // It can also be sub_klass or super_klass, meaning it's OK to kill that one. // Updates the sub's secondary super cache as necessary. + void check_klass_subtype_slow_path_linear(Register sub_klass, + Register super_klass, + Register temp1_reg, + Register temp2_reg, + Label* L_success = nullptr, + Register result_reg = noreg); + + void check_klass_subtype_slow_path_table(Register sub_klass, + Register super_klass, + Register temp1_reg, + Register temp2_reg, + Label* L_success = nullptr, + Register result_reg = noreg); + void check_klass_subtype_slow_path(Register sub_klass, Register super_klass, Register temp1_reg, @@ -619,6 +633,25 @@ class MacroAssembler: public Assembler { Label* L_success = nullptr, Register result_reg = noreg); + void lookup_secondary_supers_table_var(Register sub_klass, + Register r_super_klass, + Register temp1, + Register temp2, + Register temp3, + Register temp4, + Register result); + + // If r is valid, return r. + // If r is invalid, remove a register r2 from available_regs, add r2 + // to regs_to_push, then return r2. + Register allocate_if_noreg(const Register r, + RegSetIterator &available_regs, + RegSet ®s_to_push); + + // Frameless register spills (negative offset from SP) + void push_set(RegSet set); + void pop_set(RegSet set); + // Simplified, combined version, good for typical uses. // Falls through on failure. void check_klass_subtype(Register sub_klass, @@ -631,14 +664,14 @@ class MacroAssembler: public Assembler { // As above, but with a constant super_klass. // The result is in Register result, not the condition codes. - void lookup_secondary_supers_table(Register r_sub_klass, - Register r_super_klass, - Register temp1, - Register temp2, - Register temp3, - Register temp4, - Register result, - u1 super_klass_slot); + void lookup_secondary_supers_table_const(Register r_sub_klass, + Register r_super_klass, + Register temp1, + Register temp2, + Register temp3, + Register temp4, + Register result, + u1 super_klass_slot); void verify_secondary_supers_table(Register r_sub_klass, Register r_super_klass, diff --git a/src/hotspot/cpu/ppc/ppc.ad b/src/hotspot/cpu/ppc/ppc.ad index 808dd022738..38a0d480ec5 100644 --- a/src/hotspot/cpu/ppc/ppc.ad +++ b/src/hotspot/cpu/ppc/ppc.ad @@ -12069,6 +12069,7 @@ instruct branchLoopEndFar(cmpOp cmp, flagsRegSrc crx, label labl) %{ instruct partialSubtypeCheck(iRegPdst result, iRegP_N2P subklass, iRegP_N2P superklass, iRegPdst tmp_klass, iRegPdst tmp_arrayptr) %{ match(Set result (PartialSubtypeCheck subklass superklass)); + predicate(!UseSecondarySupersTable); effect(TEMP_DEF result, TEMP tmp_klass, TEMP tmp_arrayptr); ins_cost(DEFAULT_COST*10); @@ -12080,6 +12081,30 @@ instruct partialSubtypeCheck(iRegPdst result, iRegP_N2P subklass, iRegP_N2P supe ins_pipe(pipe_class_default); %} +// Two versions of partialSubtypeCheck, both used when we need to +// search for a super class in the secondary supers array. The first +// is used when we don't know _a priori_ the class being searched +// for. The second, far more common, is used when we do know: this is +// used for instanceof, checkcast, and any case where C2 can determine +// it by constant propagation. +instruct partialSubtypeCheckVarSuper(iRegPsrc sub, iRegPsrc super, iRegPdst result, + iRegPdst tempR1, iRegPdst tempR2, iRegPdst tempR3, iRegPdst tempR4, + flagsRegCR0 cr0, regCTR ctr) +%{ + match(Set result (PartialSubtypeCheck sub super)); + predicate(UseSecondarySupersTable); + effect(KILL cr0, KILL ctr, TEMP_DEF result, TEMP tempR1, TEMP tempR2, TEMP tempR3, TEMP tempR4); + + ins_cost(DEFAULT_COST * 10); // slightly larger than the next version + format %{ "partialSubtypeCheck $result, $sub, $super" %} + ins_encode %{ + __ lookup_secondary_supers_table_var($sub$$Register, $super$$Register, + $tempR1$$Register, $tempR2$$Register, $tempR3$$Register, $tempR4$$Register, + $result$$Register); + %} + ins_pipe(pipe_class_memory); +%} + instruct partialSubtypeCheckConstSuper(rarg3RegP sub, rarg2RegP super_reg, immP super_con, rarg6RegP result, rarg1RegP tempR1, rarg5RegP tempR2, rarg4RegP tempR3, rscratch1RegP tempR4, flagsRegCR0 cr0, regCTR ctr) @@ -12094,9 +12119,9 @@ instruct partialSubtypeCheckConstSuper(rarg3RegP sub, rarg2RegP super_reg, immP ins_encode %{ u1 super_klass_slot = ((Klass*)$super_con$$constant)->hash_slot(); if (InlineSecondarySupersTest) { - __ lookup_secondary_supers_table($sub$$Register, $super_reg$$Register, - $tempR1$$Register, $tempR2$$Register, $tempR3$$Register, $tempR4$$Register, - $result$$Register, super_klass_slot); + __ lookup_secondary_supers_table_const($sub$$Register, $super_reg$$Register, + $tempR1$$Register, $tempR2$$Register, $tempR3$$Register, $tempR4$$Register, + $result$$Register, super_klass_slot); } else { address stub = StubRoutines::lookup_secondary_supers_table_stub(super_klass_slot); Register r_stub_addr = $tempR1$$Register; diff --git a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp index da17b2fced4..f32e6256072 100644 --- a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp @@ -2038,7 +2038,8 @@ class StubGenerator: public StubCodeGenerator { void generate_type_check(Register sub_klass, Register super_check_offset, Register super_klass, - Register temp, + Register temp1, + Register temp2, Label& L_success) { assert_different_registers(sub_klass, super_check_offset, super_klass); @@ -2046,9 +2047,9 @@ class StubGenerator: public StubCodeGenerator { Label L_miss; - __ check_klass_subtype_fast_path(sub_klass, super_klass, temp, R0, &L_success, &L_miss, nullptr, + __ check_klass_subtype_fast_path(sub_klass, super_klass, temp1, temp2, &L_success, &L_miss, nullptr, super_check_offset); - __ check_klass_subtype_slow_path(sub_klass, super_klass, temp, R0, &L_success); + __ check_klass_subtype_slow_path(sub_klass, super_klass, temp1, temp2, &L_success); // Fall through on failure! __ bind(L_miss); @@ -2078,8 +2079,7 @@ class StubGenerator: public StubCodeGenerator { const Register R10_oop = R10_ARG8; // actual oop copied const Register R11_klass = R11_scratch1; // oop._klass const Register R12_tmp = R12_scratch2; - - const Register R2_minus1 = R2; + const Register R2_tmp = R2; //__ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", name); @@ -2117,7 +2117,6 @@ class StubGenerator: public StubCodeGenerator { Label load_element, store_element, store_null, success, do_epilogue; __ or_(R9_remain, R5_count, R5_count); // Initialize loop index, and test it. __ li(R8_offset, 0); // Offset from start of arrays. - __ li(R2_minus1, -1); __ bne(CCR0, load_element); // Empty array: Nothing to do. @@ -2145,7 +2144,7 @@ class StubGenerator: public StubCodeGenerator { } __ addi(R8_offset, R8_offset, heapOopSize); // Step to next offset. - __ add_(R9_remain, R2_minus1, R9_remain); // Decrement the count. + __ addic_(R9_remain, R9_remain, -1); // Decrement the count. __ beq(CCR0, success); // ======== loop entry is here ======== @@ -2165,7 +2164,7 @@ class StubGenerator: public StubCodeGenerator { __ load_klass(R11_klass, R10_oop); // Query the object klass. - generate_type_check(R11_klass, R6_ckoff, R7_ckval, R12_tmp, + generate_type_check(R11_klass, R6_ckoff, R7_ckval, R12_tmp, R2_tmp, // Branch to this on success: store_element); // ======== end loop ======== @@ -2499,7 +2498,7 @@ class StubGenerator: public StubCodeGenerator { int sco_offset = in_bytes(Klass::super_check_offset_offset()); __ lwz(sco_temp, sco_offset, dst_klass); generate_type_check(src_klass, sco_temp, dst_klass, - temp, L_disjoint_plain_copy); + temp, /* temp */ R10_ARG8, L_disjoint_plain_copy); // Fetch destination element klass from the ObjArrayKlass header. int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset()); @@ -4457,9 +4456,9 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) { r_bitmap = R11_scratch1, result = R8_ARG6; - __ lookup_secondary_supers_table(r_sub_klass, r_super_klass, - r_array_base, r_array_length, r_array_index, - r_bitmap, result, super_klass_index); + __ lookup_secondary_supers_table_const(r_sub_klass, r_super_klass, + r_array_base, r_array_length, r_array_index, + r_bitmap, result, super_klass_index); __ blr(); return start; diff --git a/src/hotspot/cpu/riscv/assembler_riscv.hpp b/src/hotspot/cpu/riscv/assembler_riscv.hpp index 21a41bd3eb4..3a638357f0b 100644 --- a/src/hotspot/cpu/riscv/assembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/assembler_riscv.hpp @@ -330,7 +330,104 @@ class InternalAddress: public Address { }; class Assembler : public AbstractAssembler { -public: +protected: + + static int zfa_zli_lookup_double(uint64_t value) { + switch(value) { + case 0xbff0000000000000 : return 0; + case 0x0010000000000000 : return 1; + case 0x3ef0000000000000 : return 2; + case 0x3f00000000000000 : return 3; + case 0x3f70000000000000 : return 4; + case 0x3f80000000000000 : return 5; + case 0x3fb0000000000000 : return 6; + case 0x3fc0000000000000 : return 7; + case 0x3fd0000000000000 : return 8; + case 0x3fd4000000000000 : return 9; + case 0x3fd8000000000000 : return 10; + case 0x3fdc000000000000 : return 11; + case 0x3fe0000000000000 : return 12; + case 0x3fe4000000000000 : return 13; + case 0x3fe8000000000000 : return 14; + case 0x3fec000000000000 : return 15; + case 0x3ff0000000000000 : return 16; + case 0x3ff4000000000000 : return 17; + case 0x3ff8000000000000 : return 18; + case 0x3ffc000000000000 : return 19; + case 0x4000000000000000 : return 20; + case 0x4004000000000000 : return 21; + case 0x4008000000000000 : return 22; + case 0x4010000000000000 : return 23; + case 0x4020000000000000 : return 24; + case 0x4030000000000000 : return 25; + case 0x4060000000000000 : return 26; + case 0x4070000000000000 : return 27; + case 0x40e0000000000000 : return 28; + case 0x40f0000000000000 : return 29; + case 0x7ff0000000000000 : return 30; + case 0x7ff8000000000000 : return 31; + default: break; + } + return -1; + } + + + static int zfa_zli_lookup_float(uint32_t value) { + switch(value) { + case 0xbf800000 : return 0; + case 0x00800000 : return 1; + case 0x37800000 : return 2; + case 0x38000000 : return 3; + case 0x3b800000 : return 4; + case 0x3c000000 : return 5; + case 0x3d800000 : return 6; + case 0x3e000000 : return 7; + case 0x3e800000 : return 8; + case 0x3ea00000 : return 9; + case 0x3ec00000 : return 10; + case 0x3ee00000 : return 11; + case 0x3f000000 : return 12; + case 0x3f200000 : return 13; + case 0x3f400000 : return 14; + case 0x3f600000 : return 15; + case 0x3f800000 : return 16; + case 0x3fa00000 : return 17; + case 0x3fc00000 : return 18; + case 0x3fe00000 : return 19; + case 0x40000000 : return 20; + case 0x40200000 : return 21; + case 0x40400000 : return 22; + case 0x40800000 : return 23; + case 0x41000000 : return 24; + case 0x41800000 : return 25; + case 0x43000000 : return 26; + case 0x43800000 : return 27; + case 0x47000000 : return 28; + case 0x47800000 : return 29; + case 0x7f800000 : return 30; + case 0x7fc00000 : return 31; + default: break; + } + return -1; + } + + public: + + static bool can_zfa_zli_float(jfloat f) { + if (!UseZfa) { + return false; + } + uint32_t f_bits = (uint32_t)jint_cast(f); + return zfa_zli_lookup_float(f_bits) != -1; + } + + static bool can_zfa_zli_double(jdouble d) { + if (!UseZfa) { + return false; + } + uint64_t d_bits = (uint64_t)julong_cast(d); + return zfa_zli_lookup_double(d_bits) != -1; + } enum { instruction_size = 4, @@ -972,6 +1069,13 @@ enum operand_size { int8, int16, int32, uint32, int64 }; fp_base(Rd->raw_encoding(), Rs1->raw_encoding(), Rs2, (RoundingMode)rm); } + template + void fp_base(FloatRegister Rd, uint8_t Rs1, uint8_t Rs2, int8_t rm) { + guarantee(is_uimm5(Rs1), "Rs1 is out of validity"); + guarantee(is_uimm5(Rs2), "Rs2 is out of validity"); + fp_base(Rd->raw_encoding(), Rs1, Rs2, (RoundingMode)rm); + } + public: enum FClassBits { @@ -1293,6 +1397,18 @@ enum operand_size { int8, int16, int32, uint32, int64 }; fp_base(Rd, Rs1, 0b00000, 0b000); } +// -------------- ZFA Instruction Definitions -------------- +// Zfa Extension for Additional Floating-Point Instructions + void _fli_s(FloatRegister Rd, uint8_t Rs1) { + assert_cond(UseZfa); + fp_base(Rd, Rs1, 0b00001, 0b000); + } + + void _fli_d(FloatRegister Rd, uint8_t Rs1) { + assert_cond(UseZfa); + fp_base(Rd, Rs1, 0b00001, 0b000); + } + // ========================== // RISC-V Vector Extension // ========================== diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp index 8d5299aa0fd..c6af2de3cd4 100644 --- a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp @@ -425,6 +425,8 @@ void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_cod assert(dest->is_register(), "should not call otherwise"); LIR_Const* c = src->as_constant_ptr(); address const_addr = nullptr; + jfloat fconst; + jdouble dconst; switch (c->type()) { case T_INT: @@ -460,15 +462,25 @@ void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_cod break; case T_FLOAT: - const_addr = float_constant(c->as_jfloat()); - assert(const_addr != nullptr, "must create float constant in the constant table"); - __ flw(dest->as_float_reg(), InternalAddress(const_addr)); + fconst = c->as_jfloat(); + if (MacroAssembler::can_fp_imm_load(fconst)) { + __ fli_s(dest->as_float_reg(), fconst); + } else { + const_addr = float_constant(fconst); + assert(const_addr != nullptr, "must create float constant in the constant table"); + __ flw(dest->as_float_reg(), InternalAddress(const_addr)); + } break; case T_DOUBLE: - const_addr = double_constant(c->as_jdouble()); - assert(const_addr != nullptr, "must create double constant in the constant table"); - __ fld(dest->as_double_reg(), InternalAddress(const_addr)); + dconst = c->as_jdouble(); + if (MacroAssembler::can_dp_imm_load(dconst)) { + __ fli_d(dest->as_double_reg(), dconst); + } else { + const_addr = double_constant(c->as_jdouble()); + assert(const_addr != nullptr, "must create double constant in the constant table"); + __ fld(dest->as_double_reg(), InternalAddress(const_addr)); + } break; default: diff --git a/src/hotspot/cpu/riscv/globals_riscv.hpp b/src/hotspot/cpu/riscv/globals_riscv.hpp index a70dedd1ef7..36c32d90cb3 100644 --- a/src/hotspot/cpu/riscv/globals_riscv.hpp +++ b/src/hotspot/cpu/riscv/globals_riscv.hpp @@ -103,6 +103,7 @@ define_pd_global(intx, InlineSmallCode, 1000); product(bool, UseZba, false, DIAGNOSTIC, "Use Zba instructions") \ product(bool, UseZbb, false, DIAGNOSTIC, "Use Zbb instructions") \ product(bool, UseZbs, false, DIAGNOSTIC, "Use Zbs instructions") \ + product(bool, UseZfa, false, EXPERIMENTAL, "Use Zfa instructions") \ product(bool, UseZfh, false, DIAGNOSTIC, "Use Zfh instructions") \ product(bool, UseZfhmin, false, DIAGNOSTIC, "Use Zfhmin instructions") \ product(bool, UseZacas, false, EXPERIMENTAL, "Use Zacas instructions") \ diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp index 50b9f8616e7..61261a17213 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp @@ -2593,6 +2593,45 @@ void MacroAssembler::movptr2(Register Rd, uint64_t addr, int32_t &offset, Regist offset = lower12; } +// floating point imm move +bool MacroAssembler::can_fp_imm_load(float imm) { + jint f_bits = jint_cast(imm); + if (f_bits == 0) { + return true; + } + return can_zfa_zli_float(imm); +} + +bool MacroAssembler::can_dp_imm_load(double imm) { + julong d_bits = julong_cast(imm); + if (d_bits == 0) { + return true; + } + return can_zfa_zli_double(imm); +} + +void MacroAssembler::fli_s(FloatRegister Rd, float imm) { + jint f_bits = jint_cast(imm); + if (f_bits == 0) { + fmv_w_x(Rd, zr); + return; + } + int Rs = zfa_zli_lookup_float(f_bits); + assert(Rs != -1, "Must be"); + _fli_s(Rd, Rs); +} + +void MacroAssembler::fli_d(FloatRegister Rd, double imm) { + uint64_t d_bits = (uint64_t)julong_cast(imm); + if (d_bits == 0) { + fmv_d_x(Rd, zr); + return; + } + int Rs = zfa_zli_lookup_double(d_bits); + assert(Rs != -1, "Must be"); + _fli_d(Rd, Rs); +} + void MacroAssembler::add(Register Rd, Register Rn, int64_t increment, Register tmp) { if (is_simm12(increment)) { addi(Rd, Rn, increment); diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp index 014297bcb32..41ccd0c4b2f 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp @@ -920,6 +920,11 @@ class MacroAssembler: public Assembler { void movptr1(Register Rd, uintptr_t addr, int32_t &offset); void movptr2(Register Rd, uintptr_t addr, int32_t &offset, Register tmp); public: + // float imm move + static bool can_fp_imm_load(float imm); + static bool can_dp_imm_load(double imm); + void fli_s(FloatRegister Rd, float imm); + void fli_d(FloatRegister Rd, double imm); // arith void add (Register Rd, Register Rn, int64_t increment, Register tmp = t0); diff --git a/src/hotspot/cpu/riscv/riscv.ad b/src/hotspot/cpu/riscv/riscv.ad index 6250b88e61e..b8660afb5fd 100644 --- a/src/hotspot/cpu/riscv/riscv.ad +++ b/src/hotspot/cpu/riscv/riscv.ad @@ -4920,7 +4920,11 @@ instruct loadConF(fRegF dst, immF con) %{ %} ins_encode %{ - __ flw(as_FloatRegister($dst$$reg), $constantaddress($con)); + if (MacroAssembler::can_fp_imm_load($con$$constant)) { + __ fli_s(as_FloatRegister($dst$$reg), $con$$constant); + } else { + __ flw(as_FloatRegister($dst$$reg), $constantaddress($con)); + } %} ins_pipe(fp_load_constant_s); @@ -4950,7 +4954,11 @@ instruct loadConD(fRegD dst, immD con) %{ %} ins_encode %{ - __ fld(as_FloatRegister($dst$$reg), $constantaddress($con)); + if (MacroAssembler::can_dp_imm_load($con$$constant)) { + __ fli_d(as_FloatRegister($dst$$reg), $con$$constant); + } else { + __ fld(as_FloatRegister($dst$$reg), $constantaddress($con)); + } %} ins_pipe(fp_load_constant_d); diff --git a/src/hotspot/cpu/riscv/vm_version_riscv.hpp b/src/hotspot/cpu/riscv/vm_version_riscv.hpp index 5f51970edf1..68665d12378 100644 --- a/src/hotspot/cpu/riscv/vm_version_riscv.hpp +++ b/src/hotspot/cpu/riscv/vm_version_riscv.hpp @@ -157,6 +157,7 @@ class VM_Version : public Abstract_VM_Version { decl(ext_Zbc , "Zbc" , RV_NO_FLAG_BIT, true , NO_UPDATE_DEFAULT) \ decl(ext_Zbs , "Zbs" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZbs)) \ decl(ext_Zcb , "Zcb" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZcb)) \ + decl(ext_Zfa , "Zfa" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZfa)) \ decl(ext_Zfh , "Zfh" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZfh)) \ decl(ext_Zfhmin , "Zfhmin" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZfhmin)) \ decl(ext_Zicsr , "Zicsr" , RV_NO_FLAG_BIT, true , NO_UPDATE_DEFAULT) \ @@ -226,6 +227,7 @@ class VM_Version : public Abstract_VM_Version { RV_ENABLE_EXTENSION(UseZbb) \ RV_ENABLE_EXTENSION(UseZbs) \ RV_ENABLE_EXTENSION(UseZcb) \ + RV_ENABLE_EXTENSION(UseZfa) \ RV_ENABLE_EXTENSION(UseZfhmin) \ RV_ENABLE_EXTENSION(UseZic64b) \ RV_ENABLE_EXTENSION(UseZicbom) \ diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index ffb542dd74e..3b8b6f23378 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -378,9 +378,10 @@ static void next_line(FILE *f) { } while (c != '\n' && c != EOF); } -void os::Linux::kernel_version(long* major, long* minor) { - *major = -1; - *minor = -1; +void os::Linux::kernel_version(long* major, long* minor, long* patch) { + *major = 0; + *minor = 0; + *patch = 0; struct utsname buffer; int ret = uname(&buffer); @@ -388,12 +389,29 @@ void os::Linux::kernel_version(long* major, long* minor) { log_warning(os)("uname(2) failed to get kernel version: %s", os::errno_name(ret)); return; } - int nr_matched = sscanf(buffer.release, "%ld.%ld", major, minor); - if (nr_matched != 2) { - log_warning(os)("Parsing kernel version failed, expected 2 version numbers, only matched %d", nr_matched); + int nr_matched = sscanf(buffer.release, "%ld.%ld.%ld", major, minor, patch); + if (nr_matched != 3) { + log_warning(os)("Parsing kernel version failed, expected 3 version numbers, only matched %d", nr_matched); } } +int os::Linux::kernel_version_compare(long major1, long minor1, long patch1, + long major2, long minor2, long patch2) { + // Compare major versions + if (major1 > major2) return 1; + if (major1 < major2) return -1; + + // Compare minor versions + if (minor1 > minor2) return 1; + if (minor1 < minor2) return -1; + + // Compare patchlevel versions + if (patch1 > patch2) return 1; + if (patch1 < patch2) return -1; + + return 0; +} + bool os::Linux::get_tick_information(CPUPerfTicks* pticks, int which_logical_cpu) { FILE* fh; uint64_t userTicks, niceTicks, systemTicks, idleTicks; diff --git a/src/hotspot/os/linux/os_linux.hpp b/src/hotspot/os/linux/os_linux.hpp index 51c16e21d07..dd753263119 100644 --- a/src/hotspot/os/linux/os_linux.hpp +++ b/src/hotspot/os/linux/os_linux.hpp @@ -93,7 +93,13 @@ class os::Linux { }; static int active_processor_count(); - static void kernel_version(long* major, long* minor); + static void kernel_version(long* major, long* minor, long* patch); + + // If kernel1 > kernel2 return 1 + // If kernel1 < kernel2 return -1 + // If kernel1 = kernel2 return 0 + static int kernel_version_compare(long major1, long minor1, long patch1, + long major2, long minor2, long patch2); // which_logical_cpu=-1 returns accumulated ticks for all cpus. static bool get_tick_information(CPUPerfTicks* pticks, int which_logical_cpu); diff --git a/src/hotspot/os/linux/systemMemoryBarrier_linux.cpp b/src/hotspot/os/linux/systemMemoryBarrier_linux.cpp index 870b3f5016a..766bb70a977 100644 --- a/src/hotspot/os/linux/systemMemoryBarrier_linux.cpp +++ b/src/hotspot/os/linux/systemMemoryBarrier_linux.cpp @@ -66,11 +66,11 @@ bool LinuxSystemMemoryBarrier::initialize() { // RISCV port was introduced in kernel 4.4. // 4.4 also made membar private expedited mandatory. // But RISCV actually don't support it until 6.9. - long major, minor; - os::Linux::kernel_version(&major, &minor); - if (!(major > 6 || (major == 6 && minor >= 9))) { - log_info(os)("Linux kernel %ld.%ld does not support MEMBARRIER PRIVATE_EXPEDITED on RISC-V.", - major, minor); + long major, minor, patch; + os::Linux::kernel_version(&major, &minor, &patch); + if (os::Linux::kernel_version_compare(major, minor, patch, 6, 9, 0) == -1) { + log_info(os)("Linux kernel %ld.%ld.%ld does not support MEMBARRIER PRIVATE_EXPEDITED on RISC-V.", + major, minor, patch); return false; } #endif diff --git a/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp b/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp index 10652660c73..5b427693a8d 100644 --- a/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp +++ b/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp @@ -24,6 +24,8 @@ */ #include "logging/log.hpp" +#include "logging/logMessage.hpp" +#include "os_linux.hpp" #include "riscv_hwprobe.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" @@ -163,7 +165,18 @@ void RiscvHwprobe::add_features_from_query_result() { VM_Version::ext_C.enable_feature(); } if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_IMA_V)) { - VM_Version::ext_V.enable_feature(); + // Linux signal return bug when using vector with vlen > 128b in pre 6.8.5. + long major, minor, patch; + os::Linux::kernel_version(&major, &minor, &patch); + if (os::Linux::kernel_version_compare(major, minor, patch, 6, 8, 5) == -1) { + LogMessage(os) log; + if (log.is_info()) { + log.info("Linux kernels before 6.8.5 (current %ld.%ld.%ld) have a known bug when using Vector and signals.", major, minor, patch); + log.info("Vector not enabled automatically via hwprobe, but can be turned on with -XX:+UseRVV."); + } + } else { + VM_Version::ext_V.enable_feature(); + } } if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_EXT_ZBA)) { VM_Version::ext_Zba.enable_feature(); diff --git a/src/hotspot/share/cds/cdsConfig.cpp b/src/hotspot/share/cds/cdsConfig.cpp index a86995adb2d..5fa6a94f70b 100644 --- a/src/hotspot/share/cds/cdsConfig.cpp +++ b/src/hotspot/share/cds/cdsConfig.cpp @@ -419,6 +419,11 @@ void CDSConfig::check_flag_aliases() { bool CDSConfig::check_vm_args_consistency(bool patch_mod_javabase, bool mode_flag_cmd_line) { check_flag_aliases(); + if (!FLAG_IS_DEFAULT(AOTMode)) { + // Using any form of the new AOTMode switch enables enhanced optimizations. + FLAG_SET_ERGO_IF_DEFAULT(AOTClassLinking, true); + } + if (AOTClassLinking) { // If AOTClassLinking is specified, enable all AOT optimizations by default. FLAG_SET_ERGO_IF_DEFAULT(AOTInvokeDynamicLinking, true); diff --git a/src/hotspot/share/cds/classListParser.cpp b/src/hotspot/share/cds/classListParser.cpp index ed2a3c61b9c..1b4b6ffb22c 100644 --- a/src/hotspot/share/cds/classListParser.cpp +++ b/src/hotspot/share/cds/classListParser.cpp @@ -42,6 +42,7 @@ #include "jvm.h" #include "logging/log.hpp" #include "logging/logTag.hpp" +#include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "oops/constantPool.inline.hpp" #include "runtime/atomic.hpp" @@ -111,6 +112,12 @@ ClassListParser::~ClassListParser() { _instance = nullptr; } +void ClassListParser::parse_classlist(const char* classlist_path, ParseMode parse_mode, TRAPS) { + UnregisteredClasses::initialize(CHECK); + ClassListParser parser(classlist_path, parse_mode); + parser.parse(THREAD); +} + void ClassListParser::parse(TRAPS) { for (; !_input_stream.done(); _input_stream.next()) { _line = _input_stream.current_line(); @@ -387,6 +394,19 @@ bool ClassListParser::parse_uint_option(const char* option_name, int* value) { return false; } +objArrayOop ClassListParser::get_specified_interfaces(TRAPS) { + const int n = _interfaces->length(); + if (n == 0) { + return nullptr; + } else { + objArrayOop array = oopFactory::new_objArray(vmClasses::Class_klass(), n, CHECK_NULL); + for (int i = 0; i < n; i++) { + array->obj_at_put(i, lookup_class_by_id(_interfaces->at(i))->java_mirror()); + } + return array; + } +} + void ClassListParser::print_specified_interfaces() { const int n = _interfaces->length(); jio_fprintf(defaultStream::error_stream(), "Currently specified interfaces[%d] = {\n", n); @@ -514,7 +534,17 @@ InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS ResourceMark rm; char * source_path = os::strdup_check_oom(ClassLoader::uri_to_path(_source)); - InstanceKlass* k = UnregisteredClasses::load_class(class_name, source_path, CHECK_NULL); + InstanceKlass* specified_super = lookup_class_by_id(_super); + Handle super_class(THREAD, specified_super->java_mirror()); + objArrayOop r = get_specified_interfaces(CHECK_NULL); + objArrayHandle interfaces(THREAD, r); + InstanceKlass* k = UnregisteredClasses::load_class(class_name, source_path, + super_class, interfaces, CHECK_NULL); + if (k->java_super() != specified_super) { + error("The specified super class %s (id %d) does not match actual super class %s", + specified_super->external_name(), _super, + k->java_super()->external_name()); + } if (k->local_interfaces()->length() != _interfaces->length()) { print_specified_interfaces(); print_actual_interfaces(k); @@ -734,49 +764,6 @@ InstanceKlass* ClassListParser::lookup_class_by_id(int id) { return *klass_ptr; } - -InstanceKlass* ClassListParser::lookup_super_for_current_class(Symbol* super_name) { - if (!is_loading_from_source()) { - return nullptr; - } - - InstanceKlass* k = lookup_class_by_id(super()); - if (super_name != k->name()) { - error("The specified super class %s (id %d) does not match actual super class %s", - k->name()->as_klass_external_name(), super(), - super_name->as_klass_external_name()); - } - return k; -} - -InstanceKlass* ClassListParser::lookup_interface_for_current_class(Symbol* interface_name) { - if (!is_loading_from_source()) { - return nullptr; - } - - const int n = _interfaces->length(); - if (n == 0) { - error("Class %s implements the interface %s, but no interface has been specified in the input line", - _class_name, interface_name->as_klass_external_name()); - ShouldNotReachHere(); - } - - int i; - for (i=0; iat(i)); - if (interface_name == k->name()) { - return k; - } - } - - // interface_name is not specified by the "interfaces:" keyword. - print_specified_interfaces(); - error("The interface %s implemented by class %s does not match any of the specified interface IDs", - interface_name->as_klass_external_name(), _class_name); - ShouldNotReachHere(); - return nullptr; -} - InstanceKlass* ClassListParser::find_builtin_class_helper(JavaThread* current, Symbol* class_name_symbol, oop class_loader_oop) { Handle class_loader(current, class_loader_oop); return SystemDictionary::find_instance_klass(current, class_name_symbol, class_loader); diff --git a/src/hotspot/share/cds/classListParser.hpp b/src/hotspot/share/cds/classListParser.hpp index 540e61335d0..1b059b4d85a 100644 --- a/src/hotspot/share/cds/classListParser.hpp +++ b/src/hotspot/share/cds/classListParser.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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 @@ -137,12 +137,10 @@ class ClassListParser : public StackObj { void print_diagnostic_info(outputStream* st, const char* msg, ...) ATTRIBUTE_PRINTF(3, 0); void constant_pool_resolution_warning(const char* msg, ...) ATTRIBUTE_PRINTF(2, 0); void error(const char* msg, ...) ATTRIBUTE_PRINTF(2, 0); + objArrayOop get_specified_interfaces(TRAPS); public: - static void parse_classlist(const char* classlist_path, ParseMode parse_mode, TRAPS) { - ClassListParser parser(classlist_path, parse_mode); - parser.parse(THREAD); - } + static void parse_classlist(const char* classlist_path, ParseMode parse_mode, TRAPS); static bool is_parsing_thread(); static ClassListParser* instance() { @@ -201,12 +199,6 @@ class ClassListParser : public StackObj { } bool is_loading_from_source(); - - // Look up the super or interface of the current class being loaded - // (in this->load_current_class()). - InstanceKlass* lookup_super_for_current_class(Symbol* super_name); - InstanceKlass* lookup_interface_for_current_class(Symbol* interface_name); - static void populate_cds_indy_info(const constantPoolHandle &pool, int cp_index, CDSIndyInfo* cii, TRAPS); }; #endif // SHARE_CDS_CLASSLISTPARSER_HPP diff --git a/src/hotspot/share/cds/metaspaceShared.cpp b/src/hotspot/share/cds/metaspaceShared.cpp index 2020a477d73..a51a903df09 100644 --- a/src/hotspot/share/cds/metaspaceShared.cpp +++ b/src/hotspot/share/cds/metaspaceShared.cpp @@ -214,34 +214,64 @@ void MetaspaceShared::dump_loaded_classes(const char* file_name, TRAPS) { } } -static bool shared_base_too_high(char* specified_base, char* aligned_base, size_t cds_max) { - if (specified_base != nullptr && aligned_base < specified_base) { - // SharedBaseAddress is very high (e.g., 0xffffffffffffff00) so - // align_up(SharedBaseAddress, MetaspaceShared::core_region_alignment()) has wrapped around. - return true; +// If p is not aligned, move it up to the next address that's aligned with alignment. +// If this is not possible (because p is too high), return nullptr. Example: +// p = 0xffffffffffff0000, alignment= 0x10000 => return nullptr. +static char* align_up_or_null(char* p, size_t alignment) { + assert(p != nullptr, "sanity"); + if (is_aligned(p, alignment)) { + return p; + } + + char* down = align_down(p, alignment); + if (max_uintx - uintx(down) < uintx(alignment)) { + // Run out of address space to align up. + return nullptr; } + + char* aligned = align_up(p, alignment); + assert(aligned >= p, "sanity"); + assert(aligned != nullptr, "sanity"); + return aligned; +} + +static bool shared_base_too_high(char* specified_base, char* aligned_base, size_t cds_max) { + // Caller should have checked if align_up_or_null( returns nullptr (comparing specified_base + // with nullptr is UB). + assert(aligned_base != nullptr, "sanity"); + assert(aligned_base >= specified_base, "sanity"); + if (max_uintx - uintx(aligned_base) < uintx(cds_max)) { - // The end of the archive will wrap around + // Not enough address space to hold an archive of cds_max bytes from aligned_base. return true; + } else { + return false; } - - return false; } static char* compute_shared_base(size_t cds_max) { char* specified_base = (char*)SharedBaseAddress; - char* aligned_base = align_up(specified_base, MetaspaceShared::core_region_alignment()); + size_t alignment = MetaspaceShared::core_region_alignment(); if (UseCompressedClassPointers) { - aligned_base = align_up(specified_base, Metaspace::reserve_alignment()); + alignment = MAX2(alignment, Metaspace::reserve_alignment()); } + if (SharedBaseAddress == 0) { + // Special meaning of -XX:SharedBaseAddress=0 -> Always map archive at os-selected address. + return specified_base; + } + + char* aligned_base = align_up_or_null(specified_base, alignment); + if (aligned_base != specified_base) { log_info(cds)("SharedBaseAddress (" INTPTR_FORMAT ") aligned up to " INTPTR_FORMAT, p2i(specified_base), p2i(aligned_base)); } const char* err = nullptr; - if (shared_base_too_high(specified_base, aligned_base, cds_max)) { + if (aligned_base == nullptr) { + err = "too high"; + } else if (shared_base_too_high(specified_base, aligned_base, cds_max)) { err = "too high"; } else if (!shared_base_valid(aligned_base)) { err = "invalid for this platform"; @@ -249,12 +279,15 @@ static char* compute_shared_base(size_t cds_max) { return aligned_base; } + // Arguments::default_SharedBaseAddress() is hard-coded in cds_globals.hpp. It must be carefully + // picked that (a) the align_up() below will always return a valid value; (b) none of + // the following asserts will fail. log_warning(cds)("SharedBaseAddress (" INTPTR_FORMAT ") is %s. Reverted to " INTPTR_FORMAT, p2i((void*)SharedBaseAddress), err, p2i((void*)Arguments::default_SharedBaseAddress())); specified_base = (char*)Arguments::default_SharedBaseAddress(); - aligned_base = align_up(specified_base, MetaspaceShared::core_region_alignment()); + aligned_base = align_up(specified_base, alignment); // Make sure the default value of SharedBaseAddress specified in globals.hpp is sane. assert(!shared_base_too_high(specified_base, aligned_base, cds_max), "Sanity"); diff --git a/src/hotspot/share/cds/unregisteredClasses.cpp b/src/hotspot/share/cds/unregisteredClasses.cpp index ca52eb1ea70..173713e341a 100644 --- a/src/hotspot/share/cds/unregisteredClasses.cpp +++ b/src/hotspot/share/cds/unregisteredClasses.cpp @@ -28,7 +28,7 @@ #include "classfile/classLoaderExt.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/symbolTable.hpp" -#include "classfile/systemDictionaryShared.hpp" +#include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" @@ -38,10 +38,22 @@ #include "runtime/javaCalls.hpp" #include "services/threadService.hpp" +InstanceKlass* UnregisteredClasses::_UnregisteredClassLoader_klass = nullptr; + +void UnregisteredClasses::initialize(TRAPS) { + if (_UnregisteredClassLoader_klass == nullptr) { + // no need for synchronization as this function is called single-threaded. + Symbol* klass_name = SymbolTable::new_symbol("jdk/internal/misc/CDS$UnregisteredClassLoader"); + Klass* k = SystemDictionary::resolve_or_fail(klass_name, true, CHECK); + _UnregisteredClassLoader_klass = InstanceKlass::cast(k); + } +} + // Load the class of the given name from the location given by path. The path is specified by // the "source:" in the class list file (see classListParser.cpp), and can be a directory or // a JAR file. -InstanceKlass* UnregisteredClasses::load_class(Symbol* name, const char* path, TRAPS) { +InstanceKlass* UnregisteredClasses::load_class(Symbol* name, const char* path, + Handle super_class, objArrayHandle interfaces, TRAPS) { assert(name != nullptr, "invariant"); assert(CDSConfig::is_dumping_static_archive(), "this function is only used with -Xshare:dump"); @@ -49,19 +61,23 @@ InstanceKlass* UnregisteredClasses::load_class(Symbol* name, const char* path, T THREAD->get_thread_stat()->perf_timers_addr(), PerfClassTraceTime::CLASS_LOAD); + // Call CDS$UnregisteredClassLoader::load(String name, Class superClass, Class[] interfaces) + Symbol* methodName = SymbolTable::new_symbol("load"); + Symbol* methodSignature = SymbolTable::new_symbol("(Ljava/lang/String;Ljava/lang/Class;[Ljava/lang/Class;)Ljava/lang/Class;"); Symbol* path_symbol = SymbolTable::new_symbol(path); - Symbol* findClass = SymbolTable::new_symbol("findClass"); - Handle url_classloader = get_url_classloader(path_symbol, CHECK_NULL); + Handle classloader = get_classloader(path_symbol, CHECK_NULL); Handle ext_class_name = java_lang_String::externalize_classname(name, CHECK_NULL); JavaValue result(T_OBJECT); - JavaCallArguments args(2); - args.set_receiver(url_classloader); + JavaCallArguments args(3); + args.set_receiver(classloader); args.push_oop(ext_class_name); + args.push_oop(super_class); + args.push_oop(interfaces); JavaCalls::call_virtual(&result, - vmClasses::URLClassLoader_klass(), - findClass, - vmSymbols::string_class_signature(), + UnregisteredClassLoader_klass(), + methodName, + methodSignature, &args, CHECK_NULL); assert(result.get_type() == T_OBJECT, "just checking"); @@ -69,45 +85,35 @@ InstanceKlass* UnregisteredClasses::load_class(Symbol* name, const char* path, T return InstanceKlass::cast(java_lang_Class::as_Klass(obj)); } -class URLClassLoaderTable : public ResourceHashtable< +class UnregisteredClasses::ClassLoaderTable : public ResourceHashtable< Symbol*, OopHandle, 137, // prime number AnyObj::C_HEAP> {}; -static URLClassLoaderTable* _url_classloader_table = nullptr; +static UnregisteredClasses::ClassLoaderTable* _classloader_table = nullptr; -Handle UnregisteredClasses::create_url_classloader(Symbol* path, TRAPS) { +Handle UnregisteredClasses::create_classloader(Symbol* path, TRAPS) { ResourceMark rm(THREAD); JavaValue result(T_OBJECT); Handle path_string = java_lang_String::create_from_str(path->as_C_string(), CHECK_NH); - JavaCalls::call_static(&result, - vmClasses::jdk_internal_loader_ClassLoaders_klass(), - vmSymbols::toFileURL_name(), - vmSymbols::toFileURL_signature(), - path_string, CHECK_NH); - assert(result.get_type() == T_OBJECT, "just checking"); - oop url_h = result.get_oop(); - objArrayHandle urls = oopFactory::new_objArray_handle(vmClasses::URL_klass(), 1, CHECK_NH); - urls->obj_at_put(0, url_h); - - Handle url_classloader = JavaCalls::construct_new_instance( - vmClasses::URLClassLoader_klass(), - vmSymbols::url_array_classloader_void_signature(), - urls, Handle(), CHECK_NH); - return url_classloader; + Handle classloader = JavaCalls::construct_new_instance( + UnregisteredClassLoader_klass(), + vmSymbols::string_void_signature(), + path_string, CHECK_NH); + return classloader; } -Handle UnregisteredClasses::get_url_classloader(Symbol* path, TRAPS) { - if (_url_classloader_table == nullptr) { - _url_classloader_table = new (mtClass)URLClassLoaderTable(); +Handle UnregisteredClasses::get_classloader(Symbol* path, TRAPS) { + if (_classloader_table == nullptr) { + _classloader_table = new (mtClass)ClassLoaderTable(); } - OopHandle* url_classloader_ptr = _url_classloader_table->get(path); - if (url_classloader_ptr != nullptr) { - return Handle(THREAD, (*url_classloader_ptr).resolve()); + OopHandle* classloader_ptr = _classloader_table->get(path); + if (classloader_ptr != nullptr) { + return Handle(THREAD, (*classloader_ptr).resolve()); } else { - Handle url_classloader = create_url_classloader(path, CHECK_NH); - _url_classloader_table->put(path, OopHandle(Universe::vm_global(), url_classloader())); + Handle classloader = create_classloader(path, CHECK_NH); + _classloader_table->put(path, OopHandle(Universe::vm_global(), classloader())); path->increment_refcount(); - return url_classloader; + return classloader; } } diff --git a/src/hotspot/share/cds/unregisteredClasses.hpp b/src/hotspot/share/cds/unregisteredClasses.hpp index a9f7dceaead..ea3a308c2de 100644 --- a/src/hotspot/share/cds/unregisteredClasses.hpp +++ b/src/hotspot/share/cds/unregisteredClasses.hpp @@ -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 @@ -25,15 +25,30 @@ #ifndef SHARE_CDS_UNREGISTEREDCLASSES_HPP #define SHARE_CDS_UNREGISTEREDCLASSES_HPP +#include "memory/allStatic.hpp" #include "runtime/handles.hpp" +class InstanceKlass; +class Symbol; + class UnregisteredClasses: AllStatic { public: - static InstanceKlass* load_class(Symbol* h_name, const char* path, TRAPS); + static InstanceKlass* load_class(Symbol* h_name, const char* path, + Handle super_class, objArrayHandle interfaces, + TRAPS); + static void initialize(TRAPS); + static InstanceKlass* UnregisteredClassLoader_klass() { + return _UnregisteredClassLoader_klass; + } + + class ClassLoaderTable; private: - static Handle create_url_classloader(Symbol* path, TRAPS); - static Handle get_url_classloader(Symbol* path, TRAPS); + // Don't put this in vmClasses as it's used only with CDS dumping. + static InstanceKlass* _UnregisteredClassLoader_klass; + + static Handle create_classloader(Symbol* path, TRAPS); + static Handle get_classloader(Symbol* path, TRAPS); }; #endif // SHARE_CDS_UNREGISTEREDCLASSES_HPP diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp index b51cfc03e78..34b4c72399d 100644 --- a/src/hotspot/share/classfile/systemDictionary.cpp +++ b/src/hotspot/share/classfile/systemDictionary.cpp @@ -423,16 +423,6 @@ InstanceKlass* SystemDictionary::resolve_with_circularity_detection(Symbol* clas assert(next_name != nullptr, "null superclass for resolving"); assert(!Signature::is_array(next_name), "invalid superclass name"); -#if INCLUDE_CDS - if (CDSConfig::is_dumping_static_archive()) { - // Special processing for handling UNREGISTERED shared classes. - InstanceKlass* k = SystemDictionaryShared::lookup_super_for_unregistered_class(class_name, - next_name, is_superclass); - if (k) { - return k; - } - } -#endif // INCLUDE_CDS // If class_name is already loaded, just return the superclass or superinterface. // Make sure there's a placeholder for the class_name before resolving. diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp index 28fd53eedcd..0b40fb6d681 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.cpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp @@ -35,6 +35,7 @@ #include "cds/heapShared.hpp" #include "cds/metaspaceShared.hpp" #include "cds/runTimeClassInfo.hpp" +#include "cds/unregisteredClasses.hpp" #include "classfile/classFileStream.hpp" #include "classfile/classLoader.hpp" #include "classfile/classLoaderData.inline.hpp" @@ -352,6 +353,12 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) { } } + if (k == UnregisteredClasses::UnregisteredClassLoader_klass()) { + ResourceMark rm; + log_info(cds)("Skipping %s: used only when dumping CDS archive", k->name()->as_C_string()); + return true; + } + return false; // false == k should NOT be excluded } @@ -470,45 +477,6 @@ bool SystemDictionaryShared::add_unregistered_class(Thread* current, InstanceKla return (klass == *v); } -// This function is called to lookup the super/interfaces of shared classes for -// unregistered loaders. E.g., SharedClass in the below example -// where "super:" (and optionally "interface:") have been specified. -// -// java/lang/Object id: 0 -// Interface id: 2 super: 0 source: cust.jar -// SharedClass id: 4 super: 0 interfaces: 2 source: cust.jar -InstanceKlass* SystemDictionaryShared::lookup_super_for_unregistered_class( - Symbol* class_name, Symbol* super_name, bool is_superclass) { - - assert(CDSConfig::is_dumping_static_archive(), "only when static dumping"); - - if (!ClassListParser::is_parsing_thread()) { - // Unregistered classes can be created only by ClassListParser::_parsing_thread. - - return nullptr; - } - - ClassListParser* parser = ClassListParser::instance(); - if (parser == nullptr) { - // We're still loading the well-known classes, before the ClassListParser is created. - return nullptr; - } - if (class_name->equals(parser->current_class_name())) { - // When this function is called, all the numbered super and interface types - // must have already been loaded. Hence this function is never recursively called. - if (is_superclass) { - return parser->lookup_super_for_current_class(super_name); - } else { - return parser->lookup_interface_for_current_class(super_name); - } - } else { - // The VM is not trying to resolve a super type of parser->current_class_name(). - // Instead, it's resolving an error class (because parser->current_class_name() has - // failed parsing or verification). Don't do anything here. - return nullptr; - } -} - void SystemDictionaryShared::set_shared_class_misc_info(InstanceKlass* k, ClassFileStream* cfs) { assert(CDSConfig::is_dumping_archive(), "sanity"); assert(!is_builtin(k), "must be unregistered class"); diff --git a/src/hotspot/share/classfile/vmClassMacros.hpp b/src/hotspot/share/classfile/vmClassMacros.hpp index 395034d4a21..7dc2d7f60c9 100644 --- a/src/hotspot/share/classfile/vmClassMacros.hpp +++ b/src/hotspot/share/classfile/vmClassMacros.hpp @@ -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 @@ -138,7 +138,6 @@ /* support for CDS */ \ do_klass(ByteArrayInputStream_klass, java_io_ByteArrayInputStream ) \ do_klass(URL_klass, java_net_URL ) \ - do_klass(URLClassLoader_klass, java_net_URLClassLoader ) \ do_klass(Enum_klass, java_lang_Enum ) \ do_klass(Jar_Manifest_klass, java_util_jar_Manifest ) \ do_klass(jdk_internal_loader_BuiltinClassLoader_klass,jdk_internal_loader_BuiltinClassLoader ) \ diff --git a/src/hotspot/share/classfile/vmSymbols.hpp b/src/hotspot/share/classfile/vmSymbols.hpp index 6859ce42491..8ee5ff02a6a 100644 --- a/src/hotspot/share/classfile/vmSymbols.hpp +++ b/src/hotspot/share/classfile/vmSymbols.hpp @@ -124,7 +124,6 @@ class SerializeClosure; template(java_security_ProtectionDomain, "java/security/ProtectionDomain") \ template(java_security_SecureClassLoader, "java/security/SecureClassLoader") \ template(java_net_URL, "java/net/URL") \ - template(java_net_URLClassLoader, "java/net/URLClassLoader") \ template(java_util_jar_Manifest, "java/util/jar/Manifest") \ template(java_io_ByteArrayInputStream, "java/io/ByteArrayInputStream") \ template(java_io_Serializable, "java/io/Serializable") \ @@ -739,7 +738,6 @@ class SerializeClosure; template(runtimeSetup, "runtimeSetup") \ template(toFileURL_name, "toFileURL") \ template(toFileURL_signature, "(Ljava/lang/String;)Ljava/net/URL;") \ - template(url_array_classloader_void_signature, "([Ljava/net/URL;Ljava/lang/ClassLoader;)V") \ \ /* jcmd Thread.dump_to_file */ \ template(jdk_internal_vm_ThreadDumper, "jdk/internal/vm/ThreadDumper") \ diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index badcfeab295..c2e2e2d607f 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -365,13 +365,24 @@ void CompileQueue::free_all() { while (next != nullptr) { CompileTask* current = next; next = current->next(); + bool found_waiter = false; { - // Wake up thread that blocks on the compile task. MutexLocker ct_lock(current->lock()); - current->lock()->notify(); + assert(current->waiting_for_completion_count() <= 1, "more than one thread are waiting for task"); + if (current->waiting_for_completion_count() > 0) { + // If another thread waits for this task, we must wake them up + // so they will stop waiting and free the task. + current->lock()->notify(); + found_waiter = true; + } + } + if (!found_waiter) { + // If no one was waiting for this task, we need to free it ourselves. In this case, the task + // is also certainly unlocked, because, again, there is no waiter. + // Otherwise, by convention, it's the waiters responsibility to free the task. + // Put the task back on the freelist. + CompileTask::free(current); } - // Put the task back on the freelist. - CompileTask::free(current); } _first = nullptr; _last = nullptr; @@ -773,20 +784,6 @@ void CompileBroker::compilation_init(JavaThread* THREAD) { } #if defined(ASSERT) && COMPILER2_OR_JVMCI -// Stress testing. Dedicated threads revert optimizations based on escape analysis concurrently to -// the running java application. Configured with vm options DeoptimizeObjectsALot*. -class DeoptimizeObjectsALotThread : public JavaThread { - - static void deopt_objs_alot_thread_entry(JavaThread* thread, TRAPS); - void deoptimize_objects_alot_loop_single(); - void deoptimize_objects_alot_loop_all(); - -public: - DeoptimizeObjectsALotThread() : JavaThread(&deopt_objs_alot_thread_entry) { } - - bool is_hidden_from_external_view() const { return true; } -}; - // Entry for DeoptimizeObjectsALotThread. The threads are started in // CompileBroker::init_compiler_threads() iff DeoptimizeObjectsALot is enabled void DeoptimizeObjectsALotThread::deopt_objs_alot_thread_entry(JavaThread* thread, TRAPS) { @@ -1736,9 +1733,11 @@ void CompileBroker::wait_for_completion(CompileTask* task) { { MonitorLocker ml(thread, task->lock()); free_task = true; + task->inc_waiting_for_completion(); while (!task->is_complete() && !is_compilation_disabled_forever()) { ml.wait(); } + task->dec_waiting_for_completion(); } if (free_task) { diff --git a/src/hotspot/share/compiler/compileBroker.hpp b/src/hotspot/share/compiler/compileBroker.hpp index f6067f75d32..ac62a20bc6f 100644 --- a/src/hotspot/share/compiler/compileBroker.hpp +++ b/src/hotspot/share/compiler/compileBroker.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -39,6 +39,22 @@ class nmethod; +#if defined(ASSERT) && COMPILER2_OR_JVMCI +// Stress testing. Dedicated threads revert optimizations based on escape analysis concurrently to +// the running java application. Configured with vm options DeoptimizeObjectsALot*. +class DeoptimizeObjectsALotThread : public JavaThread { + + static void deopt_objs_alot_thread_entry(JavaThread* thread, TRAPS); + void deoptimize_objects_alot_loop_single(); + void deoptimize_objects_alot_loop_all(); + +public: + DeoptimizeObjectsALotThread() : JavaThread(&deopt_objs_alot_thread_entry) { } + + bool is_hidden_from_external_view() const { return true; } +}; +#endif + // CompilerCounters // // Per Compiler Performance Counters. diff --git a/src/hotspot/share/compiler/compileTask.cpp b/src/hotspot/share/compiler/compileTask.cpp index 2011fa65624..e266a215de1 100644 --- a/src/hotspot/share/compiler/compileTask.cpp +++ b/src/hotspot/share/compiler/compileTask.cpp @@ -106,6 +106,8 @@ void CompileTask::initialize(int compile_id, _comp_level = comp_level; _num_inlined_bytecodes = 0; + _waiting_count = 0; + _is_complete = false; _is_success = false; @@ -282,21 +284,6 @@ void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, i } } -void CompileTask::print_inline_indent(int inline_level, outputStream* st) { - // 1234567 - st->print(" "); // print timestamp - // 1234 - st->print(" "); // print compilation number - // %s!bn - st->print(" "); // print method attributes - if (TieredCompilation) { - st->print(" "); - } - st->print(" "); // more indent - st->print(" "); // initial inlining indent - for (int i = 0; i < inline_level; i++) st->print(" "); -} - // ------------------------------------------------------------------ // CompileTask::print_compilation void CompileTask::print(outputStream* st, const char* msg, bool short_form, bool cr) { @@ -410,45 +397,76 @@ bool CompileTask::check_break_at_flags() { // ------------------------------------------------------------------ // CompileTask::print_inlining void CompileTask::print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg) { + print_inlining_header(st, method, inline_level, bci); + print_inlining_inner_message(st, result, msg); + st->cr(); +} + +void CompileTask::print_inlining_header(outputStream* st, ciMethod* method, int inline_level, int bci) { // 1234567 - st->print(" "); // print timestamp + st->print(" "); // print timestamp // 1234 - st->print(" "); // print compilation number + st->print(" "); // print compilation number // method attributes if (method->is_loaded()) { - const char sync_char = method->is_synchronized() ? 's' : ' '; + const char sync_char = method->is_synchronized() ? 's' : ' '; const char exception_char = method->has_exception_handlers() ? '!' : ' '; - const char monitors_char = method->has_monitor_bytecodes() ? 'm' : ' '; + const char monitors_char = method->has_monitor_bytecodes() ? 'm' : ' '; // print method attributes st->print(" %c%c%c ", sync_char, exception_char, monitors_char); } else { // %s!bn - st->print(" "); // print method attributes + st->print(" "); // print method attributes } if (TieredCompilation) { st->print(" "); } - st->print(" "); // more indent - st->print(" "); // initial inlining indent + st->print(" "); // more indent + st->print(" "); // initial inlining indent - for (int i = 0; i < inline_level; i++) st->print(" "); + for (int i = 0; i < inline_level; i++) { + st->print(" "); + } + + st->print("@ %d ", bci); // print bci + print_inline_inner_method_info(st, method); +} - st->print("@ %d ", bci); // print bci +void CompileTask::print_inline_inner_method_info(outputStream* st, ciMethod* method) { method->print_short_name(st); - if (method->is_loaded()) + if (method->is_loaded()) { st->print(" (%d bytes)", method->code_size()); - else + } else { st->print(" (not loaded)"); + } +} + +void CompileTask::print_inline_indent(int inline_level, outputStream* st) { + // 1234567 + st->print(" "); // print timestamp + // 1234 + st->print(" "); // print compilation number + // %s!bn + st->print(" "); // print method attributes + if (TieredCompilation) { + st->print(" "); + } + st->print(" "); // more indent + st->print(" "); // initial inlining indent + for (int i = 0; i < inline_level; i++) { + st->print(" "); + } +} +void CompileTask::print_inlining_inner_message(outputStream* st, InliningResult result, const char* msg) { if (msg != nullptr) { st->print(" %s%s", result == InliningResult::SUCCESS ? "" : "failed to inline: ", msg); } else if (result == InliningResult::FAILURE) { st->print(" %s", "failed to inline"); } - st->cr(); } void CompileTask::print_ul(const char* msg){ diff --git a/src/hotspot/share/compiler/compileTask.hpp b/src/hotspot/share/compiler/compileTask.hpp index 37459bd0ff5..14591a3abdf 100644 --- a/src/hotspot/share/compiler/compileTask.hpp +++ b/src/hotspot/share/compiler/compileTask.hpp @@ -98,6 +98,7 @@ class CompileTask : public CHeapObj { // Compilation state for a blocking JVMCI compilation JVMCICompileState* _blocking_jvmci_compile_state; #endif + int _waiting_count; // See waiting_for_completion_count() int _comp_level; int _num_inlined_bytecodes; CompileTask* _next, *_prev; @@ -174,6 +175,23 @@ class CompileTask : public CHeapObj { Monitor* lock() const { return _lock; } + // See how many threads are waiting for this task. Must have lock to read this. + int waiting_for_completion_count() { + assert(_lock->owned_by_self(), "must have lock to use waiting_for_completion_count()"); + return _waiting_count; + } + // Indicates that a thread is waiting for this task to complete. Must have lock to use this. + void inc_waiting_for_completion() { + assert(_lock->owned_by_self(), "must have lock to use inc_waiting_for_completion()"); + _waiting_count++; + } + // Indicates that a thread stopped waiting for this task to complete. Must have lock to use this. + void dec_waiting_for_completion() { + assert(_lock->owned_by_self(), "must have lock to use dec_waiting_for_completion()"); + assert(_waiting_count > 0, "waiting count is not positive"); + _waiting_count--; + } + void mark_complete() { _is_complete = true; } void mark_success() { _is_success = true; } void mark_started(jlong time) { _time_started = time; } @@ -218,6 +236,9 @@ class CompileTask : public CHeapObj { } static void print_ul(const nmethod* nm, const char* msg = nullptr); + /** + * @deprecated Please rely on Compile::inline_printer. Do not directly write inlining information to tty. + */ static void print_inline_indent(int inline_level, outputStream* st = tty); void print_tty(); @@ -235,7 +256,11 @@ class CompileTask : public CHeapObj { bool check_break_at_flags(); + static void print_inlining_header(outputStream* st, ciMethod* method, int inline_level, int bci); static void print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg = nullptr); + static void print_inline_inner_method_info(outputStream* st, ciMethod* method); + static void print_inlining_inner_message(outputStream* st, InliningResult result, const char* msg); + static void print_inlining_tty(ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg = nullptr) { print_inlining_inner(tty, method, inline_level, bci, result, msg); } diff --git a/src/hotspot/share/gc/parallel/parMarkBitMap.cpp b/src/hotspot/share/gc/parallel/parMarkBitMap.cpp index cda892f68ca..f1d309807b5 100644 --- a/src/hotspot/share/gc/parallel/parMarkBitMap.cpp +++ b/src/hotspot/share/gc/parallel/parMarkBitMap.cpp @@ -50,6 +50,11 @@ ParMarkBitMap::initialize(MemRegion covered_region) rs_align, page_sz); + if (!rs.is_reserved()) { + // Failed to reserve memory for the bitmap, + return false; + } + const size_t used_page_sz = rs.page_size(); os::trace_page_sizes("Mark Bitmap", raw_bytes, raw_bytes, rs.base(), rs.size(), used_page_sz); @@ -57,25 +62,24 @@ ParMarkBitMap::initialize(MemRegion covered_region) MemTracker::record_virtual_memory_tag((address)rs.base(), mtGC); _virtual_space = new PSVirtualSpace(rs, page_sz); - if (_virtual_space != nullptr && _virtual_space->expand_by(_reserved_byte_size)) { - _heap_start = covered_region.start(); - _heap_size = covered_region.word_size(); - BitMap::bm_word_t* map = (BitMap::bm_word_t*)_virtual_space->reserved_low_addr(); - _beg_bits = BitMapView(map, bits); - return true; - } - _heap_start = nullptr; - _heap_size = 0; - if (_virtual_space != nullptr) { + if (!_virtual_space->expand_by(_reserved_byte_size)) { + // Failed to commit memory for the bitmap. + delete _virtual_space; - _virtual_space = nullptr; + // Release memory reserved in the space. - if (rs.is_reserved()) { - MemoryReserver::release(rs); - } + MemoryReserver::release(rs); + + return false; } - return false; + + _heap_start = covered_region.start(); + _heap_size = covered_region.word_size(); + BitMap::bm_word_t* map = (BitMap::bm_word_t*)_virtual_space->reserved_low_addr(); + _beg_bits = BitMapView(map, bits); + + return true; } #ifdef ASSERT diff --git a/src/hotspot/share/gc/parallel/psCompactionManager.cpp b/src/hotspot/share/gc/parallel/psCompactionManager.cpp index 0601c5047eb..f00e18c3297 100644 --- a/src/hotspot/share/gc/parallel/psCompactionManager.cpp +++ b/src/hotspot/share/gc/parallel/psCompactionManager.cpp @@ -28,6 +28,8 @@ #include "gc/parallel/psCompactionManager.inline.hpp" #include "gc/parallel/psOldGen.hpp" #include "gc/parallel/psParallelCompact.inline.hpp" +#include "gc/shared/partialArraySplitter.inline.hpp" +#include "gc/shared/partialArrayState.hpp" #include "gc/shared/preservedMarks.inline.hpp" #include "gc/shared/taskqueue.inline.hpp" #include "logging/log.hpp" @@ -42,9 +44,9 @@ PSOldGen* ParCompactionManager::_old_gen = nullptr; ParCompactionManager** ParCompactionManager::_manager_array = nullptr; -ParCompactionManager::OopTaskQueueSet* ParCompactionManager::_oop_task_queues = nullptr; -ParCompactionManager::ObjArrayTaskQueueSet* ParCompactionManager::_objarray_task_queues = nullptr; +ParCompactionManager::PSMarkTasksQueueSet* ParCompactionManager::_marking_stacks = nullptr; ParCompactionManager::RegionTaskQueueSet* ParCompactionManager::_region_task_queues = nullptr; +PartialArrayStateManager* ParCompactionManager::_partial_array_state_manager = nullptr; ObjectStartArray* ParCompactionManager::_start_array = nullptr; ParMarkBitMap* ParCompactionManager::_mark_bitmap = nullptr; @@ -54,8 +56,10 @@ Monitor* ParCompactionManager::_shadow_region_monitor = nullptr; PreservedMarksSet* ParCompactionManager::_preserved_marks_set = nullptr; ParCompactionManager::ParCompactionManager(PreservedMarks* preserved_marks, - ReferenceProcessor* ref_processor) - : _mark_and_push_closure(this, ref_processor) { + ReferenceProcessor* ref_processor, + uint parallel_gc_threads) + :_partial_array_splitter(_partial_array_state_manager, parallel_gc_threads), + _mark_and_push_closure(this, ref_processor) { ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); @@ -78,8 +82,10 @@ void ParCompactionManager::initialize(ParMarkBitMap* mbm) { assert(_manager_array == nullptr, "Attempt to initialize twice"); _manager_array = NEW_C_HEAP_ARRAY(ParCompactionManager*, parallel_gc_threads, mtGC); - _oop_task_queues = new OopTaskQueueSet(parallel_gc_threads); - _objarray_task_queues = new ObjArrayTaskQueueSet(parallel_gc_threads); + assert(_partial_array_state_manager == nullptr, "Attempt to initialize twice"); + _partial_array_state_manager + = new PartialArrayStateManager(parallel_gc_threads); + _marking_stacks = new PSMarkTasksQueueSet(parallel_gc_threads); _region_task_queues = new RegionTaskQueueSet(parallel_gc_threads); _preserved_marks_set = new PreservedMarksSet(true); @@ -88,16 +94,15 @@ void ParCompactionManager::initialize(ParMarkBitMap* mbm) { // Create and register the ParCompactionManager(s) for the worker threads. for(uint i=0; iget(i), - PSParallelCompact::ref_processor()); - oop_task_queues()->register_queue(i, _manager_array[i]->oop_stack()); - _objarray_task_queues->register_queue(i, &_manager_array[i]->_objarray_stack); + PSParallelCompact::ref_processor(), + parallel_gc_threads); + marking_stacks()->register_queue(i, _manager_array[i]->marking_stack()); region_task_queues()->register_queue(i, _manager_array[i]->region_stack()); } _shadow_region_array = new (mtGC) GrowableArray(10, mtGC); _shadow_region_monitor = new Monitor(Mutex::nosafepoint, "CompactionManager_lock"); - } void ParCompactionManager::flush_all_string_dedup_requests() { @@ -114,42 +119,41 @@ ParCompactionManager::gc_thread_compaction_manager(uint index) { return _manager_array[index]; } -inline void ParCompactionManager::publish_and_drain_oop_tasks() { - oop obj; - while (oop_stack()->pop_overflow(obj)) { - if (!oop_stack()->try_push_to_taskqueue(obj)) { - follow_contents(obj); - } - } - while (oop_stack()->pop_local(obj)) { - follow_contents(obj); - } +void ParCompactionManager::push_objArray(oop obj) { + assert(obj->is_objArray(), "precondition"); + _mark_and_push_closure.do_klass(obj->klass()); + + objArrayOop obj_array = objArrayOop(obj); + size_t array_length = obj_array->length(); + size_t initial_chunk_size = + _partial_array_splitter.start(&_marking_stack, obj_array, nullptr, array_length); + follow_array(obj_array, 0, initial_chunk_size); } -bool ParCompactionManager::publish_or_pop_objarray_tasks(ObjArrayTask& task) { - while (_objarray_stack.pop_overflow(task)) { - if (!_objarray_stack.try_push_to_taskqueue(task)) { - return true; - } - } - return false; +void ParCompactionManager::process_array_chunk(PartialArrayState* state, bool stolen) { + // Access before release by claim(). + oop obj = state->source(); + PartialArraySplitter::Claim claim = + _partial_array_splitter.claim(state, &_marking_stack, stolen); + follow_array(objArrayOop(obj), claim._start, claim._end); } void ParCompactionManager::follow_marking_stacks() { + ScannerTask task; do { // First, try to move tasks from the overflow stack into the shared buffer, so // that other threads can steal. Otherwise process the overflow stack first. - publish_and_drain_oop_tasks(); - - // Process ObjArrays one at a time to avoid marking stack bloat. - ObjArrayTask task; - if (publish_or_pop_objarray_tasks(task) || - _objarray_stack.pop_local(task)) { - follow_array((objArrayOop)task.obj(), task.index()); + while (marking_stack()->pop_overflow(task)) { + if (!marking_stack()->try_push_to_taskqueue(task)) { + follow_contents(task, false); + } + } + while (marking_stack()->pop_local(task)) { + follow_contents(task, false); } - } while (!marking_stacks_empty()); + } while (!marking_stack_empty()); - assert(marking_stacks_empty(), "Sanity"); + assert(marking_stack_empty(), "Sanity"); } void ParCompactionManager::drain_region_stacks() { @@ -196,11 +200,32 @@ void ParCompactionManager::remove_all_shadow_regions() { _shadow_region_array->clear(); } + +#if TASKQUEUE_STATS +void ParCompactionManager::print_and_reset_taskqueue_stats() { + marking_stacks()->print_and_reset_taskqueue_stats("Marking Stacks"); + + auto get_pa_stats = [&](uint i) { + return _manager_array[i]->partial_array_task_stats(); + }; + PartialArrayTaskStats::log_set(ParallelGCThreads, get_pa_stats, + "Partial Array Task Stats"); + uint parallel_gc_threads = ParallelScavengeHeap::heap()->workers().max_workers(); + for (uint i = 0; i < parallel_gc_threads; ++i) { + get_pa_stats(i)->reset(); + } +} + +PartialArrayTaskStats* ParCompactionManager::partial_array_task_stats() { + return _partial_array_splitter.stats(); +} +#endif // TASKQUEUE_STATS + #ifdef ASSERT void ParCompactionManager::verify_all_marking_stack_empty() { uint parallel_gc_threads = ParallelGCThreads; for (uint i = 0; i < parallel_gc_threads; i++) { - assert(_manager_array[i]->marking_stacks_empty(), "Marking stack should be empty"); + assert(_manager_array[i]->marking_stack_empty(), "Marking stack should be empty"); } } diff --git a/src/hotspot/share/gc/parallel/psCompactionManager.hpp b/src/hotspot/share/gc/parallel/psCompactionManager.hpp index cd4eefe775b..739d2cb1cc7 100644 --- a/src/hotspot/share/gc/parallel/psCompactionManager.hpp +++ b/src/hotspot/share/gc/parallel/psCompactionManager.hpp @@ -27,6 +27,9 @@ #include "classfile/classLoaderData.hpp" #include "gc/parallel/psParallelCompact.hpp" +#include "gc/shared/partialArraySplitter.hpp" +#include "gc/shared/partialArrayTaskStats.hpp" +#include "gc/shared/partialArrayState.hpp" #include "gc/shared/preservedMarks.hpp" #include "gc/shared/stringdedup/stringDedup.hpp" #include "gc/shared/taskqueue.hpp" @@ -64,26 +67,22 @@ class ParCompactionManager : public CHeapObj { friend class PCAddThreadRootsMarkingTaskClosure; private: - typedef OverflowTaskQueue OopTaskQueue; - typedef GenericTaskQueueSet OopTaskQueueSet; - - // 32-bit: 4K * 8 = 32KiB; 64-bit: 8K * 16 = 128KiB - #define QUEUE_SIZE (1 << NOT_LP64(12) LP64_ONLY(13)) - typedef OverflowTaskQueue ObjArrayTaskQueue; - typedef GenericTaskQueueSet ObjArrayTaskQueueSet; - #undef QUEUE_SIZE - typedef OverflowTaskQueue RegionTaskQueue; - typedef GenericTaskQueueSet RegionTaskQueueSet; + typedef OverflowTaskQueue PSMarkTaskQueue; + typedef GenericTaskQueueSet PSMarkTasksQueueSet; + typedef OverflowTaskQueue RegionTaskQueue; + typedef GenericTaskQueueSet RegionTaskQueueSet; static ParCompactionManager** _manager_array; - static OopTaskQueueSet* _oop_task_queues; - static ObjArrayTaskQueueSet* _objarray_task_queues; + static PSMarkTasksQueueSet* _marking_stacks; static ObjectStartArray* _start_array; static RegionTaskQueueSet* _region_task_queues; static PSOldGen* _old_gen; - OopTaskQueue _oop_stack; - ObjArrayTaskQueue _objarray_stack; + static PartialArrayStateManager* _partial_array_state_manager; + PartialArraySplitter _partial_array_splitter; + + PSMarkTaskQueue _marking_stack; + size_t _next_shadow_region; PCMarkAndPushClosure _mark_and_push_closure; @@ -109,23 +108,20 @@ class ParCompactionManager : public CHeapObj { static PSOldGen* old_gen() { return _old_gen; } static ObjectStartArray* start_array() { return _start_array; } - static OopTaskQueueSet* oop_task_queues() { return _oop_task_queues; } + static PSMarkTasksQueueSet* marking_stacks() { return _marking_stacks; } static void initialize(ParMarkBitMap* mbm); - void publish_and_drain_oop_tasks(); - // Try to publish all contents from the objArray task queue overflow stack to - // the shared objArray stack. - // Returns true and a valid task if there has not been enough space in the shared - // objArray stack, otherwise returns false and the task is invalid. - bool publish_or_pop_objarray_tasks(ObjArrayTask& task); - ParCompactionManager(PreservedMarks* preserved_marks, - ReferenceProcessor* ref_processor); + ReferenceProcessor* ref_processor, + uint parallel_gc_threads); // Array of task queues. Needed by the task terminator. static RegionTaskQueueSet* region_task_queues() { return _region_task_queues; } - OopTaskQueue* oop_stack() { return &_oop_stack; } + + inline PSMarkTaskQueue* marking_stack() { return &_marking_stack; } + inline void push(PartialArrayState* stat); + void push_objArray(oop obj); // To collect per-region live-words in a worker local cache in order to // reduce threads contention. @@ -155,6 +151,11 @@ class ParCompactionManager : public CHeapObj { MarkingStatsCache* _marking_stats_cache; +#if TASKQUEUE_STATS + static void print_and_reset_taskqueue_stats(); + PartialArrayTaskStats* partial_array_task_stats(); +#endif // TASKQUEUE_STATS + public: static const size_t InvalidShadow = ~0; static size_t pop_shadow_region_mt_safe(PSParallelCompact::RegionData* region_ptr); @@ -189,7 +190,6 @@ class ParCompactionManager : public CHeapObj { // Save for later processing. Must not fail. inline void push(oop obj); - inline void push_objarray(oop objarray, size_t index); inline void push_region(size_t index); // Check mark and maybe push on marking stack. @@ -198,19 +198,19 @@ class ParCompactionManager : public CHeapObj { // Access function for compaction managers static ParCompactionManager* gc_thread_compaction_manager(uint index); - static bool steal(int queue_num, oop& t); - static bool steal_objarray(int queue_num, ObjArrayTask& t); + static bool steal(int queue_num, ScannerTask& t); static bool steal(int queue_num, size_t& region); - // Process tasks remaining on any marking stack + // Process tasks remaining on marking stack void follow_marking_stacks(); - inline bool marking_stacks_empty() const; + inline bool marking_stack_empty() const; // Process tasks remaining on any stack void drain_region_stacks(); - void follow_contents(oop obj); - void follow_array(objArrayOop array, int index); + inline void follow_contents(const ScannerTask& task, bool stolen); + inline void follow_array(objArrayOop array, size_t start, size_t end); + void process_array_chunk(PartialArrayState* state, bool stolen); class FollowStackClosure: public VoidClosure { private: @@ -234,8 +234,8 @@ class ParCompactionManager : public CHeapObj { static void verify_all_region_stack_empty() NOT_DEBUG_RETURN; }; -bool ParCompactionManager::marking_stacks_empty() const { - return _oop_stack.is_empty() && _objarray_stack.is_empty(); +bool ParCompactionManager::marking_stack_empty() const { + return _marking_stack.is_empty(); } #endif // SHARE_GC_PARALLEL_PSCOMPACTIONMANAGER_HPP diff --git a/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp b/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp index 94529d27423..2c0b8480726 100644 --- a/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp +++ b/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp @@ -32,6 +32,8 @@ #include "gc/parallel/parMarkBitMap.hpp" #include "gc/parallel/psParallelCompact.inline.hpp" #include "gc/parallel/psStringDedup.hpp" +#include "gc/shared/partialArrayState.hpp" +#include "gc/shared/partialArrayTaskStepper.inline.hpp" #include "gc/shared/taskqueue.inline.hpp" #include "oops/access.inline.hpp" #include "oops/arrayOop.hpp" @@ -46,12 +48,8 @@ inline void PCMarkAndPushClosure::do_oop_work(T* p) { _compaction_manager->mark_and_push(p); } -inline bool ParCompactionManager::steal(int queue_num, oop& t) { - return oop_task_queues()->steal(queue_num, t); -} - -inline bool ParCompactionManager::steal_objarray(int queue_num, ObjArrayTask& t) { - return _objarray_task_queues->steal(queue_num, t); +inline bool ParCompactionManager::steal(int queue_num, ScannerTask& t) { + return marking_stacks()->steal(queue_num, t); } inline bool ParCompactionManager::steal(int queue_num, size_t& region) { @@ -59,14 +57,11 @@ inline bool ParCompactionManager::steal(int queue_num, size_t& region) { } inline void ParCompactionManager::push(oop obj) { - _oop_stack.push(obj); + marking_stack()->push(ScannerTask(obj)); } -void ParCompactionManager::push_objarray(oop obj, size_t index) -{ - ObjArrayTask task(obj, index); - assert(task.is_valid(), "bad ObjArrayTask"); - _objarray_stack.push(task); +inline void ParCompactionManager::push(PartialArrayState* stat) { + marking_stack()->push(ScannerTask(stat)); } void ParCompactionManager::push_region(size_t index) @@ -111,43 +106,38 @@ inline void ParCompactionManager::FollowStackClosure::do_void() { } template -inline void follow_array_specialized(objArrayOop obj, int index, ParCompactionManager* cm) { - const size_t len = size_t(obj->length()); - const size_t beg_index = size_t(index); - assert(beg_index < len || len == 0, "index too large"); - - const size_t stride = MIN2(len - beg_index, (size_t)ObjArrayMarkingStride); - const size_t end_index = beg_index + stride; +inline void follow_array_specialized(objArrayOop obj, size_t start, size_t end, ParCompactionManager* cm) { + assert(start <= end, "invariant"); T* const base = (T*)obj->base(); - T* const beg = base + beg_index; - T* const end = base + end_index; - - if (end_index < len) { - cm->push_objarray(obj, end_index); // Push the continuation. - } + T* const beg = base + start; + T* const chunk_end = base + end; // Push the non-null elements of the next stride on the marking stack. - for (T* e = beg; e < end; e++) { + for (T* e = beg; e < chunk_end; e++) { cm->mark_and_push(e); } } -inline void ParCompactionManager::follow_array(objArrayOop obj, int index) { +inline void ParCompactionManager::follow_array(objArrayOop obj, size_t start, size_t end) { if (UseCompressedOops) { - follow_array_specialized(obj, index, this); + follow_array_specialized(obj, start, end, this); } else { - follow_array_specialized(obj, index, this); + follow_array_specialized(obj, start, end, this); } } -inline void ParCompactionManager::follow_contents(oop obj) { - assert(PSParallelCompact::mark_bitmap()->is_marked(obj), "should be marked"); - - if (obj->is_objArray()) { - _mark_and_push_closure.do_klass(obj->klass()); - follow_array(objArrayOop(obj), 0); +inline void ParCompactionManager::follow_contents(const ScannerTask& task, bool stolen) { + if (task.is_partial_array_state()) { + assert(PSParallelCompact::mark_bitmap()->is_marked(task.to_partial_array_state()->source()), "should be marked"); + process_array_chunk(task.to_partial_array_state(), stolen); } else { - obj->oop_iterate(&_mark_and_push_closure); + oop obj = task.to_oop(); + assert(PSParallelCompact::mark_bitmap()->is_marked(obj), "should be marked"); + if (obj->is_objArray()) { + push_objArray(obj); + } else { + obj->oop_iterate(&_mark_and_push_closure); + } } } @@ -219,5 +209,4 @@ inline void ParCompactionManager::flush_and_destroy_marking_stats_cache() { delete _marking_stats_cache; _marking_stats_cache = nullptr; } - #endif // SHARE_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index bdc53db29b8..90f4d6367bd 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -248,25 +248,30 @@ ParallelCompactData::create_vspace(size_t count, size_t element_size) rs_align, page_sz); + if (!rs.is_reserved()) { + // Failed to reserve memory. + return nullptr; + } + os::trace_page_sizes("Parallel Compact Data", raw_bytes, raw_bytes, rs.base(), rs.size(), page_sz); MemTracker::record_virtual_memory_tag((address)rs.base(), mtGC); PSVirtualSpace* vspace = new PSVirtualSpace(rs, page_sz); - if (vspace != nullptr) { - if (vspace->expand_by(_reserved_byte_size)) { - return vspace; - } + + if (!vspace->expand_by(_reserved_byte_size)) { + // Failed to commit memory. + delete vspace; + // Release memory reserved in the space. - if (rs.is_reserved()) { - MemoryReserver::release(rs); - rs = {}; - } + MemoryReserver::release(rs); + + return nullptr; } - return nullptr; + return vspace; } bool ParallelCompactData::initialize_region_data(size_t heap_size) @@ -1209,12 +1214,9 @@ void steal_marking_work(TaskTerminator& terminator, uint worker_id) { ParCompactionManager::gc_thread_compaction_manager(worker_id); do { - oop obj = nullptr; - ObjArrayTask task; - if (ParCompactionManager::steal_objarray(worker_id, task)) { - cm->follow_array((objArrayOop)task.obj(), task.index()); - } else if (ParCompactionManager::steal(worker_id, obj)) { - cm->follow_contents(obj); + ScannerTask task; + if (ParCompactionManager::steal(worker_id, task)) { + cm->follow_contents(task, true); } cm->follow_marking_stacks(); } while (!terminator.offer_termination()); @@ -1230,7 +1232,7 @@ class MarkFromRootsTask : public WorkerTask { MarkFromRootsTask(uint active_workers) : WorkerTask("MarkFromRootsTask"), _strong_roots_scope(active_workers), - _terminator(active_workers, ParCompactionManager::oop_task_queues()), + _terminator(active_workers, ParCompactionManager::marking_stacks()), _active_workers(active_workers) {} virtual void work(uint worker_id) { @@ -1268,7 +1270,7 @@ class ParallelCompactRefProcProxyTask : public RefProcProxyTask { public: ParallelCompactRefProcProxyTask(uint max_workers) : RefProcProxyTask("ParallelCompactRefProcProxyTask", max_workers), - _terminator(_max_workers, ParCompactionManager::oop_task_queues()) {} + _terminator(_max_workers, ParCompactionManager::marking_stacks()) {} void work(uint worker_id) override { assert(worker_id < _max_workers, "sanity"); @@ -1378,8 +1380,7 @@ void PSParallelCompact::marking_phase(ParallelOldTracer *gc_tracer) { _gc_tracer.report_object_count_after_gc(is_alive_closure(), &ParallelScavengeHeap::heap()->workers()); } #if TASKQUEUE_STATS - ParCompactionManager::oop_task_queues()->print_and_reset_taskqueue_stats("Oop Queue"); - ParCompactionManager::_objarray_task_queues->print_and_reset_taskqueue_stats("ObjArrayOop Queue"); + ParCompactionManager::print_and_reset_taskqueue_stats(); #endif } @@ -2477,4 +2478,3 @@ void MoveAndUpdateShadowClosure::complete_region(HeapWord* dest_addr, PSParallel ParCompactionManager::push_shadow_region_mt_safe(_shadow); } } - diff --git a/src/hotspot/share/gc/parallel/psScavenge.cpp b/src/hotspot/share/gc/parallel/psScavenge.cpp index 7434097da21..be31da5b05d 100644 --- a/src/hotspot/share/gc/parallel/psScavenge.cpp +++ b/src/hotspot/share/gc/parallel/psScavenge.cpp @@ -204,7 +204,7 @@ class ParallelScavengeRefProcProxyTask : public RefProcProxyTask { public: ParallelScavengeRefProcProxyTask(uint max_workers) : RefProcProxyTask("ParallelScavengeRefProcProxyTask", max_workers), - _terminator(max_workers, ParCompactionManager::oop_task_queues()) {} + _terminator(max_workers, ParCompactionManager::marking_stacks()) {} void work(uint worker_id) override { assert(worker_id < _max_workers, "sanity"); diff --git a/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp b/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp index 5fd55e2a73d..5baad7f995a 100644 --- a/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp +++ b/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp @@ -46,14 +46,17 @@ SerialBlockOffsetTable::SerialBlockOffsetTable(MemRegion reserved, size_t init_word_size): _reserved(reserved) { size_t size = compute_size(reserved.word_size()); + ReservedSpace rs = MemoryReserver::reserve(size, mtGC); + if (!rs.is_reserved()) { vm_exit_during_initialization("Could not reserve enough space for heap offset array"); } - if (!_vs.initialize(rs, 0)) { - vm_exit_during_initialization("Could not reserve enough space for heap offset array"); - } + const bool initialized = _vs.initialize(rs, 0 /* committed_size */); + + assert(initialized, "Should never fail when commmitted_size is 0"); + _offset_base = (uint8_t*)(_vs.low_boundary() - (uintptr_t(reserved.start()) >> CardTable::card_shift())); resize(init_word_size); log_trace(gc, bot)("SerialBlockOffsetTable::SerialBlockOffsetTable: "); diff --git a/src/hotspot/share/gc/serial/serialHeap.cpp b/src/hotspot/share/gc/serial/serialHeap.cpp index bae627cd1de..2408a41a87b 100644 --- a/src/hotspot/share/gc/serial/serialHeap.cpp +++ b/src/hotspot/share/gc/serial/serialHeap.cpp @@ -95,6 +95,7 @@ SerialHeap::SerialHeap() : _gc_policy_counters(new GCPolicyCounters("Copy:MSC", 2, 2)), _young_manager(nullptr), _old_manager(nullptr), + _is_heap_almost_full(false), _eden_pool(nullptr), _survivor_pool(nullptr), _old_pool(nullptr) { @@ -282,13 +283,12 @@ size_t SerialHeap::max_capacity() const { // Return true if any of the following is true: // . the allocation won't fit into the current young gen heap // . gc locker is occupied (jni critical section) -// . heap memory is tight -- the most recent previous collection -// was a full collection because a partial collection (would -// have) failed and is likely to fail again +// . heap memory is tight bool SerialHeap::should_try_older_generation_allocation(size_t word_size) const { size_t young_capacity = _young_gen->capacity_before_gc(); return (word_size > heap_word_size(young_capacity)) - || GCLocker::is_active_and_needs_gc(); + || GCLocker::is_active_and_needs_gc() + || _is_heap_almost_full; } HeapWord* SerialHeap::expand_heap_and_allocate(size_t size, bool is_tlab) { @@ -460,7 +460,7 @@ bool SerialHeap::do_young_collection(bool clear_soft_refs) { prepare_for_verify(); Universe::verify("Before GC"); } - gc_prologue(false); + gc_prologue(); COMPILER2_OR_JVMCI_PRESENT(DerivedPointerTable::clear()); save_marks(); @@ -728,7 +728,7 @@ void SerialHeap::do_full_collection_no_gc_locker(bool clear_all_soft_refs) { Universe::verify("Before GC"); } - gc_prologue(true); + gc_prologue(); COMPILER2_OR_JVMCI_PRESENT(DerivedPointerTable::clear()); CodeCache::on_gc_marking_cycle_start(); ClassUnloadingContext ctx(1 /* num_nmethod_unlink_workers */, @@ -934,7 +934,7 @@ void SerialHeap::print_heap_change(const PreGenGCValues& pre_gc_values) const { MetaspaceUtils::print_metaspace_change(pre_gc_values.metaspace_sizes()); } -void SerialHeap::gc_prologue(bool full) { +void SerialHeap::gc_prologue() { // Fill TLAB's and such ensure_parsability(true); // retire TLABs @@ -951,5 +951,18 @@ void SerialHeap::gc_epilogue(bool full) { _young_gen->gc_epilogue(full); _old_gen->gc_epilogue(); + if (_is_heap_almost_full) { + // Reset the emergency state if eden is empty after a young/full gc + if (_young_gen->eden()->is_empty()) { + _is_heap_almost_full = false; + } + } else { + if (full && !_young_gen->eden()->is_empty()) { + // Usually eden should be empty after a full GC, so heap is probably too + // full now; entering emergency state. + _is_heap_almost_full = true; + } + } + MetaspaceCounters::update_performance_counters(); }; diff --git a/src/hotspot/share/gc/serial/serialHeap.hpp b/src/hotspot/share/gc/serial/serialHeap.hpp index d35809bf3a1..28ab7905bbc 100644 --- a/src/hotspot/share/gc/serial/serialHeap.hpp +++ b/src/hotspot/share/gc/serial/serialHeap.hpp @@ -95,6 +95,13 @@ class SerialHeap : public CollectedHeap { GCMemoryManager* _young_manager; GCMemoryManager* _old_manager; + // Indicate whether heap is almost or approaching full. + // Usually, there is some memory headroom for application/gc to run properly. + // However, in extreme cases, e.g. young-gen is non-empty after a full gc, we + // will attempt some uncommon measures, e.g. alllocating small objs in + // old-gen. + bool _is_heap_almost_full; + // Helper functions for allocation HeapWord* attempt_allocation(size_t size, bool is_tlab, @@ -111,7 +118,7 @@ class SerialHeap : public CollectedHeap { bool is_young_gc_safe() const; - void gc_prologue(bool full); + void gc_prologue(); void gc_epilogue(bool full); public: diff --git a/src/hotspot/share/gc/shared/cardTable.cpp b/src/hotspot/share/gc/shared/cardTable.cpp index b32720f1d2c..fbfc07a4e09 100644 --- a/src/hotspot/share/gc/shared/cardTable.cpp +++ b/src/hotspot/share/gc/shared/cardTable.cpp @@ -82,15 +82,16 @@ void CardTable::initialize(void* region0_start, void* region1_start) { const size_t rs_align = MAX2(_page_size, os::vm_allocation_granularity()); ReservedSpace rs = MemoryReserver::reserve(_byte_map_size, rs_align, _page_size); - MemTracker::record_virtual_memory_tag((address)rs.base(), mtGC); - - os::trace_page_sizes("Card Table", num_bytes, num_bytes, - rs.base(), rs.size(), _page_size); if (!rs.is_reserved()) { vm_exit_during_initialization("Could not reserve enough space for the " "card marking array"); } + MemTracker::record_virtual_memory_tag((address)rs.base(), mtGC); + + os::trace_page_sizes("Card Table", num_bytes, num_bytes, + rs.base(), rs.size(), _page_size); + // The assembler store_check code will do an unsigned shift of the oop, // then add it to _byte_map_base, i.e. // diff --git a/src/hotspot/share/gc/shared/taskqueue.hpp b/src/hotspot/share/gc/shared/taskqueue.hpp index a6ab5741048..42d32f3dc96 100644 --- a/src/hotspot/share/gc/shared/taskqueue.hpp +++ b/src/hotspot/share/gc/shared/taskqueue.hpp @@ -561,8 +561,10 @@ class ObjArrayTask class PartialArrayState; -// Discriminated union over oop*, narrowOop*, and PartialArrayState. +// Discriminated union over oop/oop*, narrowOop*, and PartialArrayState. // Uses a low tag in the associated pointer to identify the category. +// Oop/oop* are overloaded using the same tag because they can not appear at the +// same time. // Used as a task queue element type. class ScannerTask { void* _p; @@ -595,6 +597,8 @@ class ScannerTask { public: ScannerTask() : _p(nullptr) {} + explicit ScannerTask(oop p) : _p(encode(p, OopTag)) {} + explicit ScannerTask(oop* p) : _p(encode(p, OopTag)) {} explicit ScannerTask(narrowOop* p) : _p(encode(p, NarrowOopTag)) {} @@ -622,6 +626,10 @@ class ScannerTask { return static_cast(decode(OopTag)); } + oop to_oop() const { + return cast_to_oop(decode(OopTag)); + } + narrowOop* to_narrow_oop_ptr() const { return static_cast(decode(NarrowOopTag)); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp b/src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp index 05bb5d00d8f..b3284051ee7 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp @@ -79,13 +79,14 @@ void ShenandoahCardTable::initialize() { } void ShenandoahCardTable::initialize(const ReservedSpace& card_table) { + if (!card_table.is_reserved()) { + vm_exit_during_initialization("Could not reserve enough space for the card marking array"); + } + MemTracker::record_virtual_memory_tag((address)card_table.base(), mtGC); os::trace_page_sizes("Card Table", _byte_map_size, _byte_map_size, card_table.base(), card_table.size(), _page_size); - if (!card_table.is_reserved()) { - vm_exit_during_initialization("Could not reserve enough space for the card marking array"); - } os::commit_memory_or_exit(card_table.base(), _byte_map_size, card_table.alignment(), false, "Cannot commit memory for card table"); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 4cc030b9736..db08014792c 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -166,7 +166,11 @@ static ReservedSpace reserve(size_t size, size_t preferred_page_size) { size = align_up(size, alignment); } - return MemoryReserver::reserve(size, alignment, preferred_page_size); + const ReservedSpace reserved = MemoryReserver::reserve(size, alignment, preferred_page_size); + if (!reserved.is_reserved()) { + vm_exit_during_initialization("Could not reserve space"); + } + return reserved; } jint ShenandoahHeap::initialize() { @@ -386,6 +390,10 @@ jint ShenandoahHeap::initialize() { if (_collection_set == nullptr) { cset_rs = MemoryReserver::reserve(cset_size, cset_align, os::vm_page_size()); + if (!cset_rs.is_reserved()) { + vm_exit_during_initialization("Cannot reserve memory for collection set"); + } + _collection_set = new ShenandoahCollectionSet(this, cset_rs, sh_rs.base()); } os::trace_page_sizes_for_requested_size("Collection Set", diff --git a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp index 538e87a8f19..311ea2871f7 100644 --- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp +++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp @@ -558,7 +558,9 @@ static const Node* get_base_and_offset(const MachNode* mach, intptr_t& offset) { // The memory address is computed by 'base' and fed to 'mach' via an // indirect memory operand (indicated by offset == 0). The ultimate base and // offset can be fetched directly from the inputs and Ideal type of 'base'. - offset = base->bottom_type()->isa_oopptr()->offset(); + const TypeOopPtr* oopptr = base->bottom_type()->isa_oopptr(); + if (oopptr == nullptr) return nullptr; + offset = oopptr->offset(); // Even if 'base' is not an Ideal AddP node anymore, Matcher::ReduceInst() // guarantees that the base address is still available at the same slot. base = base->in(AddPNode::Base); diff --git a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp index 5127e29712e..1732719d64c 100644 --- a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp +++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp @@ -814,6 +814,12 @@ JVMCI::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler, DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler); nm->maybe_print_nmethod(directive); DirectivesStack::release(directive); + + // Since this compilation didn't pass through the broker it wasn't logged yet. + if (PrintCompilation) { + ttyLocker ttyl; + CompileTask::print(tty, nm, "(hosted JVMCI compilation)"); + } } BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod(); diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp index 42d93ebb9ba..3097ad1be10 100644 --- a/src/hotspot/share/memory/universe.cpp +++ b/src/hotspot/share/memory/universe.cpp @@ -958,37 +958,34 @@ ReservedHeapSpace Universe::reserve_heap(size_t heap_size, size_t alignment) { // Now create the space. ReservedHeapSpace rhs = HeapReserver::reserve(total_reserved, alignment, page_size, AllocateHeapAt); - if (rhs.is_reserved()) { - assert(total_reserved == rhs.size(), "must be exactly of required size"); - assert(is_aligned(rhs.base(),alignment),"must be exactly of required alignment"); - - assert(markWord::encode_pointer_as_mark(rhs.base()).decode_pointer() == rhs.base(), - "area must be distinguishable from marks for mark-sweep"); - assert(markWord::encode_pointer_as_mark(&rhs.base()[rhs.size()]).decode_pointer() == - &rhs.base()[rhs.size()], - "area must be distinguishable from marks for mark-sweep"); + if (!rhs.is_reserved()) { + vm_exit_during_initialization( + err_msg("Could not reserve enough space for %zu KB object heap", + total_reserved/K)); + } - // We are good. + assert(total_reserved == rhs.size(), "must be exactly of required size"); + assert(is_aligned(rhs.base(),alignment),"must be exactly of required alignment"); - if (AllocateHeapAt != nullptr) { - log_info(gc,heap)("Successfully allocated Java heap at location %s", AllocateHeapAt); - } + assert(markWord::encode_pointer_as_mark(rhs.base()).decode_pointer() == rhs.base(), + "area must be distinguishable from marks for mark-sweep"); + assert(markWord::encode_pointer_as_mark(&rhs.base()[rhs.size()]).decode_pointer() == + &rhs.base()[rhs.size()], + "area must be distinguishable from marks for mark-sweep"); - if (UseCompressedOops) { - CompressedOops::initialize(rhs); - } + // We are good. - Universe::calculate_verify_data((HeapWord*)rhs.base(), (HeapWord*)rhs.end()); + if (AllocateHeapAt != nullptr) { + log_info(gc,heap)("Successfully allocated Java heap at location %s", AllocateHeapAt); + } - return rhs; + if (UseCompressedOops) { + CompressedOops::initialize(rhs); } - vm_exit_during_initialization( - err_msg("Could not reserve enough space for %zuKB object heap", - total_reserved/K)); + Universe::calculate_verify_data((HeapWord*)rhs.base(), (HeapWord*)rhs.end()); - // satisfy compiler - ShouldNotReachHere(); + return rhs; } OopStorage* Universe::vm_weak() { diff --git a/src/hotspot/share/memory/virtualspace.cpp b/src/hotspot/share/memory/virtualspace.cpp index 42b46294693..2ea90a6c9dd 100644 --- a/src/hotspot/share/memory/virtualspace.cpp +++ b/src/hotspot/share/memory/virtualspace.cpp @@ -57,7 +57,7 @@ bool VirtualSpace::initialize(ReservedSpace rs, size_t committed_size) { } bool VirtualSpace::initialize_with_granularity(ReservedSpace rs, size_t committed_size, size_t max_commit_granularity) { - if(!rs.is_reserved()) return false; // allocation failed. + assert(rs.is_reserved(), "ReservedSpace should have been initialized"); assert(_low_boundary == nullptr, "VirtualSpace already initialized"); assert(max_commit_granularity > 0, "Granularity must be non-zero."); diff --git a/src/hotspot/share/nmt/mallocHeader.hpp b/src/hotspot/share/nmt/mallocHeader.hpp index 6711c2b993e..8472b5f8ce8 100644 --- a/src/hotspot/share/nmt/mallocHeader.hpp +++ b/src/hotspot/share/nmt/mallocHeader.hpp @@ -36,7 +36,7 @@ class outputStream; /* * Malloc tracking header. * - * If NMT is active (state >= minimal), we need to track allocations. A simple and cheap way to + * If NMT is active (state >= summary), we need to track allocations. A simple and cheap way to * do this is by using malloc headers. * * The user allocation is preceded by a header and is immediately followed by a (possibly unaligned) diff --git a/src/hotspot/share/nmt/nmtTreap.hpp b/src/hotspot/share/nmt/nmtTreap.hpp index e7cc91eefd9..7e4ad3df95b 100644 --- a/src/hotspot/share/nmt/nmtTreap.hpp +++ b/src/hotspot/share/nmt/nmtTreap.hpp @@ -66,6 +66,8 @@ class Treap { TreapNode* _right; public: + TreapNode(const K& k, uint64_t p) : _priority(p), _key(k), _left(nullptr), _right(nullptr) {} + TreapNode(const K& k, const V& v, uint64_t p) : _priority(p), _key(k), @@ -313,6 +315,30 @@ class Treap { return candidate; } + struct FindResult { + FindResult(TreapNode* node, bool new_node) : node(node), new_node(new_node) {} + TreapNode* const node; + bool const new_node; + }; + + // Finds the node for the given k in the tree or inserts a new node with the default constructed value. + FindResult find(const K& k) { + if (TreapNode* found = find(_root, k)) { + return FindResult(found, false); + } + _node_count++; + // Doesn't exist, make node + void* node_place = _allocator.allocate(sizeof(TreapNode)); + uint64_t prio = prng_next(); + TreapNode* node = new (node_place) TreapNode(k, prio); + + // (LEQ_k, GT_k) + node_pair split_up = split(this->_root, k); + // merge(merge(LEQ_k, EQ_k), GT_k) + this->_root = merge(merge(split_up.left, node), split_up.right); + return FindResult(node, true); + } + TreapNode* closest_gt(const K& key) { TreapNode* candidate = nullptr; TreapNode* pos = _root; diff --git a/src/hotspot/share/opto/bytecodeInfo.cpp b/src/hotspot/share/opto/bytecodeInfo.cpp index 55c72a0c35a..e618a708f61 100644 --- a/src/hotspot/share/opto/bytecodeInfo.cpp +++ b/src/hotspot/share/opto/bytecodeInfo.cpp @@ -113,7 +113,8 @@ static bool is_unboxing_method(ciMethod* callee_method, Compile* C) { // positive filter: should callee be inlined? bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method, - int caller_bci, bool& should_delay, ciCallProfile& profile) { + JVMState* caller_jvms, bool& should_delay, ciCallProfile& profile) { + int caller_bci = caller_jvms->bci(); // Allows targeted inlining if (C->directive()->should_inline(callee_method)) { set_msg("force inline by CompileCommand"); @@ -143,9 +144,9 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method, // Check for too many throws (and not too huge) if(callee_method->interpreter_throwout_count() > InlineThrowCount && size < InlineThrowMaxSize ) { - if (C->print_inlining() && Verbose) { - CompileTask::print_inline_indent(inline_level()); - tty->print_cr("Inlined method with many throws (throws=%d):", callee_method->interpreter_throwout_count()); + if (Verbose) { + outputStream* stream = C->inline_printer()->record(callee_method, caller_jvms, InliningResult::SUCCESS); + stream->print("Inlined method with many throws (throws=%d):", callee_method->interpreter_throwout_count()); } set_msg("many throws"); return true; @@ -168,11 +169,8 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method, max_inline_size = C->freq_inline_size(); if (size <= max_inline_size && TraceFrequencyInlining) { - CompileTask::print_inline_indent(inline_level()); - tty->print_cr("Inlined frequent method (freq=%lf):", freq); - CompileTask::print_inline_indent(inline_level()); - callee_method->print(); - tty->cr(); + outputStream* stream = C->inline_printer()->record(callee_method, caller_jvms, InliningResult::SUCCESS); + stream->print("Inlined frequent method (freq=%lf):", freq); } } else { // Not hot. Check for medium-sized pre-existing nmethod at cold sites. @@ -376,7 +374,7 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, _forced_inline = false; // Reset // 'should_delay' can be overridden during replay compilation - if (!should_inline(callee_method, caller_method, caller_bci, should_delay, profile)) { + if (!should_inline(callee_method, caller_method, jvms, should_delay, profile)) { return false; } // 'should_delay' can be overridden during replay compilation @@ -534,8 +532,9 @@ const char* InlineTree::check_can_parse(ciMethod* callee) { } //------------------------------print_inlining--------------------------------- -void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, - ciMethod* caller_method, bool success) const { +void InlineTree::print_inlining(ciMethod* callee_method, JVMState* jvm, bool success) const { + int caller_bci = jvm->bci(); + ciMethod* caller_method = jvm->method(); const char* inline_msg = msg(); assert(inline_msg != nullptr, "just checking"); if (C->log() != nullptr) { @@ -545,19 +544,11 @@ void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, C->log()->inline_fail(inline_msg); } } - CompileTask::print_inlining_ul(callee_method, inline_level(), - caller_bci, inlining_result_of(success), inline_msg); - if (C->print_inlining()) { - C->print_inlining(callee_method, inline_level(), caller_bci, inlining_result_of(success), inline_msg); - guarantee(callee_method != nullptr, "would crash in CompilerEvent::InlineEvent::post"); - if (Verbose) { - const InlineTree *top = this; - while (top->caller_tree() != nullptr) { top = top->caller_tree(); } - //tty->print(" bcs: %d+%d invoked: %d", top->count_inline_bcs(), callee_method->code_size(), callee_method->interpreter_invocation_count()); - } - } + CompileTask::print_inlining_ul(callee_method, inline_level(), caller_bci, inlining_result_of(success), inline_msg); + C->inline_printer()->record(callee_method, jvm, inlining_result_of(success), inline_msg); EventCompilerInlining event; if (event.should_commit()) { + guarantee(callee_method != nullptr, "would crash in CompilerEvent::InlineEvent::post"); CompilerEvent::InlineEvent::post(event, C->compile_id(), caller_method->get_Method(), callee_method, success, inline_msg, caller_bci); } } @@ -582,14 +573,14 @@ bool InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallPro // Do some initial checks. if (!pass_initial_checks(caller_method, caller_bci, callee_method)) { set_msg("failed initial checks"); - print_inlining(callee_method, caller_bci, caller_method, false /* !success */); + print_inlining(callee_method, jvms, false /* !success */); return false; } // Do some parse checks. set_msg(check_can_parse(callee_method)); if (msg() != nullptr) { - print_inlining(callee_method, caller_bci, caller_method, false /* !success */); + print_inlining(callee_method, jvms, false /* !success */); return false; } @@ -601,7 +592,7 @@ bool InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallPro if (msg() == nullptr) { set_msg("inline (hot)"); } - print_inlining(callee_method, caller_bci, caller_method, true /* success */); + print_inlining(callee_method, jvms, true /* success */); InlineTree* callee_tree = build_inline_tree_for_callee(callee_method, jvms, caller_bci); if (should_delay) { // Record late inlining decision in order to dump it for compiler replay @@ -613,7 +604,7 @@ bool InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallPro if (msg() == nullptr) { set_msg("too cold to inline"); } - print_inlining(callee_method, caller_bci, caller_method, false /* !success */ ); + print_inlining(callee_method, jvms, false /* !success */); return false; } } @@ -634,8 +625,7 @@ InlineTree *InlineTree::build_inline_tree_for_callee( ciMethod* callee_method, J max_inline_level_adjust += 1; // don't count method handle calls from java.lang.invoke implementation } if (max_inline_level_adjust != 0 && C->print_inlining() && (Verbose || WizardMode)) { - CompileTask::print_inline_indent(inline_level()); - tty->print_cr(" \\-> discounting inline depth"); + C->inline_printer()->record(callee_method, caller_jvms, InliningResult::SUCCESS, " \\-> discounting inline depth"); } if (max_inline_level_adjust != 0 && C->log()) { int id1 = C->log()->identify(caller_jvms->method()); diff --git a/src/hotspot/share/opto/callGenerator.cpp b/src/hotspot/share/opto/callGenerator.cpp index 8ebb9f662c4..ec7117e3568 100644 --- a/src/hotspot/share/opto/callGenerator.cpp +++ b/src/hotspot/share/opto/callGenerator.cpp @@ -84,7 +84,6 @@ class ParseGenerator : public InlineCallGenerator { JVMState* ParseGenerator::generate(JVMState* jvms) { Compile* C = Compile::current(); - C->print_inlining_update(this); if (is_osr()) { // The JVMS for a OSR has a single argument (see its TypeFunc). @@ -143,7 +142,6 @@ class DirectCallGenerator : public CallGenerator { JVMState* DirectCallGenerator::generate(JVMState* jvms) { GraphKit kit(jvms); - kit.C->print_inlining_update(this); bool is_static = method()->is_static(); address target = is_static ? SharedRuntime::get_resolve_static_call_stub() : SharedRuntime::get_resolve_opt_virtual_call_stub(); @@ -218,8 +216,6 @@ JVMState* VirtualCallGenerator::generate(JVMState* jvms) { GraphKit kit(jvms); Node* receiver = kit.argument(0); - kit.C->print_inlining_update(this); - if (kit.C->log() != nullptr) { kit.C->log()->elem("virtual_call bci='%d'", jvms->bci()); } @@ -353,15 +349,6 @@ class LateInlineCallGenerator : public DirectCallGenerator { return DirectCallGenerator::generate(jvms); } - virtual void print_inlining_late(InliningResult result, const char* msg) { - CallNode* call = call_node(); - Compile* C = Compile::current(); - C->print_inlining_assert_ready(); - C->print_inlining(method(), call->jvms()->depth()-1, call->jvms()->bci(), result, msg); - C->print_inlining_move_to(this); - C->print_inlining_update_delayed(this); - } - virtual void set_unique_id(jlong id) { _unique_id = id; } @@ -431,9 +418,9 @@ bool LateInlineMHCallGenerator::do_late_inline_check(Compile* C, JVMState* jvms) assert(!input_not_const, "sanity"); // shouldn't have been scheduled for inlining in the first place if (cg != nullptr) { - if (!allow_inline && (C->print_inlining() || C->print_intrinsics())) { - C->print_inlining(cg->method(), jvms->depth()-1, call_node()->jvms()->bci(), InliningResult::FAILURE, - "late method handle call resolution"); + if (!allow_inline) { + C->inline_printer()->record(cg->method(), call_node()->jvms(), InliningResult::FAILURE, + "late method handle call resolution"); } assert(!cg->is_late_inline() || cg->is_mh_late_inline() || AlwaysIncrementalInline || StressIncrementalInlining, "we're doing late inlining"); _inline_cg = cg; @@ -499,15 +486,6 @@ class LateInlineVirtualCallGenerator : public VirtualCallGenerator { return new_jvms; } - virtual void print_inlining_late(InliningResult result, const char* msg) { - CallNode* call = call_node(); - Compile* C = Compile::current(); - C->print_inlining_assert_ready(); - C->print_inlining(method(), call->jvms()->depth()-1, call->jvms()->bci(), result, msg); - C->print_inlining_move_to(this); - C->print_inlining_update_delayed(this); - } - virtual void set_unique_id(jlong id) { _unique_id = id; } @@ -531,20 +509,16 @@ bool LateInlineVirtualCallGenerator::do_late_inline_check(Compile* C, JVMState* Node* receiver = jvms->map()->argument(jvms, 0); const Type* recv_type = C->initial_gvn()->type(receiver); if (recv_type->maybe_null()) { - if (C->print_inlining() || C->print_intrinsics()) { - C->print_inlining(method(), jvms->depth()-1, call_node()->jvms()->bci(), InliningResult::FAILURE, - "late call devirtualization failed (receiver may be null)"); - } + C->inline_printer()->record(method(), call_node()->jvms(), InliningResult::FAILURE, + "late call devirtualization failed (receiver may be null)"); return false; } // Even if inlining is not allowed, a virtual call can be strength-reduced to a direct call. bool allow_inline = C->inlining_incrementally(); if (!allow_inline && _callee->holder()->is_interface()) { // Don't convert the interface call to a direct call guarded by an interface subtype check. - if (C->print_inlining() || C->print_intrinsics()) { - C->print_inlining(method(), jvms->depth()-1, call_node()->jvms()->bci(), InliningResult::FAILURE, - "late call devirtualization failed (interface call)"); - } + C->inline_printer()->record(method(), call_node()->jvms(), InliningResult::FAILURE, + "late call devirtualization failed (interface call)"); return false; } CallGenerator* cg = C->call_generator(_callee, @@ -557,9 +531,8 @@ bool LateInlineVirtualCallGenerator::do_late_inline_check(Compile* C, JVMState* true /*allow_intrinsics*/); if (cg != nullptr) { - if (!allow_inline && (C->print_inlining() || C->print_intrinsics())) { - C->print_inlining(cg->method(), jvms->depth()-1, call_node()->jvms()->bci(), InliningResult::FAILURE, - "late call devirtualization"); + if (!allow_inline) { + C->inline_printer()->record(cg->method(), call_node()->jvms(), InliningResult::FAILURE, "late call devirtualization"); } assert(!cg->is_late_inline() || cg->is_mh_late_inline() || AlwaysIncrementalInline || StressIncrementalInlining, "we're doing late inlining"); _inline_cg = cg; @@ -682,21 +655,13 @@ void CallGenerator::do_late_inline_helper() { map->set_argument(jvms, i1, call->in(TypeFunc::Parms + i1)); } - C->print_inlining_assert_ready(); - - C->print_inlining_move_to(this); - C->log_late_inline(this); // JVMState is ready, so time to perform some checks and prepare for inlining attempt. if (!do_late_inline_check(C, jvms)) { map->disconnect_inputs(C); - C->print_inlining_update_delayed(this); return; } - if (C->print_inlining() && (is_mh_late_inline() || is_virtual_late_inline())) { - C->print_inlining_update_delayed(this); - } // Setup default node notes to be picked up by the inlining Node_Notes* old_nn = C->node_notes_at(call->_idx); @@ -711,6 +676,18 @@ void CallGenerator::do_late_inline_helper() { if (new_jvms == nullptr) return; // no change if (C->failing()) return; + if (is_mh_late_inline()) { + C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded (method handle)"); + } else if (is_string_late_inline()) { + C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded (string method)"); + } else if (is_boxing_late_inline()) { + C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded (boxing method)"); + } else if (is_vector_reboxing_late_inline()) { + C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded (vector reboxing method)"); + } else { + C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded"); + } + // Capture any exceptional control flow GraphKit kit(new_jvms); @@ -782,6 +759,8 @@ class LateInlineBoxingCallGenerator : public LateInlineCallGenerator { return new_jvms; } + virtual bool is_boxing_late_inline() const { return true; } + virtual CallGenerator* with_call_node(CallNode* call) { LateInlineBoxingCallGenerator* cg = new LateInlineBoxingCallGenerator(method(), _inline_cg); cg->set_call_node(call->as_CallStaticJava()); @@ -810,6 +789,8 @@ class LateInlineVectorReboxingCallGenerator : public LateInlineCallGenerator { return new_jvms; } + virtual bool is_vector_reboxing_late_inline() const { return true; } + virtual CallGenerator* with_call_node(CallNode* call) { LateInlineVectorReboxingCallGenerator* cg = new LateInlineVectorReboxingCallGenerator(method(), _inline_cg); cg->set_call_node(call->as_CallStaticJava()); @@ -875,7 +856,6 @@ CallGenerator* CallGenerator::for_guarded_call(ciKlass* guarded_receiver, JVMState* PredictedCallGenerator::generate(JVMState* jvms) { GraphKit kit(jvms); - kit.C->print_inlining_update(this); PhaseGVN& gvn = kit.gvn(); // We need an explicit receiver null_check before checking its type. // We share a map with the caller, so his JVMS gets adjusted. @@ -932,6 +912,9 @@ JVMState* PredictedCallGenerator::generate(JVMState* jvms) { // Make the hot call: JVMState* new_jvms = _if_hit->generate(kit.sync_jvms()); + if (kit.failing()) { + return nullptr; + } if (new_jvms == nullptr) { // Inline failed, so make a direct call. assert(_if_hit->is_inline(), "must have been a failed inline"); @@ -1045,8 +1028,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* const int vtable_index = Method::invalid_vtable_index; if (!ciMethod::is_consistent_info(callee, target)) { - print_inlining_failure(C, callee, jvms->depth() - 1, jvms->bci(), - "signatures mismatch"); + print_inlining_failure(C, callee, jvms, "signatures mismatch"); return nullptr; } @@ -1059,15 +1041,12 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* } else { assert(receiver->bottom_type() == TypePtr::NULL_PTR, "not a null: %s", Type::str(receiver->bottom_type())); - print_inlining_failure(C, callee, jvms->depth() - 1, jvms->bci(), - "receiver is always null"); + print_inlining_failure(C, callee, jvms, "receiver is always null"); } } else { - print_inlining_failure(C, callee, jvms->depth() - 1, jvms->bci(), - "receiver not constant"); + print_inlining_failure(C, callee, jvms, "receiver not constant"); } - } - break; + } break; case vmIntrinsics::_linkToVirtual: case vmIntrinsics::_linkToStatic: @@ -1082,8 +1061,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* ciMethod* target = oop_ptr->const_oop()->as_member_name()->get_vmtarget(); if (!ciMethod::is_consistent_info(callee, target)) { - print_inlining_failure(C, callee, jvms->depth() - 1, jvms->bci(), - "signatures mismatch"); + print_inlining_failure(C, callee, jvms, "signatures mismatch"); return nullptr; } @@ -1098,8 +1076,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* Node* recv = kit.argument(0); Node* casted_recv = kit.maybe_narrow_object_type(recv, signature->accessing_klass()); if (casted_recv->is_top()) { - print_inlining_failure(C, callee, jvms->depth() - 1, jvms->bci(), - "argument types mismatch"); + print_inlining_failure(C, callee, jvms, "argument types mismatch"); return nullptr; // FIXME: effectively dead; issue a halt node instead } else if (casted_recv != recv) { kit.set_argument(0, casted_recv); @@ -1112,8 +1089,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* Node* arg = kit.argument(receiver_skip + j); Node* casted_arg = kit.maybe_narrow_object_type(arg, t->as_klass()); if (casted_arg->is_top()) { - print_inlining_failure(C, callee, jvms->depth() - 1, jvms->bci(), - "argument types mismatch"); + print_inlining_failure(C, callee, jvms, "argument types mismatch"); return nullptr; // FIXME: effectively dead; issue a halt node instead } else if (casted_arg != arg) { kit.set_argument(receiver_skip + j, casted_arg); @@ -1151,15 +1127,12 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* speculative_receiver_type); return cg; } else { - print_inlining_failure(C, callee, jvms->depth() - 1, jvms->bci(), - "member_name not constant"); + print_inlining_failure(C, callee, jvms, "member_name not constant"); } - } - break; + } break; - case vmIntrinsics::_linkToNative: - print_inlining_failure(C, callee, jvms->depth() - 1, jvms->bci(), - "native call"); + case vmIntrinsics::_linkToNative: + print_inlining_failure(C, callee, jvms, "native call"); break; default: @@ -1259,6 +1232,9 @@ JVMState* PredicatedIntrinsicGenerator::generate(JVMState* jvms) { PreserveJVMState pjvms(&kit); // Generate intrinsic code: JVMState* new_jvms = _intrinsic->generate(kit.sync_jvms()); + if (kit.failing()) { + return nullptr; + } if (new_jvms == nullptr) { // Intrinsic failed, use normal compilation path for this predicate. slow_region->add_req(kit.control()); @@ -1404,7 +1380,6 @@ CallGenerator::for_uncommon_trap(ciMethod* m, JVMState* UncommonTrapCallGenerator::generate(JVMState* jvms) { GraphKit kit(jvms); - kit.C->print_inlining_update(this); // Take the trap with arguments pushed on the stack. (Cf. null_check_receiver). // Callsite signature can be different from actual method being called (i.e _linkTo* sites). // Use callsite signature always. diff --git a/src/hotspot/share/opto/callGenerator.hpp b/src/hotspot/share/opto/callGenerator.hpp index 77182580207..82b195e0c76 100644 --- a/src/hotspot/share/opto/callGenerator.hpp +++ b/src/hotspot/share/opto/callGenerator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -75,6 +75,8 @@ class CallGenerator : public ArenaObj { // same but for method handle calls virtual bool is_mh_late_inline() const { return false; } virtual bool is_string_late_inline() const { return false; } + virtual bool is_boxing_late_inline() const { return false; } + virtual bool is_vector_reboxing_late_inline() const { return false; } virtual bool is_virtual_late_inline() const { return false; } // Replace the call with an inline version of the code @@ -171,28 +173,14 @@ class CallGenerator : public ArenaObj { CallGenerator* cg); virtual Node* generate_predicate(JVMState* jvms, int predicate) { return nullptr; }; - virtual void print_inlining_late(InliningResult result, const char* msg) { ShouldNotReachHere(); } - - static void print_inlining(Compile* C, ciMethod* callee, int inline_level, int bci, const char* msg) { - print_inlining_impl(C, callee, inline_level, bci, InliningResult::SUCCESS, msg); - } - - static void print_inlining_failure(Compile* C, ciMethod* callee, int inline_level, int bci, const char* msg) { - print_inlining_impl(C, callee, inline_level, bci, InliningResult::FAILURE, msg); + static void print_inlining_failure(Compile* C, ciMethod* callee, JVMState* jvms, const char* msg) { + C->inline_printer()->record(callee, jvms, InliningResult::FAILURE, msg); C->log_inline_failure(msg); } static bool is_inlined_method_handle_intrinsic(JVMState* jvms, ciMethod* m); static bool is_inlined_method_handle_intrinsic(ciMethod* caller, int bci, ciMethod* m); static bool is_inlined_method_handle_intrinsic(ciMethod* symbolic_info, ciMethod* m); - -private: - static void print_inlining_impl(Compile* C, ciMethod* callee, int inline_level, int bci, - InliningResult result, const char* msg) { - if (C->print_inlining()) { - C->print_inlining(callee, inline_level, bci, result, msg); - } - } }; diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index a96735a15e7..8fb1eda0001 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -610,77 +610,75 @@ void Compile::print_ideal_ir(const char* phase_name) { // the continuation bci for on stack replacement. -Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci, - Options options, DirectiveSet* directive) - : Phase(Compiler), - _compile_id(ci_env->compile_id()), - _options(options), - _method(target), - _entry_bci(osr_bci), - _ilt(nullptr), - _stub_function(nullptr), - _stub_name(nullptr), - _stub_entry_point(nullptr), - _max_node_limit(MaxNodeLimit), - _post_loop_opts_phase(false), - _allow_macro_nodes(true), - _inlining_progress(false), - _inlining_incrementally(false), - _do_cleanup(false), - _has_reserved_stack_access(target->has_reserved_stack_access()), +Compile::Compile(ciEnv* ci_env, ciMethod* target, int osr_bci, + Options options, DirectiveSet* directive) + : Phase(Compiler), + _compile_id(ci_env->compile_id()), + _options(options), + _method(target), + _entry_bci(osr_bci), + _ilt(nullptr), + _stub_function(nullptr), + _stub_name(nullptr), + _stub_entry_point(nullptr), + _max_node_limit(MaxNodeLimit), + _post_loop_opts_phase(false), + _allow_macro_nodes(true), + _inlining_progress(false), + _inlining_incrementally(false), + _do_cleanup(false), + _has_reserved_stack_access(target->has_reserved_stack_access()), #ifndef PRODUCT - _igv_idx(0), - _trace_opto_output(directive->TraceOptoOutputOption), + _igv_idx(0), + _trace_opto_output(directive->TraceOptoOutputOption), #endif - _has_method_handle_invokes(false), - _clinit_barrier_on_entry(false), - _stress_seed(0), - _comp_arena(mtCompiler), - _barrier_set_state(BarrierSet::barrier_set()->barrier_set_c2()->create_barrier_state(comp_arena())), - _env(ci_env), - _directive(directive), - _log(ci_env->log()), - _first_failure_details(nullptr), - _intrinsics (comp_arena(), 0, 0, nullptr), - _macro_nodes (comp_arena(), 8, 0, nullptr), - _parse_predicates (comp_arena(), 8, 0, nullptr), - _template_assertion_predicate_opaqs (comp_arena(), 8, 0, nullptr), - _expensive_nodes (comp_arena(), 8, 0, nullptr), - _for_post_loop_igvn(comp_arena(), 8, 0, nullptr), - _unstable_if_traps (comp_arena(), 8, 0, nullptr), - _coarsened_locks (comp_arena(), 8, 0, nullptr), - _congraph(nullptr), - NOT_PRODUCT(_igv_printer(nullptr) COMMA) - _unique(0), - _dead_node_count(0), - _dead_node_list(comp_arena()), - _node_arena_one(mtCompiler, Arena::Tag::tag_node), - _node_arena_two(mtCompiler, Arena::Tag::tag_node), - _node_arena(&_node_arena_one), - _mach_constant_base_node(nullptr), - _Compile_types(mtCompiler), - _initial_gvn(nullptr), - _igvn_worklist(nullptr), - _types(nullptr), - _node_hash(nullptr), - _late_inlines(comp_arena(), 2, 0, nullptr), - _string_late_inlines(comp_arena(), 2, 0, nullptr), - _boxing_late_inlines(comp_arena(), 2, 0, nullptr), - _vector_reboxing_late_inlines(comp_arena(), 2, 0, nullptr), - _late_inlines_pos(0), - _number_of_mh_late_inlines(0), - _oom(false), - _print_inlining_stream(new (mtCompiler) stringStream()), - _print_inlining_list(nullptr), - _print_inlining_idx(0), - _print_inlining_output(nullptr), - _replay_inline_data(nullptr), - _java_calls(0), - _inner_loops(0), - _interpreter_frame_size(0), - _output(nullptr) + _has_method_handle_invokes(false), + _clinit_barrier_on_entry(false), + _stress_seed(0), + _comp_arena(mtCompiler), + _barrier_set_state(BarrierSet::barrier_set()->barrier_set_c2()->create_barrier_state(comp_arena())), + _env(ci_env), + _directive(directive), + _log(ci_env->log()), + _first_failure_details(nullptr), + _intrinsics(comp_arena(), 0, 0, nullptr), + _macro_nodes(comp_arena(), 8, 0, nullptr), + _parse_predicates(comp_arena(), 8, 0, nullptr), + _template_assertion_predicate_opaqs(comp_arena(), 8, 0, nullptr), + _expensive_nodes(comp_arena(), 8, 0, nullptr), + _for_post_loop_igvn(comp_arena(), 8, 0, nullptr), + _unstable_if_traps(comp_arena(), 8, 0, nullptr), + _coarsened_locks(comp_arena(), 8, 0, nullptr), + _congraph(nullptr), + NOT_PRODUCT(_igv_printer(nullptr) COMMA) + _unique(0), + _dead_node_count(0), + _dead_node_list(comp_arena()), + _node_arena_one(mtCompiler, Arena::Tag::tag_node), + _node_arena_two(mtCompiler, Arena::Tag::tag_node), + _node_arena(&_node_arena_one), + _mach_constant_base_node(nullptr), + _Compile_types(mtCompiler), + _initial_gvn(nullptr), + _igvn_worklist(nullptr), + _types(nullptr), + _node_hash(nullptr), + _late_inlines(comp_arena(), 2, 0, nullptr), + _string_late_inlines(comp_arena(), 2, 0, nullptr), + _boxing_late_inlines(comp_arena(), 2, 0, nullptr), + _vector_reboxing_late_inlines(comp_arena(), 2, 0, nullptr), + _late_inlines_pos(0), + _number_of_mh_late_inlines(0), + _oom(false), + _replay_inline_data(nullptr), + _inline_printer(this), + _java_calls(0), + _inner_loops(0), + _interpreter_frame_size(0), + _output(nullptr) #ifndef PRODUCT - , _in_dump_cnt(0) + , + _in_dump_cnt(0) #endif { C = this; @@ -743,7 +741,6 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci, PhaseGVN gvn; set_initial_gvn(&gvn); - print_inlining_init(); { // Scope for timing the parser TracePhase tp(_t_parser); @@ -886,71 +883,68 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci, //------------------------------Compile---------------------------------------- // Compile a runtime stub -Compile::Compile( ciEnv* ci_env, - TypeFunc_generator generator, - address stub_function, - const char *stub_name, - int is_fancy_jump, - bool pass_tls, - bool return_pc, - DirectiveSet* directive) - : Phase(Compiler), - _compile_id(0), - _options(Options::for_runtime_stub()), - _method(nullptr), - _entry_bci(InvocationEntryBci), - _stub_function(stub_function), - _stub_name(stub_name), - _stub_entry_point(nullptr), - _max_node_limit(MaxNodeLimit), - _post_loop_opts_phase(false), - _allow_macro_nodes(true), - _inlining_progress(false), - _inlining_incrementally(false), - _has_reserved_stack_access(false), +Compile::Compile(ciEnv* ci_env, + TypeFunc_generator generator, + address stub_function, + const char* stub_name, + int is_fancy_jump, + bool pass_tls, + bool return_pc, + DirectiveSet* directive) + : Phase(Compiler), + _compile_id(0), + _options(Options::for_runtime_stub()), + _method(nullptr), + _entry_bci(InvocationEntryBci), + _stub_function(stub_function), + _stub_name(stub_name), + _stub_entry_point(nullptr), + _max_node_limit(MaxNodeLimit), + _post_loop_opts_phase(false), + _allow_macro_nodes(true), + _inlining_progress(false), + _inlining_incrementally(false), + _has_reserved_stack_access(false), #ifndef PRODUCT - _igv_idx(0), - _trace_opto_output(directive->TraceOptoOutputOption), + _igv_idx(0), + _trace_opto_output(directive->TraceOptoOutputOption), #endif - _has_method_handle_invokes(false), - _clinit_barrier_on_entry(false), - _stress_seed(0), - _comp_arena(mtCompiler), - _barrier_set_state(BarrierSet::barrier_set()->barrier_set_c2()->create_barrier_state(comp_arena())), - _env(ci_env), - _directive(directive), - _log(ci_env->log()), - _first_failure_details(nullptr), - _for_post_loop_igvn(comp_arena(), 8, 0, nullptr), - _congraph(nullptr), - NOT_PRODUCT(_igv_printer(nullptr) COMMA) - _unique(0), - _dead_node_count(0), - _dead_node_list(comp_arena()), - _node_arena_one(mtCompiler), - _node_arena_two(mtCompiler), - _node_arena(&_node_arena_one), - _mach_constant_base_node(nullptr), - _Compile_types(mtCompiler), - _initial_gvn(nullptr), - _igvn_worklist(nullptr), - _types(nullptr), - _node_hash(nullptr), - _number_of_mh_late_inlines(0), - _oom(false), - _print_inlining_stream(new (mtCompiler) stringStream()), - _print_inlining_list(nullptr), - _print_inlining_idx(0), - _print_inlining_output(nullptr), - _replay_inline_data(nullptr), - _java_calls(0), - _inner_loops(0), - _interpreter_frame_size(0), - _output(nullptr), + _has_method_handle_invokes(false), + _clinit_barrier_on_entry(false), + _stress_seed(0), + _comp_arena(mtCompiler), + _barrier_set_state(BarrierSet::barrier_set()->barrier_set_c2()->create_barrier_state(comp_arena())), + _env(ci_env), + _directive(directive), + _log(ci_env->log()), + _first_failure_details(nullptr), + _for_post_loop_igvn(comp_arena(), 8, 0, nullptr), + _congraph(nullptr), + NOT_PRODUCT(_igv_printer(nullptr) COMMA) + _unique(0), + _dead_node_count(0), + _dead_node_list(comp_arena()), + _node_arena_one(mtCompiler), + _node_arena_two(mtCompiler), + _node_arena(&_node_arena_one), + _mach_constant_base_node(nullptr), + _Compile_types(mtCompiler), + _initial_gvn(nullptr), + _igvn_worklist(nullptr), + _types(nullptr), + _node_hash(nullptr), + _number_of_mh_late_inlines(0), + _oom(false), + _replay_inline_data(nullptr), + _inline_printer(this), + _java_calls(0), + _inner_loops(0), + _interpreter_frame_size(0), + _output(nullptr), #ifndef PRODUCT - _in_dump_cnt(0), + _in_dump_cnt(0), #endif - _allowed_reasons(0) { + _allowed_reasons(0) { C = this; TraceTime t1(nullptr, &_t_totalCompilation, CITime, false); @@ -991,7 +985,6 @@ Compile::Compile( ciEnv* ci_env, } Compile::~Compile() { - delete _print_inlining_stream; delete _first_failure_details; }; @@ -2112,7 +2105,7 @@ void Compile::inline_incrementally(PhaseIterGVN& igvn) { CallGenerator* cg = _late_inlines.at(i); const char* msg = "live nodes > LiveNodeCountInliningCutoff"; if (do_print_inlining) { - cg->print_inlining_late(InliningResult::FAILURE, msg); + inline_printer()->record(cg->method(), cg->call_node()->jvms(), InliningResult::FAILURE, msg); } log_late_inline_failure(cg, msg); } @@ -2232,8 +2225,6 @@ void Compile::Optimize() { ResourceMark rm; - print_inlining_reinit(); - NOT_PRODUCT( verify_graph_edges(); ) print_method(PHASE_AFTER_PARSING, 1); @@ -2484,8 +2475,6 @@ void Compile::Optimize() { check_no_dead_use(); - process_print_inlining(); - // We will never use the NodeHash table any more. Clear it so that final_graph_reshaping does not have // to remove hashes to unlock nodes for modifications. C->node_hash()->clear(); @@ -4439,126 +4428,8 @@ Node* Compile::constrained_convI2L(PhaseGVN* phase, Node* value, const TypeInt* return phase->transform(new ConvI2LNode(value, ltype)); } -// The message about the current inlining is accumulated in -// _print_inlining_stream and transferred into the _print_inlining_list -// once we know whether inlining succeeds or not. For regular -// inlining, messages are appended to the buffer pointed by -// _print_inlining_idx in the _print_inlining_list. For late inlining, -// a new buffer is added after _print_inlining_idx in the list. This -// way we can update the inlining message for late inlining call site -// when the inlining is attempted again. -void Compile::print_inlining_init() { - if (print_inlining() || print_intrinsics()) { - // print_inlining_init is actually called several times. - print_inlining_reset(); - _print_inlining_list = new (comp_arena())GrowableArray(comp_arena(), 1, 1, new PrintInliningBuffer()); - } -} - -void Compile::print_inlining_reinit() { - if (print_inlining() || print_intrinsics()) { - print_inlining_reset(); - } -} - -void Compile::print_inlining_reset() { - _print_inlining_stream->reset(); -} - -void Compile::print_inlining_commit() { - assert(print_inlining() || print_intrinsics(), "PrintInlining off?"); - // Transfer the message from _print_inlining_stream to the current - // _print_inlining_list buffer and clear _print_inlining_stream. - _print_inlining_list->at(_print_inlining_idx)->ss()->write(_print_inlining_stream->base(), _print_inlining_stream->size()); - print_inlining_reset(); -} - -void Compile::print_inlining_push() { - // Add new buffer to the _print_inlining_list at current position - _print_inlining_idx++; - _print_inlining_list->insert_before(_print_inlining_idx, new PrintInliningBuffer()); -} - -Compile::PrintInliningBuffer* Compile::print_inlining_current() { - return _print_inlining_list->at(_print_inlining_idx); -} - -void Compile::print_inlining_update(CallGenerator* cg) { - if (print_inlining() || print_intrinsics()) { - if (cg->is_late_inline()) { - if (print_inlining_current()->cg() != cg && - (print_inlining_current()->cg() != nullptr || - print_inlining_current()->ss()->size() != 0)) { - print_inlining_push(); - } - print_inlining_commit(); - print_inlining_current()->set_cg(cg); - } else { - if (print_inlining_current()->cg() != nullptr) { - print_inlining_push(); - } - print_inlining_commit(); - } - } -} - -void Compile::print_inlining_move_to(CallGenerator* cg) { - // We resume inlining at a late inlining call site. Locate the - // corresponding inlining buffer so that we can update it. - if (print_inlining() || print_intrinsics()) { - for (int i = 0; i < _print_inlining_list->length(); i++) { - if (_print_inlining_list->at(i)->cg() == cg) { - _print_inlining_idx = i; - return; - } - } - ShouldNotReachHere(); - } -} - -void Compile::print_inlining_update_delayed(CallGenerator* cg) { - if (print_inlining() || print_intrinsics()) { - assert(_print_inlining_stream->size() > 0, "missing inlining msg"); - assert(print_inlining_current()->cg() == cg, "wrong entry"); - // replace message with new message - _print_inlining_list->at_put(_print_inlining_idx, new PrintInliningBuffer()); - print_inlining_commit(); - print_inlining_current()->set_cg(cg); - } -} - -void Compile::print_inlining_assert_ready() { - assert(!_print_inlining || _print_inlining_stream->size() == 0, "losing data"); -} - -void Compile::process_print_inlining() { - assert(_late_inlines.length() == 0, "not drained yet"); - if (print_inlining() || print_intrinsics()) { - ResourceMark rm; - stringStream ss; - assert(_print_inlining_list != nullptr, "process_print_inlining should be called only once."); - for (int i = 0; i < _print_inlining_list->length(); i++) { - PrintInliningBuffer* pib = _print_inlining_list->at(i); - ss.print("%s", pib->ss()->freeze()); - delete pib; - DEBUG_ONLY(_print_inlining_list->at_put(i, nullptr)); - } - // Reset _print_inlining_list, it only contains destructed objects. - // It is on the arena, so it will be freed when the arena is reset. - _print_inlining_list = nullptr; - // _print_inlining_stream won't be used anymore, either. - print_inlining_reset(); - size_t end = ss.size(); - _print_inlining_output = NEW_ARENA_ARRAY(comp_arena(), char, end+1); - strncpy(_print_inlining_output, ss.freeze(), end+1); - _print_inlining_output[end] = 0; - } -} - void Compile::dump_print_inlining() { - if (_print_inlining_output != nullptr) { - tty->print_raw(_print_inlining_output); - } + inline_printer()->print_on(tty); } void Compile::log_late_inline(CallGenerator* cg) { diff --git a/src/hotspot/share/opto/compile.hpp b/src/hotspot/share/opto/compile.hpp index 223e7033761..93252891207 100644 --- a/src/hotspot/share/opto/compile.hpp +++ b/src/hotspot/share/opto/compile.hpp @@ -46,6 +46,7 @@ #include "runtime/vmThread.hpp" #include "utilities/ticks.hpp" #include "utilities/vmEnums.hpp" +#include "opto/printinlining.hpp" class AbstractLockNode; class AddPNode; @@ -472,29 +473,6 @@ class Compile : public Phase { // "MemLimit" directive was specified and the memory limit was hit during compilation bool _oom; - // Inlining may not happen in parse order which would make - // PrintInlining output confusing. Keep track of PrintInlining - // pieces in order. - class PrintInliningBuffer : public CHeapObj { - private: - CallGenerator* _cg; - stringStream _ss; - static const size_t default_stream_buffer_size = 128; - - public: - PrintInliningBuffer() - : _cg(nullptr), _ss(default_stream_buffer_size) {} - - stringStream* ss() { return &_ss; } - CallGenerator* cg() { return _cg; } - void set_cg(CallGenerator* cg) { _cg = cg; } - }; - - stringStream* _print_inlining_stream; - GrowableArray* _print_inlining_list; - int _print_inlining_idx; - char* _print_inlining_output; - // Only keep nodes in the expensive node list that need to be optimized void cleanup_expensive_nodes(PhaseIterGVN &igvn); // Use for sorting expensive nodes to bring similar nodes together @@ -506,37 +484,17 @@ class Compile : public Phase { void* _replay_inline_data; // Pointer to data loaded from file - void print_inlining_init(); - void print_inlining_reinit(); - void print_inlining_commit(); - void print_inlining_push(); - PrintInliningBuffer* print_inlining_current(); - void log_late_inline_failure(CallGenerator* cg, const char* msg); DEBUG_ONLY(bool _exception_backedge;) void record_method_not_compilable_oom(); - public: + InlinePrinter _inline_printer; +public: void* barrier_set_state() const { return _barrier_set_state; } - stringStream* print_inlining_stream() { - assert(print_inlining() || print_intrinsics(), "PrintInlining off?"); - return _print_inlining_stream; - } - - void print_inlining_update(CallGenerator* cg); - void print_inlining_update_delayed(CallGenerator* cg); - void print_inlining_move_to(CallGenerator* cg); - void print_inlining_assert_ready(); - void print_inlining_reset(); - - void print_inlining(ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg = nullptr) { - stringStream ss; - CompileTask::print_inlining_inner(&ss, method, inline_level, bci, result, msg); - print_inlining_stream()->print("%s", ss.freeze()); - } + InlinePrinter* inline_printer() { return &_inline_printer; } #ifndef PRODUCT IdealGraphPrinter* igv_printer() { return _igv_printer; } @@ -1100,7 +1058,6 @@ class Compile : public Phase { void remove_useless_coarsened_locks(Unique_Node_List& useful); - void process_print_inlining(); void dump_print_inlining(); bool over_inlining_cutoff() const { diff --git a/src/hotspot/share/opto/doCall.cpp b/src/hotspot/share/opto/doCall.cpp index 68a799fc6f3..736ed4e676d 100644 --- a/src/hotspot/share/opto/doCall.cpp +++ b/src/hotspot/share/opto/doCall.cpp @@ -49,33 +49,40 @@ #include "jfr/jfr.hpp" #endif -static void print_trace_type_profile(outputStream* out, int depth, ciKlass* prof_klass, int site_count, int receiver_count) { - CompileTask::print_inline_indent(depth, out); +static void print_trace_type_profile(outputStream* out, int depth, ciKlass* prof_klass, int site_count, int receiver_count, + bool with_deco) { + if (with_deco) { + CompileTask::print_inline_indent(depth, out); + } out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count); prof_klass->name()->print_symbol_on(out); - out->cr(); + if (with_deco) { + out->cr(); + } } -static void trace_type_profile(Compile* C, ciMethod* method, int depth, int bci, ciMethod* prof_method, - ciKlass* prof_klass, int site_count, int receiver_count) { +static void trace_type_profile(Compile* C, ciMethod* method, JVMState* jvms, + ciMethod* prof_method, ciKlass* prof_klass, int site_count, int receiver_count) { + int depth = jvms->depth() - 1; + int bci = jvms->bci(); if (TraceTypeProfile || C->print_inlining()) { - outputStream* out = tty; if (!C->print_inlining()) { if (!PrintOpto && !PrintCompilation) { method->print_short_name(); tty->cr(); } CompileTask::print_inlining_tty(prof_method, depth, bci, InliningResult::SUCCESS); + print_trace_type_profile(tty, depth, prof_klass, site_count, receiver_count, true); } else { - out = C->print_inlining_stream(); + auto stream = C->inline_printer()->record(method, jvms, InliningResult::SUCCESS); + print_trace_type_profile(stream, depth, prof_klass, site_count, receiver_count, false); } - print_trace_type_profile(out, depth, prof_klass, site_count, receiver_count); } LogTarget(Debug, jit, inlining) lt; if (lt.is_enabled()) { LogStream ls(lt); - print_trace_type_profile(&ls, depth, prof_klass, site_count, receiver_count); + print_trace_type_profile(&ls, depth, prof_klass, site_count, receiver_count, true); } } @@ -294,17 +301,19 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool if (miss_cg != nullptr) { if (next_hit_cg != nullptr) { assert(speculative_receiver_type == nullptr, "shouldn't end up here if we used speculation"); - trace_type_profile(C, jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)); + trace_type_profile(C, jvms->method(), jvms, next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)); // We don't need to record dependency on a receiver here and below. // Whenever we inline, the dependency is added by Parse::Parse(). miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX); } if (miss_cg != nullptr) { ciKlass* k = speculative_receiver_type != nullptr ? speculative_receiver_type : profile.receiver(0); - trace_type_profile(C, jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, k, site_count, receiver_count); + trace_type_profile(C, jvms->method(), jvms, receiver_method, k, site_count, receiver_count); float hit_prob = speculative_receiver_type != nullptr ? 1.0 : profile.receiver_prob(0); CallGenerator* cg = CallGenerator::for_predicted_call(k, miss_cg, hit_cg, hit_prob); - if (cg != nullptr) return cg; + if (cg != nullptr) { + return cg; + } } } } @@ -371,9 +380,7 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool // Use a more generic tactic, like a simple call. if (call_does_dispatch) { const char* msg = "virtual call"; - if (C->print_inlining()) { - print_inlining(callee, jvms->depth() - 1, jvms->bci(), InliningResult::FAILURE, msg); - } + C->inline_printer()->record(callee, jvms, InliningResult::FAILURE, msg); C->log_inline_failure(msg); if (IncrementalInlineVirtual && allow_inline) { return CallGenerator::for_late_inline_virtual(callee, vtable_index, prof_factor); // attempt to inline through virtual call later @@ -512,8 +519,6 @@ void Parse::do_call() { // our contribution to it is cleaned up right here. kill_dead_locals(); - C->print_inlining_assert_ready(); - // Set frequently used booleans const bool is_virtual = bc() == Bytecodes::_invokevirtual; const bool is_virtual_or_interface = is_virtual || bc() == Bytecodes::_invokeinterface; diff --git a/src/hotspot/share/opto/escape.cpp b/src/hotspot/share/opto/escape.cpp index 684b50ded4f..2d74564533e 100644 --- a/src/hotspot/share/opto/escape.cpp +++ b/src/hotspot/share/opto/escape.cpp @@ -981,10 +981,11 @@ void ConnectionGraph::reduce_phi_on_cmp(Node* cmp) { Node* other = cmp->in(1)->is_Con() ? cmp->in(1) : cmp->in(2); Node* zero = _igvn->intcon(0); + Node* one = _igvn->intcon(1); BoolTest::mask mask = cmp->unique_out()->as_Bool()->_test._test; // This Phi will merge the result of the Cmps split through the Phi - Node* res_phi = _igvn->transform(PhiNode::make(ophi->in(0), zero, TypeInt::INT)); + Node* res_phi = PhiNode::make(ophi->in(0), zero, TypeInt::INT); for (uint i=1; ireq(); i++) { Node* ophi_input = ophi->in(i); @@ -992,7 +993,12 @@ void ConnectionGraph::reduce_phi_on_cmp(Node* cmp) { const TypeInt* tcmp = optimize_ptr_compare(ophi_input, other); if (tcmp->singleton()) { - res_phi_input = _igvn->makecon(tcmp); + if ((mask == BoolTest::mask::eq && tcmp == TypeInt::CC_EQ) || + (mask == BoolTest::mask::ne && tcmp == TypeInt::CC_GT)) { + res_phi_input = one; + } else { + res_phi_input = zero; + } } else { Node* ncmp = _igvn->transform(cmp->clone()); ncmp->set_req(1, ophi_input); @@ -1004,7 +1010,8 @@ void ConnectionGraph::reduce_phi_on_cmp(Node* cmp) { res_phi->set_req(i, res_phi_input); } - Node* new_cmp = _igvn->transform(new CmpINode(res_phi, zero)); + // This CMP always compares whether the output of "res_phi" is TRUE as far as the "mask". + Node* new_cmp = _igvn->transform(new CmpINode(_igvn->transform(res_phi), (mask == BoolTest::mask::eq) ? one : zero)); _igvn->replace_node(cmp, new_cmp); } diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 9ed7bea750d..7ef030ccd7d 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -119,9 +119,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) { const char *inline_msg = is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)"; CompileTask::print_inlining_ul(callee, jvms->depth() - 1, bci, InliningResult::SUCCESS, inline_msg); - if (C->print_intrinsics() || C->print_inlining()) { - C->print_inlining(callee, jvms->depth() - 1, bci, InliningResult::SUCCESS, inline_msg); - } + C->inline_printer()->record(callee, jvms, InliningResult::SUCCESS, inline_msg); C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked); if (C->log()) { C->log()->elem("intrinsic id='%s'%s nodes='%d'", @@ -131,7 +129,6 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) { } // Push the result from the inlined method onto the stack. kit.push_result(); - C->print_inlining_update(this); return kit.transfer_exceptions_into_jvms(); } @@ -147,9 +144,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) { : "failed to inline (intrinsic), method not annotated"; } CompileTask::print_inlining_ul(callee, jvms->depth() - 1, bci, InliningResult::FAILURE, msg); - if (C->print_intrinsics() || C->print_inlining()) { - C->print_inlining(callee, jvms->depth() - 1, bci, InliningResult::FAILURE, msg); - } + C->inline_printer()->record(callee, jvms, InliningResult::FAILURE, msg); } else { // Root compile ResourceMark rm; @@ -164,7 +159,6 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) { } } C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed); - C->print_inlining_update(this); return nullptr; } @@ -190,9 +184,8 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms, int predicate) { const char *inline_msg = is_virtual() ? "(intrinsic, virtual, predicate)" : "(intrinsic, predicate)"; CompileTask::print_inlining_ul(callee, jvms->depth() - 1, bci, InliningResult::SUCCESS, inline_msg); - if (C->print_intrinsics() || C->print_inlining()) { - C->print_inlining(callee, jvms->depth() - 1, bci, InliningResult::SUCCESS, inline_msg); - } + C->inline_printer()->record(callee, jvms, InliningResult::SUCCESS, inline_msg); + C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked); if (C->log()) { C->log()->elem("predicate_intrinsic id='%s'%s nodes='%d'", @@ -208,9 +201,7 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms, int predicate) { // Not a root compile. const char* msg = "failed to generate predicate for intrinsic"; CompileTask::print_inlining_ul(kit.callee(), jvms->depth() - 1, bci, InliningResult::FAILURE, msg); - if (C->print_intrinsics() || C->print_inlining()) { - C->print_inlining(kit.callee(), jvms->depth() - 1, bci, InliningResult::FAILURE, msg); - } + C->inline_printer()->record(kit.callee(), jvms, InliningResult::FAILURE, msg); } else { // Root compile ResourceMark rm; @@ -220,9 +211,7 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms, int predicate) { is_virtual() ? " (virtual)" : "", bci); const char *msg = msg_stream.freeze(); log_debug(jit, inlining)("%s", msg); - if (C->print_intrinsics() || C->print_inlining()) { - C->print_inlining_stream()->print("%s", msg); - } + C->inline_printer()->record(kit.callee(), jvms, InliningResult::FAILURE, msg); } C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed); return nullptr; @@ -3772,6 +3761,20 @@ bool LibraryCallKit::inline_native_Continuation_pinning(bool unpin) { Node* test_pin_count_over_underflow = _gvn.transform(new BoolNode(pin_count_cmp, BoolTest::eq)); IfNode* iff_pin_count_over_underflow = create_and_map_if(control(), test_pin_count_over_underflow, PROB_MIN, COUNT_UNKNOWN); + // True branch, pin count over/underflow. + Node* pin_count_over_underflow = _gvn.transform(new IfTrueNode(iff_pin_count_over_underflow)); + { + // Trap (but not deoptimize (Action_none)) and continue in the interpreter + // which will throw IllegalStateException for pin count over/underflow. + // No memory changed so far - we can use memory create by reset_memory() + // at the beginning of this intrinsic. No need to call reset_memory() again. + PreserveJVMState pjvms(this); + set_control(pin_count_over_underflow); + uncommon_trap(Deoptimization::Reason_intrinsic, + Deoptimization::Action_none); + assert(stopped(), "invariant"); + } + // False branch, no pin count over/underflow. Increment or decrement pin count and store back. Node* valid_pin_count = _gvn.transform(new IfFalseNode(iff_pin_count_over_underflow)); set_control(valid_pin_count); @@ -3783,20 +3786,7 @@ bool LibraryCallKit::inline_native_Continuation_pinning(bool unpin) { next_pin_count = _gvn.transform(new AddINode(pin_count, _gvn.intcon(1))); } - Node* updated_pin_count_memory = store_to_memory(control(), pin_count_offset, next_pin_count, T_INT, MemNode::unordered); - - // True branch, pin count over/underflow. - Node* pin_count_over_underflow = _gvn.transform(new IfTrueNode(iff_pin_count_over_underflow)); - { - // Trap (but not deoptimize (Action_none)) and continue in the interpreter - // which will throw IllegalStateException for pin count over/underflow. - PreserveJVMState pjvms(this); - set_control(pin_count_over_underflow); - set_all_memory(input_memory_state); - uncommon_trap_exact(Deoptimization::Reason_intrinsic, - Deoptimization::Action_none); - assert(stopped(), "invariant"); - } + store_to_memory(control(), pin_count_offset, next_pin_count, T_INT, MemNode::unordered); // Result of top level CFG and Memory. RegionNode* result_rgn = new RegionNode(PATH_LIMIT); @@ -3806,7 +3796,7 @@ bool LibraryCallKit::inline_native_Continuation_pinning(bool unpin) { result_rgn->init_req(_true_path, _gvn.transform(valid_pin_count)); result_rgn->init_req(_false_path, _gvn.transform(continuation_is_null)); - result_mem->init_req(_true_path, _gvn.transform(updated_pin_count_memory)); + result_mem->init_req(_true_path, _gvn.transform(reset_memory())); result_mem->init_req(_false_path, _gvn.transform(input_memory_state)); // Set output state. @@ -4302,7 +4292,12 @@ Node* LibraryCallKit::generate_array_guard_common(Node* kls, RegionNode* region, if (obj != nullptr && is_array_ctrl != nullptr && is_array_ctrl != top()) { // Keep track of the fact that 'obj' is an array to prevent // array specific accesses from floating above the guard. - *obj = _gvn.transform(new CastPPNode(is_array_ctrl, *obj, TypeAryPtr::BOTTOM)); + Node* cast = _gvn.transform(new CastPPNode(is_array_ctrl, *obj, TypeAryPtr::BOTTOM)); + // Check for top because in rare cases, the type system can determine that + // the object can't be an array but the layout helper check is not folded. + if (!cast->is_top()) { + *obj = cast; + } } return ctrl; } diff --git a/src/hotspot/share/opto/library_call.hpp b/src/hotspot/share/opto/library_call.hpp index c3edebd367b..df9c858c5de 100644 --- a/src/hotspot/share/opto/library_call.hpp +++ b/src/hotspot/share/opto/library_call.hpp @@ -106,6 +106,10 @@ class LibraryCallKit : public GraphKit { void push_result() { // Push the result onto the stack. if (!stopped() && result() != nullptr) { + if (result()->is_top()) { + assert(false, "Can't determine return value."); + C->record_method_not_compilable("Can't determine return value."); + } BasicType bt = result()->bottom_type()->basic_type(); push_node(bt, result()); } diff --git a/src/hotspot/share/opto/node.cpp b/src/hotspot/share/opto/node.cpp index 89e7ead2c76..583d0ba7601 100644 --- a/src/hotspot/share/opto/node.cpp +++ b/src/hotspot/share/opto/node.cpp @@ -547,10 +547,6 @@ Node *Node::clone() const { if (cg != nullptr) { CallGenerator* cloned_cg = cg->with_call_node(n->as_Call()); n->as_Call()->set_generator(cloned_cg); - - C->print_inlining_assert_ready(); - C->print_inlining_move_to(cg); - C->print_inlining_update(cloned_cg); } } if (n->is_SafePoint()) { diff --git a/src/hotspot/share/opto/parse.hpp b/src/hotspot/share/opto/parse.hpp index 579e0a53211..83b211828ce 100644 --- a/src/hotspot/share/opto/parse.hpp +++ b/src/hotspot/share/opto/parse.hpp @@ -75,7 +75,7 @@ class InlineTree : public AnyObj { bool& should_delay); bool should_inline(ciMethod* callee_method, ciMethod* caller_method, - int caller_bci, + JVMState* caller_jvms, bool& should_delay, ciCallProfile& profile); bool should_not_inline(ciMethod* callee_method, @@ -87,8 +87,7 @@ class InlineTree : public AnyObj { ciMethod* caller_method, int caller_bci, ciCallProfile& profile); - void print_inlining(ciMethod* callee_method, int caller_bci, - ciMethod* caller_method, bool success) const; + void print_inlining(ciMethod* callee_method, JVMState* jvm, bool success) const; InlineTree* caller_tree() const { return _caller_tree; } InlineTree* callee_at(int bci, ciMethod* m) const; diff --git a/src/hotspot/share/opto/printinlining.cpp b/src/hotspot/share/opto/printinlining.cpp new file mode 100644 index 00000000000..accc3dcc637 --- /dev/null +++ b/src/hotspot/share/opto/printinlining.cpp @@ -0,0 +1,109 @@ +/* + * 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 + * 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 "opto/printinlining.hpp" +#include "opto/callnode.hpp" +#include "memory/allocation.hpp" +#include "memory/resourceArea.hpp" + +bool InlinePrinter::is_enabled() const { + return C->print_intrinsics() || C->print_inlining(); +} + +outputStream* InlinePrinter::record(ciMethod* callee, JVMState* state, InliningResult result, const char* msg) { + if (!is_enabled()) { + return &_nullStream; + } + outputStream* stream = locate(state, callee)->add(result); + if (msg != nullptr) { + stream->print("%s", msg); + } + return stream; // Pointer stays valid, see IPInlineSite::add() +} + +void InlinePrinter::print_on(outputStream* tty) const { + if (!is_enabled()) { + return; + } + _root.dump(tty, -1); +} + +InlinePrinter::IPInlineSite* InlinePrinter::locate(JVMState* state, ciMethod* callee) { + auto growableArray = new GrowableArrayCHeap(2); + + while (state != nullptr) { + growableArray->push(state); + state = state->caller(); + } + + IPInlineSite* site = &_root; + for (int i = growableArray->length() - 1; i >= 0; i--) { + site = &site->at_bci(growableArray->at(i)->bci(), i == 0 ? callee : nullptr); + } + + delete growableArray; + + return site; +} + +InlinePrinter::IPInlineSite& InlinePrinter::IPInlineSite::at_bci(int bci, ciMethod* callee) { + auto find_result = _children.find(bci); + IPInlineSite& child = find_result.node->val(); + + if (find_result.new_node) { + assert(callee != nullptr, "an inline call is missing in the chain up to the root"); + child.set_source(callee, bci); + } else { // We already saw a call at this site before + if (callee != nullptr && callee != child._method) { + outputStream* stream = child.add(InliningResult::SUCCESS); + stream->print("callee changed to "); + CompileTask::print_inline_inner_method_info(stream, callee); + } + } + + return child; +} + +outputStream* InlinePrinter::IPInlineSite::add(InliningResult result) { + _attempts.push(IPInlineAttempt(result)); + return _attempts.last().make_stream(); +} + +void InlinePrinter::IPInlineSite::dump(outputStream* tty, int level) const { + assert(_bci != -999, "trying to dump site without source"); + + if (_attempts.is_nonempty()) { + CompileTask::print_inlining_header(tty, _method, level, _bci); + } + for (int i = 0; i < _attempts.length(); i++) { + CompileTask::print_inlining_inner_message(tty, _attempts.at(i).result(), _attempts.at(i).stream()->base()); + } + if (_attempts.is_nonempty()) { + tty->cr(); + } + + _children.visit_in_order([=](auto* node) { + node->val().dump(tty, level + 1); + }); +} diff --git a/src/hotspot/share/opto/printinlining.hpp b/src/hotspot/share/opto/printinlining.hpp new file mode 100644 index 00000000000..ae79648319b --- /dev/null +++ b/src/hotspot/share/opto/printinlining.hpp @@ -0,0 +1,139 @@ +/* + * 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 + * 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. + * + */ + +#ifndef PRINTINLINING_HPP +#define PRINTINLINING_HPP + +#include "memory/allocation.hpp" +#include "utilities/ostream.hpp" +#include "utilities/growableArray.hpp" +#include "nmt/nmtTreap.hpp" + +class JVMState; +class ciMethod; +class Compile; +enum class InliningResult; + +// If not enabled, all method calls are no-ops. +class InlinePrinter { +private: + class IPInlineAttempt { + InliningResult _result; + stringStream* _stream; + + public: + IPInlineAttempt() : _stream(nullptr) {} + + IPInlineAttempt(InliningResult result) : _result(result), _stream(nullptr) {} + + InliningResult result() const { return _result; } + + stringStream* make_stream() { + assert(_stream == nullptr, "stream already exists"); + _stream = new (mtCompiler) stringStream; + return _stream; + } + + stringStream* stream() const { + assert(_stream != nullptr, "stream was not created yet!"); + return _stream; + } + + void deallocate_stream() { + delete _stream; + _stream = nullptr; + } + }; + + struct Cmp { + static int cmp(int a, int b) { + return a - b; + } + }; + + class IPInlineSite : public CHeapObj { + private: + ciMethod* _method; + int _bci; + GrowableArrayCHeap _attempts; + TreapCHeap _children; + + public: + IPInlineSite(ciMethod* method, int bci) : _method(method), _bci(bci) {} + + IPInlineSite() : _method(nullptr), _bci(-999) {} + + ~IPInlineSite() { + // Since GrowableArrayCHeap uses copy semantics to resize itself we + // cannot free the stream inside IPInlineAttempt's destructor unfortunately + // and have to take care of this here instead. + for (int i = 0; i < _attempts.length(); i++) { + _attempts.at(i).deallocate_stream(); + } + } + + void set_source(ciMethod* method, int bci) { + _method = method; + _bci = bci; + } + + // Finds the node for an inline attempt that occurred inside this inline. + // If this is a new site, provide the callee otherwise null. + // Returned reference is valid until any at_bci is called with non-null callee. + IPInlineSite& at_bci(int bci, ciMethod* callee); + // The returned pointer stays valid until InlinePrinter is destructed. + outputStream* add(InliningResult result); + + void dump(outputStream* tty, int level) const; + }; + + bool is_enabled() const; + + Compile* C; + + // In case print inline is disabled, this null stream is returned from ::record() + nullStream _nullStream; + + // Locates the IPInlineSite node that corresponds to this JVM state. + // state may be null. In this case, the root node is returned. + // If this is a new site, provide the callee otherwise null. + // Returned pointer is valid until InlinePrinter is destructed. + IPInlineSite* locate(JVMState* state, ciMethod* callee); + + IPInlineSite _root{nullptr, 0}; + +public: + InlinePrinter(Compile* compile) : C(compile) {} + + // Saves the result of an inline attempt of method at state. + // An optional string message with more details that is copied to the stream for this attempt. Pointer is not captured. + // Returns an output stream which stores the message associated with this attempt. The buffer stays valid until InlinePrinter is destructed. + // You can print arbitrary information to this stream but do not add line breaks, as this will break formatting. + outputStream* record(ciMethod* callee, JVMState* state, InliningResult result, const char* msg = nullptr); + + // Prints all collected inlining information to the given output stream. + void print_on(outputStream* tty) const; +}; + +#endif // PRINTINLINING_HPP diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index 45580b36270..d8df234c57b 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -300,11 +300,9 @@ WB_END WB_ENTRY(void, WB_ReadFromNoaccessArea(JNIEnv* env, jobject o)) size_t granularity = os::vm_allocation_granularity(); ReservedHeapSpace rhs = HeapReserver::reserve(100 * granularity, granularity, os::vm_page_size(), nullptr); - VirtualSpace vs; - vs.initialize(rhs, 50 * granularity); // Check if constraints are complied - if (!( UseCompressedOops && rhs.base() != nullptr && + if (!( UseCompressedOops && rhs.is_reserved() && CompressedOops::base() != nullptr && CompressedOops::use_implicit_null_checks() )) { tty->print_cr("WB_ReadFromNoaccessArea method is useless:\n " @@ -318,6 +316,10 @@ WB_ENTRY(void, WB_ReadFromNoaccessArea(JNIEnv* env, jobject o)) CompressedOops::use_implicit_null_checks()); return; } + + VirtualSpace vs; + vs.initialize(rhs, 50 * granularity); + tty->print_cr("Reading from no access area... "); tty->print_cr("*(vs.low_boundary() - rhs.noaccess_prefix() / 2 ) = %c", *(vs.low_boundary() - rhs.noaccess_prefix() / 2 )); @@ -327,6 +329,11 @@ static jint wb_stress_virtual_space_resize(size_t reserved_space_size, size_t magnitude, size_t iterations) { size_t granularity = os::vm_allocation_granularity(); ReservedHeapSpace rhs = HeapReserver::reserve(reserved_space_size * granularity, granularity, os::vm_page_size(), nullptr); + if (!rhs.is_reserved()) { + tty->print_cr("Failed to initialize ReservedSpace. Can't proceed."); + return 3; + } + VirtualSpace vs; if (!vs.initialize(rhs, 0)) { tty->print_cr("Failed to initialize VirtualSpace. Can't proceed."); diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index 094d68e1a84..0654bd3e092 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -1212,8 +1212,7 @@ void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) { if (localtime_pd(&tloc, &tz) != nullptr) { wchar_t w_buf[80]; size_t n = ::wcsftime(w_buf, 80, L"%Z", &tz); - if (n > 0) { - ::wcstombs(buf, w_buf, buflen); + if (n > 0 && ::wcstombs(buf, w_buf, buflen) != (size_t)-1) { st->print("Time: %s %s", timestring, buf); } else { st->print("Time: %s", timestring); diff --git a/src/hotspot/share/runtime/threads.cpp b/src/hotspot/share/runtime/threads.cpp index 9e7692bda6d..9a428167e00 100644 --- a/src/hotspot/share/runtime/threads.cpp +++ b/src/hotspot/share/runtime/threads.cpp @@ -828,12 +828,6 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { } #endif -#if INCLUDE_JVMCI - if (force_JVMCI_initialization) { - JVMCI::initialize_compiler(CHECK_JNI_ERR); - } -#endif - if (NativeHeapTrimmer::enabled()) { NativeHeapTrimmer::initialize(); } @@ -848,6 +842,12 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { // Notify JVMTI agents that VM initialization is complete - nop if no agents. JvmtiExport::post_vm_initialized(); +#if INCLUDE_JVMCI + if (force_JVMCI_initialization) { + JVMCI::initialize_compiler(CHECK_JNI_ERR); + } +#endif + JFR_ONLY(Jfr::on_create_vm_3();) // SapMachine 2019-02-20: Vitals diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index 37c4aebf58b..6613f300161 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -1261,6 +1261,8 @@ declare_type(CompilerThread, JavaThread) \ declare_type(StringDedupThread, JavaThread) \ declare_type(AttachListenerThread, JavaThread) \ + DEBUG_ONLY(COMPILER2_OR_JVMCI_PRESENT( \ + declare_type(DeoptimizeObjectsALotThread, JavaThread))) \ declare_toplevel_type(OSThread) \ declare_toplevel_type(JavaFrameAnchor) \ \ diff --git a/src/java.base/aix/native/libjli/java_md_aix.h b/src/java.base/aix/native/libjli/java_md_aix.h index 231b7b2d0fd..d319a1d6353 100644 --- a/src/java.base/aix/native/libjli/java_md_aix.h +++ b/src/java.base/aix/native/libjli/java_md_aix.h @@ -29,7 +29,7 @@ /* * Very limited AIX port of dladdr() for libjli.so. * - * We try to mimic dladdr(3) on Linux (see http://linux.die.net/man/3/dladdr) + * We try to mimic dladdr(3) on Linux (see https://linux.die.net/man/3/dladdr) * dladdr(3) is not POSIX but a GNU extension, and is not available on AIX. * * We only support Dl_info.dli_fname here as this is the only thing that is diff --git a/src/java.base/linux/native/libsimdsort/xss-common-qsort.h b/src/java.base/linux/native/libsimdsort/xss-common-qsort.h index 07279a487c4..95fe8738d35 100644 --- a/src/java.base/linux/native/libsimdsort/xss-common-qsort.h +++ b/src/java.base/linux/native/libsimdsort/xss-common-qsort.h @@ -49,7 +49,7 @@ * [3] https://github.com/simd-sorting/fast-and-robust: SPDX-License-Identifier: * MIT * - * [4] http://mitp-content-server.mit.edu:18180/books/content/sectbyfn?collid=books_pres_0&fn=Chapter%2027.pdf&id=8030 + * [4] https://mitp-content-server.mit.edu/books/content/sectbyfn?collid=books_pres_0&fn=Chapter%2027.pdf&id=8030 * */ diff --git a/src/java.base/share/classes/com/sun/crypto/provider/DHKeyAgreement.java b/src/java.base/share/classes/com/sun/crypto/provider/DHKeyAgreement.java index e13eec42905..2d9ad93d2fa 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/DHKeyAgreement.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/DHKeyAgreement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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,11 +379,10 @@ protected SecretKey engineGenerateSecret(String algorithm) throw new NoSuchAlgorithmException("null algorithm"); } - if (!algorithm.equalsIgnoreCase("TlsPremasterSecret") && - !AllowKDF.VALUE) { - - throw new NoSuchAlgorithmException("Unsupported secret key " - + "algorithm: " + algorithm); + if (!KeyUtil.isSupportedKeyAgreementOutputAlgorithm(algorithm) && + !AllowKDF.VALUE) { + throw new NoSuchAlgorithmException( + "Unsupported secret key algorithm: " + algorithm); } byte[] secret = engineGenerateSecret(); @@ -419,13 +418,17 @@ protected SecretKey engineGenerateSecret(String algorithm) throw new InvalidKeyException("Key material is too short"); } return skey; - } else if (algorithm.equals("TlsPremasterSecret")) { - // remove leading zero bytes per RFC 5246 Section 8.1.2 - return new SecretKeySpec( + } else if (KeyUtil.isSupportedKeyAgreementOutputAlgorithm(algorithm)) { + if (algorithm.equalsIgnoreCase("TlsPremasterSecret")) { + // remove leading zero bytes per RFC 5246 Section 8.1.2 + return new SecretKeySpec( KeyUtil.trimZeroes(secret), "TlsPremasterSecret"); + } else { + return new SecretKeySpec(secret, algorithm); + } } else { - throw new NoSuchAlgorithmException("Unsupported secret key " - + "algorithm: "+ algorithm); + throw new NoSuchAlgorithmException( + "Unsupported secret key algorithm: " + algorithm); } } } diff --git a/src/java.base/share/classes/java/io/OptionalDataException.java b/src/java.base/share/classes/java/io/OptionalDataException.java index f98bf079e8e..215b3b2906c 100644 --- a/src/java.base/share/classes/java/io/OptionalDataException.java +++ b/src/java.base/share/classes/java/io/OptionalDataException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * 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 @@ * * @since 1.1 */ -public class OptionalDataException extends ObjectStreamException { +public final class OptionalDataException extends ObjectStreamException { @java.io.Serial private static final long serialVersionUID = -8011121865681257820L; diff --git a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java index b40f6274412..fd9dcf60e54 100644 --- a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java +++ b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java @@ -830,9 +830,9 @@ public AbstractStringBuilder append(int i) { int spaceNeeded = count + DecimalDigits.stringSize(i); ensureCapacityInternal(spaceNeeded); if (isLatin1()) { - StringLatin1.getChars(i, spaceNeeded, value); + DecimalDigits.getCharsLatin1(i, spaceNeeded, value); } else { - StringUTF16.getChars(i, count, spaceNeeded, value); + DecimalDigits.getCharsUTF16(i, spaceNeeded, value); } this.count = spaceNeeded; return this; @@ -855,9 +855,9 @@ public AbstractStringBuilder append(long l) { int spaceNeeded = count + DecimalDigits.stringSize(l); ensureCapacityInternal(spaceNeeded); if (isLatin1()) { - StringLatin1.getChars(l, spaceNeeded, value); + DecimalDigits.getCharsLatin1(l, spaceNeeded, value); } else { - StringUTF16.getChars(l, count, spaceNeeded, value); + DecimalDigits.getCharsUTF16(l, spaceNeeded, value); } this.count = spaceNeeded; return this; diff --git a/src/java.base/share/classes/java/lang/Integer.java b/src/java.base/share/classes/java/lang/Integer.java index a6bf739220f..99b056ec18a 100644 --- a/src/java.base/share/classes/java/lang/Integer.java +++ b/src/java.base/share/classes/java/lang/Integer.java @@ -432,11 +432,11 @@ public static String toString(int i) { int size = DecimalDigits.stringSize(i); if (COMPACT_STRINGS) { byte[] buf = new byte[size]; - StringLatin1.getChars(i, size, buf); + DecimalDigits.getCharsLatin1(i, size, buf); return new String(buf, LATIN1); } else { byte[] buf = new byte[size * 2]; - StringUTF16.getChars(i, size, buf); + DecimalDigits.getCharsUTF16(i, size, buf); return new String(buf, UTF16); } } diff --git a/src/java.base/share/classes/java/lang/Long.java b/src/java.base/share/classes/java/lang/Long.java index 822199bb09b..c401fcd8027 100644 --- a/src/java.base/share/classes/java/lang/Long.java +++ b/src/java.base/share/classes/java/lang/Long.java @@ -462,11 +462,11 @@ public static String toString(long i) { int size = DecimalDigits.stringSize(i); if (COMPACT_STRINGS) { byte[] buf = new byte[size]; - StringLatin1.getChars(i, size, buf); + DecimalDigits.getCharsLatin1(i, size, buf); return new String(buf, LATIN1); } else { byte[] buf = new byte[size * 2]; - StringUTF16.getChars(i, size, buf); + DecimalDigits.getCharsUTF16(i, size, buf); return new String(buf, UTF16); } } diff --git a/src/java.base/share/classes/java/lang/Package.java b/src/java.base/share/classes/java/lang/Package.java index 424c390c8ef..82f40ce373b 100644 --- a/src/java.base/share/classes/java/lang/Package.java +++ b/src/java.base/share/classes/java/lang/Package.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -113,7 +113,7 @@ * * @since 1.2 */ -public class Package extends NamedPackage implements java.lang.reflect.AnnotatedElement { +public final class Package extends NamedPackage implements java.lang.reflect.AnnotatedElement { /** * Return the name of this package. * diff --git a/src/java.base/share/classes/java/lang/Runtime.java b/src/java.base/share/classes/java/lang/Runtime.java index 764a9d7fa63..6f44114e533 100644 --- a/src/java.base/share/classes/java/lang/Runtime.java +++ b/src/java.base/share/classes/java/lang/Runtime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -120,7 +120,7 @@ * @since 1.0 */ -public class Runtime { +public final class Runtime { private static final Runtime currentRuntime = new Runtime(); private static Version version; diff --git a/src/java.base/share/classes/java/lang/StringConcatHelper.java b/src/java.base/share/classes/java/lang/StringConcatHelper.java index b635d0dee0f..632fe0f58b5 100644 --- a/src/java.base/share/classes/java/lang/StringConcatHelper.java +++ b/src/java.base/share/classes/java/lang/StringConcatHelper.java @@ -298,12 +298,12 @@ static long prepend(long indexCoder, byte[] buf, char value, String prefix) { static long prepend(long indexCoder, byte[] buf, int value, String prefix) { int index = (int)indexCoder; if (indexCoder < UTF16) { - index = StringLatin1.getChars(value, index, buf); + index = DecimalDigits.getCharsLatin1(value, index, buf); index -= prefix.length(); prefix.getBytes(buf, index, String.LATIN1); return index; } else { - index = StringUTF16.getChars(value, index, buf); + index = DecimalDigits.getCharsUTF16(value, index, buf); index -= prefix.length(); prefix.getBytes(buf, index, String.UTF16); return index | UTF16; @@ -324,12 +324,12 @@ static long prepend(long indexCoder, byte[] buf, int value, String prefix) { static long prepend(long indexCoder, byte[] buf, long value, String prefix) { int index = (int)indexCoder; if (indexCoder < UTF16) { - index = StringLatin1.getChars(value, index, buf); + index = DecimalDigits.getCharsLatin1(value, index, buf); index -= prefix.length(); prefix.getBytes(buf, index, String.LATIN1); return index; } else { - index = StringUTF16.getChars(value, index, buf); + index = DecimalDigits.getCharsUTF16(value, index, buf); index -= prefix.length(); prefix.getBytes(buf, index, String.UTF16); return index | UTF16; @@ -682,11 +682,11 @@ static int prepend(int index, byte coder, byte[] buf, char value, String prefix) */ static int prepend(int index, byte coder, byte[] buf, int value, String prefix) { if (coder == String.LATIN1) { - index = StringLatin1.getChars(value, index, buf); + index = DecimalDigits.getCharsLatin1(value, index, buf); index -= prefix.length(); prefix.getBytes(buf, index, String.LATIN1); } else { - index = StringUTF16.getChars(value, index, buf); + index = DecimalDigits.getCharsUTF16(value, index, buf); index -= prefix.length(); prefix.getBytes(buf, index, String.UTF16); } @@ -706,11 +706,11 @@ static int prepend(int index, byte coder, byte[] buf, int value, String prefix) */ static int prepend(int index, byte coder, byte[] buf, long value, String prefix) { if (coder == String.LATIN1) { - index = StringLatin1.getChars(value, index, buf); + index = DecimalDigits.getCharsLatin1(value, index, buf); index -= prefix.length(); prefix.getBytes(buf, index, String.LATIN1); } else { - index = StringUTF16.getChars(value, index, buf); + index = DecimalDigits.getCharsUTF16(value, index, buf); index -= prefix.length(); prefix.getBytes(buf, index, String.UTF16); } diff --git a/src/java.base/share/classes/java/lang/StringLatin1.java b/src/java.base/share/classes/java/lang/StringLatin1.java index 7680bcbfa45..342439d1341 100644 --- a/src/java.base/share/classes/java/lang/StringLatin1.java +++ b/src/java.base/share/classes/java/lang/StringLatin1.java @@ -34,7 +34,6 @@ import java.util.stream.StreamSupport; import jdk.internal.misc.Unsafe; import jdk.internal.util.ArraysSupport; -import jdk.internal.util.DecimalDigits; import jdk.internal.vm.annotation.IntrinsicCandidate; import static java.lang.String.LATIN1; @@ -86,120 +85,6 @@ public static byte[] inflate(byte[] value, int off, int len) { return ret; } - /** - * Places characters representing the integer i into the - * character array buf. The characters are placed into - * the buffer backwards starting with the least significant - * digit at the specified index (exclusive), and working - * backwards from there. - * - * @implNote This method converts positive inputs into negative - * values, to cover the Integer.MIN_VALUE case. Converting otherwise - * (negative to positive) will expose -Integer.MIN_VALUE that overflows - * integer. - * - * @param i value to convert - * @param index next index, after the least significant digit - * @param buf target buffer, Latin1-encoded - * @return index of the most significant digit or minus sign, if present - */ - static int getChars(int i, int index, byte[] buf) { - // Used by trusted callers. Assumes all necessary bounds checks have been done by the caller. - int q; - int charPos = index; - - boolean negative = i < 0; - if (!negative) { - i = -i; - } - - // Generate two digits per iteration - while (i <= -100) { - q = i / 100; - charPos -= 2; - writeDigitPair(buf, charPos, (q * 100) - i); - i = q; - } - - // We know there are at most two digits left at this point. - if (i < -9) { - charPos -= 2; - writeDigitPair(buf, charPos, -i); - } else { - buf[--charPos] = (byte)('0' - i); - } - - if (negative) { - buf[--charPos] = (byte)'-'; - } - return charPos; - } - - /** - * Places characters representing the long i into the - * character array buf. The characters are placed into - * the buffer backwards starting with the least significant - * digit at the specified index (exclusive), and working - * backwards from there. - * - * @implNote This method converts positive inputs into negative - * values, to cover the Long.MIN_VALUE case. Converting otherwise - * (negative to positive) will expose -Long.MIN_VALUE that overflows - * long. - * - * @param i value to convert - * @param index next index, after the least significant digit - * @param buf target buffer, Latin1-encoded - * @return index of the most significant digit or minus sign, if present - */ - static int getChars(long i, int index, byte[] buf) { - // Used by trusted callers. Assumes all necessary bounds checks have been done by the caller. - long q; - int charPos = index; - - boolean negative = (i < 0); - if (!negative) { - i = -i; - } - - // Get 2 digits/iteration using longs until quotient fits into an int - while (i <= Integer.MIN_VALUE) { - q = i / 100; - charPos -= 2; - writeDigitPair(buf, charPos, (int)((q * 100) - i)); - i = q; - } - - // Get 2 digits/iteration using ints - int q2; - int i2 = (int)i; - while (i2 <= -100) { - q2 = i2 / 100; - charPos -= 2; - writeDigitPair(buf, charPos, (q2 * 100) - i2); - i2 = q2; - } - - // We know there are at most two digits left at this point. - if (i2 < -9) { - charPos -= 2; - writeDigitPair(buf, charPos, -i2); - } else { - buf[--charPos] = (byte)('0' - i2); - } - - if (negative) { - buf[--charPos] = (byte)'-'; - } - return charPos; - } - - private static void writeDigitPair(byte[] buf, int charPos, int value) { - short pair = DecimalDigits.digitPair(value); - buf[charPos] = (byte)(pair); - buf[charPos + 1] = (byte)(pair >> 8); - } - public static void getChars(byte[] value, int srcBegin, int srcEnd, char[] dst, int dstBegin) { inflate(value, srcBegin, dst, dstBegin, srcEnd - srcBegin); } diff --git a/src/java.base/share/classes/java/lang/StringUTF16.java b/src/java.base/share/classes/java/lang/StringUTF16.java index f04b991827f..a1dcca8ffad 100644 --- a/src/java.base/share/classes/java/lang/StringUTF16.java +++ b/src/java.base/share/classes/java/lang/StringUTF16.java @@ -35,7 +35,6 @@ import jdk.internal.misc.Unsafe; import jdk.internal.util.ArraysSupport; -import jdk.internal.util.DecimalDigits; import jdk.internal.vm.annotation.ForceInline; import jdk.internal.vm.annotation.IntrinsicCandidate; @@ -1513,20 +1512,6 @@ public static int codePointCountSB(byte[] val, int beginIndex, int endIndex) { return codePointCount(val, beginIndex, endIndex, true /* checked */); } - public static int getChars(int i, int begin, int end, byte[] value) { - checkBoundsBeginEnd(begin, end, value); - int pos = getChars(i, end, value); - assert begin == pos; - return pos; - } - - public static int getChars(long l, int begin, int end, byte[] value) { - checkBoundsBeginEnd(begin, end, value); - int pos = getChars(l, end, value); - assert begin == pos; - return pos; - } - public static boolean contentEquals(byte[] v1, byte[] v2, int len) { checkBoundsOffCount(0, len, v2); for (int i = 0; i < len; i++) { @@ -1662,109 +1647,6 @@ public static int lastIndexOfLatin1(byte[] src, int srcCount, static final int MAX_LENGTH = Integer.MAX_VALUE >> 1; - // Used by trusted callers. Assumes all necessary bounds checks have - // been done by the caller. - - /** - * This is a variant of {@link StringLatin1#getChars(int, int, byte[])}, but for - * UTF-16 coder. - * - * @param i value to convert - * @param index next index, after the least significant digit - * @param buf target buffer, UTF16-coded. - * @return index of the most significant digit or minus sign, if present - */ - static int getChars(int i, int index, byte[] buf) { - // Used by trusted callers. Assumes all necessary bounds checks have been done by the caller. - int q, r; - int charPos = index; - - boolean negative = (i < 0); - if (!negative) { - i = -i; - } - - // Get 2 digits/iteration using ints - while (i <= -100) { - q = i / 100; - r = (q * 100) - i; - i = q; - charPos -= 2; - putPair(buf, charPos, r); - } - - // We know there are at most two digits left at this point. - if (i < -9) { - charPos -= 2; - putPair(buf, charPos, -i); - } else { - putChar(buf, --charPos, '0' - i); - } - - if (negative) { - putChar(buf, --charPos, '-'); - } - return charPos; - } - - /** - * This is a variant of {@link StringLatin1#getChars(long, int, byte[])}, but for - * UTF-16 coder. - * - * @param i value to convert - * @param index next index, after the least significant digit - * @param buf target buffer, UTF16-coded. - * @return index of the most significant digit or minus sign, if present - */ - static int getChars(long i, int index, byte[] buf) { - // Used by trusted callers. Assumes all necessary bounds checks have been done by the caller. - long q; - int charPos = index; - - boolean negative = (i < 0); - if (!negative) { - i = -i; - } - - // Get 2 digits/iteration using longs until quotient fits into an int - while (i <= Integer.MIN_VALUE) { - q = i / 100; - charPos -= 2; - putPair(buf, charPos, (int)((q * 100) - i)); - i = q; - } - - // Get 2 digits/iteration using ints - int q2; - int i2 = (int)i; - while (i2 <= -100) { - q2 = i2 / 100; - charPos -= 2; - putPair(buf, charPos, (q2 * 100) - i2); - i2 = q2; - } - - // We know there are at most two digits left at this point. - if (i2 < -9) { - charPos -= 2; - putPair(buf, charPos, -i2); - } else { - putChar(buf, --charPos, '0' - i2); - } - - if (negative) { - putChar(buf, --charPos, '-'); - } - return charPos; - } - - private static void putPair(byte[] buf, int charPos, int v) { - int packed = (int) DecimalDigits.digitPair(v); - putChar(buf, charPos, packed & 0xFF); - putChar(buf, charPos + 1, packed >> 8); - } - // End of trusted methods. - public static void checkIndex(int off, byte[] val) { String.checkIndex(off, length(val)); } diff --git a/src/java.base/share/classes/java/lang/System.java b/src/java.base/share/classes/java/lang/System.java index 87aca3e1ffd..d159bc8262a 100644 --- a/src/java.base/share/classes/java/lang/System.java +++ b/src/java.base/share/classes/java/lang/System.java @@ -2179,14 +2179,6 @@ public byte stringCoder(String str) { return str.coder(); } - public int getCharsLatin1(long i, int index, byte[] buf) { - return StringLatin1.getChars(i, index, buf); - } - - public int getCharsUTF16(long i, int index, byte[] buf) { - return StringUTF16.getChars(i, index, buf); - } - public String join(String prefix, String suffix, String delimiter, String[] elements, int size) { return String.join(prefix, suffix, delimiter, elements, size); } diff --git a/src/java.base/share/classes/java/lang/classfile/AccessFlags.java b/src/java.base/share/classes/java/lang/classfile/AccessFlags.java index b1d026f52e4..33db731efc8 100644 --- a/src/java.base/share/classes/java/lang/classfile/AccessFlags.java +++ b/src/java.base/share/classes/java/lang/classfile/AccessFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -30,10 +30,33 @@ import jdk.internal.classfile.impl.AccessFlagsImpl; /** - * Models the access flags for a class, method, or field. Delivered as a - * {@link ClassElement}, {@link FieldElement}, or {@link MethodElement} - * when traversing the corresponding model type. + * Models the access flags for a class, method, or field. The access flags + * appears exactly once in each class, method, or field; a {@link + * ClassBuilder} and a {@link FieldBuilder} chooses an unspecified default value + * if access flags are not provided, and a {@link MethodBuilder} is always + * created with access flags. + *

    + * {@code AccessFlags} cannot be created via a factory method directly; it can + * be created with {@code withFlags} methods on the respective builders. + *

    + * A {@link MethodBuilder} throws an {@link IllegalArgumentException} if it is + * supplied an {@code AccessFlags} object that changes the preexisting + * {@link ClassFile#ACC_STATIC ACC_STATIC} flag of the builder, because the + * access flag change may invalidate previously supplied data to the builder. * + * @apiNote + * The access flags of classes, methods, and fields are modeled as a standalone + * object to support streaming as elements for {@link ClassFileTransform}. + * Other access flags are not elements of a {@link CompoundElement} and thus not + * modeled by {@code AccessFlags}; they provide their own {@code flagsMask}, + * {@code flags}, and {@code has} methods. + * + * @see ClassModel#flags() + * @see FieldModel#flags() + * @see MethodModel#flags() + * @see ClassBuilder#withFlags + * @see FieldBuilder#withFlags + * @see MethodBuilder#withFlags * @since 24 */ public sealed interface AccessFlags @@ -41,26 +64,36 @@ public sealed interface AccessFlags permits AccessFlagsImpl { /** - * {@return the access flags, as a bit mask} + * {@return the access flags, as a bit mask} It is in the range of unsigned + * short, {@code [0, 0xFFFF]}. */ int flagsMask(); /** - * {@return the access flags} + * {@return the access flags, as a set of flag enums} + * + * @throws IllegalArgumentException if the flags mask has any undefined bit set + * @see #location() */ Set flags(); /** - * {@return whether the specified flag is present} The specified flag - * should be a valid flag for the classfile location associated with this - * element otherwise false is returned. + * {@return whether the specified flag is set} If the specified flag + * is not available to this {@linkplain #location() location}, returns + * {@code false}. + * * @param flag the flag to test + * @see #location() */ boolean has(AccessFlag flag); /** - * {@return the classfile location for this element, which is either class, - * method, or field} + * {@return the {@code class} file location for this element, which is + * either class, method, or field} + * + * @see AccessFlag.Location#CLASS + * @see AccessFlag.Location#FIELD + * @see AccessFlag.Location#METHOD */ AccessFlag.Location location(); } diff --git a/src/java.base/share/classes/java/lang/classfile/AnnotationValue.java b/src/java.base/share/classes/java/lang/classfile/AnnotationValue.java index 54a9ed80573..ae31fdf3967 100644 --- a/src/java.base/share/classes/java/lang/classfile/AnnotationValue.java +++ b/src/java.base/share/classes/java/lang/classfile/AnnotationValue.java @@ -54,7 +54,7 @@ public sealed interface AnnotationValue { /** * Models an annotation value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_ANNOTATION}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_ANNOTATION}. * * @since 24 */ @@ -66,7 +66,7 @@ sealed interface OfAnnotation extends AnnotationValue /** * Models an array value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_ARRAY}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_ARRAY}. * * @since 24 */ @@ -122,7 +122,7 @@ sealed interface OfConstant extends AnnotationValue { /** * Models a string value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_STRING}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_STRING}. * * @since 24 */ @@ -149,7 +149,7 @@ default String resolvedValue() { /** * Models a double value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_DOUBLE}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_DOUBLE}. * * @since 24 */ @@ -176,7 +176,7 @@ default Double resolvedValue() { /** * Models a float value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_FLOAT}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_FLOAT}. * * @since 24 */ @@ -203,7 +203,7 @@ default Float resolvedValue() { /** * Models a long value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_LONG}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_LONG}. * * @since 24 */ @@ -230,7 +230,7 @@ default Long resolvedValue() { /** * Models an int value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_INT}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_INT}. * * @since 24 */ @@ -257,7 +257,7 @@ default Integer resolvedValue() { /** * Models a short value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_SHORT}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_SHORT}. * * @since 24 */ @@ -287,7 +287,7 @@ default Short resolvedValue() { /** * Models a char value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_CHAR}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_CHAR}. * * @since 24 */ @@ -317,7 +317,7 @@ default Character resolvedValue() { /** * Models a byte value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_BYTE}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_BYTE}. * * @since 24 */ @@ -347,7 +347,7 @@ default Byte resolvedValue() { /** * Models a boolean value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_BOOLEAN}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_BOOLEAN}. * * @since 24 */ @@ -377,7 +377,7 @@ default Boolean resolvedValue() { /** * Models a class value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_CLASS}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_CLASS}. * * @since 24 */ @@ -394,7 +394,7 @@ default ClassDesc classSymbol() { /** * Models an enum value of an element-value pair. - * The {@linkplain #tag tag} of this value is {@value TAG_ENUM}. + * The {@linkplain #tag tag} of this value is {@value %c TAG_ENUM}. * * @since 24 */ diff --git a/src/java.base/share/classes/java/lang/classfile/AttributedElement.java b/src/java.base/share/classes/java/lang/classfile/AttributedElement.java index 0edb79a863d..1feef1ba35e 100644 --- a/src/java.base/share/classes/java/lang/classfile/AttributedElement.java +++ b/src/java.base/share/classes/java/lang/classfile/AttributedElement.java @@ -39,7 +39,14 @@ * A {@link ClassFileElement} describing a {@code class} file structure that has * attributes, such as a {@code class} file, a field, a method, a {@link * CodeAttribute Code} attribute, or a record component. + *

    + * Unless otherwise specified, most attributes that can be discovered in a + * {@link CompoundElement} implements the corresponding {@linkplain + * ClassFileElement##membership membership subinterface} of {@code + * ClassFileElement}, and can be sent to a {@link ClassFileBuilder} to be + * integrated into the built structure. * + * @see java.lang.classfile.attribute * @jvms 4.7 Attributes * @sealedGraph * @since 24 diff --git a/src/java.base/share/classes/java/lang/classfile/ClassBuilder.java b/src/java.base/share/classes/java/lang/classfile/ClassBuilder.java index 996c63ddd01..6efd240d8af 100644 --- a/src/java.base/share/classes/java/lang/classfile/ClassBuilder.java +++ b/src/java.base/share/classes/java/lang/classfile/ClassBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,8 +25,8 @@ package java.lang.classfile; -import java.lang.classfile.attribute.CodeAttribute; import java.lang.classfile.constantpool.ClassEntry; +import java.lang.classfile.constantpool.ConstantPoolBuilder; import java.lang.classfile.constantpool.Utf8Entry; import java.lang.constant.ClassDesc; import java.lang.constant.MethodTypeDesc; @@ -41,14 +41,19 @@ import jdk.internal.classfile.impl.Util; /** - * A builder for classfiles. Builders are not created directly; they are passed - * to handlers by methods such as {@link ClassFile#build(ClassDesc, Consumer)} - * or to class transforms. The elements of a classfile can be specified - * abstractly (by passing a {@link ClassElement} to {@link #with(ClassFileElement)}) - * or concretely by calling the various {@code withXxx} methods. + * A builder for a {@code class} file. {@link ClassFile} provides different + * {@code build} methods that accept handlers to configure such a builder; + * {@link ClassFile#build(ClassDesc, Consumer)} suffices for basic usage, while + * {@link ClassFile#build(ClassEntry, ConstantPoolBuilder, Consumer)} allows + * fine-grained control over {@linkplain ClassFileBuilder#constantPool() the + * constant pool}. + *

    + * Refer to {@link ClassFileBuilder} for general guidance and caution around + * the use of builders for structures in the {@code class} file format. * + * @see ClassFile#build(ClassEntry, ConstantPoolBuilder, Consumer) + * @see ClassModel * @see ClassTransform - * * @since 24 */ public sealed interface ClassBuilder @@ -56,28 +61,38 @@ public sealed interface ClassBuilder permits ChainedClassBuilder, DirectClassBuilder { /** - * Sets the classfile version. + * Sets the version of this class. + * * @param major the major version number * @param minor the minor version number * @return this builder + * @see ClassFileVersion */ default ClassBuilder withVersion(int major, int minor) { return with(ClassFileVersion.of(major, minor)); } /** - * Sets the classfile access flags. + * Sets the access flags of this class. + * * @param flags the access flags, as a bit mask * @return this builder + * @see AccessFlags + * @see AccessFlag.Location#CLASS */ default ClassBuilder withFlags(int flags) { return with(new AccessFlagsImpl(AccessFlag.Location.CLASS, flags)); } /** - * Sets the classfile access flags. - * @param flags the access flags + * Sets the access flags of this class. + * + * @param flags the access flags, as flag enums * @return this builder + * @throws IllegalArgumentException if any flag cannot be applied to the + * {@link AccessFlag.Location#CLASS} location + * @see AccessFlags + * @see AccessFlag.Location#CLASS */ default ClassBuilder withFlags(AccessFlag... flags) { return with(new AccessFlagsImpl(AccessFlag.Location.CLASS, flags)); @@ -85,8 +100,10 @@ default ClassBuilder withFlags(AccessFlag... flags) { /** * Sets the superclass of this class. + * * @param superclassEntry the superclass * @return this builder + * @see Superclass */ default ClassBuilder withSuperclass(ClassEntry superclassEntry) { return with(Superclass.of(superclassEntry)); @@ -94,9 +111,11 @@ default ClassBuilder withSuperclass(ClassEntry superclassEntry) { /** * Sets the superclass of this class. + * * @param desc the superclass * @return this builder * @throws IllegalArgumentException if {@code desc} represents a primitive type + * @see Superclass */ default ClassBuilder withSuperclass(ClassDesc desc) { return withSuperclass(constantPool().classEntry(desc)); @@ -104,8 +123,10 @@ default ClassBuilder withSuperclass(ClassDesc desc) { /** * Sets the interfaces of this class. + * * @param interfaces the interfaces * @return this builder + * @see Interfaces */ default ClassBuilder withInterfaces(List interfaces) { return with(Interfaces.of(interfaces)); @@ -113,8 +134,10 @@ default ClassBuilder withInterfaces(List interfaces) { /** * Sets the interfaces of this class. + * * @param interfaces the interfaces * @return this builder + * @see Interfaces */ default ClassBuilder withInterfaces(ClassEntry... interfaces) { return withInterfaces(List.of(interfaces)); @@ -122,8 +145,11 @@ default ClassBuilder withInterfaces(ClassEntry... interfaces) { /** * Sets the interfaces of this class. + * * @param interfaces the interfaces * @return this builder + * @throws IllegalArgumentException if any element of {@code interfaces} is primitive + * @see Interfaces */ default ClassBuilder withInterfaceSymbols(List interfaces) { return withInterfaces(Util.entryList(interfaces)); @@ -131,32 +157,39 @@ default ClassBuilder withInterfaceSymbols(List interfaces) { /** * Sets the interfaces of this class. + * * @param interfaces the interfaces * @return this builder + * @throws IllegalArgumentException if any element of {@code interfaces} is primitive + * @see Interfaces */ default ClassBuilder withInterfaceSymbols(ClassDesc... interfaces) { - // List view, since ref to interfaces is temporary + // list version does defensive copy return withInterfaceSymbols(Arrays.asList(interfaces)); } /** * Adds a field. - * @param name the name of the field - * @param descriptor the field descriptor - * @param handler handler which receives a {@link FieldBuilder} which can - * further define the contents of the field + * + * @param name the field name + * @param descriptor the field descriptor string + * @param handler handler to supply the contents of the field * @return this builder + * @see FieldModel */ ClassBuilder withField(Utf8Entry name, Utf8Entry descriptor, Consumer handler); /** - * Adds a field. - * @param name the name of the field - * @param descriptor the field descriptor - * @param flags the access flags for this field + * Adds a field, with only access flags. + * + * @param name the field name + * @param descriptor the field descriptor string + * @param flags the access flags for this field, as a bit mask * @return this builder + * @see FieldModel + * @see FieldBuilder#withFlags(int) */ default ClassBuilder withField(Utf8Entry name, Utf8Entry descriptor, @@ -166,11 +199,12 @@ default ClassBuilder withField(Utf8Entry name, /** * Adds a field. - * @param name the name of the field - * @param descriptor the field descriptor - * @param handler handler which receives a {@link FieldBuilder} which can - * further define the contents of the field + * + * @param name the field name + * @param descriptor the symbolic field descriptor + * @param handler handler to supply the contents of the field * @return this builder + * @see FieldModel */ default ClassBuilder withField(String name, ClassDesc descriptor, @@ -181,11 +215,14 @@ default ClassBuilder withField(String name, } /** - * Adds a field. - * @param name the name of the field - * @param descriptor the field descriptor - * @param flags the access flags for this field + * Adds a field, with only access flags. + * + * @param name the field name + * @param descriptor the symbolic field descriptor + * @param flags the access flags for this field, as a bit mask * @return this builder + * @see FieldModel + * @see FieldBuilder#withFlags(int) */ default ClassBuilder withField(String name, ClassDesc descriptor, @@ -197,28 +234,33 @@ default ClassBuilder withField(String name, /** * Adds a field by transforming a field from another class. - * - * @implNote - *

    This method behaves as if: + *

    + * This method behaves as if: * {@snippet lang=java : - * withField(field.fieldName(), field.fieldType(), - * b -> b.transformField(field, transform)); + * // @link substring=withField target="#withField(Utf8Entry, Utf8Entry, Consumer)" : + * withField(field.fieldName(), field.fieldType(), + * fb -> fb.transform(field, transform)) // @link regex="transform(?=\()" target="FieldBuilder#transform" * } * * @param field the field to be transformed * @param transform the transform to apply to the field * @return this builder + * @see FieldTransform */ ClassBuilder transformField(FieldModel field, FieldTransform transform); /** - * Adds a method. - * @param name the name of the method + * Adds a method. The bit for {@link ClassFile#ACC_STATIC ACC_STATIC} flag + * cannot be modified by the {@code handler} later, and must be set through + * {@code methodFlags}. + * + * @param name the method name * @param descriptor the method descriptor - * @param methodFlags the access flags - * @param handler handler which receives a {@link MethodBuilder} which can - * further define the contents of the method + * @param methodFlags the access flags as a bit mask, with the {@code + * ACC_STATIC} bit definitely set + * @param handler handler to supply the contents of the method * @return this builder + * @see MethodModel */ ClassBuilder withMethod(Utf8Entry name, Utf8Entry descriptor, @@ -226,14 +268,23 @@ ClassBuilder withMethod(Utf8Entry name, Consumer handler); /** - * Adds a method, with only a {@code Code} attribute. + * Adds a method, with only access flags and a {@link CodeModel}. The bit + * for {@link ClassFile#ACC_STATIC ACC_STATIC} flag cannot be modified by + * the {@code handler} later, and must be set through {@code methodFlags}. + *

    + * This method behaves as if: + * {@snippet lang=java : + * // @link substring=withMethod target="#withMethod(Utf8Entry, Utf8Entry, int, Consumer)" : + * withMethod(name, descriptor, methodFlags, mb -> mb.withCode(handler)) // @link substring=withCode target="MethodBuilder#withCode" + * } * - * @param name the name of the method + * @param name the method name * @param descriptor the method descriptor - * @param methodFlags the access flags - * @param handler handler which receives a {@link CodeBuilder} which can - * define the contents of the method body + * @param methodFlags the access flags as a bit mask, with the {@code + * ACC_STATIC} bit definitely set + * @param handler handler to supply the contents of the method body * @return this builder + * @see MethodModel */ default ClassBuilder withMethodBody(Utf8Entry name, Utf8Entry descriptor, @@ -243,13 +294,17 @@ default ClassBuilder withMethodBody(Utf8Entry name, } /** - * Adds a method. - * @param name the name of the method + * Adds a method. The bit for {@link ClassFile#ACC_STATIC ACC_STATIC} flag + * cannot be modified by the {@code handler}, and must be set through + * {@code methodFlags}. + * + * @param name the method name * @param descriptor the method descriptor - * @param methodFlags the access flags - * @param handler handler which receives a {@link MethodBuilder} which can - * further define the contents of the method + * @param methodFlags the access flags as a bit mask, with the {@code + * ACC_STATIC} bit definitely set + * @param handler handler to supply the contents of the method * @return this builder + * @see MethodModel */ default ClassBuilder withMethod(String name, MethodTypeDesc descriptor, @@ -262,13 +317,23 @@ default ClassBuilder withMethod(String name, } /** - * Adds a method, with only a {@link CodeAttribute}. - * @param name the name of the method + * Adds a method, with only access flags and a {@link CodeModel}. The bit + * for {@link ClassFile#ACC_STATIC ACC_STATIC} flag cannot be modified by + * the {@code handler}, and must be set through {@code methodFlags}. + *

    + * This method behaves as if: + * {@snippet lang=java : + * // @link substring=withMethod target="#withMethod(String, MethodTypeDesc, int, Consumer)" : + * withMethod(name, descriptor, methodFlags, mb -> mb.withCode(handler)) // @link substring=withCode target="MethodBuilder#withCode" + * } + * + * @param name the method name * @param descriptor the method descriptor - * @param methodFlags the access flags - * @param handler handler which receives a {@link CodeBuilder} which can - * define the contents of the method body + * @param methodFlags the access flags as a bit mask, with the {@code + * ACC_STATIC} bit definitely set + * @param handler handler to supply the contents of the method body * @return this builder + * @see MethodModel */ default ClassBuilder withMethodBody(String name, MethodTypeDesc descriptor, @@ -278,17 +343,21 @@ default ClassBuilder withMethodBody(String name, } /** - * Adds a method by transforming a method from another class. - * - * @implNote - *

    This method behaves as if: + * Adds a method by transforming a method from another class. The transform + * cannot modify the {@link ClassFile#ACC_STATIC ACC_STATIC} flag of the + * original method. + *

    + * This method behaves as if: * {@snippet lang=java : - * withMethod(method.methodName(), method.methodType(), - * b -> b.transformMethod(method, transform)); + * // @link substring=withMethod target="#withMethod(Utf8Entry, Utf8Entry, int, Consumer)" : + * withMethod(method.methodName(), method.methodType(), method.flags().flagMask(), + * mb -> mb.transform(method, transform)) // @link regex="transform(?=\()" target="MethodBuilder#transform" * } + * * @param method the method to be transformed * @param transform the transform to apply to the method * @return this builder + * @see MethodTransform */ ClassBuilder transformMethod(MethodModel method, MethodTransform transform); } diff --git a/src/java.base/share/classes/java/lang/classfile/ClassElement.java b/src/java.base/share/classes/java/lang/classfile/ClassElement.java index c39ab3c4a64..866d1bafcc4 100644 --- a/src/java.base/share/classes/java/lang/classfile/ClassElement.java +++ b/src/java.base/share/classes/java/lang/classfile/ClassElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -27,9 +27,21 @@ import java.lang.classfile.attribute.*; /** - * A marker interface for elements that can appear when traversing - * a {@link ClassModel} or be presented to a {@link ClassBuilder}. + * Marker interface for a member element of a {@link ClassModel}. Such an + * element can appear when traversing a {@link ClassModel} unless otherwise + * specified, be supplied to a {@link ClassBuilder}, and be processed by a + * {@link ClassTransform}. + *

    + * {@link AccessFlags}, and {@link ClassFileVersion} are member elements of a + * class that appear exactly once during the traversal of a {@link ClassModel}. + * {@link Superclass} and {@link Interfaces} may be absent or appear at most + * once. A {@link ClassBuilder} may provide an alternative superclass if it is + * not defined but required. * + * @see ClassFileElement##membership Membership Elements + * @see MethodElement + * @see FieldElement + * @see CodeElement * @sealedGraph * @since 24 */ diff --git a/src/java.base/share/classes/java/lang/classfile/ClassFile.java b/src/java.base/share/classes/java/lang/classfile/ClassFile.java index 43fb1927b38..4b529c39099 100644 --- a/src/java.base/share/classes/java/lang/classfile/ClassFile.java +++ b/src/java.base/share/classes/java/lang/classfile/ClassFile.java @@ -25,18 +25,27 @@ package java.lang.classfile; import java.io.IOException; +import java.lang.classfile.AttributeMapper.AttributeStability; import java.lang.classfile.attribute.CharacterRangeInfo; +import java.lang.classfile.attribute.CodeAttribute; import java.lang.classfile.attribute.LocalVariableInfo; import java.lang.classfile.attribute.LocalVariableTypeInfo; import java.lang.classfile.attribute.ModuleAttribute; +import java.lang.classfile.attribute.StackMapTableAttribute; +import java.lang.classfile.attribute.UnknownAttribute; import java.lang.classfile.constantpool.ClassEntry; import java.lang.classfile.constantpool.ConstantPoolBuilder; import java.lang.classfile.constantpool.Utf8Entry; import java.lang.classfile.instruction.BranchInstruction; +import java.lang.classfile.instruction.CharacterRange; import java.lang.classfile.instruction.DiscontinuedInstruction; import java.lang.classfile.instruction.ExceptionCatch; +import java.lang.classfile.instruction.LineNumber; +import java.lang.classfile.instruction.LocalVariable; +import java.lang.classfile.instruction.LocalVariableType; import java.lang.constant.ClassDesc; import java.lang.reflect.AccessFlag; +import java.lang.reflect.ClassFileFormatVersion; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; @@ -50,9 +59,9 @@ import static jdk.internal.constant.ConstantUtils.CD_module_info; /** - * Represents a context for parsing, transforming, and generating classfiles. - * A {@code ClassFile} has a set of options that condition how parsing and - * generation is done. + * Provides ability to parse, transform, and generate {@code class} files. + * A {@code ClassFile} is a context with a set of options that condition how + * parsing and generation are done. * * @since 24 */ @@ -60,14 +69,20 @@ public sealed interface ClassFile permits ClassFileImpl { /** - * {@return a context with default options} + * {@return a context with default options} Each subtype of {@link Option} + * specifies its default. + *

    + * The default {@link AttributeMapperOption} and {@link + * ClassHierarchyResolverOption} may be unsuitable for some {@code class} + * files and result in parsing or generation errors. */ static ClassFile of() { return ClassFileImpl.DEFAULT_CONTEXT; } /** - * {@return a new context with options altered from the default} + * {@return a context with options altered from the default} Equivalent to + * {@link #of() ClassFile.of().withOptions(options)}. * @param options the desired processing options */ static ClassFile of(Option... options) { @@ -75,14 +90,15 @@ static ClassFile of(Option... options) { } /** - * {@return a copy of the context with altered options} + * {@return a context with altered options from this context} * @param options the desired processing options */ ClassFile withOptions(Option... options); /** - * An option that affects the parsing and writing of classfiles. + * An option that affects the parsing or writing of {@code class} files. * + * @see java.lang.classfile##options Options * @sealedGraph * @since 24 */ @@ -90,16 +106,32 @@ sealed interface Option { } /** - * Option describing attribute mappers for custom attributes. - * Default is only to process standard attributes. + * The option describing user-defined attributes for parsing {@code class} + * files. The default does not recognize any user-defined attribute. + *

    + * An {@code AttributeMapperOption} contains a function that maps an + * attribute name to a user attribute mapper. The function may return {@code + * null} if it does not recognize an attribute name. The returned mapper + * must ensure its {@link AttributeMapper#name() name()} is equivalent to + * the {@link Utf8Entry#stringValue() stringValue()} of the input {@link + * Utf8Entry}. + *

    + * The mapping function in this attribute has lower priority than mappers in + * {@link Attributes}, so it is impossible to override built-in attributes + * with this option. If an attribute is not recognized by any mapper in + * {@link Attributes} and is not assigned a mapper, or recognized, by this + * option, that attribute will be modeled by an {@link UnknownAttribute}. * + * @see AttributeMapper + * @see CustomAttribute * @since 24 */ sealed interface AttributeMapperOption extends Option permits ClassFileImpl.AttributeMapperOptionImpl { /** - * {@return an option describing attribute mappers for custom attributes} + * {@return an option describing user-defined attributes for parsing} + * * @param attributeMapper a function mapping attribute names to attribute mappers */ static AttributeMapperOption of(Function> attributeMapper) { @@ -114,17 +146,31 @@ static AttributeMapperOption of(Function> attribut } /** - * Option describing the class hierarchy resolver to use when generating - * stack maps. + * The option describing the class hierarchy resolver to use when generating + * stack maps or verifying classes. The default is {@link + * ClassHierarchyResolver#defaultResolver()}, which uses core reflection to + * find a class with a given name in {@linkplain ClassLoader#getSystemClassLoader() + * system class loader} and inspect it, and is insufficient if a class is + * not present in the system class loader as in applications, or if loading + * of system classes is not desired as in agents. + *

    + * A {@code ClassHierarchyResolverOption} contains a {@link ClassHierarchyResolver}. + * The resolver must be able to process all classes and interfaces, including + * those appearing as the component types of array types, that appear in the + * operand stack of the generated bytecode. If the resolver fails on any + * of the classes and interfaces with an {@link IllegalArgumentException}, + * the {@code class} file generation fails. * + * @see ClassHierarchyResolver + * @jvms 4.10.1.2 Verification Type System * @since 24 */ sealed interface ClassHierarchyResolverOption extends Option permits ClassFileImpl.ClassHierarchyResolverOptionImpl { /** - * {@return an option describing the class hierarchy resolver to use when - * generating stack maps} + * {@return an option describing the class hierarchy resolver to use} + * * @param classHierarchyResolver the resolver */ static ClassHierarchyResolverOption of(ClassHierarchyResolver classHierarchyResolver) { @@ -139,14 +185,22 @@ static ClassHierarchyResolverOption of(ClassHierarchyResolver classHierarchyReso } /** - * Option describing whether to preserve the original constant pool when - * transforming a {@code class} file. Reusing the constant pool enables - * significant optimizations in processing time and minimizes differences - * between the original and transformed {@code class} files, but may result - * in a bigger transformed {@code class} file when many elements of the - * original {@code class} file are dropped and many original constant - * pool entries become unused. Default is {@link #SHARED_POOL} to preserve - * the original constant pool. + * Option describing whether to extend from the original constant pool when + * transforming a {@code class} file. The default is {@link #SHARED_POOL} + * to extend from the original constant pool. + *

    + * This option affects all overloads of {@link #transformClass transformClass}. + * Extending from the original constant pool keeps the indices into the + * constant pool intact, which enables significant optimizations in processing + * time and minimizes differences between the original and transformed {@code + * class} files, but may result in a bigger transformed {@code class} file + * when many elements of the original {@code class} file are dropped and + * many original constant pool entries become unused. + *

    + * An alternative to this option is to use {@link #build(ClassEntry, + * ConstantPoolBuilder, Consumer)} directly. It allows extension from + * arbitrary constant pools, and may be useful if a built {@code class} file + * reuses structures from multiple original {@code class} files. * * @see ConstantPoolBuilder * @see #build(ClassEntry, ConstantPoolBuilder, Consumer) @@ -156,8 +210,8 @@ static ClassHierarchyResolverOption of(ClassHierarchyResolver classHierarchyReso enum ConstantPoolSharingOption implements Option { /** - * Preserves the original constant pool when transforming the {@code - * class} file. + * Extend the new constant pool from the original constant pool when + * transforming the {@code class} file. *

    * These two transformations below are equivalent: * {@snippet lang=java : @@ -194,87 +248,143 @@ enum ConstantPoolSharingOption implements Option { } /** - * Option describing whether to patch out unreachable code. - * Default is {@code PATCH_DEAD_CODE} to automatically patch out unreachable - * code with NOPs. + * The option describing whether to patch out unreachable code for stack map + * generation. The default is {@link #PATCH_DEAD_CODE} to automatically + * patch unreachable code and generate a valid stack map entry for the + * patched code. + *

    + * The stack map generation process may fail when it encounters unreachable + * code and {@link #KEEP_DEAD_CODE} is set. In such cases, users should + * set {@link StackMapsOption#DROP_STACK_MAPS} and provide their own stack + * maps that passes verification (JVMS {@jvms 4.10.1}). * + * @see StackMapsOption + * @jvms 4.10.1 Verification by Type Checking * @since 24 */ enum DeadCodeOption implements Option { - /** Patch unreachable code */ + /** + * Patch unreachable code with dummy code, and generate valid dummy + * stack map entries. This ensures the generated code can pass + * verification (JVMS {@jvms 4.10.1}). + */ PATCH_DEAD_CODE, - /** Keep the unreachable code */ + /** + * Keep the unreachable code for the accuracy of the generated {@code + * class} file. Users should set {@link StackMapsOption#DROP_STACK_MAPS} + * to prevent stack map generation from running and provide their own + * {@link StackMapTableAttribute} to a {@link CodeBuilder}. + */ KEEP_DEAD_CODE } /** - * Option describing whether to filter unresolved labels. - * Default is {@code FAIL_ON_DEAD_LABELS} to throw IllegalArgumentException - * when any {@link ExceptionCatch}, {@link LocalVariableInfo}, - * {@link LocalVariableTypeInfo}, or {@link CharacterRangeInfo} - * reference to unresolved {@link Label} during bytecode serialization. - * Setting this option to {@code DROP_DEAD_LABELS} filters the above - * elements instead. + * The option describing whether to filter {@linkplain + * CodeBuilder#labelBinding(Label) unbound labels} and drop their + * enclosing structures if possible. The default is {@link + * #FAIL_ON_DEAD_LABELS} to fail fast with an {@link IllegalArgumentException} + * when a {@link PseudoInstruction} refers to an unbound label during + * bytecode generation. + *

    + * The affected {@link PseudoInstruction}s include {@link ExceptionCatch}, + * {@link LocalVariable}, {@link LocalVariableType}, and {@link + * CharacterRange}. Setting this option to {@link #DROP_DEAD_LABELS} + * filters these pseudo-instructions from a {@link CodeBuilder} instead. + * Note that instructions, such as {@link BranchInstruction}, with unbound + * labels always fail-fast with an {@link IllegalArgumentException}. * + * @see DebugElementsOption * @since 24 */ enum DeadLabelsOption implements Option { - /** Fail on unresolved labels */ + /** + * Fail fast on {@linkplain CodeBuilder#labelBinding(Label) unbound + * labels}. This also ensures the accuracy of the generated {@code + * class} files. + */ FAIL_ON_DEAD_LABELS, - /** Filter unresolved labels */ + /** + * Filter {@link PseudoInstruction}s with {@linkplain + * CodeBuilder#labelBinding(Label) unbound labels}. Note that + * instructions with unbound labels still cause an {@link + * IllegalArgumentException}. + */ DROP_DEAD_LABELS } /** - * Option describing whether to process or discard debug elements. - * Debug elements include the local variable table, local variable type - * table, and character range table. Discarding debug elements may - * reduce the overhead of parsing or transforming classfiles. - * Default is {@code PASS_DEBUG} to process debug elements. + * The option describing whether to process or discard debug {@link + * PseudoInstruction}s in the traversal of a {@link CodeModel} or a {@link + * CodeBuilder}. The default is {@link #PASS_DEBUG} to process debug + * pseudo-instructions as all other {@link CodeElement}. + *

    + * Debug pseudo-instructions include {@link LocalVariable}, {@link + * LocalVariableType}, and {@link CharacterRange}. Discarding debug + * elements may reduce the overhead of parsing or transforming {@code class} + * files and has no impact on the run-time behavior. * + * @see LineNumbersOption * @since 24 */ enum DebugElementsOption implements Option { - /** Process debug elements */ + /** + * Process debug pseudo-instructions like other member elements of a + * {@link CodeModel}. + */ PASS_DEBUG, - /** Drop debug elements */ + /** + * Drop debug pseudo-instructions from traversal and builders. + */ DROP_DEBUG } /** - * Option describing whether to process or discard line numbers. + * The option describing whether to process or discard {@link LineNumber}s + * in the traversal of a {@link CodeModel} or a {@link CodeBuilder}. The + * default is {@link #PASS_LINE_NUMBERS} to process all line number entries + * as all other {@link CodeElement}. + *

    * Discarding line numbers may reduce the overhead of parsing or transforming - * classfiles. - * Default is {@code PASS_LINE_NUMBERS} to process line numbers. + * {@code class} files and has no impact on the run-time behavior. * + * @see DebugElementsOption * @since 24 */ enum LineNumbersOption implements Option { - /** Process line numbers */ + /** + * Process {@link LineNumber} like other member elements of a {@link + * CodeModel}. + */ PASS_LINE_NUMBERS, - /** Drop line numbers */ + /** + * Drop {@link LineNumber} from traversal and builders. + */ DROP_LINE_NUMBERS; } /** - * Option describing whether to automatically rewrite short jumps to - * long when necessary. - * Default is {@link #FIX_SHORT_JUMPS} to automatically rewrite jump - * instructions. + * The option describing whether to automatically rewrite short jumps to + * equivalent instructions when necessary. The default is {@link + * #FIX_SHORT_JUMPS} to automatically rewrite. *

    * Due to physical restrictions, some types of instructions cannot encode * certain jump targets with bci offsets less than -32768 or greater than * 32767, as they use a {@code s2} to encode such an offset. (The maximum * length of the {@code code} array is 65535.) These types of instructions * are called "short jumps". + *

    + * Disabling rewrite can ensure the physical accuracy of a generated {@code + * class} file and avoid the overhead from a failed first attempt for + * overflowing forward jumps in some cases, if the generated {@code class} + * file is stable. * * @see BranchInstruction * @see DiscontinuedInstruction.JsrInstruction @@ -294,80 +404,153 @@ enum ShortJumpsOption implements Option { * Fail with an {@link IllegalArgumentException} if short jump overflows. *

    * This is useful to ensure the physical accuracy of a generated {@code - * class} file. + * class} file and avoids the overhead from a failed first attempt for + * overflowing forward jumps in some cases. */ FAIL_ON_SHORT_JUMPS } /** - * Option describing whether to generate stackmaps. - * Default is {@code STACK_MAPS_WHEN_REQUIRED} to generate stack - * maps for {@link #JAVA_6_VERSION} or above, where specifically for - * {@link #JAVA_6_VERSION} the stack maps may not be generated. - * @jvms 4.10.1 Verification by Type Checking + * The option describing whether to generate stack maps. The default is + * {@link #STACK_MAPS_WHEN_REQUIRED} to generate stack maps or reuse + * existing ones if compatible. + *

    + * The {@link StackMapTableAttribute} is a derived property from a {@link + * CodeAttribute Code} attribute to allow a Java Virtual Machine to perform + * verification in one pass. Thus, it is not modeled as part of a {@link + * CodeModel}, but computed on-demand instead via stack maps generation. + *

    + * Stack map generation may fail with an {@link IllegalArgumentException} if + * there is {@linkplain DeadCodeOption unreachable code} or legacy + * {@linkplain DiscontinuedInstruction.JsrInstruction jump routine} + * instructions. When {@link #DROP_STACK_MAPS} option is used, users can + * provide their own stack maps by supplying a {@link StackMapTableAttribute} + * to a {@link CodeBuilder}. * + * @see StackMapTableAttribute + * @see DeadCodeOption + * @jvms 4.10.1 Verification by Type Checking * @since 24 */ enum StackMapsOption implements Option { - /** Generate stack maps when required */ + /** + * Generate stack maps or reuse existing ones if compatible. Stack maps + * are present on major versions {@value #JAVA_6_VERSION} or above. For + * these versions, {@link CodeBuilder} tries to reuse compatible stack + * maps information if the code array and exception handlers are still + * compatible after a transformation; otherwise, it runs stack map + * generation. However, it does not fail fast if the major version is + * {@value #JAVA_6_VERSION}, which allows jump subroutine instructions + * that are incompatible with stack maps to exist in the {@code code} + * array. + */ STACK_MAPS_WHEN_REQUIRED, - /** Always generate stack maps */ + /** + * Forces running stack map generation. This runs stack map generation + * unconditionally and fails fast if the generation fails due to any + * reason. + */ GENERATE_STACK_MAPS, - /** Drop stack maps from code */ + /** + * Do not run stack map generation. Users must supply their own + * {@link StackMapTableAttribute} to a {@link CodeBuilder} if the code + * has branches or exception handlers; otherwise, the generated code + * will fail verification (JVMS {@jvms 4.10.1}). + *

    + * This option is required for user-supplied {@link StackMapTableAttribute} + * to be respected. Stack maps on an existing {@link CodeAttribute Code} + * attribute can be reused as below with this option: + * {@snippet lang=java file="PackageSnippets.java" region="manual-reuse-stack-maps"} + */ DROP_STACK_MAPS } /** - * Option describing whether to process or discard unrecognized or problematic - * original attributes when a class, record component, field, method or code is - * transformed in its exploded form. - * Default is {@code PASS_ALL_ATTRIBUTES} to process all original attributes. - * @see AttributeMapper.AttributeStability + * The option describing whether to retain or discard attributes that cannot + * verify their correctness after a transformation. The default is {@link + * #PASS_ALL_ATTRIBUTES} to retain all attributes as-is. + *

    + * Many attributes only depend on data managed by the Class-File API, such + * as constant pool entries or labels into the {@code code} array. If they + * change, the Class-File API knows their updated values and can write a + * correct version by expanding the structures and recomputing the updated + * indexes, known as "explosion". However, some attributes, such as type + * annotations, depend on arbitrary data that may be modified during + * transformations but the Class-File API does not track, such as index to + * an entry in the {@linkplain ClassModel#interfaces() interfaces} of a + * {@code ClassFile} structure. As a result, the Class-File API cannot + * verify the correctness of such information. * + * @see AttributeStability * @since 24 */ enum AttributesProcessingOption implements Option { - /** Process all original attributes during transformation */ + /** + * Retain all original attributes during transformation. + */ PASS_ALL_ATTRIBUTES, - /** Drop unknown attributes during transformation */ + /** + * Drop attributes with {@link AttributeStability#UNKNOWN} data + * dependency during transformation. + */ DROP_UNKNOWN_ATTRIBUTES, - /** Drop unknown and unstable original attributes during transformation */ + /** + * Drop attributes with {@link AttributeStability#UNSTABLE} or higher + * data dependency during transformation. + */ DROP_UNSTABLE_ATTRIBUTES } /** - * Parse a classfile into a {@link ClassModel}. - * @param bytes the bytes of the classfile + * Parses a {@code class} file into a {@link ClassModel}. + *

    + * Due to the on-demand nature of {@code class} file parsing, an {@link + * IllegalArgumentException} may be thrown on any accessor method invocation + * on the returned model or any structure returned by the accessors in the + * structure hierarchy. + * + * @param bytes the bytes of the {@code class} file * @return the class model - * @throws IllegalArgumentException or its subclass if the classfile format is - * not supported or an incompatibility prevents parsing of the classfile + * @throws IllegalArgumentException if the {@code class} file is malformed + * or of a version {@linkplain #latestMajorVersion() not supported} + * by the current runtime */ ClassModel parse(byte[] bytes); /** - * Parse a classfile into a {@link ClassModel}. - * @param path the path to the classfile + * Parses a {@code class} into a {@link ClassModel}. + *

    + * Due to the on-demand nature of {@code class} file parsing, an {@link + * IllegalArgumentException} may be thrown on any accessor method invocation + * on the returned model or any structure returned by the accessors in the + * structure hierarchy. + * + * @param path the path to the {@code class} file * @return the class model - * @throws java.io.IOException if an I/O error occurs - * @throws IllegalArgumentException or its subclass if the classfile format is - * not supported or an incompatibility prevents parsing of the classfile + * @throws IOException if an I/O error occurs + * @throws IllegalArgumentException if the {@code class} file is malformed + * or of a version {@linkplain #latestMajorVersion() not supported} + * by the current runtime + * @see #parse(byte[]) */ default ClassModel parse(Path path) throws IOException { return parse(Files.readAllBytes(path)); } /** - * Build a classfile into a byte array. + * Builds a {@code class} file into a byte array. + * * @param thisClass the name of the class to build * @param handler a handler that receives a {@link ClassBuilder} - * @return the classfile bytes - * @throws IllegalArgumentException if {@code thisClass} represents a primitive type + * @return the {@code class} file bytes + * @throws IllegalArgumentException if {@code thisClass} represents a + * primitive type or building encounters a failure */ default byte[] build(ClassDesc thisClass, Consumer handler) { @@ -376,24 +559,27 @@ default byte[] build(ClassDesc thisClass, } /** - * Build a classfile into a byte array using the provided constant pool - * builder. + * Builds a {@code class} file into a byte array using the provided constant + * pool builder. * * @param thisClassEntry the name of the class to build * @param constantPool the constant pool builder * @param handler a handler that receives a {@link ClassBuilder} - * @return the classfile bytes + * @return the {@code class} file bytes + * @throws IllegalArgumentException if building encounters a failure */ byte[] build(ClassEntry thisClassEntry, ConstantPoolBuilder constantPool, Consumer handler); /** - * Build a classfile into a file. + * Builds a {@code class} file into a file in a file system. + * * @param path the path to the file to write * @param thisClass the name of the class to build * @param handler a handler that receives a {@link ClassBuilder} - * @throws java.io.IOException if an I/O error occurs + * @throws IOException if an I/O error occurs + * @throws IllegalArgumentException if building encounters a failure */ default void buildTo(Path path, ClassDesc thisClass, @@ -402,14 +588,15 @@ default void buildTo(Path path, } /** - * Build a classfile into a file using the provided constant pool - * builder. + * Builds a {@code class} file into a file in a file system using the + * provided constant pool builder. * * @param path the path to the file to write * @param thisClassEntry the name of the class to build * @param constantPool the constant pool builder * @param handler a handler that receives a {@link ClassBuilder} - * @throws java.io.IOException if an I/O error occurs + * @throws IOException if an I/O error occurs + * @throws IllegalArgumentException if building encounters a failure */ default void buildTo(Path path, ClassEntry thisClassEntry, @@ -419,22 +606,26 @@ default void buildTo(Path path, } /** - * Build a module descriptor into a byte array. + * Builds a module descriptor into a byte array. + * * @param moduleAttribute the {@code Module} attribute - * @return the classfile bytes + * @return the {@code class} file bytes + * @throws IllegalArgumentException if building encounters a failure */ default byte[] buildModule(ModuleAttribute moduleAttribute) { return buildModule(moduleAttribute, clb -> {}); } /** - * Build a module descriptor into a byte array. + * Builds a module descriptor into a byte array. + * * @param moduleAttribute the {@code Module} attribute * @param handler a handler that receives a {@link ClassBuilder} - * @return the classfile bytes + * @return the {@code class} file bytes + * @throws IllegalArgumentException if building encounters a failure */ default byte[] buildModule(ModuleAttribute moduleAttribute, - Consumer handler) { + Consumer handler) { return build(CD_module_info, clb -> { clb.withFlags(AccessFlag.MODULE); clb.with(moduleAttribute); @@ -443,10 +634,12 @@ default byte[] buildModule(ModuleAttribute moduleAttribute, } /** - * Build a module descriptor into a file. + * Builds a module descriptor into a file in a file system. + * * @param path the file to write * @param moduleAttribute the {@code Module} attribute - * @throws java.io.IOException if an I/O error occurs + * @throws IOException if an I/O error occurs + * @throws IllegalArgumentException if building encounters a failure */ default void buildModuleTo(Path path, ModuleAttribute moduleAttribute) throws IOException { @@ -454,11 +647,13 @@ default void buildModuleTo(Path path, } /** - * Build a module descriptor into a file. + * Builds a module descriptor into a file in a file system. + * * @param path the file to write * @param moduleAttribute the {@code Module} attribute * @param handler a handler that receives a {@link ClassBuilder} - * @throws java.io.IOException if an I/O error occurs + * @throws IOException if an I/O error occurs + * @throws IllegalArgumentException if building encounters a failure */ default void buildModuleTo(Path path, ModuleAttribute moduleAttribute, @@ -467,257 +662,396 @@ default void buildModuleTo(Path path, } /** - * Transform one classfile into a new classfile with the aid of a - * {@link ClassTransform}. The transform will receive each element of + * Transform one {@code class} file into a new {@code class} file according + * to a {@link ClassTransform}. The transform will receive each element of * this class, as well as a {@link ClassBuilder} for building the new class. * The transform is free to preserve, remove, or replace elements as it * sees fit. - * - * @implNote + *

    * This method behaves as if: * {@snippet lang=java : - * this.build(model.thisClass(), ConstantPoolBuilder.of(model), - * clb -> clb.transform(model, transform)); + * ConstantPoolBuilder cpb = null; // @replace substring=null; replacement=... + * this.build(model.thisClass(), cpb, + * clb -> clb.transform(model, transform)); * } + * where {@code cpb} is determined by {@link ConstantPoolSharingOption}. + * + * @apiNote + * This is named {@code transformClass} instead of {@code transform} for + * consistency with {@link ClassBuilder#transformField}, {@link + * ClassBuilder#transformMethod}, and {@link MethodBuilder#transformCode}, + * and to distinguish from {@link ClassFileBuilder#transform}, which is + * more generic and powerful. * * @param model the class model to transform * @param transform the transform * @return the bytes of the new class + * @throws IllegalArgumentException if building encounters a failure + * @see ConstantPoolSharingOption */ default byte[] transformClass(ClassModel model, ClassTransform transform) { return transformClass(model, model.thisClass(), transform); } /** - * Transform one classfile into a new classfile with the aid of a - * {@link ClassTransform}. The transform will receive each element of + * Transform one {@code class} file into a new {@code class} file according + * to a {@link ClassTransform}. The transform will receive each element of * this class, as well as a {@link ClassBuilder} for building the new class. * The transform is free to preserve, remove, or replace elements as it * sees fit. * + * @apiNote + * This is named {@code transformClass} instead of {@code transform} for + * consistency with {@link ClassBuilder#transformField}, {@link + * ClassBuilder#transformMethod}, and {@link MethodBuilder#transformCode}, + * and to distinguish from {@link ClassFileBuilder#transform}, which is + * more generic and powerful. + * * @param model the class model to transform * @param newClassName new class name * @param transform the transform * @return the bytes of the new class + * @throws IllegalArgumentException if building encounters a failure + * @see ConstantPoolSharingOption */ default byte[] transformClass(ClassModel model, ClassDesc newClassName, ClassTransform transform) { return transformClass(model, TemporaryConstantPool.INSTANCE.classEntry(newClassName), transform); } /** - * Transform one classfile into a new classfile with the aid of a - * {@link ClassTransform}. The transform will receive each element of + * Transform one {@code class} file into a new {@code class} file according + * to a {@link ClassTransform}. The transform will receive each element of * this class, as well as a {@link ClassBuilder} for building the new class. * The transform is free to preserve, remove, or replace elements as it * sees fit. - * - * @implNote + *

    * This method behaves as if: * {@snippet lang=java : - * this.build(newClassName, ConstantPoolBuilder.of(model), - * clb -> clb.transform(model, transform)); + * ConstantPoolBuilder cpb = null; // @replace substring=null; replacement=... + * this.build(newClassName, cpb, clb -> clb.transform(model, transform)); * } + * where {@code cpb} is determined by {@link ConstantPoolSharingOption}. + * + * @apiNote + * This is named {@code transformClass} instead of {@code transform} for + * consistency with {@link ClassBuilder#transformField}, {@link + * ClassBuilder#transformMethod}, and {@link MethodBuilder#transformCode}, + * and to distinguish from {@link ClassFileBuilder#transform}, which is + * more generic and powerful. * * @param model the class model to transform * @param newClassName new class name * @param transform the transform * @return the bytes of the new class + * @throws IllegalArgumentException if building encounters a failure + * @see ConstantPoolSharingOption */ byte[] transformClass(ClassModel model, ClassEntry newClassName, ClassTransform transform); /** - * Verify a classfile. Any verification errors found will be returned. + * Verify a {@code class} file. All verification errors found will be returned. + * * @param model the class model to verify - * @return a list of verification errors, or an empty list if no errors are + * @return a list of verification errors, or an empty list if no error is * found */ List verify(ClassModel model); /** - * Verify a classfile. Any verification errors found will be returned. - * @param bytes the classfile bytes to verify - * @return a list of verification errors, or an empty list if no errors are + * Verify a {@code class} file. All verification errors found will be returned. + * + * @param bytes the {@code class} file bytes to verify + * @return a list of verification errors, or an empty list if no error is * found */ List verify(byte[] bytes); /** - * Verify a classfile. Any verification errors found will be returned. - * @param path the classfile path to verify - * @return a list of verification errors, or an empty list if no errors are + * Verify a {@code class} file. All verification errors found will be returned. + * + * @param path the {@code class} file path to verify + * @return a list of verification errors, or an empty list if no error is * found - * @throws java.io.IOException if an I/O error occurs + * @throws IOException if an I/O error occurs */ default List verify(Path path) throws IOException { return verify(Files.readAllBytes(path)); } - /** 0xCAFEBABE */ + /** + * The magic number identifying the {@code class} file format, {@value + * "0x%04x" #MAGIC_NUMBER}. It is a big-endian 4-byte value. + */ int MAGIC_NUMBER = 0xCAFEBABE; - /** The bit mask of PUBLIC access and property modifier. */ + /** The bit mask of {@link AccessFlag#PUBLIC} access and property modifier. */ int ACC_PUBLIC = 0x0001; - /** The bit mask of PROTECTED access and property modifier. */ + /** The bit mask of {@link AccessFlag#PROTECTED} access and property modifier. */ int ACC_PROTECTED = 0x0004; - /** The bit mask of PRIVATE access and property modifier. */ + /** The bit mask of {@link AccessFlag#PRIVATE} access and property modifier. */ int ACC_PRIVATE = 0x0002; - /** The bit mask of INTERFACE access and property modifier. */ + /** The bit mask of {@link AccessFlag#INTERFACE} access and property modifier. */ int ACC_INTERFACE = 0x0200; - /** The bit mask of ENUM access and property modifier. */ + /** The bit mask of {@link AccessFlag#ENUM} access and property modifier. */ int ACC_ENUM = 0x4000; - /** The bit mask of ANNOTATION access and property modifier. */ + /** The bit mask of {@link AccessFlag#ANNOTATION} access and property modifier. */ int ACC_ANNOTATION = 0x2000; - /** The bit mask of SUPER access and property modifier. */ + /** The bit mask of {@link AccessFlag#SUPER} access and property modifier. */ int ACC_SUPER = 0x0020; - /** The bit mask of ABSTRACT access and property modifier. */ + /** The bit mask of {@link AccessFlag#ABSTRACT} access and property modifier. */ int ACC_ABSTRACT = 0x0400; - /** The bit mask of VOLATILE access and property modifier. */ + /** The bit mask of {@link AccessFlag#VOLATILE} access and property modifier. */ int ACC_VOLATILE = 0x0040; - /** The bit mask of TRANSIENT access and property modifier. */ + /** The bit mask of {@link AccessFlag#TRANSIENT} access and property modifier. */ int ACC_TRANSIENT = 0x0080; - /** The bit mask of SYNTHETIC access and property modifier. */ + /** The bit mask of {@link AccessFlag#SYNTHETIC} access and property modifier. */ int ACC_SYNTHETIC = 0x1000; - /** The bit mask of STATIC access and property modifier. */ + /** The bit mask of {@link AccessFlag#STATIC} access and property modifier. */ int ACC_STATIC = 0x0008; - /** The bit mask of FINAL access and property modifier. */ + /** The bit mask of {@link AccessFlag#FINAL} access and property modifier. */ int ACC_FINAL = 0x0010; - /** The bit mask of SYNCHRONIZED access and property modifier. */ + /** The bit mask of {@link AccessFlag#SYNCHRONIZED} access and property modifier. */ int ACC_SYNCHRONIZED = 0x0020; - /** The bit mask of BRIDGE access and property modifier. */ + /** The bit mask of {@link AccessFlag#BRIDGE} access and property modifier. */ int ACC_BRIDGE = 0x0040; - /** The bit mask of VARARGS access and property modifier. */ + /** The bit mask of {@link AccessFlag#VARARGS} access and property modifier. */ int ACC_VARARGS = 0x0080; - /** The bit mask of NATIVE access and property modifier. */ + /** The bit mask of {@link AccessFlag#NATIVE} access and property modifier. */ int ACC_NATIVE = 0x0100; - /** The bit mask of STRICT access and property modifier. */ + /** The bit mask of {@link AccessFlag#STRICT} access and property modifier. */ int ACC_STRICT = 0x0800; - /** The bit mask of MODULE access and property modifier. */ + /** The bit mask of {@link AccessFlag#MODULE} access and property modifier. */ int ACC_MODULE = 0x8000; - /** The bit mask of OPEN access and property modifier. */ + /** The bit mask of {@link AccessFlag#OPEN} access and property modifier. */ int ACC_OPEN = 0x20; - /** The bit mask of MANDATED access and property modifier. */ + /** The bit mask of {@link AccessFlag#MANDATED} access and property modifier. */ int ACC_MANDATED = 0x8000; - /** The bit mask of TRANSITIVE access and property modifier. */ + /** The bit mask of {@link AccessFlag#TRANSITIVE} access and property modifier. */ int ACC_TRANSITIVE = 0x20; - /** The bit mask of STATIC_PHASE access and property modifier. */ + /** The bit mask of {@link AccessFlag#STATIC_PHASE} access and property modifier. */ int ACC_STATIC_PHASE = 0x40; - /** The class major version of JAVA_1. */ + /** + * The class major version of the initial version of Java, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_0 + * @see ClassFileFormatVersion#RELEASE_1 + */ int JAVA_1_VERSION = 45; - /** The class major version of JAVA_2. */ + /** + * The class major version introduced by Java 2 SE 1.2, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_2 + */ int JAVA_2_VERSION = 46; - /** The class major version of JAVA_3. */ + /** + * The class major version introduced by Java 2 SE 1.3, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_3 + */ int JAVA_3_VERSION = 47; - /** The class major version of JAVA_4. */ + /** + * The class major version introduced by Java 2 SE 1.4, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_4 + */ int JAVA_4_VERSION = 48; - /** The class major version of JAVA_5. */ + /** + * The class major version introduced by Java 2 SE 5.0, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_5 + */ int JAVA_5_VERSION = 49; - /** The class major version of JAVA_6. */ + /** + * The class major version introduced by Java SE 6, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_6 + */ int JAVA_6_VERSION = 50; - /** The class major version of JAVA_7. */ + /** + * The class major version introduced by Java SE 7, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_7 + */ int JAVA_7_VERSION = 51; - /** The class major version of JAVA_8. */ + /** + * The class major version introduced by Java SE 8, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_8 + */ int JAVA_8_VERSION = 52; - /** The class major version of JAVA_9. */ + /** + * The class major version introduced by Java SE 9, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_9 + */ int JAVA_9_VERSION = 53; - /** The class major version of JAVA_10. */ + /** + * The class major version introduced by Java SE 10, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_10 + */ int JAVA_10_VERSION = 54; - /** The class major version of JAVA_11. */ + /** + * The class major version introduced by Java SE 11, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_11 + */ int JAVA_11_VERSION = 55; - /** The class major version of JAVA_12. */ + /** + * The class major version introduced by Java SE 12, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_12 + */ int JAVA_12_VERSION = 56; - /** The class major version of JAVA_13. */ + /** + * The class major version introduced by Java SE 13, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_13 + */ int JAVA_13_VERSION = 57; - /** The class major version of JAVA_14. */ + /** + * The class major version introduced by Java SE 14, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_14 + */ int JAVA_14_VERSION = 58; - /** The class major version of JAVA_15. */ + /** + * The class major version introduced by Java SE 15, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_15 + */ int JAVA_15_VERSION = 59; - /** The class major version of JAVA_16. */ + /** + * The class major version introduced by Java SE 16, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_16 + */ int JAVA_16_VERSION = 60; - /** The class major version of JAVA_17. */ + /** + * The class major version introduced by Java SE 17, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_17 + */ int JAVA_17_VERSION = 61; - /** The class major version of JAVA_18. */ + /** + * The class major version introduced by Java SE 18, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_18 + */ int JAVA_18_VERSION = 62; - /** The class major version of JAVA_19. */ + /** + * The class major version introduced by Java SE 19, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_19 + */ int JAVA_19_VERSION = 63; - /** The class major version of JAVA_20. */ + /** + * The class major version introduced by Java SE 20, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_20 + */ int JAVA_20_VERSION = 64; - /** The class major version of JAVA_21. */ + /** + * The class major version introduced by Java SE 21, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_21 + */ int JAVA_21_VERSION = 65; - /** The class major version of JAVA_22. */ + /** + * The class major version introduced by Java SE 22, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_22 + */ int JAVA_22_VERSION = 66; - /** The class major version of JAVA_23. */ + /** + * The class major version introduced by Java SE 23, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_23 + */ int JAVA_23_VERSION = 67; - /** The class major version of JAVA_24. */ + /** + * The class major version introduced by Java SE 24, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_24 + */ int JAVA_24_VERSION = 68; /** - * The class major version of JAVA_25. + * The class major version introduced by Java SE 25, {@value}. + * + * @see ClassFileFormatVersion#RELEASE_25 * @since 25 */ int JAVA_25_VERSION = 69; /** - * A minor version number indicating a class uses preview features - * of a Java SE version since 12, for major versions {@value + * A minor version number {@value} indicating a class uses preview features + * of a Java SE release since 12, for major versions {@value * #JAVA_12_VERSION} and above. */ int PREVIEW_MINOR_VERSION = 65535; /** - * {@return the latest major Java version} + * {@return the latest class major version supported by the current runtime} */ static int latestMajorVersion() { return JAVA_25_VERSION; } /** - * {@return the latest minor Java version} + * {@return the latest class minor version supported by the current runtime} + * + * @apiNote + * This does not report the {@link #PREVIEW_MINOR_VERSION} when the current + * runtime has preview feature enabled, as {@code class} files with a major + * version other than {@link #latestMajorVersion()} and the preview minor + * version are not supported. */ static int latestMinorVersion() { return 0; diff --git a/src/java.base/share/classes/java/lang/classfile/ClassFileBuilder.java b/src/java.base/share/classes/java/lang/classfile/ClassFileBuilder.java index 01eeefd0b9b..172daa83cf8 100644 --- a/src/java.base/share/classes/java/lang/classfile/ClassFileBuilder.java +++ b/src/java.base/share/classes/java/lang/classfile/ClassFileBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,17 +31,36 @@ import jdk.internal.classfile.impl.TransformImpl; /** - * A builder for a classfile or portion of a classfile. Builders are rarely - * created directly; they are passed to handlers by methods such as - * {@link ClassFile#build(ClassDesc, Consumer)} or to transforms. - * Elements of the newly built entity can be specified - * abstractly (by passing a {@link ClassFileElement} to {@link #with(ClassFileElement)} - * or concretely by calling the various {@code withXxx} methods. + * A builder for a {@link CompoundElement}, which accepts the member elements + * to be integrated into the built structure. Builders are usually passed as + * an argument to {@link Consumer} handlers, such as in {@link + * ClassFile#build(ClassDesc, Consumer)}. The handlers should deliver elements + * to a builder similar to how a {@link CompoundElement} traverses its member + * elements. + *

    + * The basic way a builder accepts elements is through {@link #with}, which + * supports call chaining. Concrete subtypes of builders usually define extra + * methods to define elements directly to the builder, such as {@link + * ClassBuilder#withFlags(int)} or {@link CodeBuilder#aload(int)}. + *

    + * Whether a member element can appear multiple times in a compound structure + * affects the behavior of the element in {@code ClassFileBuilder}s. If an + * element can appear at most once but multiple instances are supplied to a + * {@code ClassFileBuilder}, the last supplied instance appears on the built + * structure. If an element appears exactly once but no instance is supplied, + * an unspecified default value element may be used in that structure. + *

    + * Due to restrictions of the {@code class} file format, certain member elements + * that can be modeled by the API cannot be represented in the built structure + * under specific circumstances. Passing such elements to the builder causes + * {@link IllegalArgumentException}. Some {@link ClassFile.Option}s control + * whether such elements should be altered or dropped to produce valid {@code + * class} files. * - * @param the element type - * @param the builder type + * @param the member element type + * @param the self type of this builder + * @see CompoundElement * @see ClassFileTransform - * * @sealedGraph * @since 24 */ @@ -49,8 +68,15 @@ public sealed interface ClassFileBuilder permits ClassBuilder, FieldBuilder, MethodBuilder, CodeBuilder { /** - * Integrate the {@link ClassFileElement} into the entity being built. - * @param e the element + * Integrates the member element into the structure being built. + * + * @apiNote + * This method exists to implement {@link Consumer}; users can use {@link + * #with} for call chaining. + * + * @param e the member element + * @throws IllegalArgumentException if the member element cannot be + * represented in the {@code class} file format */ @Override default void accept(E e) { @@ -58,9 +84,12 @@ default void accept(E e) { } /** - * Integrate the {@link ClassFileElement} into the entity being built. - * @param e the element + * Integrates the member element into the structure being built. + * + * @param e the member element * @return this builder + * @throws IllegalArgumentException if the member element cannot be + * represented in the {@code class} file format */ B with(E e); @@ -70,10 +99,29 @@ default void accept(E e) { ConstantPoolBuilder constantPool(); /** - * Apply a transform to a model, directing results to this builder. - * @param model the model to transform + * Applies a transform to a compound structure, directing results to this + * builder. + *

    + * The transform will receive each element of the compound structure, as + * well as this builder for building the structure. The transform is free + * to preserve, remove, or replace elements as it sees fit. + *

    + * A builder can run multiple transforms against different compound + * structures, integrating member elements of different origins. + * + * @apiNote + * Many subinterfaces have methods like {@link ClassBuilder#transformMethod} + * or {@link MethodBuilder#transformCode}. However, calling them is + * fundamentally different from calling this method: those methods call the + * {@code transform} on the child builders instead of on itself. For + * example, {@code classBuilder.transformMethod} calls {@code + * methodBuilder.transform} with a new method builder instead of calling + * {@code classBuilder.transform} on itself. + * + * @param model the structure to transform * @param transform the transform to apply * @return this builder + * @see ClassFileTransform */ default B transform(CompoundElement model, ClassFileTransform transform) { @SuppressWarnings("unchecked") diff --git a/src/java.base/share/classes/java/lang/classfile/ClassFileElement.java b/src/java.base/share/classes/java/lang/classfile/ClassFileElement.java index ed84eb39d53..5d5d0020949 100644 --- a/src/java.base/share/classes/java/lang/classfile/ClassFileElement.java +++ b/src/java.base/share/classes/java/lang/classfile/ClassFileElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,12 +25,34 @@ package java.lang.classfile; /** - * Immutable model for a portion of (or the entirety of) a classfile. Elements - * that model parts of the classfile that have attributes will implement {@link - * AttributedElement}; elements that model complex parts of the classfile that - * themselves contain their own child elements will implement {@link - * CompoundElement}. Elements specific to various locations in the classfile - * will implement {@link ClassElement}, {@link MethodElement}, etc. + * Marker interface for structures with special capabilities in the {@code + * class} file format. {@link AttributedElement} indicates a structure has + * {@link Attribute}s. {@link CompoundElement} indicates a structure can be + * viewed as a composition of member structures, whose memberships are marked by + * {@link ClassElement}, {@link MethodElement}, {@link FieldElement}, or {@link + * CodeElement}. + * + *

    Membership Elements

    + * {@link ClassModel}, {@link MethodModel}, {@link FieldModel}, and {@link + * CodeModel} each has a dedicated interface marking its member structures: + * {@link ClassElement}, {@link MethodElement}, {@link FieldElement}, and + * {@link CodeElement}. They can be supplied to a {@link ClassBuilder}, a + * {@link MethodBuilder}, a {@link FieldBuilder}, or a {@link CodeBuilder} to be + * included as members of the built model. Unless otherwise specified, these + * structures are delivered during the {@linkplain CompoundElement traversal} of + * the corresponding models. Some of these elements may appear at most once or + * exactly once in the traversal of the models; such elements have special + * treatment by {@link ClassFileBuilder} and are specified in their modeling + * interfaces. If such elements appear multiple times during traversal, the + * last occurrence should be used and all previous instances should be + * discarded. + *

    + * These membership element marker interfaces are sealed; future versions of the + * Java SE Platform may define new elements to the sealed hierarchy when the + * {@code class} file format for the Java Platform evolves. Using an exhaustive + * pattern matching switch over these hierarchies indicates the user only wish + * the processing code to run on a specific version of Java Platform, and will + * fail if unknown new elements are encountered. * * @sealedGraph * @since 24 diff --git a/src/java.base/share/classes/java/lang/classfile/ClassFileTransform.java b/src/java.base/share/classes/java/lang/classfile/ClassFileTransform.java index 7d9385eed68..9126b13bce9 100644 --- a/src/java.base/share/classes/java/lang/classfile/ClassFileTransform.java +++ b/src/java.base/share/classes/java/lang/classfile/ClassFileTransform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,44 +25,74 @@ package java.lang.classfile; import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute; +import java.util.function.Predicate; import java.util.function.Supplier; /** - * A transformation on streams of elements. Transforms are used during - * transformation of classfile entities; a transform is provided to a method like - * {@link ClassFile#transformClass(ClassModel, ClassTransform)}, and the elements of the class, - * along with a builder, are presented to the transform. - * - *

    The subtypes of {@linkplain - * ClassFileTransform} (e.g., {@link ClassTransform}) are functional interfaces - * that accept an element and a corresponding builder. Since any element can be - * reproduced on the builder via {@link ClassBuilder#with(ClassFileElement)}, a - * transform can easily leave elements in place, remove them, replace them, or - * augment them with other elements. This enables localized transforms to be - * represented concisely. - * - *

    Transforms also have an {@link #atEnd(ClassFileBuilder)} method, for - * which the default implementation does nothing, so that a transform can - * perform additional building after the stream of elements is exhausted. - * - *

    Transforms can be chained together via the {@link - * #andThen(ClassFileTransform)} method, so that the output of one becomes the - * input to another. This allows smaller units of transformation to be captured - * and reused. - * - *

    Some transforms are stateful; for example, a transform that injects an - * annotation on a class may watch for the {@link RuntimeVisibleAnnotationsAttribute} - * element and transform it if found, but if it is not found, will generate a - * {@linkplain RuntimeVisibleAnnotationsAttribute} element containing the - * injected annotation from the {@linkplain #atEnd(ClassFileBuilder)} handler. - * To do this, the transform must accumulate some state during the traversal so - * that the end handler knows what to do. If such a transform is to be reused, - * its state must be reset for each traversal; this will happen automatically if - * the transform is created with {@link ClassTransform#ofStateful(Supplier)} (or - * corresponding methods for other classfile locations.) + * A transformation on a {@link CompoundElement} by processing its individual + * member elements and sending the results to a {@link ClassFileBuilder}, + * through {@link ClassFileBuilder#transform}. A subtype of {@code + * ClassFileTransform} is defined for each subtype of {@link CompoundElement} + * and {@link ClassFileBuilder}, as shown in the sealed class hierarchy below. + *

    + * For example, this is a basic transformation of a {@link CodeModel} that + * redirects all calls to static methods in the {@code Foo} class to the {@code + * Bar} class, preserving all other elements: + * {@snippet file="PackageSnippets.java" region=fooToBarTransform} + * Note that if no transformation of a member element is desired, the element + * should be presented to {@link ClassFileBuilder#with builder::with}. If no + * action is taken, that member element is dropped. + *

    + * More advanced usages of transforms include {@linkplain ##start-end start or + * end handling}, {@linkplain ##stateful stateful transformation} that makes a + * decision based on previously encountered member elements, and {@linkplain + * ##composition composition} of transforms, where one transform processes the + * results of a previous transform on the input compound structure. All these + * capabilities are supported by this interface and accessible to user transform + * implementations. + *

    + * Users can define custom start and end handling for a transform by overriding + * {@link #atStart} and {@link #atEnd}. The start handler is called before any + * member element is processed, and the end handler is called after all member + * elements are processed. For example, the start handler can be used to inject + * extra code elements to the beginning of a code array, and the end handler, + * combined with stateful transformation, can perform cleanup actions, such as + * determining if an attribute has been merged, or if a new attribute should be + * defined. Each subtype of {@code ClassFileTransform} defines a utility method + * {@code endHandler} that returns a transform that only has end handling. + *

    + * Transforms can have states that persist across processing of individual + * member elements. For example, if a transform injects an annotation, the + * transform may keep track if it has encountered and presented an updated + * {@link RuntimeVisibleAnnotationsAttribute} to the builder; if it has not yet, + * it can present a new attribute containing only the injected annotation in its + * end handler. If such a transform is to be shared or reused, each returned + * transform should have its own state. Each subtype of {@code ClassFileTransform} + * defines a utility method {@code ofStateful} where a supplier creates the + * transform at its initial state each time the transform is reused. + *

    + * Transforms can be composed via {@link #andThen}. When this transform is + * composed with another transform, it means the output member elements received + * by the {@link ClassFileBuilder} become the input elements to that other + * transform. Composition avoids building intermediate structures for multiple + * transforms to run on. Each subtype of {@code ClassFileTransform} implements + * {@link #andThen}, which generally should not be implemented by users. + *

    + * Transforms that run on smaller structures can be lifted to its enclosing + * structures to selectively run on all enclosed smaller structures of the same + * kind. For example, a {@link CodeTransform} can be lifted via {@link + * ClassTransform#transformingMethodBodies(Predicate, CodeTransform)} to + * transform the method body of select methods in the class it runs on. This + * allows users to write small transforms and apply to larger scales. + *

    + * Besides {@link ClassFileBuilder#transform}, there are other methods that + * accepts a transform conveniently, such as {@link ClassFile#transformClass}, + * {@link ClassBuilder#transformField}, {@link ClassBuilder#transformMethod}, or + * {@link MethodBuilder#transformCode}. They are convenience methods that suit + * the majority of transformation scenarios. * * @param the transform type - * @param the element type + * @param the member element type * @param the builder type * * @sealedGraph @@ -79,6 +109,9 @@ public sealed interface ClassFileTransform< * body.) If no transformation is desired, the element can be presented to * {@link B#with(ClassFileElement)}. If the element is to be dropped, no * action is required. + *

    + * This method is called by the Class-File API. Users should never call + * this method. * * @param builder the builder for the new entity * @param element the element @@ -89,6 +122,9 @@ public sealed interface ClassFileTransform< * Take any final action during transformation of a classfile entity. Called * after all elements of the class are presented to {@link * #accept(ClassFileBuilder, ClassFileElement)}. + *

    + * This method is called by the Class-File API. Users should never call + * this method. * * @param builder the builder for the new entity * @implSpec The default implementation does nothing. @@ -100,6 +136,9 @@ default void atEnd(B builder) { * Take any preliminary action during transformation of a classfile entity. * Called before any elements of the class are presented to {@link * #accept(ClassFileBuilder, ClassFileElement)}. + *

    + * This method is called by the Class-File API. Users should never call + * this method. * * @param builder the builder for the new entity * @implSpec The default implementation does nothing. @@ -110,6 +149,10 @@ default void atStart(B builder) { /** * Chain this transform with another; elements presented to the builder of * this transform will become the input to the next transform. + *

    + * This method is implemented by the Class-File API. Users usually don't + * have sufficient access to Class-File API functionalities to override this + * method correctly for generic downstream transforms. * * @param next the downstream transform * @return the chained transform diff --git a/src/java.base/share/classes/java/lang/classfile/ClassFileVersion.java b/src/java.base/share/classes/java/lang/classfile/ClassFileVersion.java index 1916a185cc8..5a795b94865 100644 --- a/src/java.base/share/classes/java/lang/classfile/ClassFileVersion.java +++ b/src/java.base/share/classes/java/lang/classfile/ClassFileVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -24,32 +24,62 @@ */ package java.lang.classfile; +import java.lang.reflect.ClassFileFormatVersion; + import jdk.internal.classfile.impl.ClassFileVersionImpl; /** - * Models the classfile version information for a class. Delivered as a {@link - * java.lang.classfile.ClassElement} when traversing the elements of a {@link - * ClassModel}. + * Models the minor and major version numbers of a {@code class} file (JVMS + * {@jvms 4.1}). The {@code class} file version appears exactly once in each + * class, and is set to an unspecified default value if not explicitly provided. + *

    + * The major versions of {@code class} file format begins at {@value + * ClassFile#JAVA_1_VERSION} for Java Platform version 1.0.2, and is continuous + * up to {@link ClassFile#latestMajorVersion()}. In general, each major version + * defines a new supported {@code class} file format, modeled by {@link + * ClassFileFormatVersion}, and supports all previous formats. + *

    + * For major versions up to {@value ClassFile#JAVA_11_VERSION} for Java SE + * Platform 11, the minor version of any value is supported. For major versions + * {@value ClassFile#JAVA_12_VERSION} for Java SE Platform version 12 and above, + * the minor version must be {@code 0} or {@value ClassFile#PREVIEW_MINOR_VERSION}. + * The minor version {@code 0} is always supported, and represents the format + * modeled by {@link ClassFileFormatVersion}. The minor version {@code 65535} + * indicates the {@code class} file uses preview features of the Java SE + * Platform release represented by the major version. A Java Virtual Machine + * can only load such a {@code class} file if it has the same Java SE Platform + * version and the JVM has preview features enabled. * + * @see ClassModel#majorVersion() + * @see ClassModel#minorVersion() + * @see ClassFileFormatVersion + * @jvms 4.1 The {@code ClassFile} Structure * @since 24 */ public sealed interface ClassFileVersion extends ClassElement permits ClassFileVersionImpl { /** - * {@return the major classfile version} + * {@return the major version} It is in the range of unsigned short, {@code + * [0, 65535]}. + * + * @apiNote + * Constants in {@link ClassFile} named {@code Java_#_VERSION}, where # is + * a release number, such as {@link ClassFile#JAVA_21_VERSION}, describe the + * class major versions of the Java Platform SE. */ int majorVersion(); /** - * {@return the minor classfile version} + * {@return the minor version} It is in the range of unsigned short, {@code + * [0, 65535]}. */ int minorVersion(); /** * {@return a {@link ClassFileVersion} element} - * @param majorVersion the major classfile version - * @param minorVersion the minor classfile version + * @param majorVersion the major version + * @param minorVersion the minor version */ static ClassFileVersion of(int majorVersion, int minorVersion) { return new ClassFileVersionImpl(majorVersion, minorVersion); diff --git a/src/java.base/share/classes/java/lang/classfile/ClassHierarchyResolver.java b/src/java.base/share/classes/java/lang/classfile/ClassHierarchyResolver.java index 2c612854a64..3bc56b43b7b 100644 --- a/src/java.base/share/classes/java/lang/classfile/ClassHierarchyResolver.java +++ b/src/java.base/share/classes/java/lang/classfile/ClassHierarchyResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -24,7 +24,11 @@ */ package java.lang.classfile; +import java.io.IOException; import java.io.InputStream; +import java.io.UncheckedIOException; +import java.lang.classfile.ClassFile.StackMapsOption; +import java.lang.classfile.attribute.StackMapTableAttribute; import java.lang.constant.ClassDesc; import java.lang.invoke.MethodHandles; import java.util.Collection; @@ -42,27 +46,42 @@ import static java.util.Objects.requireNonNull; /** - * Provides class hierarchy information for generating correct stack maps - * during code building. + * Provides class hierarchy information for {@linkplain StackMapsOption stack + * maps generation} and {@linkplain ClassFile#verify(byte[]) verification}. + * A class hierarchy resolver must be able to process all classes and interfaces + * encountered during these workloads. * + * @see ClassFile.ClassHierarchyResolverOption + * @see StackMapTableAttribute + * @jvms 4.10.1.2 Verification Type System * @since 24 */ @FunctionalInterface public interface ClassHierarchyResolver { /** - * {@return the default instance of {@linkplain ClassHierarchyResolver} that + * {@return the default instance of {@code ClassHierarchyResolver} that * gets {@link ClassHierarchyInfo} from system class loader with reflection} + * This default instance cannot load classes from other class loaders, such + * as the caller's class loader; it also loads the system classes if they + * are not yet loaded, which makes it unsuitable for instrumentation. */ static ClassHierarchyResolver defaultResolver() { return ClassHierarchyImpl.DEFAULT_RESOLVER; } /** - * {@return the {@link ClassHierarchyInfo} for a given class name, or null - * if the name is unknown to the resolver} + * {@return the {@code ClassHierarchyInfo} for a given class name, or {@code + * null} if the name is unknown to the resolver} + *

    + * This method is called by the Class-File API to obtain the hierarchy + * information of a class or interface; users should not call this method. + * The symbolic descriptor passed by the Class-File API always represents + * a class or interface. + * * @param classDesc descriptor of the class - * @throws IllegalArgumentException if a class shouldn't be queried for hierarchy + * @throws IllegalArgumentException if a class shouldn't be queried for + * hierarchy, such as when it is inaccessible */ ClassHierarchyInfo getClassInfo(ClassDesc classDesc); @@ -78,6 +97,7 @@ sealed interface ClassHierarchyInfo permits ClassHierarchyImpl.ClassHierarchyInf * * @param superClass descriptor of the super class, may be {@code null} * @return the info indicating the super class + * @see Superclass */ static ClassHierarchyInfo ofClass(ClassDesc superClass) { return new ClassHierarchyImpl.ClassHierarchyInfoImpl(superClass, false); @@ -94,14 +114,15 @@ static ClassHierarchyInfo ofInterface() { } /** - * Chains this {@linkplain ClassHierarchyResolver} with another to be - * consulted if this resolver does not know about the specified class. + * Chains this {@code ClassHierarchyResolver} with another to be consulted + * if this resolver does not know about the specified class. + * + * @implSpec + * The default implementation returns resolver implemented to query {@code + * other} resolver in case this resolver returns {@code null}. * * @param other the other resolver * @return the chained resolver - * - * @implSpec The default implementation returns resolver implemented to ask - * other resolver in cases where this resolver returns {@code null}. */ default ClassHierarchyResolver orElse(ClassHierarchyResolver other) { requireNonNull(other); @@ -117,32 +138,32 @@ public ClassHierarchyInfo getClassInfo(ClassDesc classDesc) { } /** - * Returns a ClassHierarchyResolver that caches class hierarchy information from this - * resolver. The returned resolver will not update if delegate resolver returns differently. - * The thread safety of the returned resolver depends on the thread safety of the map + * {@return a {@code ClassHierarchyResolver} that caches class hierarchy + * information from this resolver} The returned resolver will not update if + * the query results from this resolver changed over time. The thread + * safety of the returned resolver depends on the thread safety of the map * returned by the {@code cacheFactory}. * - * @param cacheFactory the factory for the cache - * @return the ClassHierarchyResolver with caching + * @implSpec + * The default implementation returns a resolver holding an instance of the + * cache map provided by the {@code cacheFactory}. It looks up in the cache + * map, or if a class name has not yet been queried, queries this resolver + * and caches the result, including a {@code null} that indicates unknown + * class names. The cache map may refuse {@code null} keys and values. * - * @implSpec The default implementation returns resolver holding an instance - * of the cache map provided by the {@code cacheFactory}. It asks - * the cache map always first and fills the cache map with all - * resolved and also unresolved class info. The cache map may refuse - * {@code null} keys and values. + * @param cacheFactory the factory for the cache */ default ClassHierarchyResolver cached(Supplier> cacheFactory) { return new ClassHierarchyImpl.CachedClassHierarchyResolver(this, cacheFactory.get()); } /** - * Returns a ClassHierarchyResolver that caches class hierarchy information from this - * resolver. The returned resolver will not update if delegate resolver returns differently. - * The returned resolver is not thread-safe. + * {@return a {@code ClassHierarchyResolver} that caches class hierarchy + * information from this resolver} The returned resolver will not update if + * the query results from this resolver changed over time. The returned + * resolver is not thread-safe. * {@snippet file="PackageSnippets.java" region="lookup-class-hierarchy-resolver"} * - * @return the ClassHierarchyResolver - * * @implSpec The default implementation calls {@link #cached(Supplier)} with * {@link HashMap} supplier as {@code cacheFactory}. */ @@ -160,24 +181,24 @@ public Map get() { } /** - * Returns a {@linkplain ClassHierarchyResolver} that extracts class hierarchy - * information from classfiles located by a mapping function. The mapping function - * should return null if it cannot provide a mapping for a classfile. Any IOException - * from the provided input stream is rethrown as an UncheckedIOException. + * {@return a {@code ClassHierarchyResolver} that extracts class hierarchy + * information from {@code class} files returned by a mapping function} The + * mapping function should return {@code null} if it cannot provide a + * {@code class} file for a class name. Any {@link IOException} from the + * provided input stream is rethrown as an {@link UncheckedIOException} + * in {@link #getClassInfo(ClassDesc)}. * - * @param classStreamResolver maps class descriptors to classfile input streams - * @return the {@linkplain ClassHierarchyResolver} + * @param classStreamResolver maps class descriptors to {@code class} file input streams */ static ClassHierarchyResolver ofResourceParsing(Function classStreamResolver) { return new ClassHierarchyImpl.ResourceParsingClassHierarchyResolver(requireNonNull(classStreamResolver)); } /** - * Returns a {@linkplain ClassHierarchyResolver} that extracts class hierarchy - * information from classfiles located by a class loader. + * {@return a {@code ClassHierarchyResolver} that extracts class hierarchy + * information from {@code class} files located by a class loader} * * @param loader the class loader, to find class files - * @return the {@linkplain ClassHierarchyResolver} */ static ClassHierarchyResolver ofResourceParsing(ClassLoader loader) { requireNonNull(loader); @@ -190,24 +211,22 @@ public InputStream apply(ClassDesc classDesc) { } /** - * Returns a {@linkplain ClassHierarchyResolver} that extracts class hierarchy - * information from collections of class hierarchy metadata + * {@return a {@code ClassHierarchyResolver} that extracts class hierarchy + * information from collections of class hierarchy metadata} * * @param interfaces a collection of classes known to be interfaces * @param classToSuperClass a map from classes to their super classes - * @return the {@linkplain ClassHierarchyResolver} */ static ClassHierarchyResolver of(Collection interfaces, - Map classToSuperClass) { + Map classToSuperClass) { return new StaticClassHierarchyResolver(interfaces, classToSuperClass); } /** - * Returns a ClassHierarchyResolver that extracts class hierarchy information via - * the Reflection API with a {@linkplain ClassLoader}. + * {@return a {@code ClassHierarchyResolver} that extracts class hierarchy + * information via classes loaded by a class loader with reflection} * * @param loader the class loader - * @return the class hierarchy resolver */ static ClassHierarchyResolver ofClassLoading(ClassLoader loader) { requireNonNull(loader); @@ -224,13 +243,13 @@ public Class apply(ClassDesc cd) { } /** - * Returns a ClassHierarchyResolver that extracts class hierarchy information via - * the Reflection API with a {@linkplain MethodHandles.Lookup Lookup}. If the class - * resolved is inaccessible to the given lookup, it throws {@link + * {@return a {@code ClassHierarchyResolver} that extracts class hierarchy + * information via classes accessible to a {@link MethodHandles.Lookup} + * with reflection} If the class resolved is inaccessible to the given + * lookup, {@link #getClassInfo(ClassDesc)} throws {@link * IllegalArgumentException} instead of returning {@code null}. * * @param lookup the lookup, must be able to access classes to resolve - * @return the class hierarchy resolver */ static ClassHierarchyResolver ofClassLoading(MethodHandles.Lookup lookup) { requireNonNull(lookup); diff --git a/src/java.base/share/classes/java/lang/classfile/ClassModel.java b/src/java.base/share/classes/java/lang/classfile/ClassModel.java index db804348cfe..2c547e6336d 100644 --- a/src/java.base/share/classes/java/lang/classfile/ClassModel.java +++ b/src/java.base/share/classes/java/lang/classfile/ClassModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,18 +25,41 @@ package java.lang.classfile; +import java.lang.classfile.attribute.BootstrapMethodsAttribute; +import java.lang.classfile.attribute.ModuleAttribute; import java.lang.classfile.constantpool.ClassEntry; import java.lang.classfile.constantpool.ConstantPool; +import java.lang.classfile.constantpool.ConstantPoolBuilder; +import java.lang.constant.ClassDesc; +import java.lang.reflect.AccessFlag; import java.util.List; import java.util.Optional; +import java.util.function.Consumer; import jdk.internal.classfile.impl.ClassImpl; /** - * Models a classfile. The contents of the classfile can be traversed via - * a streaming view, or via random access (e.g., - * {@link #flags()}), or by freely mixing the two. + * Models a {@code class} file. A {@code class} file can be viewed as a + * {@linkplain CompoundElement composition} of {@link ClassElement}s, or by + * random access via accessor methods if only specific parts of the {@code + * class} file is needed. + *

    + * Use {@link ClassFile#parse(byte[])}, which parses the binary data of a {@code + * class} file into a model, to obtain a {@code ClassModel}. + *

    + * To construct a {@code class} file, use {@link ClassFile#build(ClassDesc, + * Consumer)}. {@link ClassFile#transformClass(ClassModel, ClassTransform)} + * allows creating a new class by selectively processing the original class + * elements and directing the results to a class builder. + *

    + * A class holds attributes, most of which are accessible as member elements. + * {@link BootstrapMethodsAttribute} can only be accessed via {@linkplain + * AttributedElement explicit attribute reading}, as it is modeled as part of + * the {@linkplain #constantPool() constant pool}. * + * @see ClassFile#parse(byte[]) + * @see ClassTransform + * @jvms 4.1 The {@code ClassFile} Structure * @since 24 */ public sealed interface ClassModel @@ -45,19 +68,35 @@ public sealed interface ClassModel /** * {@return the constant pool for this class} + * + * @see ConstantPoolBuilder#of(ClassModel) */ ConstantPool constantPool(); - /** {@return the access flags} */ + /** + * {@return the access flags} + * + * @see AccessFlag.Location#CLASS + */ AccessFlags flags(); /** {@return the constant pool entry describing the name of this class} */ ClassEntry thisClass(); - /** {@return the major classfile version} */ + /** + * {@return the major version of this class} It is in the range of unsigned + * short, {@code [0, 65535]}. + * + * @see ClassFileVersion + */ int majorVersion(); - /** {@return the minor classfile version} */ + /** + * {@return the minor version of this class} It is in the range of unsigned + * short, {@code [0, 65535]}. + * + * @see ClassFileVersion + */ int minorVersion(); /** {@return the fields of this class} */ @@ -66,12 +105,28 @@ public sealed interface ClassModel /** {@return the methods of this class} */ List methods(); - /** {@return the superclass of this class, if there is one} */ + /** + * {@return the superclass of this class, if there is one} + * This {@code class} file may have no superclass if this represents a + * {@linkplain #isModuleInfo() module descriptor} or the {@link Object} + * class; otherwise, it must have a superclass. If this is an interface, + * the superclass must be {@link Object}. + * + * @see Superclass + */ Optional superclass(); - /** {@return the interfaces implemented by this class} */ + /** + * {@return the interfaces implemented by this class} + * + * @see Interfaces + */ List interfaces(); - /** {@return whether this class is a module descriptor} */ + /** + * {@return whether this {@code class} file is a module descriptor} + * + * @see ClassFile#buildModule(ModuleAttribute, Consumer) + */ boolean isModuleInfo(); } diff --git a/src/java.base/share/classes/java/lang/classfile/ClassTransform.java b/src/java.base/share/classes/java/lang/classfile/ClassTransform.java index 82b61a15089..c365b79f463 100644 --- a/src/java.base/share/classes/java/lang/classfile/ClassTransform.java +++ b/src/java.base/share/classes/java/lang/classfile/ClassTransform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -35,9 +35,12 @@ /** * A transformation on streams of {@link ClassElement}. + *

    + * Refer to {@link ClassFileTransform} for general guidance and caution around + * the use of transforms for structures in the {@code class} file format. * - * @see ClassFileTransform - * + * @see ClassModel + * @see ClassFile#transformClass(ClassModel, ClassTransform) * @since 24 */ @FunctionalInterface @@ -45,7 +48,7 @@ public non-sealed interface ClassTransform extends ClassFileTransform { /** - * A class transform that sends all elements to the builder. + * A class transform that passes all elements to the builder. */ static final ClassTransform ACCEPT_ALL = new ClassTransform() { @Override @@ -55,7 +58,7 @@ public void accept(ClassBuilder builder, ClassElement element) { }; /** - * Create a stateful class transform from a {@link Supplier}. The supplier + * Creates a stateful class transform from a {@link Supplier}. The supplier * will be invoked for each transformation. * * @param supplier a {@link Supplier} that produces a fresh transform object @@ -67,7 +70,7 @@ static ClassTransform ofStateful(Supplier supplier) { } /** - * Create a class transform that passes each element through to the builder, + * Creates a class transform that passes each element through to the builder, * and calls the specified function when transformation is complete. * * @param finisher the function to call when transformation is complete @@ -89,8 +92,8 @@ public void atEnd(ClassBuilder builder) { } /** - * Create a class transform that passes each element through to the builder, - * except for those that the supplied {@link Predicate} is true for. + * Creates a class transform that passes each element through to the builder, + * except for those that the supplied {@link Predicate} returns true for. * * @param filter the predicate that determines which elements to drop * @return the class transform @@ -104,8 +107,10 @@ static ClassTransform dropping(Predicate filter) { } /** - * Create a class transform that transforms {@link MethodModel} elements - * with the supplied method transform. + * Creates a class transform that transforms {@link MethodModel} elements + * with the supplied method transform for methods that the supplied {@link + * Predicate} returns true for, passing other elements through to the + * builder. * * @param filter a predicate that determines which methods to transform * @param xform the method transform @@ -117,8 +122,9 @@ static ClassTransform transformingMethods(Predicate filter, } /** - * Create a class transform that transforms {@link MethodModel} elements - * with the supplied method transform. + * Creates a class transform that transforms {@link MethodModel} elements + * with the supplied method transform, passing other elements through to the + * builder. * * @param xform the method transform * @return the class transform @@ -128,8 +134,10 @@ static ClassTransform transformingMethods(MethodTransform xform) { } /** - * Create a class transform that transforms the {@link CodeAttribute} (method body) - * of {@link MethodModel} elements with the supplied code transform. + * Creates a class transform that transforms the {@link CodeAttribute} (method body) + * of {@link MethodModel} elements with the supplied code transform for + * methods that the supplied {@link Predicate} returns true for, passing + * other elements through to the builder. * * @param filter a predicate that determines which methods to transform * @param xform the code transform @@ -141,8 +149,9 @@ static ClassTransform transformingMethodBodies(Predicate filter, } /** - * Create a class transform that transforms the {@link CodeAttribute} (method body) - * of {@link MethodModel} elements with the supplied code transform. + * Creates a class transform that transforms the {@link CodeAttribute} (method body) + * of {@link MethodModel} elements with the supplied code transform, passing + * other elements through to the builder. * * @param xform the code transform * @return the class transform @@ -152,8 +161,9 @@ static ClassTransform transformingMethodBodies(CodeTransform xform) { } /** - * Create a class transform that transforms {@link FieldModel} elements - * with the supplied field transform. + * Creates a class transform that transforms {@link FieldModel} elements + * with the supplied field transform, passing other elements through to the + * builder. * * @param xform the field transform * @return the class transform diff --git a/src/java.base/share/classes/java/lang/classfile/CodeBuilder.java b/src/java.base/share/classes/java/lang/classfile/CodeBuilder.java index 3cbcb893cb1..9eafaa2df9c 100644 --- a/src/java.base/share/classes/java/lang/classfile/CodeBuilder.java +++ b/src/java.base/share/classes/java/lang/classfile/CodeBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,6 +25,7 @@ package java.lang.classfile; +import java.lang.classfile.ClassFile.*; import java.lang.classfile.constantpool.*; import java.lang.classfile.instruction.*; import java.lang.constant.ClassDesc; @@ -44,12 +45,23 @@ import static jdk.internal.classfile.impl.BytecodeHelpers.handleDescToHandleInfo; /** - * A builder for code attributes (method bodies). Builders are not created - * directly; they are passed to handlers by methods such as {@link - * MethodBuilder#withCode(Consumer)} or to code transforms. The elements of a - * code can be specified abstractly, by passing a {@link CodeElement} to {@link - * #with(ClassFileElement)} or concretely by calling the various {@code withXxx} - * methods. + * A builder for {@link CodeModel Code} attributes (method bodies). {@link + * MethodBuilder#withCode} is the basic way to obtain a code builder; {@link + * ClassBuilder#withMethodBody} is a shortcut. There are also derived code + * builders from {@link #block}, which handles code blocks and {@link + * #transforming}, which runs transforms on existing handlers, both of which + * requires a code builder to be available first. + *

    + * Refer to {@link ClassFileBuilder} for general guidance and caution around + * the use of builders for structures in the {@code class} file format. Unlike + * in other builders, the order of member elements in a code builder is + * significant: they affect the resulting bytecode. Many Class-File API options + * affect code builders: {@link DeadCodeOption} and {@link ShortJumpsOption} + * affect the resulting bytecode, and {@link DeadLabelsOption}, {@link + * DebugElementsOption}, {@link LineNumbersOption}, {@link StackMapsOption}, and + * {@link AttributesProcessingOption} affect the resulting attributes on the + * built {@code Code} attribute, that some elements sent to a code builder is + * otherwise ignored. * *

    Instruction Factories

    * {@code CodeBuilder} provides convenience methods to create instructions (See @@ -60,52 +72,63 @@ * #aload aload}. Note that some constant instructions, such as {@link #iconst_1 * iconst_1}, do not have generic versions, and thus have their own factories. *
  • Instructions that accept wide operands, such as {@code ldc2_w} or {@code - * wide}, share their factories with their regular version like {@link #ldc}. Note - * that {@link #goto_w goto_w} has its own factory to avoid {@linkplain - * ClassFile.ShortJumpsOption short jumps}. + * wide}, share their factories with their regular version like {@link #ldc}. + * Note that {@link #goto_w goto_w} has its own factory to avoid {@linkplain + * ShortJumpsOption short jumps}. *
  • The {@code goto}, {@code instanceof}, {@code new}, and {@code return} * instructions' factories are named {@link #goto_ goto_}, {@link #instanceOf * instanceOf}, {@link #new_ new_}, and {@link #return_() return_} respectively, * due to clashes with keywords in the Java programming language. - *
  • Factories are not provided for instructions {@code jsr}, {@code jsr_w}, - * {@code ret}, and {@code wide ret}, which cannot appear in class files with - * major version {@value ClassFile#JAVA_7_VERSION} or higher. (JVMS {@jvms 4.9.1}) + *
  • Factories are not provided for instructions {@link Opcode#JSR jsr}, + * {@link Opcode#JSR_W jsr_w}, {@link Opcode#RET ret}, and {@link Opcode#RET_W + * wide ret}, which cannot appear in class files with major version {@value + * ClassFile#JAVA_7_VERSION} or higher. (JVMS {@jvms 4.9.1}) They can still be + * provided via {@link #with}. * * + * @see MethodBuilder#withCode + * @see CodeModel * @see CodeTransform - * * @since 24 */ public sealed interface CodeBuilder extends ClassFileBuilder permits CodeBuilder.BlockCodeBuilder, ChainedCodeBuilder, TerminalCodeBuilder, NonterminalCodeBuilder { - /** {@return a fresh unbound label} */ + /** + * {@return a fresh unbound label} + * The label can be bound with {@link #labelBinding}. + */ Label newLabel(); - /** {@return the label associated with the beginning of the current block} - * If the current {@linkplain CodeBuilder} is not a "block" builder, such as - * those provided by {@link #block(Consumer)} or {@link #ifThenElse(Consumer, Consumer)}, - * the current block will be the entire method body. */ + /** + * {@return the label associated with the beginning of the current block} + * If this builder is not a "block" builder, such as those provided by + * {@link #block(Consumer)} or {@link #ifThenElse(Consumer, Consumer)}, + * the current block will be the entire method body. + */ Label startLabel(); - /** {@return the label associated with the end of the current block} - * If the current {@linkplain CodeBuilder} is not a "block" builder, such as - * those provided by {@link #block(Consumer)} or {@link #ifThenElse(Consumer, Consumer)}, - * the current block will be the entire method body. */ + /** + * {@return the label associated with the end of the current block} + * If this builder is not a "block" builder, such as those provided by + * {@link #block(Consumer)} or {@link #ifThenElse(Consumer, Consumer)}, + * the current block will be the entire method body. + */ Label endLabel(); /** - * {@return the local variable slot associated with the receiver}. + * {@return the local variable slot associated with the receiver} * * @throws IllegalStateException if this is a static method */ int receiverSlot(); /** - * {@return the local variable slot associated with the specified parameter}. + * {@return the local variable slot associated with the specified parameter} * The returned value is adjusted for the receiver slot (if the method is - * an instance method) and for the requirement that {@code long} and {@code double} + * an instance method) and for the requirement that {@link TypeKind#LONG + * long} and {@link TypeKind#DOUBLE double} * values require two slots. * * @param paramNo the index of the parameter @@ -115,25 +138,28 @@ public sealed interface CodeBuilder /** * {@return the local variable slot of a fresh local variable} This method * makes reasonable efforts to determine which slots are in use and which - * are not. When transforming a method, fresh locals begin at the {@code maxLocals} - * of the original method. For a method being built directly, fresh locals - * begin after the last parameter slot. - * - *

    If the current code builder is a "block" code builder provided by - * {@link #block(Consumer)}, {@link #ifThen(Consumer)}, or - * {@link #ifThenElse(Consumer, Consumer)}, at the end of the block, locals - * are reset to their value at the beginning of the block. + * are not. When transforming a method, fresh locals begin at the {@code + * maxLocals} of the original method. For a method being built directly, + * fresh locals begin after the last parameter slot. + *

    + * If the current code builder is a {@link BlockCodeBuilder}, at the end of + * the block, locals are reset to their value at the beginning of the block. * * @param typeKind the type of the local variable */ int allocateLocal(TypeKind typeKind); /** - * Apply a transform to the code built by a handler, directing results to this builder. + * Apply a transform to the code built by a handler, directing results to + * this builder. + * + * @apiNote + * This is similar to {@link #transform}, but this does not require the + * code elements to be viewed as a {@link CodeModel} first. * * @param transform the transform to apply to the code built by the handler - * @param handler the handler that receives a {@linkplain CodeBuilder} to - * build the code. + * @param handler the handler that receives a {@link CodeBuilder} to + * build the code * @return this builder */ default CodeBuilder transforming(CodeTransform transform, Consumer handler) { @@ -145,32 +171,36 @@ default CodeBuilder transforming(CodeTransform transform, Consumer } /** - * A builder for blocks of code. + * A builder for blocks of code. Its {@link #startLabel()} and {@link + * #endLabel()} do not enclose the entire method body, but from the start to + * the end of the block. * * @since 24 */ sealed interface BlockCodeBuilder extends CodeBuilder permits BlockCodeBuilderImpl { /** - * {@return the label locating where control is passed back to the parent block.} - * A branch to this label "break"'s out of the current block. + * {@return the label locating where control is passed back to the + * parent block} A branch to this label "break"'s out of the current + * block. *

    - * If an instruction occurring immediately after the built block's last instruction would - * be reachable from that last instruction, then a {@linkplain #goto_ goto} instruction - * targeting the "break" label is appended to the built block. + * If the last instruction in this block does not lead to the break + * label, Class-File API may append instructions to target the "break" + * label to the built block. */ Label breakLabel(); } /** - * Add a lexical block to the method being built. + * Adds a lexical block to the method being built. *

    - * Within this block, the {@link #startLabel()} and {@link #endLabel()} correspond - * to the start and end of the block, and the {@link BlockCodeBuilder#breakLabel()} - * also corresponds to the end of the block. + * Within this block, the {@link #startLabel()} and {@link #endLabel()} + * correspond to the start and end of the block, and the {@link + * BlockCodeBuilder#breakLabel()} also corresponds to the end of the block, + * or the cursor position immediately after this call in this builder. * - * @param handler handler that receives a {@linkplain BlockCodeBuilder} to - * generate the body of the lexical block. + * @param handler handler that receives a {@link BlockCodeBuilder} to + * generate the body of the lexical block * @return this builder */ default CodeBuilder block(Consumer handler) { @@ -183,33 +213,37 @@ default CodeBuilder block(Consumer handler) { } /** - * Add an "if-then" block that is conditional on the boolean value - * on top of the operand stack. + * Adds an "if-then" block that is conditional on the {@link TypeKind#BOOLEAN + * boolean} value on top of the operand stack. Control flow enters the + * "then" block if the value represents {@code true}. *

    - * The {@link BlockCodeBuilder#breakLabel()} for the "then" block corresponds to the - * end of that block. + * The {@link BlockCodeBuilder#breakLabel()} for the "then" block corresponds + * to the cursor position immediately after this call in this builder. * - * @param thenHandler handler that receives a {@linkplain BlockCodeBuilder} to - * generate the body of the {@code if} + * @param thenHandler handler that receives a {@linkplain BlockCodeBuilder} + * to generate the body of the {@code if} * @return this builder + * @see #ifThen(Opcode, Consumer) */ default CodeBuilder ifThen(Consumer thenHandler) { return ifThen(Opcode.IFNE, thenHandler); } /** - * Add an "if-then" block that is conditional on the value(s) on top of the operand stack - * in accordance with the given opcode. + * Adds an "if-then" block that is conditional on the value(s) on top of the + * operand stack in accordance with the given opcode. Control flow enters + * the "then" block if the branching condition for {@code opcode} succeeds. *

    - * The {@link BlockCodeBuilder#breakLabel()} for the "then" block corresponds to the - * end of that block. + * The {@link BlockCodeBuilder#breakLabel()} for the "then" block corresponds + * to the cursor position immediately after this call in this builder. * - * @param opcode the operation code for a branch instructions that accepts one or two operands on the stack - * @param thenHandler handler that receives a {@linkplain BlockCodeBuilder} to + * @param opcode the operation code for a branch instruction that accepts + * one or two operands on the stack + * @param thenHandler handler that receives a {@link BlockCodeBuilder} to * generate the body of the {@code if} * @return this builder - * @throws IllegalArgumentException if the operation code is not for a branch instruction that accepts - * one or two operands + * @throws IllegalArgumentException if the operation code is not for a + * branch instruction that accepts one or two operands */ default CodeBuilder ifThen(Opcode opcode, Consumer thenHandler) { @@ -227,17 +261,20 @@ default CodeBuilder ifThen(Opcode opcode, } /** - * Add an "if-then-else" block that is conditional on the boolean value - * on top of the operand stack. + * Adds an "if-then-else" block that is conditional on the {@link + * TypeKind#BOOLEAN boolean} value on top of the operand stack. Control + * flow enters the "then" block if the value represents {@code true}, and + * enters the "else" block otherwise. *

    - * The {@link BlockCodeBuilder#breakLabel()} for each block corresponds to the - * end of the "else" block. + * The {@link BlockCodeBuilder#breakLabel()} for each block corresponds to + * the cursor position immediately after this call in this builder. * - * @param thenHandler handler that receives a {@linkplain BlockCodeBuilder} to + * @param thenHandler handler that receives a {@link BlockCodeBuilder} to * generate the body of the {@code if} - * @param elseHandler handler that receives a {@linkplain BlockCodeBuilder} to + * @param elseHandler handler that receives a {@link BlockCodeBuilder} to * generate the body of the {@code else} * @return this builder + * @see #ifThenElse(Opcode, Consumer, Consumer) */ default CodeBuilder ifThenElse(Consumer thenHandler, Consumer elseHandler) { @@ -245,20 +282,23 @@ default CodeBuilder ifThenElse(Consumer thenHandler, } /** - * Add an "if-then-else" block that is conditional on the value(s) on top of the operand stack - * in accordance with the given opcode. + * Adds an "if-then-else" block that is conditional on the value(s) on top + * of the operand stack in accordance with the given opcode. Control flow + * enters the "then" block if the branching condition for {@code opcode} + * succeeds, and enters the "else" block otherwise. *

    - * The {@link BlockCodeBuilder#breakLabel()} for each block corresponds to the - * end of the "else" block. + * The {@link BlockCodeBuilder#breakLabel()} for each block corresponds to + * the cursor position immediately after this call in this builder. * - * @param opcode the operation code for a branch instructions that accepts one or two operands on the stack - * @param thenHandler handler that receives a {@linkplain BlockCodeBuilder} to - * generate the body of the {@code if} - * @param elseHandler handler that receives a {@linkplain BlockCodeBuilder} to - * generate the body of the {@code else} + * @param opcode the operation code for a branch instruction that accepts + * one or two operands on the stack + * @param thenHandler handler that receives a {@linkplain BlockCodeBuilder} + * to generate the body of the {@code if} + * @param elseHandler handler that receives a {@linkplain BlockCodeBuilder} + * to generate the body of the {@code else} * @return this builder - * @throws IllegalArgumentException if the operation code is not for a branch instruction that accepts - * one or two operands + * @throws IllegalArgumentException if the operation code is not for a + * branch instruction that accepts one or two operands */ default CodeBuilder ifThenElse(Opcode opcode, Consumer thenHandler, @@ -286,23 +326,29 @@ default CodeBuilder ifThenElse(Opcode opcode, * A builder to add catch blocks. * * @see #trying - * + * @see ExceptionCatch * @since 24 */ sealed interface CatchBuilder permits CatchBuilderImpl { /** * Adds a catch block that catches an exception of the given type. *

    - * The caught exception will be on top of the operand stack when the catch block is entered. + * The caught exception will be on top of the operand stack when the + * catch block is entered. *

    - * If the type of exception is {@code null} then the catch block catches all exceptions. + * The {@link BlockCodeBuilder#breakLabel()} for the catch block corresponds + * to the break label of the {@code tryHandler} block in {@link #trying}. + *

    + * If the type of exception is {@code null} then the catch block catches + * all exceptions. * - * @param exceptionType the type of exception to catch. - * @param catchHandler handler that receives a {@linkplain CodeBuilder} to - * generate the body of the catch block. + * @param exceptionType the type of exception to catch, may be {@code null} + * @param catchHandler handler that receives a {@link BlockCodeBuilder} to + * generate the body of the catch block * @return this builder - * @throws IllegalArgumentException if an existing catch block catches an exception of the given type - * or {@code exceptionType} represents a primitive type + * @throws IllegalArgumentException if an existing catch block catches + * an exception of the given type or {@code exceptionType} + * represents a primitive type * @see #catchingMulti * @see #catchingAll */ @@ -311,15 +357,21 @@ sealed interface CatchBuilder permits CatchBuilderImpl { /** * Adds a catch block that catches exceptions of the given types. *

    - * The caught exception will be on top of the operand stack when the catch block is entered. + * The caught exception will be on top of the operand stack when the + * catch block is entered. + *

    + * The {@link BlockCodeBuilder#breakLabel()} for the catch block corresponds + * to the break label of the {@code tryHandler} block in {@link #trying}. *

    - * If the type of exception is {@code null} then the catch block catches all exceptions. + * If list of exception types is empty then the catch block catches all + * exceptions. * - * @param exceptionTypes the types of exception to catch. - * @param catchHandler handler that receives a {@linkplain CodeBuilder} to - * generate the body of the catch block. + * @param exceptionTypes the types of exception to catch + * @param catchHandler handler that receives a {@link BlockCodeBuilder} + * to generate the body of the catch block * @return this builder - * @throws IllegalArgumentException if an existing catch block catches one or more exceptions of the given types. + * @throws IllegalArgumentException if an existing catch block catches + * one or more exceptions of the given types * @see #catching * @see #catchingAll */ @@ -328,11 +380,16 @@ sealed interface CatchBuilder permits CatchBuilderImpl { /** * Adds a "catch" block that catches all exceptions. *

    - * The caught exception will be on top of the operand stack when the catch block is entered. + * The {@link BlockCodeBuilder#breakLabel()} for the catch block corresponds + * to the break label of the {@code tryHandler} block in {@link #trying}. + *

    + * The caught exception will be on top of the operand stack when the + * catch block is entered. * - * @param catchAllHandler handler that receives a {@linkplain CodeBuilder} to - * generate the body of the catch block - * @throws IllegalArgumentException if an existing catch block catches all exceptions. + * @param catchAllHandler handler that receives a {@link BlockCodeBuilder} + * to generate the body of the catch block + * @throws IllegalArgumentException if an existing catch block catches + * all exceptions * @see #catching * @see #catchingMulti */ @@ -340,16 +397,23 @@ sealed interface CatchBuilder permits CatchBuilderImpl { } /** - * Adds a "try-catch" block comprising one try block and zero or more catch blocks. - * Exceptions thrown by instructions in the try block may be caught by catch blocks. + * Adds a "try-catch" block comprising one try block and zero or more catch + * blocks. Exceptions thrown by instructions in the try block may be caught + * by catch blocks. + *

    + * The {@link BlockCodeBuilder#breakLabel()} for the try block and all + * catch blocks in the {@code catchesHandler} correspond to the cursor + * position immediately after this call in this builder. * - * @param tryHandler handler that receives a {@linkplain CodeBuilder} to + * @param tryHandler handler that receives a {@link BlockCodeBuilder} to * generate the body of the try block. - * @param catchesHandler a handler that receives a {@linkplain CatchBuilder} - * to generate bodies of catch blocks. + * @param catchesHandler a handler that receives a {@link CatchBuilder} + * to generate bodies of catch blocks * @return this builder - * @throws IllegalArgumentException if the try block is empty. + * @throws IllegalArgumentException if the try block is empty * @see CatchBuilder + * @see ExceptionCatch + * @see #exceptionCatch */ default CodeBuilder trying(Consumer tryHandler, Consumer catchesHandler) { @@ -375,93 +439,119 @@ default CodeBuilder trying(Consumer tryHandler, // Base convenience methods /** - * Generate an instruction to load a value from a local variable + * Generates an instruction to load a value from a local variable. + * * @param tk the load type * @param slot the local variable slot * @return this builder - * @throws IllegalArgumentException if {@code tk} is {@link TypeKind#VOID void} - * or {@code slot} is out of range + * @throws IllegalArgumentException if {@code tk} is {@link TypeKind#VOID + * void} or {@code slot} is out of range + * @see LoadInstruction */ default CodeBuilder loadLocal(TypeKind tk, int slot) { return with(LoadInstruction.of(tk, slot)); } /** - * Generate an instruction to store a value to a local variable + * Generates an instruction to store a value to a local variable. + * * @param tk the store type * @param slot the local variable slot * @return this builder - * @throws IllegalArgumentException if {@code tk} is {@link TypeKind#VOID void} - * or {@code slot} is out of range + * @throws IllegalArgumentException if {@code tk} is {@link TypeKind#VOID + * void} or {@code slot} is out of range + * @see StoreInstruction */ default CodeBuilder storeLocal(TypeKind tk, int slot) { return with(StoreInstruction.of(tk, slot)); } /** - * Generate a branch instruction - * @see Opcode.Kind#BRANCH + * Generates a branch instruction. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set, the + * opcode has {@linkplain Opcode#sizeIfFixed() size} 3, and {@code target} + * cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param op the branch opcode * @param target the branch target * @return this builder + * @throws IllegalArgumentException if {@code op} is not of {@link + * Opcode.Kind#BRANCH} + * @see BranchInstruction */ default CodeBuilder branch(Opcode op, Label target) { return with(BranchInstruction.of(op, target)); } /** - * Generate return instruction + * Generates a return instruction. + * * @param tk the return type * @return this builder + * @see ReturnInstruction */ default CodeBuilder return_(TypeKind tk) { return with(ReturnInstruction.of(tk)); } /** - * Generate an instruction to access a field - * @see Opcode.Kind#FIELD_ACCESS + * Generates an instruction to access a field. + * * @param opcode the field access opcode * @param ref the field reference * @return this builder + * @throws IllegalArgumentException if {@code opcode} is not of {@link + * Opcode.Kind#FIELD_ACCESS} + * @see FieldInstruction */ default CodeBuilder fieldAccess(Opcode opcode, FieldRefEntry ref) { return with(FieldInstruction.of(opcode, ref)); } /** - * Generate an instruction to access a field - * @see Opcode.Kind#FIELD_ACCESS + * Generates an instruction to access a field. + * * @param opcode the field access opcode * @param owner the class * @param name the field name * @param type the field type * @return this builder + * @throws IllegalArgumentException if {@code opcode} is not of {@link + * Opcode.Kind#FIELD_ACCESS}, or {@code owner} is primitive + * @see FieldInstruction */ default CodeBuilder fieldAccess(Opcode opcode, ClassDesc owner, String name, ClassDesc type) { return fieldAccess(opcode, constantPool().fieldRefEntry(owner, name, type)); } /** - * Generate an instruction to invoke a method or constructor - * @see Opcode.Kind#INVOKE + * Generates an instruction to invoke a method. + * * @param opcode the invoke opcode * @param ref the interface method or method reference * @return this builder + * @throws IllegalArgumentException if {@code opcode} is not of {@link + * Opcode.Kind#INVOKE} + * @see InvokeInstruction */ default CodeBuilder invoke(Opcode opcode, MemberRefEntry ref) { return with(InvokeInstruction.of(opcode, ref)); } /** - * Generate an instruction to invoke a method or constructor - * @see Opcode.Kind#INVOKE + * Generates an instruction to invoke a method. + * * @param opcode the invoke opcode * @param owner the class * @param name the method name * @param desc the method type - * @param isInterface the interface method invocation indication + * @param isInterface whether the owner class is an interface * @return this builder + * @throws IllegalArgumentException if {@code opcode} is not of {@link + * Opcode.Kind#INVOKE}, or {@code owner} is primitive + * @see InvokeInstruction */ default CodeBuilder invoke(Opcode opcode, ClassDesc owner, String name, MethodTypeDesc desc, boolean isInterface) { return invoke(opcode, @@ -470,9 +560,13 @@ default CodeBuilder invoke(Opcode opcode, ClassDesc owner, String name, MethodTy } /** - * Generate an instruction to load from an array + * Generates an instruction to load from an array. + * * @param tk the array element type * @return this builder + * @throws IllegalArgumentException if {@code tk} is {@link TypeKind#VOID + * void} + * @see ArrayLoadInstruction */ default CodeBuilder arrayLoad(TypeKind tk) { Opcode opcode = BytecodeHelpers.arrayLoadOpcode(tk); @@ -480,9 +574,13 @@ default CodeBuilder arrayLoad(TypeKind tk) { } /** - * Generate an instruction to store into an array + * Generates an instruction to store into an array. + * * @param tk the array element type * @return this builder + * @throws IllegalArgumentException if {@code tk} is {@link TypeKind#VOID + * void} + * @see ArrayStoreInstruction */ default CodeBuilder arrayStore(TypeKind tk) { Opcode opcode = BytecodeHelpers.arrayStoreOpcode(tk); @@ -490,12 +588,14 @@ default CodeBuilder arrayStore(TypeKind tk) { } /** - * Generate instruction(s) to convert {@code fromType} to {@code toType} + * Generates instruction(s) to convert {@code fromType} to {@code toType}. + * * @param fromType the source type * @param toType the target type * @return this builder - * @throws IllegalArgumentException for conversions of {@link TypeKind#VOID void} or - * {@link TypeKind#REFERENCE reference} + * @throws IllegalArgumentException for conversions of {@link TypeKind#VOID + * void} or {@link TypeKind#REFERENCE reference} + * @see ConvertInstruction */ default CodeBuilder conversion(TypeKind fromType, TypeKind toType) { var computationalFrom = fromType.asLoadable(); @@ -548,9 +648,11 @@ default CodeBuilder conversion(TypeKind fromType, TypeKind toType) { } /** - * Generate an instruction pushing a constant onto the operand stack - * @param value the constant value + * Generates an instruction pushing a constant onto the operand stack. + * + * @param value the constant value, may be {@code null} * @return this builder + * @see ConstantInstruction */ default CodeBuilder loadConstant(ConstantDesc value) { //avoid switch expressions here @@ -567,11 +669,13 @@ default CodeBuilder loadConstant(ConstantDesc value) { /** - * Generate an instruction pushing a constant int value onto the operand stack. - * This is identical to {@link #loadConstant(ConstantDesc) loadConstant(Integer.valueOf(value))}. + * Generates an instruction pushing a constant {@link TypeKind#INT int} + * value onto the operand stack. This is equivalent to {@link + * #loadConstant(ConstantDesc) loadConstant(Integer.valueOf(value))}. + * * @param value the int value * @return this builder - * @since 24 + * @see ConstantInstruction */ default CodeBuilder loadConstant(int value) { return switch (value) { @@ -589,11 +693,13 @@ default CodeBuilder loadConstant(int value) { } /** - * Generate an instruction pushing a constant long value onto the operand stack. - * This is identical to {@link #loadConstant(ConstantDesc) loadConstant(Long.valueOf(value))}. + * Generates an instruction pushing a constant {@link TypeKind#LONG long} + * value onto the operand stack. This is equivalent to {@link + * #loadConstant(ConstantDesc) loadConstant(Long.valueOf(value))}. + * * @param value the long value * @return this builder - * @since 24 + * @see ConstantInstruction */ default CodeBuilder loadConstant(long value) { return value == 0l ? lconst_0() @@ -602,11 +708,16 @@ default CodeBuilder loadConstant(long value) { } /** - * Generate an instruction pushing a constant float value onto the operand stack. - * This is identical to {@link #loadConstant(ConstantDesc) loadConstant(Float.valueOf(value))}. + * Generates an instruction pushing a constant {@link TypeKind#FLOAT float} + * value onto the operand stack. This is equivalent to {@link + * #loadConstant(ConstantDesc) loadConstant(Float.valueOf(value))}. + *

    + * All NaN values of the {@code float} may or may not be collapsed + * into a single {@linkplain Float#NaN "canonical" NaN value}. + * * @param value the float value * @return this builder - * @since 24 + * @see ConstantInstruction */ default CodeBuilder loadConstant(float value) { return Float.floatToRawIntBits(value) == 0 ? fconst_0() @@ -616,11 +727,16 @@ default CodeBuilder loadConstant(float value) { } /** - * Generate an instruction pushing a constant double value onto the operand stack. - * This is identical to {@link #loadConstant(ConstantDesc) loadConstant(Double.valueOf(value))}. + * Generates an instruction pushing a constant {@link TypeKind#DOUBLE double} + * value onto the operand stack. This is equivalent to {@link + * #loadConstant(ConstantDesc) loadConstant(Double.valueOf(value))}. + *

    + * All NaN values of the {@code double} may or may not be collapsed + * into a single {@linkplain Double#NaN "canonical" NaN value}. + * * @param value the double value * @return this builder - * @since 24 + * @see ConstantInstruction */ default CodeBuilder loadConstant(double value) { return Double.doubleToRawLongBits(value) == 0l ? dconst_0() @@ -629,8 +745,10 @@ default CodeBuilder loadConstant(double value) { } /** - * Generate a do nothing instruction + * Generates a do-nothing instruction. + * * @return this builder + * @see NopInstruction */ default CodeBuilder nop() { return with(NopInstruction.of()); @@ -639,8 +757,11 @@ default CodeBuilder nop() { // Base pseudo-instruction builder methods /** - * Create new label bound with current position + * Creates a new label bound at the current position. + * * @return this builder + * @see #newLabel() + * @see #labelBinding */ default Label newBoundLabel() { var label = newLabel(); @@ -649,54 +770,86 @@ default Label newBoundLabel() { } /** - * Bind label with current position + * Binds a label to the current position. + * + * @apiNote + * The label to bind does not have to be {@linkplain #newLabel() from this + * builder}; it can be from another parsed {@link CodeModel}. + * * @param label the label * @return this builder + * @see LabelTarget */ default CodeBuilder labelBinding(Label label) { return with((LabelImpl) label); } /** - * Declare a source line number of the current builder position + * Declares a source line number beginning at the current position. + *

    + * This call may be ignored according to {@link ClassFile.LineNumbersOption}. + * * @param line the line number * @return this builder + * @see LineNumber */ default CodeBuilder lineNumber(int line) { return with(LineNumber.of(line)); } /** - * Declare an exception table entry + * Declares an exception table entry. + *

    + * This call may be ignored if any of the argument labels is not {@linkplain + * #labelBinding bound} and {@link ClassFile.DeadLabelsOption#DROP_DEAD_LABELS} + * is set. + * * @param start the try block start * @param end the try block end * @param handler the exception handler start - * @param catchType the catch type or null to catch all exceptions and errors + * @param catchType the catch type, may be {@code null} to catch all exceptions and errors * @return this builder + * @see ExceptionCatch + * @see CodeBuilder#trying */ default CodeBuilder exceptionCatch(Label start, Label end, Label handler, ClassEntry catchType) { return with(ExceptionCatch.of(handler, start, end, Optional.ofNullable(catchType))); } /** - * Declare an exception table entry + * Declares an exception table entry. + *

    + * This call may be ignored if any of the argument labels is not {@linkplain + * #labelBinding bound} and {@link ClassFile.DeadLabelsOption#DROP_DEAD_LABELS} + * is set. + * * @param start the try block start * @param end the try block end * @param handler the exception handler start * @param catchType the optional catch type, empty to catch all exceptions and errors * @return this builder + * @see ExceptionCatch + * @see CodeBuilder#trying */ default CodeBuilder exceptionCatch(Label start, Label end, Label handler, Optional catchType) { return with(ExceptionCatch.of(handler, start, end, catchType)); } /** - * Declare an exception table entry + * Declares an exception table entry. + *

    + * This call may be ignored if any of the argument labels is not {@linkplain + * #labelBinding bound} and {@link ClassFile.DeadLabelsOption#DROP_DEAD_LABELS} + * is set. + * * @param start the try block start * @param end the try block end * @param handler the exception handler start * @param catchType the catch type * @return this builder + * @throws IllegalArgumentException if {@code catchType} is primitive + * @see ExceptionCatch + * @see CodeBuilder#trying */ default CodeBuilder exceptionCatch(Label start, Label end, Label handler, ClassDesc catchType) { requireNonNull(catchType); @@ -704,31 +857,49 @@ default CodeBuilder exceptionCatch(Label start, Label end, Label handler, ClassD } /** - * Declare an exception table entry catching all exceptions and errors + * Declares an exception table entry catching all exceptions and errors. + *

    + * This call may be ignored if any of the argument labels is not {@linkplain + * #labelBinding bound} and {@link ClassFile.DeadLabelsOption#DROP_DEAD_LABELS} + * is set. + * * @param start the try block start * @param end the try block end * @param handler the exception handler start * @return this builder + * @see ExceptionCatch + * @see CodeBuilder#trying */ default CodeBuilder exceptionCatchAll(Label start, Label end, Label handler) { return with(ExceptionCatch.of(handler, start, end)); } /** - * Declare a character range entry + * Declares a character range entry. + *

    + * This call may be ignored if {@link ClassFile.DebugElementsOption#DROP_DEBUG} + * is set, or if any of the argument labels is not {@linkplain #labelBinding + * bound} and {@link ClassFile.DeadLabelsOption#DROP_DEAD_LABELS} is set. + * * @param startScope the start scope of the character range * @param endScope the end scope of the character range * @param characterRangeStart the encoded start of the character range region (inclusive) * @param characterRangeEnd the encoded end of the character range region (exclusive) * @param flags the flags word, indicating the kind of range * @return this builder + * @see CharacterRange */ default CodeBuilder characterRange(Label startScope, Label endScope, int characterRangeStart, int characterRangeEnd, int flags) { return with(CharacterRange.of(startScope, endScope, characterRangeStart, characterRangeEnd, flags)); } /** - * Declare a local variable entry + * Declares a local variable entry. + *

    + * This call may be ignored if {@link ClassFile.DebugElementsOption#DROP_DEBUG} + * is set, or if any of the argument labels is not {@linkplain #labelBinding + * bound} and {@link ClassFile.DeadLabelsOption#DROP_DEAD_LABELS} is set. + * * @param slot the local variable slot * @param nameEntry the variable name * @param descriptorEntry the variable descriptor @@ -736,13 +907,19 @@ default CodeBuilder characterRange(Label startScope, Label endScope, int charact * @param endScope the end scope of the variable * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see LocalVariable */ default CodeBuilder localVariable(int slot, Utf8Entry nameEntry, Utf8Entry descriptorEntry, Label startScope, Label endScope) { return with(LocalVariable.of(slot, nameEntry, descriptorEntry, startScope, endScope)); } /** - * Declare a local variable entry + * Declares a local variable entry. + *

    + * This call may be ignored if {@link ClassFile.DebugElementsOption#DROP_DEBUG} + * is set, or if any of the argument labels is not {@linkplain #labelBinding + * bound} and {@link ClassFile.DeadLabelsOption#DROP_DEAD_LABELS} is set. + * * @param slot the local variable slot * @param name the variable name * @param descriptor the variable descriptor @@ -750,6 +927,7 @@ default CodeBuilder localVariable(int slot, Utf8Entry nameEntry, Utf8Entry descr * @param endScope the end scope of the variable * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see LocalVariable */ default CodeBuilder localVariable(int slot, String name, ClassDesc descriptor, Label startScope, Label endScope) { return localVariable(slot, @@ -759,7 +937,17 @@ default CodeBuilder localVariable(int slot, String name, ClassDesc descriptor, L } /** - * Declare a local variable type entry + * Declares a local variable type entry. + *

    + * This call may be ignored if {@link ClassFile.DebugElementsOption#DROP_DEBUG} + * is set, or if any of the argument labels is not {@linkplain #labelBinding + * bound} and {@link ClassFile.DeadLabelsOption#DROP_DEAD_LABELS} is set. + * + * @apiNote + * When a local variable type entry is declared, a local variable entry with + * the descriptor derived from erasure (JLS {@jls 4.6}) of the signature + * should be declared as well. + * * @param slot the local variable slot * @param nameEntry the variable name * @param signatureEntry the variable signature @@ -767,13 +955,24 @@ default CodeBuilder localVariable(int slot, String name, ClassDesc descriptor, L * @param endScope the end scope of the variable * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see LocalVariableType */ default CodeBuilder localVariableType(int slot, Utf8Entry nameEntry, Utf8Entry signatureEntry, Label startScope, Label endScope) { return with(LocalVariableType.of(slot, nameEntry, signatureEntry, startScope, endScope)); } /** - * Declare a local variable type entry + * Declares a local variable type entry. + *

    + * This call may be ignored if {@link ClassFile.DebugElementsOption#DROP_DEBUG} + * is set, or if any of the argument labels is not {@linkplain #labelBinding + * bound} and {@link ClassFile.DeadLabelsOption#DROP_DEAD_LABELS} is set. + * + * @apiNote + * When a local variable type entry is declared, a local variable entry with + * the descriptor derived from erasure (JLS {@jls 4.6}) of the signature + * should be declared as well. + * * @param slot the local variable slot * @param name the variable name * @param signature the variable signature @@ -781,6 +980,7 @@ default CodeBuilder localVariableType(int slot, Utf8Entry nameEntry, Utf8Entry s * @param endScope the end scope of the variable * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see LocalVariableType */ default CodeBuilder localVariableType(int slot, String name, Signature signature, Label startScope, Label endScope) { return localVariableType(slot, @@ -792,971 +992,1491 @@ default CodeBuilder localVariableType(int slot, String name, Signature signature // Bytecode conveniences /** - * Generate an instruction pushing the null object reference onto the operand stack + * Generates an instruction pushing the null object {@link TypeKind#REFERENCE + * reference} onto the operand stack. + * * @return this builder + * @see Opcode#ACONST_NULL + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder aconst_null() { return with(ConstantInstruction.ofIntrinsic(Opcode.ACONST_NULL)); } /** - * Generate an instruction to load a reference from an array + * Generates an instruction to load from a {@link TypeKind#REFERENCE + * reference} array. + * * @return this builder + * @see Opcode#AALOAD + * @see #arrayLoad(TypeKind) + * @see ArrayLoadInstruction */ default CodeBuilder aaload() { return arrayLoad(TypeKind.REFERENCE); } /** - * Generate an instruction to store into a reference array + * Generates an instruction to store into a {@link TypeKind#REFERENCE + * reference} array. + * * @return this builder + * @see Opcode#AASTORE + * @see #arrayStore(TypeKind) + * @see ArrayStoreInstruction */ default CodeBuilder aastore() { return arrayStore(TypeKind.REFERENCE); } /** - * Generate an instruction to load a reference from a local variable - * - *

    This may also generate {@code aload_} and - * {@code wide aload} instructions. + * Generates an instruction to load a {@link TypeKind#REFERENCE reference} + * from a local variable. + *

    + * This may also generate {@link Opcode#ALOAD_0 aload_<N>} and {@link + * Opcode#ALOAD_W wide aload} instructions. * * @param slot the local variable slot * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see Opcode#ALOAD + * @see #loadLocal + * @see LoadInstruction */ default CodeBuilder aload(int slot) { return loadLocal(TypeKind.REFERENCE, slot); } /** - * Generate an instruction to create a new array of reference + * Generates an instruction to create a new array of {@link TypeKind#REFERENCE + * reference}. + * * @param classEntry the component type * @return this builder + * @see Opcode#ANEWARRAY + * @see NewReferenceArrayInstruction */ default CodeBuilder anewarray(ClassEntry classEntry) { return with(NewReferenceArrayInstruction.of(classEntry)); } /** - * Generate an instruction to create a new array of reference + * Generates an instruction to create a new array of {@link TypeKind#REFERENCE + * reference}. + * * @param className the component type * @return this builder * @throws IllegalArgumentException if {@code className} represents a primitive type + * @see Opcode#ANEWARRAY + * @see NewReferenceArrayInstruction */ default CodeBuilder anewarray(ClassDesc className) { return anewarray(constantPool().classEntry(className)); } /** - * Generate an instruction to return a reference from the method + * Generates an instruction to return a {@link TypeKind#REFERENCE reference} + * from this method. + * * @return this builder + * @see Opcode#ARETURN + * @see #return_(TypeKind) + * @see ReturnInstruction */ default CodeBuilder areturn() { return return_(TypeKind.REFERENCE); } /** - * Generate an instruction to get length of an array + * Generates an instruction to get the length of an array. + * * @return this builder + * @see Opcode#ARRAYLENGTH + * @see OperatorInstruction */ default CodeBuilder arraylength() { return with(OperatorInstruction.of(Opcode.ARRAYLENGTH)); } /** - * Generate an instruction to store a reference into a local variable - * - *

    This may also generate {@code astore_} and - * {@code wide astore} instructions. + * Generates an instruction to store a {@link TypeKind#REFERENCE reference} + * into a local variable. Such an instruction can also store a {@link + * TypeKind##returnAddress returnAddress}. + *

    + * This may also generate {@link Opcode#ASTORE_0 astore_<N>} and + * {@link Opcode#ASTORE_W wide astore} instructions. * * @param slot the local variable slot * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see Opcode#ASTORE + * @see #storeLocal + * @see StoreInstruction */ default CodeBuilder astore(int slot) { return storeLocal(TypeKind.REFERENCE, slot); } /** - * Generate an instruction to throw an exception or error + * Generates an instruction to throw an exception or error. + * * @return this builder + * @see Opcode#ATHROW + * @see ThrowInstruction */ default CodeBuilder athrow() { return with(ThrowInstruction.of()); } /** - * Generate an instruction to load a byte from a array + * Generates an instruction to load from a {@link TypeKind#BYTE byte} or + * {@link TypeKind#BOOLEAN boolean} array. + * * @return this builder + * @see Opcode#BALOAD + * @see #arrayLoad(TypeKind) + * @see ArrayLoadInstruction */ default CodeBuilder baload() { return arrayLoad(TypeKind.BYTE); } /** - * Generate an instruction to store into a byte array + * Generates an instruction to store into a {@link TypeKind#BYTE byte} or + * {@link TypeKind#BOOLEAN boolean} array. + * * @return this builder + * @see Opcode#BASTORE + * @see #arrayStore(TypeKind) + * @see ArrayStoreInstruction */ default CodeBuilder bastore() { return arrayStore(TypeKind.BYTE); } /** - * Generate an instruction pushing an int in the range of byte onto the operand stack. + * Generates an instruction pushing an {@link TypeKind#INT int} in the range + * of {@link TypeKind#BYTE byte} ({@code [-128, 127]}) onto the operand + * stack. + * * @param b the int in the range of byte * @return this builder * @throws IllegalArgumentException if {@code b} is out of range of byte + * @see Opcode#BIPUSH + * @see #loadConstant(int) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder bipush(int b) { return with(ConstantInstruction.ofArgument(Opcode.BIPUSH, b)); } /** - * Generate an instruction to load a char from an array + * Generates an instruction to load from a {@link TypeKind#CHAR char} array. + * * @return this builder + * @see Opcode#CALOAD + * @see #arrayLoad(TypeKind) + * @see ArrayLoadInstruction */ default CodeBuilder caload() { return arrayLoad(TypeKind.CHAR); } /** - * Generate an instruction to store into a char array + * Generates an instruction to store into a {@link TypeKind#CHAR char} array. + * * @return this builder + * @see Opcode#CASTORE + * @see #arrayStore(TypeKind) + * @see ArrayStoreInstruction */ default CodeBuilder castore() { return arrayStore(TypeKind.CHAR); } /** - * Generate an instruction to check whether an object is of the given type + * Generates an instruction to check whether an object is of the given type, + * throwing a {@link ClassCastException} if the check fails. + * * @param type the object type * @return this builder + * @see Opcode#CHECKCAST + * @see TypeCheckInstruction */ default CodeBuilder checkcast(ClassEntry type) { return with(TypeCheckInstruction.of(Opcode.CHECKCAST, type)); } /** - * Generate an instruction to check whether an object is of the given type + * Generates an instruction to check whether an object is of the given type, + * throwing a {@link ClassCastException} if the check fails. + * * @param type the object type * @return this builder * @throws IllegalArgumentException if {@code type} represents a primitive type + * @see Opcode#CHECKCAST + * @see TypeCheckInstruction */ default CodeBuilder checkcast(ClassDesc type) { return checkcast(constantPool().classEntry(type)); } /** - * Generate an instruction to convert a double into a float + * Generates an instruction to convert a {@link TypeKind#DOUBLE double} into + * a {@link TypeKind#FLOAT float}. + * * @return this builder + * @see Opcode#D2F + * @see ConvertInstruction */ default CodeBuilder d2f() { return with(ConvertInstruction.of(Opcode.D2F)); } /** - * Generate an instruction to convert a double into an int + * Generates an instruction to convert a {@link TypeKind#DOUBLE double} into + * an {@link TypeKind#INT int}. + * * @return this builder + * @see Opcode#D2I + * @see ConvertInstruction */ default CodeBuilder d2i() { return with(ConvertInstruction.of(Opcode.D2I)); } /** - * Generate an instruction to convert a double into a long + * Generates an instruction to convert a {@link TypeKind#DOUBLE double} into + * a {@link TypeKind#LONG long}. + * * @return this builder + * @see Opcode#D2L + * @see ConvertInstruction */ default CodeBuilder d2l() { return with(ConvertInstruction.of(Opcode.D2L)); } /** - * Generate an instruction to add a double + * Generates an instruction to add two {@link TypeKind#DOUBLE doubles}. + * * @return this builder + * @see Opcode#DADD + * @see OperatorInstruction */ default CodeBuilder dadd() { return with(OperatorInstruction.of(Opcode.DADD)); } /** - * Generate an instruction to load a double from an array + * Generates an instruction to load from a {@link TypeKind#DOUBLE double} + * array. + * * @return this builder + * @see Opcode#DALOAD + * @see #arrayLoad(TypeKind) + * @see ArrayLoadInstruction */ default CodeBuilder daload() { return arrayLoad(TypeKind.DOUBLE); } /** - * Generate an instruction to store into a double array + * Generates an instruction to store into a {@link TypeKind#DOUBLE double} + * array. + * * @return this builder + * @see Opcode#DASTORE + * @see #arrayStore(TypeKind) + * @see ArrayStoreInstruction */ default CodeBuilder dastore() { return arrayStore(TypeKind.DOUBLE); } /** - * Generate an instruction to add a double + * Generates an instruction to compare two {@link TypeKind#DOUBLE doubles}, + * producing {@code 1} if any operand is {@link Double#isNaN(double) NaN}. + * * @return this builder + * @see Opcode#DCMPG + * @see OperatorInstruction */ default CodeBuilder dcmpg() { return with(OperatorInstruction.of(Opcode.DCMPG)); } /** - * Generate an instruction to compare doubles + * Generates an instruction to compare two {@link TypeKind#DOUBLE doubles}, + * producing {@code -1} if any operand is {@link Double#isNaN(double) NaN}. + * * @return this builder + * @see Opcode#DCMPL + * @see OperatorInstruction */ default CodeBuilder dcmpl() { return with(OperatorInstruction.of(Opcode.DCMPL)); } /** - * Generate an instruction pushing double constant 0 onto the operand stack + * Generates an instruction pushing {@link TypeKind#DOUBLE double} constant + * 0 onto the operand stack. + * * @return this builder + * @see Opcode#DCONST_0 + * @see #loadConstant(double) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder dconst_0() { return with(ConstantInstruction.ofIntrinsic(Opcode.DCONST_0)); } /** - * Generate an instruction pushing double constant 1 onto the operand stack + * Generates an instruction pushing {@link TypeKind#DOUBLE double} constant + * 1 onto the operand stack. + * * @return this builder + * @see Opcode#DCONST_1 + * @see #loadConstant(double) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder dconst_1() { return with(ConstantInstruction.ofIntrinsic(Opcode.DCONST_1)); } /** - * Generate an instruction to divide doubles + * Generates an instruction to divide {@link TypeKind#DOUBLE doubles}. + * * @return this builder + * @see Opcode#DDIV + * @see OperatorInstruction */ default CodeBuilder ddiv() { return with(OperatorInstruction.of(Opcode.DDIV)); } /** - * Generate an instruction to load a double from a local variable - * - *

    This may also generate {@code dload_} and - * {@code wide dload} instructions. + * Generates an instruction to load a {@link TypeKind#DOUBLE double} from a + * local variable. + *

    + * This may also generate {@link Opcode#DLOAD_0 dload_<N>} and {@link + * Opcode#DLOAD_W wide dload} instructions. * * @param slot the local variable slot * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see Opcode#DLOAD + * @see #loadLocal(TypeKind, int) + * @see LoadInstruction */ default CodeBuilder dload(int slot) { return loadLocal(TypeKind.DOUBLE, slot); } /** - * Generate an instruction to multiply doubles + * Generates an instruction to multiply {@link TypeKind#DOUBLE doubles}. + * * @return this builder + * @see Opcode#DMUL + * @see OperatorInstruction */ default CodeBuilder dmul() { return with(OperatorInstruction.of(Opcode.DMUL)); } /** - * Generate an instruction to negate a double + * Generates an instruction to negate a {@link TypeKind#DOUBLE double}. + * * @return this builder + * @see Opcode#DNEG + * @see OperatorInstruction */ default CodeBuilder dneg() { return with(OperatorInstruction.of(Opcode.DNEG)); } /** - * Generate an instruction to calculate double remainder + * Generates an instruction to calculate {@link TypeKind#DOUBLE double} + * remainder. + * * @return this builder + * @see Opcode#DREM + * @see OperatorInstruction */ default CodeBuilder drem() { return with(OperatorInstruction.of(Opcode.DREM)); } /** - * Generate an instruction to return a double from the method + * Generates an instruction to return a {@link TypeKind#DOUBLE double} from + * this method. + * * @return this builder + * @see Opcode#DRETURN + * @see #return_(TypeKind) + * @see ReturnInstruction */ default CodeBuilder dreturn() { return return_(TypeKind.DOUBLE); } /** - * Generate an instruction to store a double into a local variable - * - *

    This may also generate {@code dstore_} and - * {@code wide dstore} instructions. + * Generates an instruction to store a {@link TypeKind#DOUBLE double} into a + * local variable. + *

    + * This may also generate {@link Opcode#DSTORE_0 dstore_<N>} and + * {@link Opcode#DSTORE_W wide dstore} instructions. * * @param slot the local variable slot * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see Opcode#DSTORE + * @see #storeLocal(TypeKind, int) + * @see StoreInstruction */ default CodeBuilder dstore(int slot) { return storeLocal(TypeKind.DOUBLE, slot); } /** - * Generate an instruction to subtract doubles + * Generates an instruction to subtract {@link TypeKind#DOUBLE doubles}. + * * @return this builder + * @see Opcode#DSUB + * @see OperatorInstruction */ default CodeBuilder dsub() { return with(OperatorInstruction.of(Opcode.DSUB)); } /** - * Generate an instruction to duplicate the top operand stack value + * Generates an instruction to duplicate the top operand stack value. + * * @return this builder + * @see Opcode#DUP + * @see StackInstruction */ default CodeBuilder dup() { return with(StackInstruction.of(Opcode.DUP)); } /** - * Generate an instruction to duplicate the top one or two operand stack value + * Generates an instruction to duplicate the top one or two operand stack + * value. + * * @return this builder + * @see Opcode#DUP2 + * @see StackInstruction */ default CodeBuilder dup2() { return with(StackInstruction.of(Opcode.DUP2)); } /** - * Generate an instruction to duplicate the top one or two operand stack values and insert two or three - * values down + * Generates an instruction to duplicate the top one or two operand stack + * values and insert two or three values down. + * * @return this builder + * @see Opcode#DUP2_X1 + * @see StackInstruction */ default CodeBuilder dup2_x1() { return with(StackInstruction.of(Opcode.DUP2_X1)); } /** - * Generate an instruction to duplicate the top one or two operand stack values and insert two, three, - * or four values down + * Generates an instruction to duplicate the top one or two operand stack + * values and insert two, three, or four values down. + * * @return this builder + * @see Opcode#DUP2_X2 + * @see StackInstruction */ default CodeBuilder dup2_x2() { return with(StackInstruction.of(Opcode.DUP2_X2)); } /** - * Generate an instruction to duplicate the top operand stack value and insert two values down + * Generates an instruction to duplicate the top operand stack value and + * insert two values down. + * * @return this builder + * @see Opcode#DUP_X1 + * @see StackInstruction */ default CodeBuilder dup_x1() { return with(StackInstruction.of(Opcode.DUP_X1)); } /** - * Generate an instruction to duplicate the top operand stack value and insert two or three values down + * Generates an instruction to duplicate the top operand stack value and + * insert two or three values down. + * * @return this builder + * @see Opcode#DUP_X2 + * @see StackInstruction */ default CodeBuilder dup_x2() { return with(StackInstruction.of(Opcode.DUP_X2)); } /** - * Generate an instruction to convert a float into a double + * Generates an instruction to convert a {@link TypeKind#FLOAT float} into a + * {@link TypeKind#DOUBLE double}. + * * @return this builder + * @see Opcode#F2D + * @see ConvertInstruction */ default CodeBuilder f2d() { return with(ConvertInstruction.of(Opcode.F2D)); } /** - * Generate an instruction to convert a float into an int + * Generates an instruction to convert a {@link TypeKind#FLOAT float} into + * an {@link TypeKind#INT int}. + * * @return this builder + * @see Opcode#F2I + * @see ConvertInstruction */ default CodeBuilder f2i() { return with(ConvertInstruction.of(Opcode.F2I)); } /** - * Generate an instruction to convert a float into a long + * Generates an instruction to convert a {@link TypeKind#FLOAT float} into a + * {@link TypeKind#LONG long}. + * * @return this builder + * @see Opcode#F2L + * @see ConvertInstruction */ default CodeBuilder f2l() { return with(ConvertInstruction.of(Opcode.F2L)); } /** - * Generate an instruction to add a float + * Generates an instruction to add two {@link TypeKind#FLOAT floats}. + * * @return this builder + * @see Opcode#FADD + * @see OperatorInstruction */ default CodeBuilder fadd() { return with(OperatorInstruction.of(Opcode.FADD)); } /** - * Generate an instruction to load a float from an array + * Generates an instruction to load from a {@link TypeKind#FLOAT float} + * array. + * * @return this builder + * @see Opcode#FALOAD + * @see #arrayLoad(TypeKind) + * @see ArrayLoadInstruction */ default CodeBuilder faload() { return arrayLoad(TypeKind.FLOAT); } /** - * Generate an instruction to store into a float array + * Generates an instruction to store into a {@link TypeKind#FLOAT float} + * array. + * * @return this builder + * @see Opcode#FASTORE + * @see #arrayStore(TypeKind) + * @see ArrayStoreInstruction */ default CodeBuilder fastore() { return arrayStore(TypeKind.FLOAT); } /** - * Generate an instruction to compare floats + * Generates an instruction to compare {@link TypeKind#FLOAT floats}, + * producing {@code 1} if any operand is {@link Float#isNaN(float) NaN}. + * * @return this builder + * @see Opcode#FCMPG + * @see OperatorInstruction */ default CodeBuilder fcmpg() { return with(OperatorInstruction.of(Opcode.FCMPG)); } /** - * Generate an instruction to compare floats + * Generates an instruction to compare {@link TypeKind#FLOAT floats}, + * producing {@code -1} if any operand is {@link Float#isNaN(float) NaN}. + * * @return this builder + * @see Opcode#FCMPL + * @see OperatorInstruction */ default CodeBuilder fcmpl() { return with(OperatorInstruction.of(Opcode.FCMPL)); } /** - * Generate an instruction pushing float constant 0 onto the operand stack + * Generates an instruction pushing {@link TypeKind#FLOAT float} constant 0 + * onto the operand stack. + * * @return this builder + * @see Opcode#FCONST_0 + * @see #loadConstant(float) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder fconst_0() { return with(ConstantInstruction.ofIntrinsic(Opcode.FCONST_0)); } /** - * Generate an instruction pushing float constant 1 onto the operand stack + * Generates an instruction pushing {@link TypeKind#FLOAT float} constant 1 + * onto the operand stack. + * * @return this builder + * @see Opcode#FCONST_1 + * @see #loadConstant(float) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder fconst_1() { return with(ConstantInstruction.ofIntrinsic(Opcode.FCONST_1)); } /** - * Generate an instruction pushing float constant 2 onto the operand stack + * Generates an instruction pushing {@link TypeKind#FLOAT float} constant 2 + * onto the operand stack. + * * @return this builder + * @see Opcode#FCONST_2 + * @see #loadConstant(float) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder fconst_2() { return with(ConstantInstruction.ofIntrinsic(Opcode.FCONST_2)); } /** - * Generate an instruction to divide floats + * Generates an instruction to divide {@link TypeKind#FLOAT floats}. + * * @return this builder + * @see Opcode#FDIV + * @see OperatorInstruction */ default CodeBuilder fdiv() { return with(OperatorInstruction.of(Opcode.FDIV)); } /** - * Generate an instruction to load a float from a local variable - * - *

    This may also generate {@code fload_} and - * {@code wide fload} instructions. + * Generates an instruction to load a {@link TypeKind#FLOAT float} from a + * local variable. + *

    + * This may also generate {@link Opcode#FLOAD_0 fload_<N>} and {@link + * Opcode#FLOAD_W wide fload} instructions. * * @param slot the local variable slot * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see Opcode#FLOAD + * @see #loadLocal(TypeKind, int) + * @see LoadInstruction */ default CodeBuilder fload(int slot) { return loadLocal(TypeKind.FLOAT, slot); } /** - * Generate an instruction to multiply floats + * Generates an instruction to multiply {@link TypeKind#FLOAT floats}. + * * @return this builder + * @see Opcode#FMUL + * @see OperatorInstruction */ default CodeBuilder fmul() { return with(OperatorInstruction.of(Opcode.FMUL)); } /** - * Generate an instruction to negate a float + * Generates an instruction to negate a {@link TypeKind#FLOAT float}. + * * @return this builder + * @see Opcode#FNEG + * @see OperatorInstruction */ default CodeBuilder fneg() { return with(OperatorInstruction.of(Opcode.FNEG)); } /** - * Generate an instruction to calculate floats remainder + * Generates an instruction to calculate {@link TypeKind#FLOAT floats} + * remainder. + * * @return this builder + * @see Opcode#FREM + * @see OperatorInstruction */ default CodeBuilder frem() { return with(OperatorInstruction.of(Opcode.FREM)); } /** - * Generate an instruction to return a float from the method + * Generates an instruction to return a {@link TypeKind#FLOAT float} from + * this method. + * * @return this builder + * @see Opcode#FRETURN + * @see #return_(TypeKind) + * @see ReturnInstruction */ default CodeBuilder freturn() { return return_(TypeKind.FLOAT); } /** - * Generate an instruction to store a float into a local variable - * - *

    This may also generate {@code fstore_} and - * {@code wide fstore} instructions. + * Generates an instruction to store a {@link TypeKind#FLOAT float} into a + * local variable. + *

    + * This may also generate {@link Opcode#FSTORE_0 fstore_<N>} and + * {@link Opcode#FSTORE_W wide fstore} instructions. * * @param slot the local variable slot * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see Opcode#FSTORE + * @see #storeLocal(TypeKind, int) + * @see StoreInstruction */ default CodeBuilder fstore(int slot) { return storeLocal(TypeKind.FLOAT, slot); } /** - * Generate an instruction to subtract floats + * Generates an instruction to subtract {@link TypeKind#FLOAT floats}. + * * @return this builder + * @see Opcode#FSUB + * @see OperatorInstruction */ default CodeBuilder fsub() { return with(OperatorInstruction.of(Opcode.FSUB)); } /** - * Generate an instruction to fetch field from an object + * Generates an instruction to fetch field from an object. + * * @param ref the field reference * @return this builder + * @see Opcode#GETFIELD + * @see #fieldAccess(Opcode, FieldRefEntry) + * @see FieldInstruction */ default CodeBuilder getfield(FieldRefEntry ref) { return fieldAccess(Opcode.GETFIELD, ref); } /** - * Generate an instruction to fetch field from an object + * Generates an instruction to fetch field from an object. + * * @param owner the owner class * @param name the field name * @param type the field type * @return this builder * @throws IllegalArgumentException if {@code owner} represents a primitive type + * @see Opcode#GETFIELD + * @see #fieldAccess(Opcode, ClassDesc, String, ClassDesc) + * @see FieldInstruction */ default CodeBuilder getfield(ClassDesc owner, String name, ClassDesc type) { return fieldAccess(Opcode.GETFIELD, owner, name, type); } /** - * Generate an instruction to get static field from a class + * Generates an instruction to get static field from a class or interface. + * * @param ref the field reference * @return this builder + * @see Opcode#GETSTATIC + * @see #fieldAccess(Opcode, FieldRefEntry) + * @see FieldInstruction */ default CodeBuilder getstatic(FieldRefEntry ref) { return fieldAccess(Opcode.GETSTATIC, ref); } /** - * Generate an instruction to get static field from a class + * Generates an instruction to get static field from a class or interface. + * * @param owner the owner class * @param name the field name * @param type the field type * @return this builder * @throws IllegalArgumentException if {@code owner} represents a primitive type + * @see Opcode#GETSTATIC + * @see #fieldAccess(Opcode, ClassDesc, String, ClassDesc) + * @see FieldInstruction */ default CodeBuilder getstatic(ClassDesc owner, String name, ClassDesc type) { return fieldAccess(Opcode.GETSTATIC, owner, name, type); } /** - * Generate an instruction to branch always + * Generates an instruction to branch always. + *

    + * This may also generate {@link Opcode#GOTO_W goto_w} instructions if + * {@link ShortJumpsOption#FIX_SHORT_JUMPS} is set. * - *

    This may also generate {@code goto_w} instructions if the {@link - * ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS FIX_SHORT_JUMPS} option - * is set. - * - * @apiNote The instruction's name is {@code goto}, which coincides with a - * reserved keyword of the Java programming language, thus this method is - * named with an extra {@code _} suffix instead. + * @apiNote + * The instruction's name is {@code goto}, which coincides with a reserved + * keyword of the Java programming language, thus this method is named with + * an extra {@code _} suffix instead. * * @param target the branch target * @return this builder + * @see Opcode#GOTO + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder goto_(Label target) { return branch(Opcode.GOTO, target); } /** - * Generate an instruction to branch always with wide index + * Generates an instruction to branch always with wide index. + * * @param target the branch target * @return this builder + * @see Opcode#GOTO_W + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder goto_w(Label target) { return branch(Opcode.GOTO_W, target); } /** - * Generate an instruction to convert an int into a byte + * Generates an instruction to truncate an {@link TypeKind#INT int} into the + * range of {@link TypeKind#BYTE byte} and sign-extend it. + * * @return this builder + * @see Opcode#I2B + * @see ConvertInstruction */ default CodeBuilder i2b() { return with(ConvertInstruction.of(Opcode.I2B)); } /** - * Generate an instruction to convert an int into a char + * Generates an instruction to truncate an {@link TypeKind#INT int} into the + * range of {@link TypeKind#CHAR char} and zero-extend it. + * * @return this builder + * @see Opcode#I2C + * @see ConvertInstruction */ default CodeBuilder i2c() { return with(ConvertInstruction.of(Opcode.I2C)); } /** - * Generate an instruction to convert an int into a double + * Generates an instruction to convert an {@link TypeKind#INT int} into a + * {@link TypeKind#DOUBLE double}. + * * @return this builder + * @see Opcode#I2D + * @see ConvertInstruction */ default CodeBuilder i2d() { return with(ConvertInstruction.of(Opcode.I2D)); } /** - * Generate an instruction to convert an int into a float + * Generates an instruction to convert an {@link TypeKind#INT int} into a + * {@link TypeKind#FLOAT float}. + * * @return this builder + * @see Opcode#I2F + * @see ConvertInstruction */ default CodeBuilder i2f() { return with(ConvertInstruction.of(Opcode.I2F)); } /** - * Generate an instruction to convert an int into a long + * Generates an instruction to convert an {@link TypeKind#INT int} into a + * {@link TypeKind#LONG long}. + * * @return this builder + * @see Opcode#I2L + * @see ConvertInstruction */ default CodeBuilder i2l() { return with(ConvertInstruction.of(Opcode.I2L)); } /** - * Generate an instruction to convert an int into a short + * Generates an instruction to truncate an {@link TypeKind#INT int} into the + * range of {@link TypeKind#SHORT short} and sign-extend it. + * * @return this builder + * @see Opcode#I2S + * @see ConvertInstruction */ default CodeBuilder i2s() { return with(ConvertInstruction.of(Opcode.I2S)); } /** - * Generate an instruction to add an int + * Generates an instruction to add two {@link TypeKind#INT ints}. + * * @return this builder + * @see Opcode#IADD + * @see OperatorInstruction */ default CodeBuilder iadd() { return with(OperatorInstruction.of(Opcode.IADD)); } /** - * Generate an instruction to load a int from an array + * Generates an instruction to load from an {@link TypeKind#INT int} array. + * * @return this builder + * @see Opcode#IALOAD + * @see #arrayLoad(TypeKind) + * @see ArrayLoadInstruction */ default CodeBuilder iaload() { return arrayLoad(TypeKind.INT); } /** - * Generate an instruction to calculate boolean AND of ints + * Generates an instruction to calculate bitwise AND of {@link TypeKind#INT + * ints}, also used for {@link TypeKind#BOOLEAN boolean} AND. + * * @return this builder + * @see Opcode#IAND + * @see OperatorInstruction */ default CodeBuilder iand() { return with(OperatorInstruction.of(Opcode.IAND)); } /** - * Generate an instruction to store into an int array + * Generates an instruction to store into an {@link TypeKind#INT int} array. + * * @return this builder + * @see Opcode#IASTORE + * @see #arrayStore(TypeKind) + * @see ArrayStoreInstruction */ default CodeBuilder iastore() { return arrayStore(TypeKind.INT); } /** - * Generate an instruction pushing int constant 0 onto the operand stack + * Generates an instruction pushing {@link TypeKind#INT int} constant 0 onto + * the operand stack. + * * @return this builder + * @see Opcode#ICONST_0 + * @see #loadConstant(int) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder iconst_0() { return with(ConstantInstruction.ofIntrinsic(Opcode.ICONST_0)); } /** - * Generate an instruction pushing int constant 1 onto the operand stack + * Generates an instruction pushing {@link TypeKind#INT int} constant 1 onto + * the operand stack. + * * @return this builder + * @see Opcode#ICONST_1 + * @see #loadConstant(int) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder iconst_1() { return with(ConstantInstruction.ofIntrinsic(Opcode.ICONST_1)); } /** - * Generate an instruction pushing int constant 2 onto the operand stack + * Generates an instruction pushing {@link TypeKind#INT int} constant 2 onto + * the operand stack. + * * @return this builder + * @see Opcode#ICONST_2 + * @see #loadConstant(int) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder iconst_2() { return with(ConstantInstruction.ofIntrinsic(Opcode.ICONST_2)); } /** - * Generate an instruction pushing int constant 3 onto the operand stack + * Generates an instruction pushing {@link TypeKind#INT int} constant 3 onto + * the operand stack. + * * @return this builder + * @see Opcode#ICONST_3 + * @see #loadConstant(int) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder iconst_3() { return with(ConstantInstruction.ofIntrinsic(Opcode.ICONST_3)); } /** - * Generate an instruction pushing int constant 4 onto the operand stack + * Generates an instruction pushing {@link TypeKind#INT int} constant 4 onto + * the operand stack. + * * @return this builder + * @see Opcode#ICONST_4 + * @see #loadConstant(int) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder iconst_4() { return with(ConstantInstruction.ofIntrinsic(Opcode.ICONST_4)); } /** - * Generate an instruction pushing int constant 5 onto the operand stack + * Generates an instruction pushing {@link TypeKind#INT int} constant 5 onto + * the operand stack. + * * @return this builder + * @see Opcode#ICONST_5 + * @see #loadConstant(int) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder iconst_5() { return with(ConstantInstruction.ofIntrinsic(Opcode.ICONST_5)); } /** - * Generate an instruction pushing int constant -1 onto the operand stack + * Generates an instruction pushing {@link TypeKind#INT int} constant -1 + * onto the operand stack. + * * @return this builder + * @see Opcode#ICONST_M1 + * @see #loadConstant(int) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder iconst_m1() { return with(ConstantInstruction.ofIntrinsic(Opcode.ICONST_M1)); } /** - * Generate an instruction to divide ints + * Generates an instruction to divide {@link TypeKind#INT ints}. + * * @return this builder + * @see Opcode#IDIV + * @see OperatorInstruction */ default CodeBuilder idiv() { return with(OperatorInstruction.of(Opcode.IDIV)); } /** - * Generate an instruction to branch if reference comparison succeeds + * Generates an instruction to branch if {@link TypeKind#REFERENCE reference} + * comparison {@code operand1 == operand2} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IF_ACMPEQ + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder if_acmpeq(Label target) { return branch(Opcode.IF_ACMPEQ, target); } /** - * Generate an instruction to branch if reference comparison succeeds + * Generates an instruction to branch if {@link TypeKind#REFERENCE reference} + * comparison {@code operand1 != operand2} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IF_ACMPNE + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder if_acmpne(Label target) { return branch(Opcode.IF_ACMPNE, target); } /** - * Generate an instruction to branch if int comparison succeeds + * Generates an instruction to branch if {@link TypeKind#INT int} comparison + * {@code operand1 == operand2} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IF_ICMPEQ + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder if_icmpeq(Label target) { return branch(Opcode.IF_ICMPEQ, target); } /** - * Generate an instruction to branch if int comparison succeeds + * Generates an instruction to branch if {@link TypeKind#INT int} comparison + * {@code operand1 >= operand2} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IF_ICMPGE + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder if_icmpge(Label target) { return branch(Opcode.IF_ICMPGE, target); } /** - * Generate an instruction to branch if int comparison succeeds + * Generates an instruction to branch if {@link TypeKind#INT int} comparison + * {@code operand1 > operand2} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IF_ICMPGT + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder if_icmpgt(Label target) { return branch(Opcode.IF_ICMPGT, target); } /** - * Generate an instruction to branch if int comparison succeeds + * Generates an instruction to branch if {@link TypeKind#INT int} comparison + * {@code operand1 <= operand2} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IF_ICMPLE + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder if_icmple(Label target) { return branch(Opcode.IF_ICMPLE, target); } /** - * Generate an instruction to branch if int comparison succeeds + * Generates an instruction to branch if {@link TypeKind#INT int} comparison + * {@code operand1 < operand2} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IF_ICMPLT + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder if_icmplt(Label target) { return branch(Opcode.IF_ICMPLT, target); } /** - * Generate an instruction to branch if int comparison succeeds + * Generates an instruction to branch if {@link TypeKind#INT int} comparison + * {@code operand1 != operand2} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IF_ICMPNE + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder if_icmpne(Label target) { return branch(Opcode.IF_ICMPNE, target); } /** - * Generate an instruction to branch if reference is not null + * Generates an instruction to branch if {@link TypeKind#REFERENCE reference} + * is not {@code null}. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IFNONNULL + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder ifnonnull(Label target) { return branch(Opcode.IFNONNULL, target); } /** - * Generate an instruction to branch if reference is null + * Generates an instruction to branch if {@link TypeKind#REFERENCE reference} + * is {@code null}. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IFNULL + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder ifnull(Label target) { return branch(Opcode.IFNULL, target); } /** - * Generate an instruction to branch if int comparison with zero succeeds + * Generates an instruction to branch if {@link TypeKind#INT int} comparison + * with zero {@code == 0} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IFEQ + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder ifeq(Label target) { return branch(Opcode.IFEQ, target); } /** - * Generate an instruction to branch if int comparison with zero succeeds + * Generates an instruction to branch if {@link TypeKind#INT int} comparison + * with zero {@code >= 0} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IFGE + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder ifge(Label target) { return branch(Opcode.IFGE, target); } /** - * Generate an instruction to branch if int comparison with zero succeeds + * Generates an instruction to branch if {@link TypeKind#INT int} comparison + * with zero {@code > 0} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IFGT + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder ifgt(Label target) { return branch(Opcode.IFGT, target); } /** - * Generate an instruction to branch if int comparison with zero succeeds + * Generates an instruction to branch if {@link TypeKind#INT int} comparison + * with zero {@code <= 0} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IFLE + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder ifle(Label target) { return branch(Opcode.IFLE, target); } /** - * Generate an instruction to branch if int comparison with zero succeeds + * Generates an instruction to branch if {@link TypeKind#INT int} comparison + * with zero {@code < 0} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IFLT + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder iflt(Label target) { return branch(Opcode.IFLT, target); } /** - * Generate an instruction to branch if int comparison with zero succeeds + * Generates an instruction to branch if {@link TypeKind#INT int} comparison + * with zero {@code != 0} succeeds. + *

    + * This may generate multiple instructions to accomplish the same effect if + * {@link ClassFile.ShortJumpsOption#FIX_SHORT_JUMPS} is set and {@code + * target} cannot be encoded as a BCI offset in {@code [-32768, 32767]}. + * * @param target the branch target * @return this builder + * @see Opcode#IFNE + * @see #branch(Opcode, Label) + * @see BranchInstruction */ default CodeBuilder ifne(Label target) { return branch(Opcode.IFNE, target); } /** - * Generate an instruction to increment a local variable by a constant + * Generates an instruction to increment an {@link TypeKind#INT int} local + * variable by a constant. + *

    + * This may also generate {@link Opcode#IINC_W wide iinc} instructions if + * {@code slot} exceeds {@code 255} or {@code val} exceeds the range of + * {@link TypeKind#BYTE byte}. + * * @param slot the local variable slot * @param val the increment value * @return this builder * @throws IllegalArgumentException if {@code slot} or {@code val} is out of range + * @see Opcode#IINC + * @see IncrementInstruction */ default CodeBuilder iinc(int slot, int val) { return with(IncrementInstruction.of(slot, val)); } /** - * Generate an instruction to load an int from a local variable - * - *

    This may also generate {@code iload_} and - * {@code wide iload} instructions. + * Generates an instruction to load an {@link TypeKind#INT int} from a local + * variable. + *

    + * This may also generate {@link Opcode#ILOAD_0 iload_<N>} and {@link + * Opcode#ILOAD_W wide iload} instructions. * * @param slot the local variable slot * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see Opcode#ILOAD + * @see #loadLocal(TypeKind, int) + * @see LoadInstruction */ default CodeBuilder iload(int slot) { return loadLocal(TypeKind.INT, slot); } /** - * Generate an instruction to multiply ints + * Generates an instruction to multiply {@link TypeKind#INT ints}. + * * @return this builder + * @see Opcode#IMUL + * @see OperatorInstruction */ default CodeBuilder imul() { return with(OperatorInstruction.of(Opcode.IMUL)); } /** - * Generate an instruction to negate an int + * Generates an instruction to negate an {@link TypeKind#INT int}. + * * @return this builder + * @see Opcode#INEG + * @see OperatorInstruction */ default CodeBuilder ineg() { return with(OperatorInstruction.of(Opcode.INEG)); } /** - * Generate an instruction to determine if an object is of the given type + * Generates an instruction to determine if an object is of the given type, + * producing a {@link TypeKind#BOOLEAN boolean} result on the operand stack. * - * @apiNote The instruction's name is {@code instanceof}, which coincides with a + * @apiNote + * The instruction's name is {@code instanceof}, which coincides with a * reserved keyword of the Java programming language, thus this method is * named with camel case instead. * * @param target the target type * @return this builder + * @see Opcode#INSTANCEOF + * @see TypeCheckInstruction */ default CodeBuilder instanceOf(ClassEntry target) { return with(TypeCheckInstruction.of(Opcode.INSTANCEOF, target)); } /** - * Generate an instruction to determine if an object is of the given type + * Generates an instruction to determine if an object is of the given type, + * producing a {@link TypeKind#BOOLEAN boolean} result on the operand stack. * - * @apiNote The instruction's name is {@code instanceof}, which coincides with a + * @apiNote + * The instruction's name is {@code instanceof}, which coincides with a * reserved keyword of the Java programming language, thus this method is * named with camel case instead. * * @param target the target type * @return this builder * @throws IllegalArgumentException if {@code target} represents a primitive type + * @see Opcode#INSTANCEOF + * @see TypeCheckInstruction */ default CodeBuilder instanceOf(ClassDesc target) { return instanceOf(constantPool().classEntry(target)); } /** - * Generate an instruction to invoke a dynamically-computed call site + * Generates an instruction to invoke a dynamically-computed call site. + * * @param ref the dynamic call site * @return this builder + * @see Opcode#INVOKEDYNAMIC + * @see InvokeDynamicInstruction */ default CodeBuilder invokedynamic(InvokeDynamicEntry ref) { return with(InvokeDynamicInstruction.of(ref)); } /** - * Generate an instruction to invoke a dynamically-computed call site + * Generates an instruction to invoke a dynamically-computed call site. + * * @param ref the dynamic call site * @return this builder + * @see Opcode#INVOKEDYNAMIC + * @see InvokeDynamicInstruction */ default CodeBuilder invokedynamic(DynamicCallSiteDesc ref) { MethodHandleEntry bsMethod = handleDescToHandleInfo(constantPool(), (DirectMethodHandleDesc) ref.bootstrapMethod()); @@ -1771,649 +2491,920 @@ default CodeBuilder invokedynamic(DynamicCallSiteDesc ref) { } /** - * Generate an instruction to invoke an interface method + * Generates an instruction to invoke an interface method. + * * @param ref the interface method reference * @return this builder + * @see Opcode#INVOKEINTERFACE + * @see #invoke(Opcode, MemberRefEntry) + * @see InvokeInstruction */ default CodeBuilder invokeinterface(InterfaceMethodRefEntry ref) { return invoke(Opcode.INVOKEINTERFACE, ref); } /** - * Generate an instruction to invoke an interface method - * @param owner the owner class + * Generates an instruction to invoke an interface method. + * + * @param owner the owner interface * @param name the method name * @param type the method type * @return this builder * @throws IllegalArgumentException if {@code owner} represents a primitive type + * @see Opcode#INVOKEINTERFACE + * @see #invoke(Opcode, ClassDesc, String, MethodTypeDesc, boolean) + * @see InvokeInstruction */ default CodeBuilder invokeinterface(ClassDesc owner, String name, MethodTypeDesc type) { return invoke(Opcode.INVOKEINTERFACE, constantPool().interfaceMethodRefEntry(owner, name, type)); } /** - * Generate an instruction to invoke an instance method; direct invocation of instance initialization - * methods and methods of the current class and its supertypes + * Generates an instruction to invoke an instance method in an interface; + * direct invocation of methods of the current class and its supertypes. + * * @param ref the interface method reference * @return this builder + * @see Opcode#INVOKESPECIAL + * @see #invoke(Opcode, MemberRefEntry) + * @see InvokeInstruction */ default CodeBuilder invokespecial(InterfaceMethodRefEntry ref) { return invoke(Opcode.INVOKESPECIAL, ref); } /** - * Generate an instruction to invoke an instance method; direct invocation of instance initialization - * methods and methods of the current class and its supertypes + * Generates an instruction to invoke an instance method in a class; direct + * invocation of instance initialization methods and methods of the current + * class and its supertypes. + * * @param ref the method reference * @return this builder + * @see Opcode#INVOKESPECIAL + * @see #invoke(Opcode, MemberRefEntry) + * @see InvokeInstruction */ default CodeBuilder invokespecial(MethodRefEntry ref) { return invoke(Opcode.INVOKESPECIAL, ref); } /** - * Generate an instruction to invoke an instance method; direct invocation of instance initialization - * methods and methods of the current class and its supertypes - * @param owner the owner class + * Generates an instruction to invoke an instance method in a class; direct + * invocation of instance initialization methods and methods of the current + * class and its supertypes. + * + * @param owner the owner class, must not be an interface * @param name the method name * @param type the method type * @return this builder * @throws IllegalArgumentException if {@code owner} represents a primitive type + * @see Opcode#INVOKESPECIAL + * @see #invoke(Opcode, ClassDesc, String, MethodTypeDesc, boolean) + * @see InvokeInstruction */ default CodeBuilder invokespecial(ClassDesc owner, String name, MethodTypeDesc type) { return invoke(Opcode.INVOKESPECIAL, owner, name, type, false); } /** - * Generate an instruction to invoke an instance method; direct invocation of instance initialization - * methods and methods of the current class and its supertypes - * @param owner the owner class + * Generates an instruction to invoke an instance method; direct invocation + * of instance initialization methods and methods of the current class and + * its supertypes. + * + * @param owner the owner class or interface * @param name the method name * @param type the method type - * @param isInterface the interface method invocation indication + * @param isInterface whether the owner is an interface * @return this builder * @throws IllegalArgumentException if {@code owner} represents a primitive type + * @see Opcode#INVOKESPECIAL + * @see #invoke(Opcode, ClassDesc, String, MethodTypeDesc, boolean) + * @see InvokeInstruction */ default CodeBuilder invokespecial(ClassDesc owner, String name, MethodTypeDesc type, boolean isInterface) { return invoke(Opcode.INVOKESPECIAL, owner, name, type, isInterface); } /** - * Generate an instruction to invoke a class (static) method + * Generates an instruction to invoke a class (static) method of an interface. + * * @param ref the interface method reference * @return this builder + * @see Opcode#INVOKESTATIC + * @see #invoke(Opcode, MemberRefEntry) + * @see InvokeInstruction */ default CodeBuilder invokestatic(InterfaceMethodRefEntry ref) { return invoke(Opcode.INVOKESTATIC, ref); } /** - * Generate an instruction to invoke a class (static) method + * Generates an instruction to invoke a class (static) method of a class. + * * @param ref the method reference * @return this builder + * @see Opcode#INVOKESTATIC + * @see #invoke(Opcode, MemberRefEntry) + * @see InvokeInstruction */ default CodeBuilder invokestatic(MethodRefEntry ref) { return invoke(Opcode.INVOKESTATIC, ref); } /** - * Generate an instruction to invoke a class (static) method - * @param owner the owner class + * Generates an instruction to invoke a class (static) method of a class. + * + * @param owner the owner class, must not be an interface * @param name the method name * @param type the method type * @return this builder * @throws IllegalArgumentException if {@code owner} represents a primitive type + * @see Opcode#INVOKESTATIC + * @see #invoke(Opcode, ClassDesc, String, MethodTypeDesc, boolean) + * @see InvokeInstruction */ default CodeBuilder invokestatic(ClassDesc owner, String name, MethodTypeDesc type) { return invoke(Opcode.INVOKESTATIC, owner, name, type, false); } /** - * Generate an instruction to invoke a class (static) method - * @param owner the owner class + * Generates an instruction to invoke a class (static) method. + * + * @param owner the owner class or interface * @param name the method name * @param type the method type - * @param isInterface the interface method invocation indication + * @param isInterface whether the owner is an interface * @return this builder * @throws IllegalArgumentException if {@code owner} represents a primitive type + * @see Opcode#INVOKESTATIC + * @see #invoke(Opcode, ClassDesc, String, MethodTypeDesc, boolean) + * @see InvokeInstruction */ default CodeBuilder invokestatic(ClassDesc owner, String name, MethodTypeDesc type, boolean isInterface) { return invoke(Opcode.INVOKESTATIC, owner, name, type, isInterface); } /** - * Generate an instruction to invoke an instance method; dispatch based on class + * Generates an instruction to invoke an instance method; dispatch based on class. + * * @param ref the method reference * @return this builder + * @see Opcode#INVOKEVIRTUAL + * @see #invoke(Opcode, MemberRefEntry) + * @see InvokeInstruction */ default CodeBuilder invokevirtual(MethodRefEntry ref) { return invoke(Opcode.INVOKEVIRTUAL, ref); } /** - * Generate an instruction to invoke an instance method; dispatch based on class - * @param owner the owner class + * Generates an instruction to invoke an instance method; dispatch based on class. + * + * @param owner the owner class, must not be an interface * @param name the method name * @param type the method type * @return this builder * @throws IllegalArgumentException if {@code owner} represents a primitive type + * @see Opcode#INVOKEVIRTUAL + * @see #invoke(Opcode, ClassDesc, String, MethodTypeDesc, boolean) + * @see InvokeInstruction */ default CodeBuilder invokevirtual(ClassDesc owner, String name, MethodTypeDesc type) { return invoke(Opcode.INVOKEVIRTUAL, owner, name, type, false); } /** - * Generate an instruction to calculate boolean OR of ints + * Generates an instruction to calculate bitwise OR of {@link TypeKind#INT + * ints}, also used for {@link TypeKind#BOOLEAN boolean} OR. + * * @return this builder + * @see Opcode#IOR + * @see OperatorInstruction */ default CodeBuilder ior() { return with(OperatorInstruction.of(Opcode.IOR)); } /** - * Generate an instruction to calculate ints remainder + * Generates an instruction to calculate {@link TypeKind#INT ints} remainder. + * * @return this builder + * @see Opcode#IREM + * @see OperatorInstruction */ default CodeBuilder irem() { return with(OperatorInstruction.of(Opcode.IREM)); } /** - * Generate an instruction to return an int from the method + * Generates an instruction to return an {@link TypeKind#INT int} from this + * method. + * * @return this builder + * @see Opcode#IRETURN + * @see #return_(TypeKind) + * @see ReturnInstruction */ default CodeBuilder ireturn() { return return_(TypeKind.INT); } /** - * Generate an instruction to shift an int left + * Generates an instruction to shift an {@link TypeKind#INT int} left. + * * @return this builder + * @see Opcode#ISHL + * @see OperatorInstruction */ default CodeBuilder ishl() { return with(OperatorInstruction.of(Opcode.ISHL)); } /** - * Generate an instruction to shift an int right + * Generates an instruction to shift an {@link TypeKind#INT int} right. + * This carries the sign bit to the vacated most significant bits, as + * opposed to {@link #iushr()} that fills vacated most significant bits with + * {@code 0}. + * * @return this builder + * @see Opcode#ISHR + * @see OperatorInstruction */ default CodeBuilder ishr() { return with(OperatorInstruction.of(Opcode.ISHR)); } /** - * Generate an instruction to store an int into a local variable - * - *

    This may also generate {@code istore_} and - * {@code wide istore} instructions. + * Generates an instruction to store an {@link TypeKind#INT int} into a + * local variable. + *

    + * This may also generate {@link Opcode#ISTORE_0 istore_<N>} and + * {@link Opcode#ISTORE_W wide istore} instructions. * * @param slot the local variable slot * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see Opcode#ISTORE + * @see #storeLocal(TypeKind, int) + * @see StoreInstruction */ default CodeBuilder istore(int slot) { return storeLocal(TypeKind.INT, slot); } /** - * Generate an instruction to subtract ints + * Generates an instruction to subtract {@link TypeKind#INT ints}. + * * @return this builder + * @see Opcode#ISUB + * @see OperatorInstruction */ default CodeBuilder isub() { return with(OperatorInstruction.of(Opcode.ISUB)); } /** - * Generate an instruction to logical shift an int right + * Generates an instruction to logical shift an {@link TypeKind#INT int} + * right. This fills vacated most significant bits with {@code 0}, as + * opposed to {@link #ishr()} that carries the sign bit to the vacated most + * significant bits. + * * @return this builder + * @see Opcode#IUSHR + * @see OperatorInstruction */ default CodeBuilder iushr() { return with(OperatorInstruction.of(Opcode.IUSHR)); } /** - * Generate an instruction to calculate boolean XOR of ints + * Generates an instruction to calculate bitwise XOR of {@link TypeKind#INT + * ints}. This can also be used for {@link TypeKind#BOOLEAN boolean} XOR. + * * @return this builder + * @see Opcode#IXOR + * @see OperatorInstruction */ default CodeBuilder ixor() { return with(OperatorInstruction.of(Opcode.IXOR)); } /** - * Generate an instruction to access a jump table by key match and jump + * Generates an instruction to access a jump table by key match and jump. + * * @param defaultTarget the default jump target * @param cases the switch cases * @return this builder + * @see Opcode#LOOKUPSWITCH + * @see LookupSwitchInstruction */ default CodeBuilder lookupswitch(Label defaultTarget, List cases) { return with(LookupSwitchInstruction.of(defaultTarget, cases)); } /** - * Generate an instruction to convert a long into a double + * Generates an instruction to convert a {@link TypeKind#LONG long} into a + * {@link TypeKind#DOUBLE double}. + * * @return this builder + * @see Opcode#L2D + * @see OperatorInstruction */ default CodeBuilder l2d() { return with(ConvertInstruction.of(Opcode.L2D)); } /** - * Generate an instruction to convert a long into a float + * Generates an instruction to convert a {@link TypeKind#LONG long} into a + * {@link TypeKind#FLOAT float}. + * * @return this builder + * @see Opcode#L2F + * @see OperatorInstruction */ default CodeBuilder l2f() { return with(ConvertInstruction.of(Opcode.L2F)); } /** - * Generate an instruction to convert a long into an int + * Generates an instruction to convert a {@link TypeKind#LONG long} into an + * {@link TypeKind#INT int}. + * * @return this builder + * @see Opcode#L2I + * @see OperatorInstruction */ default CodeBuilder l2i() { return with(ConvertInstruction.of(Opcode.L2I)); } /** - * Generate an instruction to add a long + * Generates an instruction to add two {@link TypeKind#LONG longs}. + * * @return this builder + * @see Opcode#LADD + * @see OperatorInstruction */ default CodeBuilder ladd() { return with(OperatorInstruction.of(Opcode.LADD)); } /** - * Generate an instruction to load a long from an array + * Generates an instruction to load from a {@link TypeKind#LONG long} array. + * * @return this builder + * @see Opcode#LALOAD + * @see #arrayLoad(TypeKind) + * @see ArrayLoadInstruction */ default CodeBuilder laload() { return arrayLoad(TypeKind.LONG); } /** - * Generate an instruction to calculate boolean AND of longs + * Generates an instruction to calculate bitwise AND of {@link TypeKind#LONG + * longs}. + * * @return this builder + * @see Opcode#LAND + * @see OperatorInstruction */ default CodeBuilder land() { return with(OperatorInstruction.of(Opcode.LAND)); } /** - * Generate an instruction to store into a long array + * Generates an instruction to store into a {@link TypeKind#LONG long} array. + * * @return this builder + * @see Opcode#LASTORE + * @see #arrayStore(TypeKind) + * @see ArrayStoreInstruction */ default CodeBuilder lastore() { return arrayStore(TypeKind.LONG); } /** - * Generate an instruction to compare longs + * Generates an instruction to compare {@link TypeKind#LONG longs}. + * * @return this builder + * @see Opcode#LCMP + * @see OperatorInstruction */ default CodeBuilder lcmp() { return with(OperatorInstruction.of(Opcode.LCMP)); } /** - * Generate an instruction pushing long constant 0 onto the operand stack + * Generates an instruction pushing {@link TypeKind#LONG long} constant 0 + * onto the operand stack. + * * @return this builder + * @see Opcode#LCONST_0 + * @see #loadConstant(long) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder lconst_0() { return with(ConstantInstruction.ofIntrinsic(Opcode.LCONST_0)); } /** - * Generate an instruction pushing long constant 1 onto the operand stack + * Generates an instruction pushing {@link TypeKind#LONG long} constant 1 + * onto the operand stack. + * * @return this builder + * @see Opcode#LCONST_1 + * @see #loadConstant(long) + * @see ConstantInstruction.IntrinsicConstantInstruction */ default CodeBuilder lconst_1() { return with(ConstantInstruction.ofIntrinsic(Opcode.LCONST_1)); } /** - * Generate an instruction pushing an item from the run-time constant pool onto the operand stack - * - *

    This may also generate {@code ldc_w} and {@code ldc2_w} instructions. + * Generates an instruction pushing an item from the run-time constant pool + * onto the operand stack. + *

    + * This may also generate {@link Opcode#LDC_W ldc_w} and {@link Opcode#LDC2_W + * ldc2_w} instructions. * - * @apiNote {@link #loadConstant(ConstantDesc) loadConstant} generates more optimal instructions - * and should be used for general constants if an {@code ldc} instruction is not strictly required. + * @apiNote + * {@link #loadConstant(ConstantDesc) loadConstant} generates more optimal + * instructions and should be used for general constants if an {@code ldc} + * instruction is not strictly required. * * @param value the constant value * @return this builder + * @see Opcode#LDC + * @see #loadConstant(ConstantDesc) + * @see ConstantInstruction.LoadConstantInstruction */ default CodeBuilder ldc(ConstantDesc value) { return ldc(BytecodeHelpers.constantEntry(constantPool(), value)); } /** - * Generate an instruction pushing an item from the run-time constant pool onto the operand stack - * - *

    This may also generate {@code ldc_w} and {@code ldc2_w} instructions. + * Generates an instruction pushing an item from the run-time constant pool + * onto the operand stack. + *

    + * This may also generate {@link Opcode#LDC_W ldc_w} and {@link Opcode#LDC2_W + * ldc2_w} instructions. * * @param entry the constant value * @return this builder + * @see Opcode#LDC + * @see #loadConstant(ConstantDesc) + * @see ConstantInstruction.LoadConstantInstruction */ default CodeBuilder ldc(LoadableConstantEntry entry) { return with(ConstantInstruction.ofLoad(BytecodeHelpers.ldcOpcode(entry), entry)); } /** - * Generate an instruction to divide longs + * Generates an instruction to divide {@link TypeKind#LONG longs}. + * * @return this builder + * @see Opcode#LDIV + * @see OperatorInstruction */ default CodeBuilder ldiv() { return with(OperatorInstruction.of(Opcode.LDIV)); } /** - * Generate an instruction to load a long from a local variable - * - *

    This may also generate {@code lload_} and - * {@code wide lload} instructions. + * Generates an instruction to load a {@link TypeKind#LONG long} from a + * local variable. + *

    + * This may also generate {@link Opcode#LLOAD_0 lload_<N>} and {@link + * Opcode#LLOAD_W wide lload} instructions. * * @param slot the local variable slot * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see Opcode#LLOAD + * @see #loadLocal(TypeKind, int) + * @see LoadInstruction */ default CodeBuilder lload(int slot) { return loadLocal(TypeKind.LONG, slot); } /** - * Generate an instruction to multiply longs + * Generates an instruction to multiply {@link TypeKind#LONG longs}. + * * @return this builder + * @see Opcode#LMUL + * @see OperatorInstruction */ default CodeBuilder lmul() { return with(OperatorInstruction.of(Opcode.LMUL)); } /** - * Generate an instruction to negate a long + * Generates an instruction to negate a {@link TypeKind#LONG long}. + * * @return this builder + * @see Opcode#LNEG + * @see OperatorInstruction */ default CodeBuilder lneg() { return with(OperatorInstruction.of(Opcode.LNEG)); } /** - * Generate an instruction to calculate boolean OR of longs + * Generates an instruction to calculate bitwise OR of {@link TypeKind#LONG + * longs}. + * * @return this builder + * @see Opcode#LOR + * @see OperatorInstruction */ default CodeBuilder lor() { return with(OperatorInstruction.of(Opcode.LOR)); } /** - * Generate an instruction to calculate longs remainder + * Generates an instruction to calculate {@link TypeKind#LONG longs} + * remainder. + * * @return this builder + * @see Opcode#LREM + * @see OperatorInstruction */ default CodeBuilder lrem() { return with(OperatorInstruction.of(Opcode.LREM)); } /** - * Generate an instruction to return a long from the method + * Generates an instruction to return a {@link TypeKind#LONG long} from this + * method. + * * @return this builder + * @see Opcode#LRETURN + * @see #return_(TypeKind) + * @see ReturnInstruction */ default CodeBuilder lreturn() { return return_(TypeKind.LONG); } /** - * Generate an instruction to shift a long left + * Generates an instruction to shift a {@link TypeKind#LONG long} left. + * * @return this builder + * @see Opcode#LSHL + * @see OperatorInstruction */ default CodeBuilder lshl() { return with(OperatorInstruction.of(Opcode.LSHL)); } /** - * Generate an instruction to shift a long right + * Generates an instruction to shift a {@link TypeKind#LONG long} right. + * This carries the sign bit to the vacated most significant bits, as + * opposed to {@link #lushr()} that fills vacated most significant bits with + * {@code 0}. + * * @return this builder + * @see Opcode#LSHR + * @see OperatorInstruction */ default CodeBuilder lshr() { return with(OperatorInstruction.of(Opcode.LSHR)); } /** - * Generate an instruction to store a long into a local variable - * - *

    This may also generate {@code lstore_} and - * {@code wide lstore} instructions. + * Generates an instruction to store a {@link TypeKind#LONG long} into a + * local variable. + *

    + * This may also generate {@link Opcode#LSTORE_0 lstore_<N>} and + * {@link Opcode#LSTORE_W wide lstore} instructions. * * @param slot the local variable slot * @return this builder * @throws IllegalArgumentException if {@code slot} is out of range + * @see Opcode#LSTORE + * @see #storeLocal(TypeKind, int) + * @see StoreInstruction */ default CodeBuilder lstore(int slot) { return storeLocal(TypeKind.LONG, slot); } /** - * Generate an instruction to subtract longs + * Generates an instruction to subtract {@link TypeKind#LONG longs}. + * * @return this builder + * @see Opcode#LSUB + * @see OperatorInstruction */ default CodeBuilder lsub() { return with(OperatorInstruction.of(Opcode.LSUB)); } /** - * Generate an instruction to logical shift a long left + * Generates an instruction to logical shift a {@link TypeKind#LONG long} + * right. This fills vacated most significant bits with {@code 0}, as + * opposed to {@link #lshr()} that carries the sign bit to the vacated most + * significant bits. + * * @return this builder + * @see Opcode#LUSHR + * @see OperatorInstruction */ default CodeBuilder lushr() { return with(OperatorInstruction.of(Opcode.LUSHR)); } /** - * Generate an instruction to calculate boolean XOR of longs + * Generates an instruction to calculate bitwise XOR of {@link TypeKind#LONG + * longs}. + * * @return this builder + * @see Opcode#LXOR + * @see OperatorInstruction */ default CodeBuilder lxor() { return with(OperatorInstruction.of(Opcode.LXOR)); } /** - * Generate an instruction to enter monitor for an object + * Generates an instruction to enter monitor for an object. + * * @return this builder + * @see Opcode#MONITORENTER + * @see MonitorInstruction */ default CodeBuilder monitorenter() { return with(MonitorInstruction.of(Opcode.MONITORENTER)); } /** - * Generate an instruction to exit monitor for an object + * Generates an instruction to exit monitor for an object. + * * @return this builder + * @see Opcode#MONITOREXIT + * @see MonitorInstruction */ default CodeBuilder monitorexit() { return with(MonitorInstruction.of(Opcode.MONITOREXIT)); } /** - * Generate an instruction to create a new multidimensional array + * Generates an instruction to create a new multidimensional array. + * * @param array the array type * @param dims the number of dimensions * @return this builder * @throws IllegalArgumentException if {@code dims} is out of range + * @see Opcode#MULTIANEWARRAY + * @see NewMultiArrayInstruction */ default CodeBuilder multianewarray(ClassEntry array, int dims) { return with(NewMultiArrayInstruction.of(array, dims)); } /** - * Generate an instruction to create a new multidimensional array + * Generates an instruction to create a new multidimensional array. + * * @param array the array type * @param dims the number of dimensions * @return this builder * @throws IllegalArgumentException if {@code array} represents a primitive type - * or if {@code dims} is out of range + * or if {@code dims} is out of range + * @see Opcode#MULTIANEWARRAY + * @see NewMultiArrayInstruction */ default CodeBuilder multianewarray(ClassDesc array, int dims) { return multianewarray(constantPool().classEntry(array), dims); } /** - * Generate an instruction to create a new object + * Generates an instruction to create a new object. * - * @apiNote The instruction's name is {@code new}, which coincides with a - * reserved keyword of the Java programming language, thus this method is - * named with an extra {@code _} suffix instead. + * @apiNote + * The instruction's name is {@code new}, which coincides with a reserved + * keyword of the Java programming language, thus this method is named with + * an extra {@code _} suffix instead. * * @param clazz the new class type * @return this builder + * @see Opcode#NEW + * @see NewObjectInstruction */ default CodeBuilder new_(ClassEntry clazz) { return with(NewObjectInstruction.of(clazz)); } /** - * Generate an instruction to create a new object + * Generates an instruction to create a new object. * - * @apiNote The instruction's name is {@code new}, which coincides with a - * reserved keyword of the Java programming language, thus this method is - * named with an extra {@code _} suffix instead. + * @apiNote + * The instruction's name is {@code new}, which coincides with a reserved + * keyword of the Java programming language, thus this method is named with + * an extra {@code _} suffix instead. * * @param clazz the new class type * @return this builder * @throws IllegalArgumentException if {@code clazz} represents a primitive type + * @see Opcode#NEW + * @see NewObjectInstruction */ default CodeBuilder new_(ClassDesc clazz) { return new_(constantPool().classEntry(clazz)); } /** - * Generate an instruction to create a new array of a primitive type + * Generates an instruction to create a new array of a primitive type. + * * @param typeKind the primitive array type * @return this builder * @throws IllegalArgumentException when the {@code typeKind} is not a legal * primitive array component type + * @see Opcode#NEWARRAY + * @see NewPrimitiveArrayInstruction */ default CodeBuilder newarray(TypeKind typeKind) { return with(NewPrimitiveArrayInstruction.of(typeKind)); } /** - * Generate an instruction to pop the top operand stack value + * Generates an instruction to pop the top operand stack value. + * * @return this builder + * @see Opcode#POP + * @see StackInstruction */ default CodeBuilder pop() { return with(StackInstruction.of(Opcode.POP)); } /** - * Generate an instruction to pop the top one or two operand stack values + * Generates an instruction to pop the top one or two operand stack values. + * * @return this builder + * @see Opcode#POP2 + * @see StackInstruction */ default CodeBuilder pop2() { return with(StackInstruction.of(Opcode.POP2)); } /** - * Generate an instruction to set field in an object + * Generates an instruction to set field in an object. + * * @param ref the field reference * @return this builder + * @see Opcode#PUTFIELD + * @see #fieldAccess(Opcode, FieldRefEntry) + * @see FieldInstruction */ default CodeBuilder putfield(FieldRefEntry ref) { return fieldAccess(Opcode.PUTFIELD, ref); } /** - * Generate an instruction to set field in an object + * Generates an instruction to set field in an object. + * * @param owner the owner class * @param name the field name * @param type the field type * @return this builder * @throws IllegalArgumentException if {@code owner} represents a primitive type + * @see Opcode#PUTFIELD + * @see #fieldAccess(Opcode, ClassDesc, String, ClassDesc) + * @see FieldInstruction */ default CodeBuilder putfield(ClassDesc owner, String name, ClassDesc type) { return fieldAccess(Opcode.PUTFIELD, owner, name, type); } /** - * Generate an instruction to set static field in a class + * Generates an instruction to set static field in a class. + * * @param ref the field reference * @return this builder + * @see Opcode#PUTSTATIC + * @see #fieldAccess(Opcode, FieldRefEntry) + * @see FieldInstruction */ default CodeBuilder putstatic(FieldRefEntry ref) { return fieldAccess(Opcode.PUTSTATIC, ref); } /** - * Generate an instruction to set static field in a class - * @param owner the owner class + * Generates an instruction to set static field in a class. + * + * @param owner the owner class or interface * @param name the field name * @param type the field type * @return this builder * @throws IllegalArgumentException if {@code owner} represents a primitive type + * @see Opcode#PUTSTATIC + * @see #fieldAccess(Opcode, ClassDesc, String, ClassDesc) + * @see FieldInstruction */ default CodeBuilder putstatic(ClassDesc owner, String name, ClassDesc type) { return fieldAccess(Opcode.PUTSTATIC, owner, name, type); } /** - * Generate an instruction to return void from the method + * Generates an instruction to return {@link TypeKind#VOID void} from this + * method. * - * @apiNote The instruction's name is {@code return}, which coincides with a - * reserved keyword of the Java programming language, thus this method is - * named with an extra {@code _} suffix instead. + * @apiNote + * The instruction's name is {@code return}, which coincides with a reserved + * keyword of the Java programming language, thus this method is named with + * an extra {@code _} suffix instead. * * @return this builder + * @see Opcode#RETURN + * @see #return_(TypeKind) + * @see ReturnInstruction */ default CodeBuilder return_() { return return_(TypeKind.VOID); } /** - * Generate an instruction to load a short from an array + * Generates an instruction to load from a {@link TypeKind#SHORT short} + * array. + * * @return this builder + * @see Opcode#SALOAD + * @see #arrayLoad(TypeKind) + * @see ArrayLoadInstruction */ default CodeBuilder saload() { return arrayLoad(TypeKind.SHORT); } /** - * Generate an instruction to store into a short array + * Generates an instruction to store into a {@link TypeKind#SHORT short} + * array. + * * @return this builder + * @see Opcode#SASTORE + * @see #arrayStore(TypeKind) + * @see ArrayStoreInstruction */ default CodeBuilder sastore() { return arrayStore(TypeKind.SHORT); } /** - * Generate an instruction pushing an int in the range of short onto the operand stack. + * Generates an instruction pushing an {@link TypeKind#INT int} in the range + * of {@link TypeKind#SHORT short}, {@code [-32768, 32767]}, onto the + * operand stack. + * * @param s the int in the range of short * @return this builder * @throws IllegalArgumentException if {@code s} is out of range of short + * @see Opcode#SIPUSH + * @see #loadConstant(int) + * @see ConstantInstruction.ArgumentConstantInstruction */ default CodeBuilder sipush(int s) { return with(ConstantInstruction.ofArgument(Opcode.SIPUSH, s)); } /** - * Generate an instruction to swap the top two operand stack values + * Generates an instruction to swap the top two operand stack values. + * * @return this builder + * @see Opcode#SWAP + * @see StackInstruction */ default CodeBuilder swap() { return with(StackInstruction.of(Opcode.SWAP)); } /** - * Generate an instruction to access a jump table by index and jump - * @param low the low key value - * @param high the high key value + * Generates an instruction to access a jump table by index and jump. + * + * @param low the minimum key, inclusive + * @param high the maximum key, inclusive * @param defaultTarget the default jump target * @param cases the switch cases * @return this builder + * @see Opcode#TABLESWITCH + * @see TableSwitchInstruction */ default CodeBuilder tableswitch(int low, int high, Label defaultTarget, List cases) { return with(TableSwitchInstruction.of(low, high, defaultTarget, cases)); } /** - * Generate an instruction to access a jump table by index and jump + * Generates an instruction to access a jump table by index and jump. + * Computes the minimum and maximum keys from the {@code cases}. + * * @param defaultTarget the default jump target * @param cases the switch cases * @return this builder + * @see Opcode#TABLESWITCH + * @see #tableswitch(int, int, Label, List) + * @see TableSwitchInstruction */ default CodeBuilder tableswitch(Label defaultTarget, List cases) { int low = Integer.MAX_VALUE; diff --git a/src/java.base/share/classes/java/lang/classfile/CodeElement.java b/src/java.base/share/classes/java/lang/classfile/CodeElement.java index 63669d41014..9ca51383344 100644 --- a/src/java.base/share/classes/java/lang/classfile/CodeElement.java +++ b/src/java.base/share/classes/java/lang/classfile/CodeElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -29,13 +29,20 @@ import java.lang.classfile.attribute.StackMapTableAttribute; /** - * A marker interface for elements that can appear when traversing - * a {@link CodeModel} or be presented to a {@link CodeBuilder}. Code elements - * are either an {@link Instruction}, which models an instruction in the body - * of a method, or a {@link PseudoInstruction}, which models metadata from - * the code attribute, such as line number metadata, local variable metadata, - * exception metadata, label target metadata, etc. + * Marker interface for a member element of a {@link CodeModel}. Such an + * element can appear when traversing a {@link CodeModel} unless otherwise + * specified, be supplied to a {@link CodeBuilder}, and be processed by a + * {@link CodeTransform}. + *

    + * Code elements can be categorized into {@link Instruction}, {@link + * PseudoInstruction}, and {@link Attribute}. Unlike in other {@link + * CompoundElement}, the order of elements for all {@link Instruction}s and some + * {@link PseudoInstruction}s is significant. * + * @see ClassFileElement##membership Membership Elements + * @see ClassElement + * @see MethodElement + * @see FieldElement * @sealedGraph * @since 24 */ diff --git a/src/java.base/share/classes/java/lang/classfile/CodeModel.java b/src/java.base/share/classes/java/lang/classfile/CodeModel.java index 644f7660564..614b4cfda84 100644 --- a/src/java.base/share/classes/java/lang/classfile/CodeModel.java +++ b/src/java.base/share/classes/java/lang/classfile/CodeModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,17 +25,44 @@ package java.lang.classfile; +import java.lang.classfile.ClassFile.DeadLabelsOption; +import java.lang.classfile.ClassFile.DebugElementsOption; +import java.lang.classfile.ClassFile.LineNumbersOption; +import java.lang.classfile.attribute.BootstrapMethodsAttribute; import java.lang.classfile.attribute.CodeAttribute; +import java.lang.classfile.attribute.StackMapTableAttribute; import java.lang.classfile.instruction.ExceptionCatch; import java.util.List; import java.util.Optional; +import java.util.function.Consumer; import jdk.internal.classfile.impl.BufferedCodeBuilder; /** - * Models the body of a method (the {@code Code} attribute). The instructions - * of the method body are accessed via a streaming view. + * Models the body of a method (the {@code Code} attribute). A {@code Code} + * attribute is viewed as a {@linkplain CompoundElement composition} of {@link + * CodeElement}s, which is the only way to access {@link Instruction}s; the + * order of elements of a code model is significant. + *

    + * A {@code CodeModel} is obtained from {@link MethodModel#code()}, or in the + * traversal of the member elements of a method. + *

    + * {@link MethodBuilder#withCode} is the main way to build code models. {@link + * MethodBuilder#transformCode} and {@link CodeBuilder#transforming} allow + * creating new {@code Code} attributes by selectively processing the original + * code elements and directing the results to a code builder. + *

    + * A {@code Code} attribute holds attributes, but they are usually not member + * elements, but are decomposed to {@link PseudoInstruction}, accessible + * according to {@link DeadLabelsOption}, {@link DebugElementsOption}, and + * {@link LineNumbersOption}. {@link StackMapTableAttribute} can only be + * accessed via {@linkplain AttributedElement explicit attribute reading}, as it + * is considered a derived property from the code body. * + * @see MethodModel#code() + * @see CodeTransform + * @see CodeAttribute + * @jvms 4.7.3 The {@code Code} Attribute * @since 24 */ public sealed interface CodeModel diff --git a/src/java.base/share/classes/java/lang/classfile/CodeTransform.java b/src/java.base/share/classes/java/lang/classfile/CodeTransform.java index b76c02bf5fb..40465630853 100644 --- a/src/java.base/share/classes/java/lang/classfile/CodeTransform.java +++ b/src/java.base/share/classes/java/lang/classfile/CodeTransform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,10 +32,22 @@ import static java.util.Objects.requireNonNull; /** - * A transformation on streams of {@link CodeElement}. - * - * @see ClassFileTransform + * A transformation on streams of {@link CodeElement}. The stream can come + * from a {@link CodeModel}, or a handler to a {@link CodeBuilder} as in + * {@link CodeBuilder#transforming}. + *

    + * Refer to {@link ClassFileTransform} for general guidance and caution around + * the use of transforms for structures in the {@code class} file format. + *

    + * A code transform can be lifted to a method or a class transform via {@link + * MethodTransform#transformingCode(CodeTransform)} and {@link + * ClassTransform#transformingMethodBodies(CodeTransform)}, transforming only + * the {@link CodeModel} within those structures and passing all other elements + * to the builders. * + * @see CodeModel + * @see MethodBuilder#transformCode + * @see CodeBuilder#transforming * @since 24 */ @FunctionalInterface @@ -43,7 +55,7 @@ public non-sealed interface CodeTransform extends ClassFileTransform { /** - * A code transform that sends all elements to the builder. + * A code transform that passes all elements to the builder. */ CodeTransform ACCEPT_ALL = new CodeTransform() { @Override @@ -53,7 +65,7 @@ public void accept(CodeBuilder builder, CodeElement element) { }; /** - * Create a stateful code transform from a {@link Supplier}. The supplier + * Creates a stateful code transform from a {@link Supplier}. The supplier * will be invoked for each transformation. * * @param supplier a {@link Supplier} that produces a fresh transform object @@ -65,7 +77,7 @@ static CodeTransform ofStateful(Supplier supplier) { } /** - * Create a code transform that passes each element through to the builder, + * Creates a code transform that passes each element through to the builder, * and calls the specified function when transformation is complete. * * @param finisher the function to call when transformation is complete diff --git a/src/java.base/share/classes/java/lang/classfile/CompoundElement.java b/src/java.base/share/classes/java/lang/classfile/CompoundElement.java index d9f9fe1e5f9..1b06a260302 100644 --- a/src/java.base/share/classes/java/lang/classfile/CompoundElement.java +++ b/src/java.base/share/classes/java/lang/classfile/CompoundElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -37,14 +37,26 @@ import jdk.internal.classfile.components.ClassPrinter; /** - * A {@link ClassFileElement} that has complex structure defined in terms of - * other classfile elements, such as a method, field, method body, or entire - * class. When encountering a {@linkplain CompoundElement}, clients have the - * option to treat the element as a single entity (e.g., an entire method) - * or to traverse the contents of that element with the methods in this class - * (e.g., {@link #forEach(Consumer)}, etc.) - * @param the element type + * A {@code class} file structure that can be viewed as a composition of its + * member structures. {@code CompoundElement} allows users to traverse these + * member elements with {@link #forEach(Consumer)} or {@link #elementStream()}, + * or buffer the elements obtained from the traversal through {@link + * #iterator()} or {@link #elementList()}. + *

    + * Unless otherwise specified, all member elements of compatible type will be + * presented during the traversal if they exist in this element. Some member + * elements specify that they may appear at most once in this element; if such + * elements are presented multiple times, the latest occurrence is authentic and + * all previous occurrences should be ignored. + *

    + * {@code CompoundElement}s can be constructed by {@link ClassFileBuilder}s. + * {@link ClassFileBuilder#transform(CompoundElement, ClassFileTransform)} + * provides an easy way to create a new structure by selectively processing + * the original member structures and directing the results to the builder. * + * @param the member element type + * @see ClassFileElement##membership Membership Elements + * @see ClassFileBuilder * @sealedGraph * @since 24 */ @@ -52,15 +64,16 @@ public sealed interface CompoundElement extends ClassFileElement, Iterable permits ClassModel, CodeModel, FieldModel, MethodModel, jdk.internal.classfile.impl.AbstractUnboundModel { /** - * Invoke the provided handler with each element contained in this - * compound element + * Invokes the provided handler with each member element in this compound + * element. + * * @param consumer the handler */ @Override void forEach(Consumer consumer); /** - * {@return an {@link Iterator} describing all the elements contained in this + * {@return an {@link Iterator} describing all member elements in this * compound element} */ @Override @@ -69,8 +82,8 @@ default Iterator iterator() { } /** - * {@return a {@link Stream} containing all the elements contained in this - * compound element} + * {@return a {@link Stream} containing all member elements in this compound + * element} */ default Stream elementStream() { return StreamSupport.stream(Spliterators.spliteratorUnknownSize( @@ -80,8 +93,8 @@ default Stream elementStream() { } /** - * {@return an {@link List} containing all the elements contained in this - * compound element} + * {@return a {@link List} containing all member elements in this compound + * element} */ default List elementList() { List list = new ArrayList<>(); @@ -95,9 +108,11 @@ public void accept(E e) { } /** - * {@return a text representation of the compound element and its contents for debugging purposes} + * {@return a text representation of the compound element and its contents + * for debugging purposes} * - * The format, structure and exact contents of the returned string are not specified and may change at any time in the future. + * The format, structure and exact contents of the returned string are not + * specified and may change at any time in the future. */ default String toDebugString() { StringBuilder text = new StringBuilder(); diff --git a/src/java.base/share/classes/java/lang/classfile/FieldBuilder.java b/src/java.base/share/classes/java/lang/classfile/FieldBuilder.java index c473e09cab7..477aa6984a2 100644 --- a/src/java.base/share/classes/java/lang/classfile/FieldBuilder.java +++ b/src/java.base/share/classes/java/lang/classfile/FieldBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,7 +25,7 @@ package java.lang.classfile; -import java.lang.classfile.constantpool.Utf8Entry; +import java.lang.constant.ClassDesc; import java.lang.reflect.AccessFlag; import java.util.function.Consumer; @@ -34,14 +34,17 @@ import jdk.internal.classfile.impl.TerminalFieldBuilder; /** - * A builder for fields. Builders are not created directly; they are passed - * to handlers by methods such as {@link ClassBuilder#withField(Utf8Entry, Utf8Entry, Consumer)} - * or to field transforms. The elements of a field can be specified - * abstractly (by passing a {@link FieldElement} to {@link #with(ClassFileElement)} - * or concretely by calling the various {@code withXxx} methods. + * A builder for fields. The main way to obtain a field builder is via {@link + * ClassBuilder#withField(String, ClassDesc, Consumer)}. The {@linkplain + * ClassBuilder#withField(String, ClassDesc, int) access flag overload} is + * useful if no attribute needs to be configured, skipping the handler. + *

    + * Refer to {@link ClassFileBuilder} for general guidance and caution around + * the use of builders for structures in the {@code class} file format. * + * @see ClassBuilder#withField(String, ClassDesc, Consumer) + * @see FieldModel * @see FieldTransform - * * @since 24 */ public sealed interface FieldBuilder @@ -50,8 +53,12 @@ public sealed interface FieldBuilder /** * Sets the field access flags. + * * @param flags the access flags, as a bit mask * @return this builder + * @see AccessFlags + * @see AccessFlag.Location#FIELD + * @see ClassBuilder#withField(String, ClassDesc, int) */ default FieldBuilder withFlags(int flags) { return with(new AccessFlagsImpl(AccessFlag.Location.FIELD, flags)); @@ -59,8 +66,12 @@ default FieldBuilder withFlags(int flags) { /** * Sets the field access flags. + * * @param flags the access flags, as a bit mask * @return this builder + * @see AccessFlags + * @see AccessFlag.Location#FIELD + * @see ClassBuilder#withField(String, ClassDesc, int) */ default FieldBuilder withFlags(AccessFlag... flags) { return with(new AccessFlagsImpl(AccessFlag.Location.FIELD, flags)); diff --git a/src/java.base/share/classes/java/lang/classfile/FieldElement.java b/src/java.base/share/classes/java/lang/classfile/FieldElement.java index a2c1b22751e..a1c9905b6dd 100644 --- a/src/java.base/share/classes/java/lang/classfile/FieldElement.java +++ b/src/java.base/share/classes/java/lang/classfile/FieldElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -27,9 +27,18 @@ import java.lang.classfile.attribute.*; /** - * A marker interface for elements that can appear when traversing - * a {@link FieldModel} or be presented to a {@link FieldBuilder}. + * Marker interface for a member element of a {@link FieldModel}. Such an + * element can appear when traversing a {@link FieldModel} unless otherwise + * specified, be supplied to a {@link FieldBuilder}, and be processed by a + * {@link FieldTransform}. + *

    + * {@link AccessFlags} is the only member element of a field that appear exactly + * once during the traversal of a {@link FieldModel}. * + * @see ClassFileElement##membership Membership Elements + * @see ClassElement + * @see MethodElement + * @see CodeElement * @sealedGraph * @since 24 */ diff --git a/src/java.base/share/classes/java/lang/classfile/FieldModel.java b/src/java.base/share/classes/java/lang/classfile/FieldModel.java index 89fa1e192b0..21c3d903b68 100644 --- a/src/java.base/share/classes/java/lang/classfile/FieldModel.java +++ b/src/java.base/share/classes/java/lang/classfile/FieldModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -27,24 +27,43 @@ import java.lang.classfile.constantpool.Utf8Entry; import java.lang.constant.ClassDesc; +import java.lang.reflect.AccessFlag; import java.util.Optional; +import java.util.function.Consumer; import jdk.internal.classfile.impl.BufferedFieldBuilder; import jdk.internal.classfile.impl.FieldImpl; import jdk.internal.classfile.impl.Util; /** - * Models a field. The contents of the field can be traversed via - * a streaming view, or via random access (e.g., - * {@link #flags()}), or by freely mixing the two. + * Models a field. A field can be viewed as a {@linkplain CompoundElement + * composition} of {@link FieldElement}s, or by random access via accessor + * methods if only specific parts of the field is needed. + *

    + * Fields can be obtained from {@link ClassModel#fields()}, or in the traversal + * of member elements of a class. + *

    + * {@link ClassBuilder#withField(String, ClassDesc, Consumer)} is the main way + * to construct fields. {@link ClassBuilder#transformField} allows creating a + * new field by selectively processing the original field elements and directing + * the results to a field builder. + *

    + * All field attributes are accessible as member elements. * + * @see ClassModel#fields() + * @see FieldTransform + * @jvms 4.5 Fields * @since 24 */ public sealed interface FieldModel extends CompoundElement, AttributedElement, ClassElement permits BufferedFieldBuilder.Model, FieldImpl { - /** {@return the access flags} */ + /** + * {@return the access flags} + * + * @see AccessFlag.Location#FIELD + */ AccessFlags flags(); /** {@return the class model this field is a member of, if known} */ @@ -53,10 +72,10 @@ public sealed interface FieldModel /** {@return the name of this field} */ Utf8Entry fieldName(); - /** {@return the field descriptor of this field} */ + /** {@return the field descriptor string of this field} */ Utf8Entry fieldType(); - /** {@return the field descriptor of this field, as a symbolic descriptor} */ + /** {@return the field type, as a symbolic descriptor} */ default ClassDesc fieldTypeSymbol() { return Util.fieldTypeSymbol(fieldType()); } diff --git a/src/java.base/share/classes/java/lang/classfile/FieldTransform.java b/src/java.base/share/classes/java/lang/classfile/FieldTransform.java index 90313ae48f0..ef55861a328 100644 --- a/src/java.base/share/classes/java/lang/classfile/FieldTransform.java +++ b/src/java.base/share/classes/java/lang/classfile/FieldTransform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,9 +34,17 @@ /** * A transformation on streams of {@link FieldElement}. + *

    + * Refer to {@link ClassFileTransform} for general guidance and caution around + * the use of transforms for structures in the {@code class} file format. + *

    + * A field transform can be lifted to a class transform via {@link + * ClassTransform#transformingFields(FieldTransform)}, transforming only + * the {@link FieldModel} among the class members and passing all other elements + * to the builders. * - * @see ClassFileTransform - * + * @see FieldModel + * @see ClassBuilder#transformField * @since 24 */ @FunctionalInterface @@ -44,7 +52,7 @@ public non-sealed interface FieldTransform extends ClassFileTransform { /** - * A field transform that sends all elements to the builder. + * A field transform that passes all elements to the builder. */ FieldTransform ACCEPT_ALL = new FieldTransform() { @Override @@ -54,7 +62,7 @@ public void accept(FieldBuilder builder, FieldElement element) { }; /** - * Create a stateful field transform from a {@link Supplier}. The supplier + * Creates a stateful field transform from a {@link Supplier}. The supplier * will be invoked for each transformation. * * @param supplier a {@link Supplier} that produces a fresh transform object @@ -66,7 +74,7 @@ static FieldTransform ofStateful(Supplier supplier) { } /** - * Create a field transform that passes each element through to the builder, + * Creates a field transform that passes each element through to the builder, * and calls the specified function when transformation is complete. * * @param finisher the function to call when transformation is complete @@ -88,7 +96,7 @@ public void atEnd(FieldBuilder builder) { } /** - * Create a field transform that passes each element through to the builder, + * Creates a field transform that passes each element through to the builder, * except for those that the supplied {@link Predicate} is true for. * * @param filter the predicate that determines which elements to drop diff --git a/src/java.base/share/classes/java/lang/classfile/Instruction.java b/src/java.base/share/classes/java/lang/classfile/Instruction.java index 199aa6447a1..12bf513e96a 100644 --- a/src/java.base/share/classes/java/lang/classfile/Instruction.java +++ b/src/java.base/share/classes/java/lang/classfile/Instruction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,12 +32,15 @@ /** * Models an executable instruction in the {@code code} array of the {@link - * CodeAttribute Code} attribute of a method. + * CodeAttribute Code} attribute of a method. The order of instructions in + * a {@link CodeModel} is significant. *

    * The {@link #opcode() opcode} identifies the operation of an instruction. * Each {@linkplain Opcode#kind() kind} of opcode has its own modeling interface * for instructions. * + * @see Opcode + * @jvms 6.5 Instructions * @sealedGraph * @since 24 */ diff --git a/src/java.base/share/classes/java/lang/classfile/Interfaces.java b/src/java.base/share/classes/java/lang/classfile/Interfaces.java index 2c0e5b2e54b..bd89c494f24 100644 --- a/src/java.base/share/classes/java/lang/classfile/Interfaces.java +++ b/src/java.base/share/classes/java/lang/classfile/Interfaces.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,16 +33,22 @@ import jdk.internal.classfile.impl.Util; /** - * Models the interfaces of a class. Delivered as a {@link - * java.lang.classfile.ClassElement} when traversing a {@link ClassModel}. + * Models the interfaces (JVMS {@jvms 4.1}) of a class. An {@code Interfaces} + * appears at most once in a {@link ClassModel}: if it does not appear, the + * class has no interfaces, which is equivalent to an {@code Interfaces} whose + * {@link #interfaces()} returns an empty list. A {@link ClassBuilder} sets + * the interfaces to an empty list if the interfaces is not supplied. * + * @see ClassModel#interfaces() + * @see ClassBuilder#withInterfaces + * @jvms 4.1 The {@code ClassFile} Structure * @since 24 */ public sealed interface Interfaces extends ClassElement permits InterfacesImpl { - /** {@return the interfaces of this class} */ + /** {@return the interfaces of this class, may be empty} */ List interfaces(); /** @@ -64,6 +70,7 @@ static Interfaces of(ClassEntry... interfaces) { /** * {@return an {@linkplain Interfaces} element} * @param interfaces the interfaces + * @throws IllegalArgumentException if any of {@code interfaces} is primitive */ static Interfaces ofSymbols(List interfaces) { return of(Util.entryList(interfaces)); @@ -72,6 +79,7 @@ static Interfaces ofSymbols(List interfaces) { /** * {@return an {@linkplain Interfaces} element} * @param interfaces the interfaces + * @throws IllegalArgumentException if any of {@code interfaces} is primitive */ static Interfaces ofSymbols(ClassDesc... interfaces) { return ofSymbols(Arrays.asList(interfaces)); diff --git a/src/java.base/share/classes/java/lang/classfile/MethodBuilder.java b/src/java.base/share/classes/java/lang/classfile/MethodBuilder.java index 747cbe2e107..ff777246fde 100644 --- a/src/java.base/share/classes/java/lang/classfile/MethodBuilder.java +++ b/src/java.base/share/classes/java/lang/classfile/MethodBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,7 +25,7 @@ package java.lang.classfile; -import java.lang.classfile.constantpool.Utf8Entry; +import java.lang.constant.MethodTypeDesc; import java.lang.reflect.AccessFlag; import java.util.function.Consumer; @@ -34,14 +34,18 @@ import jdk.internal.classfile.impl.TerminalMethodBuilder; /** - * A builder for methods. Builders are not created directly; they are passed - * to handlers by methods such as {@link ClassBuilder#withMethod(Utf8Entry, Utf8Entry, int, Consumer)} - * or to method transforms. The elements of a method can be specified - * abstractly (by passing a {@link MethodElement} to {@link #with(ClassFileElement)} - * or concretely by calling the various {@code withXxx} methods. + * A builder for methods. The main way to obtain a method builder is via {@link + * ClassBuilder#withMethod(String, MethodTypeDesc, int, Consumer)}. {@link + * ClassBuilder#withMethodBody(String, MethodTypeDesc, int, Consumer)} is + * useful if no attribute on the method except {@link CodeModel Code} needs to + * be configured, skipping the method handler. + *

    + * Refer to {@link ClassFileBuilder} for general guidance and caution around + * the use of builders for structures in the {@code class} file format. * + * @see MethodModel * @see MethodTransform - * + * @jvms 4.6 Methods * @since 24 */ public sealed interface MethodBuilder @@ -49,18 +53,30 @@ public sealed interface MethodBuilder permits ChainedMethodBuilder, TerminalMethodBuilder { /** - * Sets the method access flags. + * Sets the method access flags. The {@link AccessFlag#STATIC} flag cannot + * be modified after the builder is created. + * * @param flags the access flags, as a bit mask * @return this builder + * @throws IllegalArgumentException if the {@link ClassFile#ACC_STATIC + * ACC_STATIC} flag is modified + * @see AccessFlags + * @see AccessFlag.Location#METHOD */ default MethodBuilder withFlags(int flags) { return with(new AccessFlagsImpl(AccessFlag.Location.METHOD, flags)); } /** - * Sets the method access flags. + * Sets the method access flags. The {@link AccessFlag#STATIC} flag cannot + * be modified after the builder is created. + * * @param flags the access flags, as a bit mask * @return this builder + * @throws IllegalArgumentException if the {@link ClassFile#ACC_STATIC + * ACC_STATIC} flag is modified + * @see AccessFlags + * @see AccessFlag.Location#METHOD */ default MethodBuilder withFlags(AccessFlag... flags) { return with(new AccessFlagsImpl(AccessFlag.Location.METHOD, flags)); @@ -68,24 +84,26 @@ default MethodBuilder withFlags(AccessFlag... flags) { /** * Build the method body for this method. + * * @param code a handler receiving a {@link CodeBuilder} * @return this builder + * @see CodeModel */ MethodBuilder withCode(Consumer code); /** * Build the method body for this method by transforming the body of another * method. - * - * @implNote - *

    This method behaves as if: + *

    + * This method behaves as if: * {@snippet lang=java : - * withCode(b -> b.transformCode(code, transform)); + * withCode(cob -> cob.transform(code, transform)); * } * * @param code the method body to be transformed * @param transform the transform to apply to the method body * @return this builder + * @see CodeTransform */ MethodBuilder transformCode(CodeModel code, CodeTransform transform); } diff --git a/src/java.base/share/classes/java/lang/classfile/MethodElement.java b/src/java.base/share/classes/java/lang/classfile/MethodElement.java index 77254a6a82c..8905f1fbcc3 100644 --- a/src/java.base/share/classes/java/lang/classfile/MethodElement.java +++ b/src/java.base/share/classes/java/lang/classfile/MethodElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -27,9 +27,18 @@ import java.lang.classfile.attribute.*; /** - * A marker interface for elements that can appear when traversing - * a {@link MethodModel} or be presented to a {@link MethodBuilder}. + * Marker interface for a member element of a {@link MethodModel}. Such an + * element can appear when traversing a {@link MethodModel} unless otherwise + * specified, be supplied to a {@link MethodBuilder}, and be processed by a + * {@link MethodTransform}. + *

    + * {@link AccessFlags} is the only member element of a method that appear + * exactly once during the traversal of a {@link MethodModel}. * + * @see ClassFileElement##membership Membership Elements + * @see ClassElement + * @see FieldElement + * @see CodeElement * @sealedGraph * @since 24 */ diff --git a/src/java.base/share/classes/java/lang/classfile/MethodModel.java b/src/java.base/share/classes/java/lang/classfile/MethodModel.java index d88051a5eb3..758223debe5 100644 --- a/src/java.base/share/classes/java/lang/classfile/MethodModel.java +++ b/src/java.base/share/classes/java/lang/classfile/MethodModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -27,24 +27,43 @@ import java.lang.classfile.constantpool.Utf8Entry; import java.lang.constant.MethodTypeDesc; +import java.lang.reflect.AccessFlag; import java.util.Optional; +import java.util.function.Consumer; import jdk.internal.classfile.impl.BufferedMethodBuilder; import jdk.internal.classfile.impl.MethodImpl; import jdk.internal.classfile.impl.Util; /** - * Models a method. The contents of the method can be traversed via - * a streaming view, or via random access (e.g., - * {@link #flags()}), or by freely mixing the two. + * Models a method. A method can be viewed as a {@linkplain CompoundElement + * composition} of {@link MethodElement}s, or by random access via accessor + * methods if only specific parts of the method is needed. + *

    + * Methods can be obtained from {@link ClassModel#methods()}, or in the + * traversal of member elements of a class. + *

    + * {@link ClassBuilder#withMethod(String, MethodTypeDesc, int, Consumer)} is the + * main way to construct methods. {@link ClassBuilder#transformMethod} allows + * creating a new method by selectively processing the original method elements + * and directing the results to a method builder. + *

    + * All method attributes are accessible as member elements. * + * @see ClassModel#methods() + * @see MethodTransform + * @jvms 4.6 Methods * @since 24 */ public sealed interface MethodModel extends CompoundElement, AttributedElement, ClassElement permits BufferedMethodBuilder.Model, MethodImpl { - /** {@return the access flags} */ + /** + * {@return the access flags} + * + * @see AccessFlag.Location#METHOD + */ AccessFlags flags(); /** {@return the class model this method is a member of, if known} */ @@ -53,10 +72,10 @@ public sealed interface MethodModel /** {@return the name of this method} */ Utf8Entry methodName(); - /** {@return the method descriptor of this method} */ + /** {@return the method descriptor string of this method} */ Utf8Entry methodType(); - /** {@return the method descriptor of this method, as a symbolic descriptor} */ + /** {@return the method type, as a symbolic descriptor} */ default MethodTypeDesc methodTypeSymbol() { return Util.methodTypeSymbol(methodType()); } diff --git a/src/java.base/share/classes/java/lang/classfile/MethodTransform.java b/src/java.base/share/classes/java/lang/classfile/MethodTransform.java index 865fadbae87..d7d9a8445aa 100644 --- a/src/java.base/share/classes/java/lang/classfile/MethodTransform.java +++ b/src/java.base/share/classes/java/lang/classfile/MethodTransform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,9 +34,17 @@ /** * A transformation on streams of {@link MethodElement}. + *

    + * Refer to {@link ClassFileTransform} for general guidance and caution around + * the use of transforms for structures in the {@code class} file format. + *

    + * A method transform can be lifted to a class transform via {@link + * ClassTransform#transformingMethods(MethodTransform)}, transforming only + * the {@link MethodModel} among the class members and passing all other + * elements to the builders. * - * @see ClassFileTransform - * + * @see MethodModel + * @see ClassBuilder#transformMethod * @since 24 */ @FunctionalInterface @@ -44,7 +52,7 @@ public non-sealed interface MethodTransform extends ClassFileTransform { /** - * A method transform that sends all elements to the builder. + * A method transform that passes all elements to the builder. */ MethodTransform ACCEPT_ALL = new MethodTransform() { @Override @@ -54,7 +62,7 @@ public void accept(MethodBuilder builder, MethodElement element) { }; /** - * Create a stateful method transform from a {@link Supplier}. The supplier + * Creates a stateful method transform from a {@link Supplier}. The supplier * will be invoked for each transformation. * * @param supplier a {@link Supplier} that produces a fresh transform object @@ -67,7 +75,7 @@ static MethodTransform ofStateful(Supplier supplier) { } /** - * Create a method transform that passes each element through to the builder, + * Creates a method transform that passes each element through to the builder, * and calls the specified function when transformation is complete. * * @param finisher the function to call when transformation is complete @@ -89,7 +97,7 @@ public void atEnd(MethodBuilder builder) { } /** - * Create a method transform that passes each element through to the builder, + * Creates a method transform that passes each element through to the builder, * except for those that the supplied {@link Predicate} is true for. * * @param filter the predicate that determines which elements to drop @@ -104,8 +112,9 @@ static MethodTransform dropping(Predicate filter) { } /** - * Create a method transform that transforms {@link CodeModel} elements - * with the supplied code transform. + * Creates a method transform that transforms {@link CodeModel} elements + * with the supplied code transform, passing every other element through to + * the builder. * * @param xform the method transform * @return the class transform diff --git a/src/java.base/share/classes/java/lang/classfile/Opcode.java b/src/java.base/share/classes/java/lang/classfile/Opcode.java index a3b0a370763..99ea4696f60 100644 --- a/src/java.base/share/classes/java/lang/classfile/Opcode.java +++ b/src/java.base/share/classes/java/lang/classfile/Opcode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -42,7 +42,7 @@ * instead of wide pseudo-opcodes. * * @see Instruction - * + * @jvms 6.5 Instructions * @since 24 */ public enum Opcode { @@ -1143,7 +1143,7 @@ public enum Opcode { LXOR(RawBytecodeHelper.LXOR, 1, Kind.OPERATOR), /** - * Increment local variable by constant. + * Increment {@link TypeKind#INT int} local variable by constant. * * @jvms 6.5.iinc iinc * @see Kind#INCREMENT diff --git a/src/java.base/share/classes/java/lang/classfile/PseudoInstruction.java b/src/java.base/share/classes/java/lang/classfile/PseudoInstruction.java index 456bce04c80..6d2e76b5cb8 100644 --- a/src/java.base/share/classes/java/lang/classfile/PseudoInstruction.java +++ b/src/java.base/share/classes/java/lang/classfile/PseudoInstruction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -35,13 +35,16 @@ import jdk.internal.classfile.impl.AbstractPseudoInstruction; /** - * Models metadata about a {@link CodeAttribute}, such as entries in the - * exception table, line number table, local variable table, or the mapping - * between instructions and labels. Pseudo-instructions are delivered as part - * of the element stream of a {@link CodeModel}. Delivery of some - * pseudo-instructions can be disabled by modifying the value of classfile - * options (e.g., {@link ClassFile.DebugElementsOption}). + * Models metadata about a {@link CodeModel}, derived from the {@link + * CodeAttribute Code} attribute itself or its attributes. + *

    + * Order is significant for some pseudo-instructions relative to {@link + * Instruction}s, such as {@link LabelTarget} or {@link LineNumber}. Some + * pseudo-instructions can be omitted in reading and writing according to + * certain {@link ClassFile.Option}s. These are specified in the corresponding + * modeling interfaces. * + * @sealedGraph * @since 24 */ public sealed interface PseudoInstruction diff --git a/src/java.base/share/classes/java/lang/classfile/Superclass.java b/src/java.base/share/classes/java/lang/classfile/Superclass.java index fe30fe8a8e3..34d11dc605f 100644 --- a/src/java.base/share/classes/java/lang/classfile/Superclass.java +++ b/src/java.base/share/classes/java/lang/classfile/Superclass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,13 +25,24 @@ package java.lang.classfile; import java.lang.classfile.constantpool.ClassEntry; +import java.lang.constant.ClassDesc; import jdk.internal.classfile.impl.SuperclassImpl; /** - * Models the superclass of a class. Delivered as a {@link - * java.lang.classfile.ClassElement} when traversing a {@link ClassModel}. + * Models the superclass (JVMS {@jvms 4.1}) of a class. A {@code Superclass} + * appears at most once in a {@link ClassModel}: it must be absent for + * {@linkplain ClassModel#isModuleInfo() module descriptors} or the {@link + * Object} class, and must be present otherwise. A {@link ClassBuilder} sets + * the {@link Object} class as the superclass if the superclass is not supplied + * and the class to build is required to have a superclass. + *

    + * All {@linkplain ClassFile#ACC_INTERFACE interfaces} have {@link Object} as + * their superclass. * + * @see ClassModel#superclass() + * @see ClassBuilder#withSuperclass + * @jvms 4.1 The {@code ClassFile} Structure * @since 24 */ public sealed interface Superclass @@ -43,6 +54,7 @@ public sealed interface Superclass /** * {@return a {@linkplain Superclass} element} + * * @param superclassEntry the superclass */ static Superclass of(ClassEntry superclassEntry) { diff --git a/src/java.base/share/classes/java/lang/classfile/TypeKind.java b/src/java.base/share/classes/java/lang/classfile/TypeKind.java index e3fc11858f5..d912c5c37ac 100644 --- a/src/java.base/share/classes/java/lang/classfile/TypeKind.java +++ b/src/java.base/share/classes/java/lang/classfile/TypeKind.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -108,11 +108,16 @@ public enum TypeKind { */ LONG(2, 11), /** - * The primitive type {@code float}. + * The primitive type {@code float}. All NaN values of {@code float} may or + * may not be collapsed into a single {@linkplain Float#NaN "canonical" NaN + * value} in loading and storing. */ FLOAT(1, 6), /** - * The primitive type {@code double}. It is of {@linkplain #slotSize() category} 2. + * The primitive type {@code double}. It is of {@linkplain #slotSize() + * category} 2. All NaN values of {@code double} may or may not be + * collapsed into a single {@linkplain Double#NaN "canonical" NaN value} + * in loading and storing. */ DOUBLE(2, 7), // End primitive types diff --git a/src/java.base/share/classes/java/lang/classfile/attribute/CodeAttribute.java b/src/java.base/share/classes/java/lang/classfile/attribute/CodeAttribute.java index 4a06fe2d610..743014704f9 100644 --- a/src/java.base/share/classes/java/lang/classfile/attribute/CodeAttribute.java +++ b/src/java.base/share/classes/java/lang/classfile/attribute/CodeAttribute.java @@ -49,6 +49,7 @@ * being built. * * @see Attributes#code() + * @see CodeModel * @jvms 4.7.3 The {@code Code} Attribute * @since 24 */ diff --git a/src/java.base/share/classes/java/lang/classfile/attribute/InnerClassInfo.java b/src/java.base/share/classes/java/lang/classfile/attribute/InnerClassInfo.java index 1394ee592ed..960d3755c4c 100644 --- a/src/java.base/share/classes/java/lang/classfile/attribute/InnerClassInfo.java +++ b/src/java.base/share/classes/java/lang/classfile/attribute/InnerClassInfo.java @@ -68,7 +68,8 @@ public sealed interface InnerClassInfo /** * {@return a bit mask of flags denoting access permissions and properties - * of the inner class} + * of the inner class} It is in the range of unsigned short, {@code [0, + * 0xFFFF]}. * * @see Class#getModifiers() * @see AccessFlag.Location#INNER_CLASS diff --git a/src/java.base/share/classes/java/lang/classfile/attribute/MethodParameterInfo.java b/src/java.base/share/classes/java/lang/classfile/attribute/MethodParameterInfo.java index 0366ec07e25..636c671f25a 100644 --- a/src/java.base/share/classes/java/lang/classfile/attribute/MethodParameterInfo.java +++ b/src/java.base/share/classes/java/lang/classfile/attribute/MethodParameterInfo.java @@ -53,7 +53,8 @@ public sealed interface MethodParameterInfo Optional name(); /** - * {@return the access flags, as a bit mask} + * {@return the access flags, as a bit mask} It is in the range of unsigned + * short, {@code [0, 0xFFFF]}. * * @see Parameter#getModifiers() * @see AccessFlag.Location#METHOD_PARAMETER diff --git a/src/java.base/share/classes/java/lang/classfile/attribute/ModuleAttribute.java b/src/java.base/share/classes/java/lang/classfile/attribute/ModuleAttribute.java index 231796c1b81..ad564913d84 100644 --- a/src/java.base/share/classes/java/lang/classfile/attribute/ModuleAttribute.java +++ b/src/java.base/share/classes/java/lang/classfile/attribute/ModuleAttribute.java @@ -81,7 +81,8 @@ public sealed interface ModuleAttribute ModuleEntry moduleName(); /** - * {@return the module flags of the module, as a bit mask} + * {@return the module flags of the module, as a bit mask} It is in the + * range of unsigned short, {@code [0, 0xFFFF]}. * * @see ModuleDescriptor#modifiers() * @see AccessFlag.Location#MODULE diff --git a/src/java.base/share/classes/java/lang/classfile/attribute/ModuleExportInfo.java b/src/java.base/share/classes/java/lang/classfile/attribute/ModuleExportInfo.java index 2071561a1e5..e498b8bc036 100644 --- a/src/java.base/share/classes/java/lang/classfile/attribute/ModuleExportInfo.java +++ b/src/java.base/share/classes/java/lang/classfile/attribute/ModuleExportInfo.java @@ -58,6 +58,7 @@ public sealed interface ModuleExportInfo /** * {@return the flags associated with this export declaration, as a bit mask} + * It is in the range of unsigned short, {@code [0, 0xFFFF]}. * * @see ModuleDescriptor.Exports#modifiers() * @see AccessFlag.Location#MODULE_EXPORTS diff --git a/src/java.base/share/classes/java/lang/classfile/attribute/ModuleOpenInfo.java b/src/java.base/share/classes/java/lang/classfile/attribute/ModuleOpenInfo.java index 16c0cf8a057..d183a0b4985 100644 --- a/src/java.base/share/classes/java/lang/classfile/attribute/ModuleOpenInfo.java +++ b/src/java.base/share/classes/java/lang/classfile/attribute/ModuleOpenInfo.java @@ -64,6 +64,7 @@ public sealed interface ModuleOpenInfo /** * {@return the flags associated with this open declaration, as a bit mask} + * It is in the range of unsigned short, {@code [0, 0xFFFF]}. * * @see ModuleDescriptor.Opens#modifiers() * @see AccessFlag.Location#MODULE_OPENS diff --git a/src/java.base/share/classes/java/lang/classfile/attribute/ModuleRequireInfo.java b/src/java.base/share/classes/java/lang/classfile/attribute/ModuleRequireInfo.java index edffe941629..49544554090 100644 --- a/src/java.base/share/classes/java/lang/classfile/attribute/ModuleRequireInfo.java +++ b/src/java.base/share/classes/java/lang/classfile/attribute/ModuleRequireInfo.java @@ -55,6 +55,7 @@ public sealed interface ModuleRequireInfo /** * {@return the flags associated with this require declaration, as a bit mask} + * It is in the range of unsigned short, {@code [0, 0xFFFF]}. * * @see ModuleDescriptor.Requires#modifiers() * @see AccessFlag.Location#MODULE_REQUIRES diff --git a/src/java.base/share/classes/java/lang/classfile/attribute/ModuleResolutionAttribute.java b/src/java.base/share/classes/java/lang/classfile/attribute/ModuleResolutionAttribute.java index 75e9ca485ff..039700f024a 100644 --- a/src/java.base/share/classes/java/lang/classfile/attribute/ModuleResolutionAttribute.java +++ b/src/java.base/share/classes/java/lang/classfile/attribute/ModuleResolutionAttribute.java @@ -78,7 +78,8 @@ public sealed interface ModuleResolutionAttribute permits BoundAttribute.BoundModuleResolutionAttribute, UnboundAttribute.UnboundModuleResolutionAttribute { /** - * {@return the module resolution flags} + * {@return the module resolution flags} It is in the range of unsigned + * short, {@code [0, 0xFFFF]}. *

    * The value of the resolution_flags item is a mask of flags used to denote * properties of module resolution. The flags are as follows: diff --git a/src/java.base/share/classes/java/lang/classfile/constantpool/ConstantPoolBuilder.java b/src/java.base/share/classes/java/lang/classfile/constantpool/ConstantPoolBuilder.java index 260fc982dab..b7145eeb59c 100644 --- a/src/java.base/share/classes/java/lang/classfile/constantpool/ConstantPoolBuilder.java +++ b/src/java.base/share/classes/java/lang/classfile/constantpool/ConstantPoolBuilder.java @@ -467,6 +467,9 @@ default ConstantDynamicEntry constantDynamicEntry(DynamicConstantDesc dcd) { /** * {@return a {@link FloatEntry} describing the provided value} + *

    + * All NaN values of the {@code float} may or may not be collapsed into a + * single {@linkplain Float#NaN "canonical" NaN value}. * * @param value the value * @see FloatEntry#floatValue() FloatEntry::floatValue @@ -483,6 +486,9 @@ default ConstantDynamicEntry constantDynamicEntry(DynamicConstantDesc dcd) { /** * {@return a {@link DoubleEntry} describing the provided value} + *

    + * All NaN values of the {@code double} may or may not be collapsed into a + * single {@linkplain Double#NaN "canonical" NaN value}. * * @param value the value * @see DoubleEntry#doubleValue() DoubleEntry::doubleValue diff --git a/src/java.base/share/classes/java/lang/classfile/instruction/ExceptionCatch.java b/src/java.base/share/classes/java/lang/classfile/instruction/ExceptionCatch.java index 2a86c4bd09c..e924ca718e7 100644 --- a/src/java.base/share/classes/java/lang/classfile/instruction/ExceptionCatch.java +++ b/src/java.base/share/classes/java/lang/classfile/instruction/ExceptionCatch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -54,6 +54,7 @@ * } * * @see CodeBuilder#exceptionCatch CodeBuilder::exceptionCatch + * @see CodeAttribute#exceptionHandlers() * @jvms 4.7.3 The {@code Code} Attribute * @since 24 */ diff --git a/src/java.base/share/classes/java/lang/classfile/package-info.java b/src/java.base/share/classes/java/lang/classfile/package-info.java index 2d6a8959a2d..b5d79ff6e7e 100644 --- a/src/java.base/share/classes/java/lang/classfile/package-info.java +++ b/src/java.base/share/classes/java/lang/classfile/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,14 +25,16 @@ /** *

    Provides classfile parsing, generation, and transformation library.

    - * The {@code java.lang.classfile} package contains classes for reading, writing, and - * modifying Java class files, as specified in Chapter {@jvms 4} of the - * Java Virtual Machine Specification. + * The {@code java.lang.classfile} package contains API models for reading, + * writing, and modifying Java class files, as specified in Chapter {@jvms 4} of + * the Java Virtual Machine Specification. This package, {@link + * java.lang.classfile.attribute}, {@link java.lang.classfile.constantpool}, + * and {@link java.lang.classfile.instruction} form the Class-File API. * *

    Reading classfiles

    - * The main class for reading classfiles is {@link java.lang.classfile.ClassModel}; we - * convert bytes into a {@link java.lang.classfile.ClassModel} with {@link - * java.lang.classfile.ClassFile#parse(byte[])}: + * The main class for reading classfiles is {@link ClassModel}; we + * convert bytes into a {@link ClassModel} with {@link + * ClassFile#parse(byte[])}: * * {@snippet lang=java : * ClassModel cm = ClassFile.of().parse(bytes); @@ -41,29 +43,32 @@ * There are several additional overloads of {@code parse} that let you specify * various processing options. *

    - * A {@link java.lang.classfile.ClassModel} is an immutable description of a class + * A {@link ClassModel} is an immutable description of a class * file. It provides accessor methods to get at class metadata (e.g., {@link - * java.lang.classfile.ClassModel#thisClass()}, {@link java.lang.classfile.ClassModel#flags()}), - * as well as subordinate classfile entities ({@link java.lang.classfile.ClassModel#fields()}, - * {@link java.lang.classfile.ClassModel#attributes()}). A {@link - * java.lang.classfile.ClassModel} is inflated lazily; most parts of the classfile are - * not parsed until they are actually needed. + * ClassModel#thisClass()}, {@link ClassModel#flags()}), + * as well as subordinate classfile entities ({@link ClassModel#fields()}, + * {@link ClassModel#attributes()}). A {@link + * ClassModel} is inflated lazily; most parts of the classfile are + * not parsed until they are actually needed. Due to the laziness, these models + * may not be thread safe. Additionally, invocations to accessor methods on + * models may lead to {@link IllegalArgumentException} due to malformed {@code + * class} file format, as parsing happens lazily. *

    * We can enumerate the names of the fields and methods in a class by: * {@snippet lang="java" class="PackageSnippets" region="enumerateFieldsMethods1"} *

    - * When we enumerate the methods, we get a {@link java.lang.classfile.MethodModel} for each method; like a + * When we enumerate the methods, we get a {@link MethodModel} for each method; like a * {@code ClassModel}, it gives us access to method metadata and * the ability to descend into subordinate entities such as the bytecodes of the * method body. In this way, a {@code ClassModel} is the root of a * tree, with children for fields, methods, and attributes, and {@code MethodModel} in * turn has its own children (attributes, {@code CodeModel}, etc.) *

    - * Methods like {@link java.lang.classfile.ClassModel#methods} allows us to traverse the class structure + * Methods like {@link ClassModel#methods} allows us to traverse the class structure * explicitly, going straight to the parts we are interested in. This is useful * for certain kinds of analysis, but if we wanted to process the whole * classfile, we may want something more organized. A {@link - * java.lang.classfile.ClassModel} also provides us with a view of the classfile as a + * ClassModel} also provides us with a view of the classfile as a * series of class elements, which may include methods, fields, attributes, * and more, and which can be distinguished with pattern matching. We could * rewrite the above example as: @@ -87,24 +92,24 @@ * models and elements. Models represent complex structures, * such as classes, methods, fields, record elements, or the code body of a * method. Models can be explored either via random-access navigation (such as - * the {@link java.lang.classfile.ClassModel#methods()} accessor) or as a linear + * the {@link ClassModel#methods()} accessor) or as a linear * sequence of elements. (Elements can in turn also be models; a {@link - * java.lang.classfile.FieldModel} is also an element of a class.) For each model type - * (e.g., {@link java.lang.classfile.MethodModel}), there is a corresponding element - * type ({@link java.lang.classfile.MethodElement}). Models and elements are immutable + * FieldModel} is also an element of a class.) For each model type + * (e.g., {@link MethodModel}), there is a corresponding element + * type ({@link MethodElement}). Models and elements are immutable * and are inflated lazily so creating a model does not necessarily require * processing its entire content. * *

    The constant pool

    * Much of the interesting content in a classfile lives in the constant - * pool. {@link java.lang.classfile.ClassModel} provides a lazily-inflated, - * read-only view of the constant pool via {@link java.lang.classfile.ClassModel#constantPool()}. + * pool. {@link ClassModel} provides a lazily-inflated, + * read-only view of the constant pool via {@link ClassModel#constantPool()}. * Descriptions of classfile content is often exposed in the form of various - * subtypes of {@link java.lang.classfile.constantpool.PoolEntry}, such as {@link - * java.lang.classfile.constantpool.ClassEntry} or {@link java.lang.classfile.constantpool.Utf8Entry}. + * subtypes of {@link PoolEntry}, such as {@link + * ClassEntry} or {@link Utf8Entry}. *

    * Constant pool entries are also exposed through models and elements; in the - * above traversal example, the {@link java.lang.classfile.instruction.InvokeInstruction} + * above traversal example, the {@link InvokeInstruction} * element exposed a method for {@code owner} that corresponds to a {@code * Constant_Class_info} entry in the constant pool. * @@ -112,9 +117,9 @@ * Much of the contents of a classfile is stored in attributes; attributes are * found on classes, methods, fields, record components, and on the {@code Code} * attribute. Most attributes are surfaced as elements; for example, {@link - * java.lang.classfile.attribute.SignatureAttribute} is a {@link - * java.lang.classfile.ClassElement}, {@link java.lang.classfile.MethodElement}, and {@link - * java.lang.classfile.FieldElement} since it can appear in all of those places, and is + * SignatureAttribute} is a {@link + * ClassElement}, {@link MethodElement}, and {@link + * FieldElement} since it can appear in all of those places, and is * included when iterating the elements of the corresponding model. *

    * Some attributes are not surfaced as elements; these are attributes that are @@ -125,77 +130,84 @@ * treated as part of the structure they are coupled to (the entries of the * {@code BootstrapMethods} attribute are treated as part of the constant pool; * line numbers and local variable metadata are modeled as elements of {@link - * java.lang.classfile.CodeModel}.) + * CodeModel}.) *

    * The {@code Code} attribute, in addition to being modeled as a {@link - * java.lang.classfile.MethodElement}, is also a model in its own right ({@link - * java.lang.classfile.CodeModel}) due to its complex structure. + * MethodElement}, is also a model in its own right ({@link + * CodeModel}) due to its complex structure. *

    * Each standard attribute has an interface (in {@code java.lang.classfile.attribute}) * which exposes the contents of the attribute and provides factories to * construct the attribute. For example, the {@code Signature} attribute is - * defined by the {@link java.lang.classfile.attribute.SignatureAttribute} class, and - * provides accessors for {@link java.lang.classfile.attribute.SignatureAttribute#signature()} - * as well as factories taking {@link java.lang.classfile.constantpool.Utf8Entry} or - * {@link java.lang.String}. + * defined by the {@link SignatureAttribute} class, and + * provides accessors for {@link SignatureAttribute#signature()} + * as well as factories taking {@link Utf8Entry} or + * {@link String}. * *

    Custom attributes

    * Attributes are converted between their classfile form and their corresponding - * object form via an {@link java.lang.classfile.AttributeMapper}. An {@code + * object form via an {@link AttributeMapper}. An {@code * AttributeMapper} provides the - * {@link java.lang.classfile.AttributeMapper#readAttribute(AttributedElement, + * {@link AttributeMapper#readAttribute(AttributedElement, * ClassReader, int)} method for mapping from the classfile format * to an attribute instance, and the - * {@link java.lang.classfile.AttributeMapper#writeAttribute(java.lang.classfile.BufWriter, - * java.lang.classfile.Attribute)} method for mapping back to the classfile format. It also + * {@link AttributeMapper#writeAttribute(BufWriter, + * Attribute)} method for mapping back to the classfile format. It also * contains metadata including the attribute name, the set of classfile entities * where the attribute is applicable, and whether multiple attributes of the * same kind are allowed on a single entity. *

    - * There are built-in attribute mappers (in {@link java.lang.classfile.Attributes}) for + * There are built-in attribute mappers (in {@link Attributes}) for * each of the attribute types defined in section {@jvms 4.7} of The Java Virtual * Machine Specification, as well as several common nonstandard attributes used by the * JDK such as {@code CharacterRangeTable}. *

    * Unrecognized attributes are delivered as elements of type {@link - * java.lang.classfile.attribute.UnknownAttribute}, which provide access only to the + * UnknownAttribute}, which provide access only to the * {@code byte[]} contents of the attribute. *

    * For nonstandard attributes, user-provided attribute mappers can be specified * through the use of the {@link - * java.lang.classfile.ClassFile.AttributeMapperOption#of(java.util.function.Function)}} + * ClassFile.AttributeMapperOption#of(Function)}} * classfile option. Implementations of custom attributes should extend {@link - * java.lang.classfile.CustomAttribute}. + * CustomAttribute}. * - *

    Options

    + *

    Options

    *

    - * {@link java.lang.classfile.ClassFile#of(java.lang.classfile.ClassFile.Option[])} - * accepts a list of options. {@link java.lang.classfile.ClassFile.Option} is a base interface + * {@link ClassFile#of(ClassFile.Option[])} + * accepts a list of options. {@link ClassFile.Option} is a base interface * for some statically enumerated options, as well as factories for more complex options, * including: *

      - *
    • {@link java.lang.classfile.ClassFile.AttributeMapperOption#of(java.util.function.Function)} + *
    • {@link ClassFile.AttributeMapperOption#of(Function)} * -- specify format of custom attributes
    • - *
    • {@link java.lang.classfile.ClassFile.AttributesProcessingOption} + *
    • {@link ClassFile.AttributesProcessingOption} * -- unrecognized or problematic original attributes (default is {@code PASS_ALL_ATTRIBUTES})
    • - *
    • {@link java.lang.classfile.ClassFile.ClassHierarchyResolverOption#of(java.lang.classfile.ClassHierarchyResolver)} + *
    • {@link ClassFile.ClassHierarchyResolverOption#of(ClassHierarchyResolver)} * -- specify a custom class hierarchy resolver used by stack map generation
    • - *
    • {@link java.lang.classfile.ClassFile.ConstantPoolSharingOption}} + *
    • {@link ClassFile.ConstantPoolSharingOption}} * -- share constant pool when transforming (default is {@code SHARED_POOL})
    • - *
    • {@link java.lang.classfile.ClassFile.DeadCodeOption}} + *
    • {@link ClassFile.DeadCodeOption}} * -- patch out unreachable code (default is {@code PATCH_DEAD_CODE})
    • - *
    • {@link java.lang.classfile.ClassFile.DeadLabelsOption}} + *
    • {@link ClassFile.DeadLabelsOption}} * -- filter unresolved labels (default is {@code FAIL_ON_DEAD_LABELS})
    • - *
    • {@link java.lang.classfile.ClassFile.DebugElementsOption} + *
    • {@link ClassFile.DebugElementsOption} * -- processing of debug information, such as local variable metadata (default is {@code PASS_DEBUG})
    • - *
    • {@link java.lang.classfile.ClassFile.LineNumbersOption} + *
    • {@link ClassFile.LineNumbersOption} * -- processing of line numbers (default is {@code PASS_LINE_NUMBERS})
    • - *
    • {@link java.lang.classfile.ClassFile.ShortJumpsOption} + *
    • {@link ClassFile.ShortJumpsOption} * -- automatically rewrite short jumps to long when necessary (default is {@code FIX_SHORT_JUMPS})
    • - *
    • {@link java.lang.classfile.ClassFile.StackMapsOption} + *
    • {@link ClassFile.StackMapsOption} * -- generate stackmaps (default is {@code STACK_MAPS_WHEN_REQUIRED})
    • *
    *

    + * {@link ClassFile.AttributeMapperOption} and {@link ClassFile.ClassHierarchyResolverOption} + * are critical to the correctness of {@code class} file parsing and generation. + * The attribute mapper is required to parse custom attributes. A correct + * resolver is required to generate {@code class} files that refer to classes + * not available to the system class loader in its bytecode, or in corner cases, + * when generation wishes to avoid loading system classes, such as in agents. + *

    * Most options allow you to request that certain parts of the classfile be * skipped during traversal, such as debug information or unrecognized * attributes. Some options allow you to suppress generation of portions of the @@ -207,8 +219,8 @@ *

    Writing classfiles

    * ClassFile generation is accomplished through builders. For each * entity type that has a model, there is also a corresponding builder type; - * classes are built through {@link java.lang.classfile.ClassBuilder}, methods through - * {@link java.lang.classfile.MethodBuilder}, etc. + * classes are built through {@link ClassBuilder}, methods through + * {@link MethodBuilder}, etc. *

    * Rather than creating builders directly, builders are provided as an argument * to a user-provided lambda. To generate the familiar "hello world" program, @@ -226,34 +238,34 @@ * Builders often support multiple ways of expressing the same entity at * different levels of abstraction. For example, the {@code invokevirtual} * instruction invoking {@code println} could have been generated with {@link - * java.lang.classfile.CodeBuilder#invokevirtual(java.lang.constant.ClassDesc, - * java.lang.String, java.lang.constant.MethodTypeDesc) CodeBuilder.invokevirtual}, {@link - * java.lang.classfile.CodeBuilder#invoke(java.lang.classfile.Opcode, - * java.lang.constant.ClassDesc, java.lang.String, java.lang.constant.MethodTypeDesc, - * boolean) CodeBuilder.invokeInstruction}, or {@link - * java.lang.classfile.CodeBuilder#with(java.lang.classfile.ClassFileElement) + * CodeBuilder#invokevirtual(ClassDesc, + * String, MethodTypeDesc) CodeBuilder.invokevirtual}, {@link + * CodeBuilder#invoke(Opcode, + * ClassDesc, String, MethodTypeDesc, + * boolean) CodeBuilder.invoke}, or {@link + * CodeBuilder#with(ClassFileElement) * CodeBuilder.with}. *

    * The convenience method {@code CodeBuilder.invokevirtual} behaves as if it calls - * the convenience method {@code CodeBuilder.invokeInstruction}, which in turn behaves + * the convenience method {@code CodeBuilder.invoke}, which in turn behaves * as if it calls method {@code CodeBuilder.with}. This composing of method calls on the * builder enables the composing of transforms (as described later). *

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

    * *

    Symbolic information

    * To describe symbolic information for classes and types, the API uses the - * nominal descriptor abstractions from {@code java.lang.constant} such as {@link - * java.lang.constant.ClassDesc} and {@link java.lang.constant.MethodTypeDesc}, + * nominal descriptor abstractions from {@link java.lang.constant} such as {@link + * ClassDesc} and {@link MethodTypeDesc}, * which is less error-prone than using raw strings. *

    * If a constant pool entry has a nominal representation then it provides a * method returning the corresponding nominal descriptor type e.g. - * method {@link java.lang.classfile.constantpool.ClassEntry#asSymbol} returns + * method {@link ClassEntry#asSymbol} returns * {@code ClassDesc}. *

    * Where appropriate builders provide two methods for building an element with @@ -266,13 +278,14 @@ * methods accepts the provided information without implicit validation. * However, fatal inconsistencies (like for example invalid code sequence or * unresolved labels) affects internal tools and may cause exceptions later in - * the classfile building process. + * the classfile building process. These fatal exceptions are thrown as + * {@link IllegalArgumentException}. *

    * Using nominal descriptors assures the right serial form is applied by the * ClassFile API library based on the actual context. Also these nominal * descriptors are validated during their construction, so it is not possible to * create them with invalid content by mistake. Following example pass class - * name to the {@link java.lang.constant.ClassDesc#of} method for validation + * name to the {@link ClassDesc#of} method for validation * and the library performs automatic conversion to the right internal form of * the class name when serialized in the constant pool as a class entry. * {@snippet lang=java : @@ -290,7 +303,7 @@ * } *

    * More complex verification of a classfile can be achieved by invocation of - * {@link java.lang.classfile.ClassFile#verify}. + * {@link ClassFile#verify}. * *

    Transforming classfiles

    * ClassFile Processing APIs are most frequently used to combine reading and @@ -301,9 +314,9 @@ * to the builder. *

    * If we wanted to strip out methods whose names starts with "debug", we could - * get an existing {@link java.lang.classfile.ClassModel}, build a new classfile that - * provides a {@link java.lang.classfile.ClassBuilder}, iterate the elements of the - * original {@link java.lang.classfile.ClassModel}, and pass through all of them to + * get an existing {@link ClassModel}, build a new classfile that + * provides a {@link ClassBuilder}, iterate the elements of the + * original {@link ClassModel}, and pass through all of them to * the builder except the methods we want to drop: * {@snippet lang="java" class="PackageSnippets" region="stripDebugMethods1"} *

    @@ -335,7 +348,7 @@ * operations can be more easily combined. Suppose we want to redirect * invocations of static methods on {@code Foo} to the corresponding method on * {@code Bar} instead. We could express this as a transformation on {@link - * java.lang.classfile.CodeElement}: + * CodeElement}: * {@snippet lang="java" class="PackageSnippets" region="fooToBarTransform"} *

    * We can then lift this transformation on code elements into a @@ -376,7 +389,7 @@ * {@snippet lang="java" class="PackageSnippets" region="instrumentCallsTransform"} *

    * Then we can compose {@code fooToBar} and {@code instrumentCalls} with {@link - * java.lang.classfile.CodeTransform#andThen(java.lang.classfile.CodeTransform)}: + * CodeTransform#andThen(CodeTransform)}: * * {@snippet lang=java : * var cc = ClassFile.of(); @@ -399,7 +412,7 @@ * attributes that are not transformed can be processed by bulk-copying their * bytes, rather than parsing them and regenerating their contents.) If * constant pool sharing is not desired it can be suppressed - * with the {@link java.lang.classfile.ClassFile.ConstantPoolSharingOption} option. + * with the {@link ClassFile.ConstantPoolSharingOption} option. * Such suppression may be beneficial when transformation removes many elements, * resulting in many unreferenced constant pool entries. * @@ -429,14 +442,14 @@ * corresponding interface to describe that element, and factory methods to * create that element. Some element kinds also have convenience methods on the * corresponding builder (e.g., {@link - * java.lang.classfile.CodeBuilder#invokevirtual(java.lang.constant.ClassDesc, - * java.lang.String, java.lang.constant.MethodTypeDesc)}). + * CodeBuilder#invokevirtual(ClassDesc, + * String, MethodTypeDesc)}). *

    * Most symbolic information in elements is represented by constant pool entries * (for example, the owner of a field is represented by a {@link - * java.lang.classfile.constantpool.ClassEntry}.) Factories and builders also - * accept nominal descriptors from {@code java.lang.constant} (e.g., {@link - * java.lang.constant.ClassDesc}.) + * ClassEntry}.) Factories and builders also + * accept nominal descriptors from {@link java.lang.constant} (e.g., {@link + * ClassDesc}.) * *

    Data model

    * We define each kind of element by its name, an optional arity indicator (zero @@ -485,7 +498,7 @@ * * Fields and methods are models with their own elements. The elements of fields * and methods are fairly simple; most of the complexity of methods lives in the - * {@link java.lang.classfile.CodeModel} (which models the {@code Code} attribute + * {@link CodeModel} (which models the {@code Code} attribute * along with the code-related attributes: stack map table, local variable table, * line number table, etc.) * @@ -502,7 +515,7 @@ * | ExceptionsAttribute?(List exceptions) * } * - * {@link java.lang.classfile.CodeModel} is unique in that its elements are ordered. + * {@link CodeModel} is unique in that its elements are ordered. * Elements of {@code Code} include ordinary bytecodes, as well as a number of pseudo-instructions * representing branch targets, line number metadata, local variable metadata, and * catch blocks. @@ -549,3 +562,13 @@ * @since 24 */ package java.lang.classfile; + +import java.lang.classfile.attribute.SignatureAttribute; +import java.lang.classfile.attribute.UnknownAttribute; +import java.lang.classfile.constantpool.ClassEntry; +import java.lang.classfile.constantpool.PoolEntry; +import java.lang.classfile.constantpool.Utf8Entry; +import java.lang.classfile.instruction.InvokeInstruction; +import java.lang.constant.ClassDesc; +import java.lang.constant.MethodTypeDesc; +import java.util.function.Function; diff --git a/src/java.base/share/classes/java/lang/classfile/snippet-files/PackageSnippets.java b/src/java.base/share/classes/java/lang/classfile/snippet-files/PackageSnippets.java index 7a58da7f6ce..df901b1a6cc 100644 --- a/src/java.base/share/classes/java/lang/classfile/snippet-files/PackageSnippets.java +++ b/src/java.base/share/classes/java/lang/classfile/snippet-files/PackageSnippets.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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,6 +25,7 @@ package java.lang.classfile.snippets; import java.lang.classfile.*; +import java.lang.classfile.attribute.CodeAttribute; import java.lang.classfile.instruction.*; import java.lang.constant.ClassDesc; import java.lang.constant.ConstantDescs; @@ -185,10 +186,14 @@ void fooToBarTransform() { // @start region="fooToBarTransform" CodeTransform fooToBar = (b, e) -> { if (e instanceof InvokeInstruction i - && i.owner().asInternalName().equals("Foo") - && i.opcode() == Opcode.INVOKESTATIC) - b.invoke(i.opcode(), CD_Bar, i.name().stringValue(), i.typeSymbol(), i.isInterface()); - else b.with(e); + && i.owner().name().equalsString("Foo") + && i.opcode() == Opcode.INVOKESTATIC) { + // remove the old element i by doing nothing to the builder + // add a new invokestatic instruction to the builder + b.invokestatic(CD_Bar, i.name().stringValue(), i.typeSymbol(), i.isInterface()); + } else { + b.with(e); // leaves the element in place + } }; // @end } @@ -324,4 +329,12 @@ void resolverExample() { ClassHierarchyResolver resolver = ClassHierarchyResolver.ofClassLoading(lookup).cached(); // @end } + + void manualReuseStackMaps(CodeBuilder cob, MethodModel method) { + // @start region="manual-reuse-stack-maps" + CodeAttribute code = method.findAttribute(Attributes.code()).orElseThrow(); + // Note that StackMapTable may be absent, representing code with no branching + code.findAttribute(Attributes.stackMapTable()).ifPresent(cob); + // @end + } } diff --git a/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java b/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java index 0cfbcd4abf5..a75b133d8e0 100644 --- a/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java +++ b/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -41,12 +41,12 @@ * A nominal descriptor for an * {@code invokedynamic} call site. * - *

    Concrete subtypes of {@linkplain DynamicCallSiteDesc} should be immutable - * and their behavior should not rely on object identity. + *

    A {@code DynamicCallSiteDesc} is immutable and its behavior does not + * rely on object identity. * * @since 12 */ -public class DynamicCallSiteDesc { +public final class DynamicCallSiteDesc { private final DirectMethodHandleDesc bootstrapMethod; private final ConstantDesc[] bootstrapArgs; diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java b/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java index 0ab2dbfdae9..51846e682b6 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.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 @@ -69,7 +69,7 @@ * * @since 1.7 */ -public class MethodHandleProxies { +public final class MethodHandleProxies { private MethodHandleProxies() { } // do not instantiate diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index 7542b0e513a..79370df3f3b 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.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 @@ -84,7 +84,7 @@ * @author John Rose, JSR 292 EG * @since 1.7 */ -public class MethodHandles { +public final class MethodHandles { private MethodHandles() { } // do not instantiate diff --git a/src/java.base/share/classes/java/lang/module/Configuration.java b/src/java.base/share/classes/java/lang/module/Configuration.java index 7959df3ca00..a76a32cfb28 100644 --- a/src/java.base/share/classes/java/lang/module/Configuration.java +++ b/src/java.base/share/classes/java/lang/module/Configuration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, 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 @@ -75,6 +75,61 @@ * ModuleLayer.boot().configuration()}. The configuration for the boot layer * will often be the parent when creating new configurations.

    * + *

    Optional Services

    + * + * Resolution requires that if a module {@code M} '{@code uses}' a service or + * '{@code provides}' an implementation of a service, then the service must be available + * to {@code M} at run time, either because {@code M} itself contains the service's + * package or because {@code M} reads another module that exports the service's package. + * However, it is sometimes desirable for the service's package to come from a module + * that is optional at run time, as indicated by the use of 'requires static' in this + * example: + * + * {@snippet : + * module M { + * requires static Y; + * uses p.S; + * } + * + * module Y { + * exports p; + * } + * } + * + * Resolution is resilient when a service's package comes from a module that is optional + * at run time. That is, if a module {@code M} has an optional dependency on some module + * {@code Y}, but {@code Y} is not needed at run time ({@code Y} might be observable but + * no-one reads it), then resolution at run time assumes that {@code Y} exported + * the service's package at compile time. Resolution at run time does not attempt to + * check whether {@code Y} is observable or (if it is observable) whether {@code Y} + * exports the service's package. + * + *

    The module that '{@code uses}' the service, or '{@code provides}' an implementation + * of it, may depend directly on the optional module, as {@code M} does above, or may + * depend indirectly on the optional module, as shown here: + * + * {@snippet : + * module M { + * requires X; + * uses p.S; + * } + * + * module X { + * requires static transitive Y; + * } + * + * module Y { + * exports p; + * } + * } + * + * In effect, the service that {@code M} '{@code uses}', or '{@code provides}' an + * implementation of, is optional if it comes from an optional dependency. In this case, + * code in {@code M} must be prepared to deal with the class or interface that denotes + * the service being unavailable at run time. This is distinct from the more regular + * case where the service is available but no implementations of the service are + * available. + * *

    Example

    * *

    The following example uses the {@link @@ -153,7 +208,6 @@ private Configuration(List parents, Resolver resolver) { this.graph = g; this.modules = Set.of(moduleArray); this.nameToModule = Map.ofEntries(nameEntries); - this.targetPlatform = resolver.targetPlatform(); } @@ -358,10 +412,17 @@ static Configuration resolveAndBind(ModuleFinder finder, * module {@code M} containing package {@code p} reads another module * that exports {@code p} to {@code M}.

  • * - *
  • A module {@code M} declares that it "{@code uses p.S}" or - * "{@code provides p.S with ...}" but package {@code p} is neither in - * module {@code M} nor exported to {@code M} by any module that - * {@code M} reads.

  • + *
  • A module {@code M} declares that it '{@code uses p.S}' or + * '{@code provides p.S with ...}', but the package {@code p} is neither in + * module {@code M} nor exported to {@code M} by any module that {@code M} + * reads. Additionally, neither of the following is {@code true}: + *

      + *
    • {@code M} declares '{@code requires static}' for at least one + * module that is not in the readability graph.
    • + *
    • {@code M} reads another module that declares + * '{@code requires transitive static}' for at least one module that is + * not in the readability graph.
    • + *
  • * * * diff --git a/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java b/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java index 4b43a457b88..169c2656bba 100644 --- a/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java +++ b/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, 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 @@ -91,7 +91,7 @@ * @since 9 */ -public class ModuleDescriptor +public final class ModuleDescriptor implements Comparable { diff --git a/src/java.base/share/classes/java/lang/module/Resolver.java b/src/java.base/share/classes/java/lang/module/Resolver.java index bff087fb674..e09060fd797 100644 --- a/src/java.base/share/classes/java/lang/module/Resolver.java +++ b/src/java.base/share/classes/java/lang/module/Resolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -689,7 +689,6 @@ private ResolvedModule computeIfAbsent(Map map, * */ private void checkExportSuppliers(Map> graph) { - for (Map.Entry> e : graph.entrySet()) { ModuleDescriptor descriptor1 = e.getKey().descriptor(); String name1 = descriptor1.name(); @@ -754,7 +753,6 @@ private void checkExportSuppliers(Map> graph failTwoSuppliers(descriptor1, source, descriptor2, supplier); } } - } } @@ -764,18 +762,21 @@ private void checkExportSuppliers(Map> graph // uses S for (String service : descriptor1.uses()) { String pn = packageName(service); - if (!packageToExporter.containsKey(pn)) { - resolveFail("Module %s does not read a module that exports %s", - descriptor1.name(), pn); + if (!packageToExporter.containsKey(pn) + && !requiresStaticMissingModule(descriptor1, reads)) { + resolveFail("Module %s uses %s but does not read a module that exports %s to %s", + descriptor1.name(), service, pn, descriptor1.name()); + } } // provides S for (ModuleDescriptor.Provides provides : descriptor1.provides()) { String pn = packageName(provides.service()); - if (!packageToExporter.containsKey(pn)) { - resolveFail("Module %s does not read a module that exports %s", - descriptor1.name(), pn); + if (!packageToExporter.containsKey(pn) + && !requiresStaticMissingModule(descriptor1, reads)) { + resolveFail("Module %s provides %s but does not read a module that exports %s to %s", + descriptor1.name(), provides.service(), pn, descriptor1.name()); } } @@ -785,6 +786,34 @@ private void checkExportSuppliers(Map> graph } + /** + * Returns true if a module 'requires static' a module that is not in the + * readability graph, or reads a module that 'requires static transitive' + * a module that is not in the readability graph. + */ + private boolean requiresStaticMissingModule(ModuleDescriptor descriptor, + Set reads) { + Set moduleNames = reads.stream() + .map(ResolvedModule::name) + .collect(Collectors.toSet()); + for (ModuleDescriptor.Requires r : descriptor.requires()) { + if (r.modifiers().contains(Modifier.STATIC) + && !moduleNames.contains(r.name())) { + return true; + } + } + for (ResolvedModule rm : reads) { + for (ModuleDescriptor.Requires r : rm.descriptor().requires()) { + if (r.modifiers().contains(Modifier.STATIC) + && r.modifiers().contains(Modifier.TRANSITIVE) + && !moduleNames.contains(r.name())) { + return true; + } + } + } + return false; + } + /** * Fail because a module in the configuration exports the same package to * a module that reads both. This includes the case where a module M diff --git a/src/java.base/share/classes/java/lang/module/package-info.java b/src/java.base/share/classes/java/lang/module/package-info.java index 45dc40d5218..561a8ab635a 100644 --- a/src/java.base/share/classes/java/lang/module/package-info.java +++ b/src/java.base/share/classes/java/lang/module/package-info.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 @@ -191,6 +191,10 @@ * However, if M is recursively enumerated at step 1 then all modules that are * enumerated and `requires static M` will read M.

    * + *

    The {@linkplain java.lang.module.Configuration##optional-services Optional + * Services} section of {@link java.lang.module.Configuration} shows how resolution + * can be resilient when a service comes from a module that is optional at run time. + * *

    Completeness

    * *

    Resolution may be partial at compile-time in that the complete transitive diff --git a/src/java.base/share/classes/java/lang/reflect/Modifier.java b/src/java.base/share/classes/java/lang/reflect/Modifier.java index 4b13d19f85e..1b7bc3bf65b 100644 --- a/src/java.base/share/classes/java/lang/reflect/Modifier.java +++ b/src/java.base/share/classes/java/lang/reflect/Modifier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * 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,7 +52,7 @@ * @author Kenneth Russell * @since 1.1 */ -public class Modifier { +public final class Modifier { /** * Do not call. */ diff --git a/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java b/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java index c56874e6eda..24b55600954 100644 --- a/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java +++ b/src/java.base/share/classes/java/lang/runtime/ObjectMethods.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 @@ -48,7 +48,7 @@ * * @since 16 */ -public class ObjectMethods { +public final class ObjectMethods { private ObjectMethods() { } diff --git a/src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java b/src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java index 53f1572fa74..2c31b1d0606 100644 --- a/src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java +++ b/src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.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 @@ -74,7 +74,7 @@ * * @since 21 */ -public class SwitchBootstraps { +public final class SwitchBootstraps { private SwitchBootstraps() {} diff --git a/src/java.base/share/classes/java/math/BigDecimal.java b/src/java.base/share/classes/java/math/BigDecimal.java index ceb9053fc2c..583f21a536a 100644 --- a/src/java.base/share/classes/java/math/BigDecimal.java +++ b/src/java.base/share/classes/java/math/BigDecimal.java @@ -35,9 +35,15 @@ import java.io.ObjectInputStream; import java.io.ObjectStreamException; import java.io.StreamCorruptedException; +import java.nio.charset.CharacterCodingException; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Objects; +import jdk.internal.access.JavaLangAccess; +import jdk.internal.access.SharedSecrets; +import jdk.internal.util.DecimalDigits; + /** * Immutable, arbitrary-precision signed decimal numbers. A {@code * BigDecimal} consists of an arbitrary precision integer @@ -328,6 +334,8 @@ * @since 1.1 */ public class BigDecimal extends Number implements Comparable { + private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess(); + /* * Let l = log_2(10). * Then, L < l < L + ulp(L) / 2, that is, L = roundTiesToEven(l). @@ -4164,103 +4172,6 @@ public BigDecimal ulp() { return BigDecimal.valueOf(1, this.scale(), 1); } - // Private class to build a string representation for BigDecimal object. The - // StringBuilder field acts as a buffer to hold the temporary representation - // of BigDecimal. The cmpCharArray holds all the characters for the compact - // representation of BigDecimal (except for '-' sign' if it is negative) if - // its intCompact field is not INFLATED. - static class StringBuilderHelper { - final StringBuilder sb; // Placeholder for BigDecimal string - final char[] cmpCharArray; // character array to place the intCompact - - StringBuilderHelper() { - sb = new StringBuilder(32); - // All non negative longs can be made to fit into 19 character array. - cmpCharArray = new char[19]; - } - - // Accessors. - StringBuilder getStringBuilder() { - sb.setLength(0); - return sb; - } - - char[] getCompactCharArray() { - return cmpCharArray; - } - - /** - * Places characters representing the intCompact in {@code long} into - * cmpCharArray and returns the offset to the array where the - * representation starts. - * - * @param intCompact the number to put into the cmpCharArray. - * @return offset to the array where the representation starts. - * Note: intCompact must be greater or equal to zero. - */ - int putIntCompact(long intCompact) { - assert intCompact >= 0; - - long q; - int r; - // since we start from the least significant digit, charPos points to - // the last character in cmpCharArray. - int charPos = cmpCharArray.length; - - // Get 2 digits/iteration using longs until quotient fits into an int - while (intCompact > Integer.MAX_VALUE) { - q = intCompact / 100; - r = (int)(intCompact - q * 100); - intCompact = q; - cmpCharArray[--charPos] = DIGIT_ONES[r]; - cmpCharArray[--charPos] = DIGIT_TENS[r]; - } - - // Get 2 digits/iteration using ints when i2 >= 100 - int q2; - int i2 = (int)intCompact; - while (i2 >= 100) { - q2 = i2 / 100; - r = i2 - q2 * 100; - i2 = q2; - cmpCharArray[--charPos] = DIGIT_ONES[r]; - cmpCharArray[--charPos] = DIGIT_TENS[r]; - } - - cmpCharArray[--charPos] = DIGIT_ONES[i2]; - if (i2 >= 10) - cmpCharArray[--charPos] = DIGIT_TENS[i2]; - - return charPos; - } - - static final char[] DIGIT_TENS = { - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', - '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', - '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', - '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', - '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', - '6', '6', '6', '6', '6', '6', '6', '6', '6', '6', - '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', - '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', - '9', '9', '9', '9', '9', '9', '9', '9', '9', '9', - }; - - static final char[] DIGIT_ONES = { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - }; - } - /** * Lay out this {@code BigDecimal} into a {@code char[]} array. * The Java 1.2 equivalent to this was called {@code getValueString}. @@ -4271,6 +4182,8 @@ int putIntCompact(long intCompact) { * {@code BigDecimal} */ private String layoutChars(boolean sci) { + long intCompact = this.intCompact; + int scale = this.scale; if (scale == 0) // zero scale is trivial return (intCompact != INFLATED) ? Long.toString(intCompact): @@ -4280,18 +4193,25 @@ private String layoutChars(boolean sci) { // currency fast path int lowInt = (int)intCompact % 100; int highInt = (int)intCompact / 100; - return (Integer.toString(highInt) + '.' + - StringBuilderHelper.DIGIT_TENS[lowInt] + - StringBuilderHelper.DIGIT_ONES[lowInt]) ; + int highIntSize = DecimalDigits.stringSize(highInt); + byte[] buf = new byte[highIntSize + 3]; + DecimalDigits.getCharsLatin1(highInt, highIntSize, buf); + buf[highIntSize] = '.'; + DecimalDigits.putPairLatin1(buf, highIntSize + 1, lowInt); + try { + return JLA.newStringNoRepl(buf, StandardCharsets.ISO_8859_1); + } catch (CharacterCodingException cce) { + throw new AssertionError(cce); + } } - StringBuilderHelper sbHelper = new StringBuilderHelper(); char[] coeff; int offset; // offset is the starting index for coeff array // Get the significand as an absolute value if (intCompact != INFLATED) { - offset = sbHelper.putIntCompact(Math.abs(intCompact)); - coeff = sbHelper.getCompactCharArray(); + // All non negative longs can be made to fit into 19 character array. + coeff = new char[19]; + offset = DecimalDigits.getChars(Math.abs(intCompact), coeff.length, coeff); } else { offset = 0; coeff = intVal.abs().toString().toCharArray(); @@ -4301,7 +4221,7 @@ private String layoutChars(boolean sci) { // If E-notation is needed, length will be: +1 if negative, +1 // if '.' needed, +2 for "E+", + up to 10 for adjusted exponent. // Otherwise it could have +1 if negative, plus leading "0.00000" - StringBuilder buf = sbHelper.getStringBuilder(); + StringBuilder buf = new StringBuilder(32);; if (signum() < 0) // prefix '-' if negative buf.append('-'); int coeffLen = coeff.length - offset; diff --git a/src/java.base/share/classes/java/net/InterfaceAddress.java b/src/java.base/share/classes/java/net/InterfaceAddress.java index 979ed9cc7f5..c0ebae261e8 100644 --- a/src/java.base/share/classes/java/net/InterfaceAddress.java +++ b/src/java.base/share/classes/java/net/InterfaceAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, 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,7 @@ * @see java.net.NetworkInterface * @since 1.6 */ -public class InterfaceAddress { +public final class InterfaceAddress { private InetAddress address = null; private Inet4Address broadcast = null; private short maskLength = 0; diff --git a/src/java.base/share/classes/java/net/URLDecoder.java b/src/java.base/share/classes/java/net/URLDecoder.java index e2070458e2b..45d18c9a470 100644 --- a/src/java.base/share/classes/java/net/URLDecoder.java +++ b/src/java.base/share/classes/java/net/URLDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, 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 @@ -81,7 +81,7 @@ * @since 1.2 */ -public class URLDecoder { +public final class URLDecoder { /** * Do not call. diff --git a/src/java.base/share/classes/java/net/URLEncoder.java b/src/java.base/share/classes/java/net/URLEncoder.java index 3c02dd50e6e..3b5dea4db78 100644 --- a/src/java.base/share/classes/java/net/URLEncoder.java +++ b/src/java.base/share/classes/java/net/URLEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -84,7 +84,7 @@ * @author Herb Jellinek * @since 1.0 */ -public class URLEncoder { +public final class URLEncoder { private static final IntPredicate DONT_NEED_ENCODING; static { diff --git a/src/java.base/share/classes/java/nio/charset/CoderResult.java b/src/java.base/share/classes/java/nio/charset/CoderResult.java index fcce8774171..342fbefbe6d 100644 --- a/src/java.base/share/classes/java/nio/charset/CoderResult.java +++ b/src/java.base/share/classes/java/nio/charset/CoderResult.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, 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 @@ -81,7 +81,7 @@ * @since 1.4 */ -public class CoderResult { +public final class CoderResult { private static final int CR_UNDERFLOW = 0; private static final int CR_OVERFLOW = 1; diff --git a/src/java.base/share/classes/java/nio/charset/CodingErrorAction.java b/src/java.base/share/classes/java/nio/charset/CodingErrorAction.java index c708e634de1..d933756eb1c 100644 --- a/src/java.base/share/classes/java/nio/charset/CodingErrorAction.java +++ b/src/java.base/share/classes/java/nio/charset/CodingErrorAction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, 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 @@ -40,7 +40,7 @@ * @since 1.4 */ -public class CodingErrorAction { +public final class CodingErrorAction { private String name; diff --git a/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java b/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java index cec473cef96..0410179550b 100644 --- a/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java +++ b/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.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 @@ -88,6 +88,7 @@ * Consult the release documentation for your implementation to see if any * other algorithms are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Jan Luehe * * @@ -161,6 +162,7 @@ public final String getAlgorithm() { * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code AlgorithmParameterGenerator} object * * @throws NoSuchAlgorithmException if no {@code Provider} supports an @@ -208,6 +210,7 @@ public static AlgorithmParameterGenerator getInstance(String algorithm) * * @param provider the string name of the {@code Provider}. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code AlgorithmParameterGenerator} object * * @throws IllegalArgumentException if the provider name is {@code null} @@ -258,6 +261,7 @@ public static AlgorithmParameterGenerator getInstance(String algorithm, * * @param provider the {@code Provider} object. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code AlgorithmParameterGenerator} object * * @throws IllegalArgumentException if the specified provider is diff --git a/src/java.base/share/classes/java/security/AlgorithmParameters.java b/src/java.base/share/classes/java/security/AlgorithmParameters.java index 7747d642c20..defe25571f7 100644 --- a/src/java.base/share/classes/java/security/AlgorithmParameters.java +++ b/src/java.base/share/classes/java/security/AlgorithmParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -69,6 +69,7 @@ * Consult the release documentation for your implementation to see if any * other algorithms are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Jan Luehe * * @@ -147,6 +148,7 @@ public final String getAlgorithm() { * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new parameter object * * @throws NoSuchAlgorithmException if no {@code Provider} supports an @@ -194,6 +196,7 @@ public static AlgorithmParameters getInstance(String algorithm) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new parameter object * * @throws IllegalArgumentException if the provider name is {@code null} @@ -244,6 +247,7 @@ public static AlgorithmParameters getInstance(String algorithm, * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new parameter object * * @throws IllegalArgumentException if the provider is {@code null} diff --git a/src/java.base/share/classes/java/security/DrbgParameters.java b/src/java.base/share/classes/java/security/DrbgParameters.java index d979aba9531..5cd8b171c72 100644 --- a/src/java.base/share/classes/java/security/DrbgParameters.java +++ b/src/java.base/share/classes/java/security/DrbgParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, 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 @@ -229,10 +229,11 @@ * * @spec https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90Ar1.pdf * Recommendation for Random Number Generation Using Deterministic Random Bit Generators + * @spec security/standard-names.html Java Security Standard Algorithm Names * * @since 9 */ -public class DrbgParameters { +public final class DrbgParameters { private DrbgParameters() { // This class should not be instantiated diff --git a/src/java.base/share/classes/java/security/Key.java b/src/java.base/share/classes/java/security/Key.java index 190a3db2999..ed6ec42d362 100644 --- a/src/java.base/share/classes/java/security/Key.java +++ b/src/java.base/share/classes/java/security/Key.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * 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,10 +120,9 @@ public interface Key extends java.io.Serializable { /** * Returns the standard algorithm name for this key. For - * example, "DSA" would indicate that this key is a DSA key. - * See the key related sections (KeyFactory, KeyGenerator, - * KeyPairGenerator, and SecretKeyFactory) in the + * example, "RSA" would indicate that this key is an RSA key. + * See the Key Algorithms section in the + * * Java Security Standard Algorithm Names Specification * for information about standard key algorithm names. * diff --git a/src/java.base/share/classes/java/security/KeyFactory.java b/src/java.base/share/classes/java/security/KeyFactory.java index 7c51faf6aa2..8eaf72f1b83 100644 --- a/src/java.base/share/classes/java/security/KeyFactory.java +++ b/src/java.base/share/classes/java/security/KeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -84,6 +84,7 @@ * Consult the release documentation for your implementation to see if any * other algorithms are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Jan Luehe * * @see Key @@ -169,6 +170,7 @@ private KeyFactory(String algorithm) throws NoSuchAlgorithmException { * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KeyFactory} object * * @throws NoSuchAlgorithmException if no {@code Provider} supports a @@ -205,6 +207,7 @@ public static KeyFactory getInstance(String algorithm) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KeyFactory} object * * @throws IllegalArgumentException if the provider name is {@code null} @@ -247,6 +250,7 @@ public static KeyFactory getInstance(String algorithm, String provider) * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KeyFactory} object * * @throws IllegalArgumentException if the specified provider is diff --git a/src/java.base/share/classes/java/security/KeyPairGenerator.java b/src/java.base/share/classes/java/security/KeyPairGenerator.java index 3583248f81e..6d7148a76f5 100644 --- a/src/java.base/share/classes/java/security/KeyPairGenerator.java +++ b/src/java.base/share/classes/java/security/KeyPairGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -131,6 +131,7 @@ * Consult the release documentation for your implementation to see if any * other algorithms are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Benjamin Renaud * @since 1.1 * @@ -157,6 +158,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { * "{@docRoot}/../specs/security/standard-names.html#keypairgenerator-algorithms"> * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. + * @spec security/standard-names.html Java Security Standard Algorithm Names */ protected KeyPairGenerator(String algorithm) { this.algorithm = algorithm; @@ -169,6 +171,7 @@ protected KeyPairGenerator(String algorithm) { * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the standard string name of the algorithm. */ public String getAlgorithm() { @@ -221,6 +224,7 @@ private static KeyPairGenerator getInstance(Instance instance, * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KeyPairGenerator} object * * @throws NoSuchAlgorithmException if no {@code Provider} supports a @@ -280,6 +284,7 @@ public static KeyPairGenerator getInstance(String algorithm) * * @param provider the string name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KeyPairGenerator} object * * @throws IllegalArgumentException if the provider name is {@code null} @@ -320,6 +325,7 @@ public static KeyPairGenerator getInstance(String algorithm, * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @param provider the provider. * * @return the new {@code KeyPairGenerator} object diff --git a/src/java.base/share/classes/java/security/KeyStore.java b/src/java.base/share/classes/java/security/KeyStore.java index b420cc69aa6..9e50a1588e7 100644 --- a/src/java.base/share/classes/java/security/KeyStore.java +++ b/src/java.base/share/classes/java/security/KeyStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -183,6 +183,7 @@ * Consult the release documentation for your implementation to see if any * other types are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Jan Luehe * * @see java.security.PrivateKey @@ -300,6 +301,7 @@ public PasswordProtection(char[] password) { * @throws NullPointerException if {@code protectionAlgorithm} is * {@code null} * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @since 1.8 */ public PasswordProtection(char[] password, String protectionAlgorithm, @@ -852,6 +854,7 @@ private String getProviderName() { * Java Security Standard Algorithm Names Specification * for information about standard keystore types. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a keystore object of the specified type * * @throws KeyStoreException if no provider supports a @@ -893,6 +896,7 @@ public static KeyStore getInstance(String type) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a keystore object of the specified type * * @throws IllegalArgumentException if the provider name is {@code null} @@ -939,6 +943,7 @@ public static KeyStore getInstance(String type, String provider) * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a keystore object of the specified type * * @throws IllegalArgumentException if the specified provider is diff --git a/src/java.base/share/classes/java/security/MessageDigest.java b/src/java.base/share/classes/java/security/MessageDigest.java index f83c4ed6d3b..fa8d3dea8fd 100644 --- a/src/java.base/share/classes/java/security/MessageDigest.java +++ b/src/java.base/share/classes/java/security/MessageDigest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -96,6 +96,7 @@ * Consult the release documentation for your implementation to see if any * other algorithms are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Benjamin Renaud * @since 1.1 * @@ -128,6 +129,7 @@ public abstract class MessageDigest extends MessageDigestSpi { * "{@docRoot}/../specs/security/standard-names.html#messagedigest-algorithms"> * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. + * @spec security/standard-names.html Java Security Standard Algorithm Names */ protected MessageDigest(String algorithm) { this.algorithm = algorithm; @@ -166,6 +168,7 @@ private MessageDigest(String algorithm, Provider p) { * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code MessageDigest} object that implements the * specified algorithm * @@ -221,6 +224,7 @@ public static MessageDigest getInstance(String algorithm) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code MessageDigest} object that implements the * specified algorithm * @@ -275,6 +279,7 @@ public static MessageDigest getInstance(String algorithm, String provider) * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code MessageDigest} object that implements the * specified algorithm * @@ -513,6 +518,7 @@ public void reset() { * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the name of the algorithm */ public final String getAlgorithm() { diff --git a/src/java.base/share/classes/java/security/Provider.java b/src/java.base/share/classes/java/security/Provider.java index 203ffa82345..de2845fb550 100644 --- a/src/java.base/share/classes/java/security/Provider.java +++ b/src/java.base/share/classes/java/security/Provider.java @@ -1147,6 +1147,7 @@ public Service getService(String type, String algorithm) { s = legacyMap.get(key); if (s != null && !s.isValid()) { legacyMap.remove(key, s); + return null; } } diff --git a/src/java.base/share/classes/java/security/SecureRandom.java b/src/java.base/share/classes/java/security/SecureRandom.java index e6cc1134c09..e53341be9da 100644 --- a/src/java.base/share/classes/java/security/SecureRandom.java +++ b/src/java.base/share/classes/java/security/SecureRandom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -144,7 +144,7 @@ * RFC 4086: Randomness Requirements for Security * @spec https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.140-2.pdf * Security Requirements for Cryptographic Modules - * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @see java.security.SecureRandomSpi * @see java.util.Random * @@ -214,6 +214,7 @@ public class SecureRandom extends java.util.Random { * "{@docRoot}/../specs/security/standard-names.html#securerandom-number-generation-algorithms"> * Java Security Standard Algorithm Names Specification * for information about standard RNG algorithm names. + * @spec security/standard-names.html Java Security Standard Algorithm Names */ public SecureRandom() { /* @@ -257,6 +258,7 @@ private boolean getThreadSafe() { * for information about standard RNG algorithm names. * * @param seed the seed. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @throws NullPointerException if {@code seed} is {@code null} */ public SecureRandom(byte[] seed) { @@ -371,6 +373,7 @@ private String getProviderName() { * Java Security Standard Algorithm Names Specification * for information about standard RNG algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code SecureRandom} object * * @throws NoSuchAlgorithmException if no {@code Provider} supports a @@ -412,6 +415,7 @@ public static SecureRandom getInstance(String algorithm) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code SecureRandom} object * * @throws IllegalArgumentException if the provider name is {@code null} @@ -456,6 +460,7 @@ public static SecureRandom getInstance(String algorithm, String provider) * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code SecureRandom} object * * @throws IllegalArgumentException if the specified provider is @@ -511,6 +516,7 @@ public static SecureRandom getInstance(String algorithm, * @param params the {@code SecureRandomParameters} * the newly created {@code SecureRandom} object must support. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code SecureRandom} object * * @throws IllegalArgumentException if the specified params is @@ -563,6 +569,7 @@ public static SecureRandom getInstance( * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code SecureRandom} object * * @throws IllegalArgumentException if the provider name is {@code null} @@ -615,6 +622,7 @@ public static SecureRandom getInstance(String algorithm, * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code SecureRandom} object * * @throws IllegalArgumentException if the specified provider or params diff --git a/src/java.base/share/classes/java/security/SecureRandomSpi.java b/src/java.base/share/classes/java/security/SecureRandomSpi.java index 3185f61720a..4c7c58cae11 100644 --- a/src/java.base/share/classes/java/security/SecureRandomSpi.java +++ b/src/java.base/share/classes/java/security/SecureRandomSpi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2022, 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 @@ -79,6 +79,7 @@ * {@code SecureRandom} will call the applicable engine methods * without any synchronization. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @since 1.2 */ diff --git a/src/java.base/share/classes/java/security/Signature.java b/src/java.base/share/classes/java/security/Signature.java index 006188aac61..52aa4328b2c 100644 --- a/src/java.base/share/classes/java/security/Signature.java +++ b/src/java.base/share/classes/java/security/Signature.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -122,6 +122,7 @@ * Consult the release documentation for your implementation to see if any * other algorithms are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Benjamin Renaud * @since 1.1 * @@ -206,6 +207,7 @@ public void initSign(Signature s, PrivateKey privateKey, * "{@docRoot}/../specs/security/standard-names.html#signature-algorithms"> * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. + * @spec security/standard-names.html Java Security Standard Algorithm Names */ protected Signature(String algorithm) { this.algorithm = algorithm; @@ -252,6 +254,7 @@ protected Signature(String algorithm) { * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code Signature} object * * @throws NoSuchAlgorithmException if no {@code Provider} supports a @@ -375,6 +378,7 @@ private static boolean isSpi(Service s) { * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code Signature} object * * @throws IllegalArgumentException if the provider name is {@code null} @@ -428,6 +432,7 @@ public static Signature getInstance(String algorithm, String provider) * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code Signature} object * * @throws IllegalArgumentException if the provider is {@code null} diff --git a/src/java.base/share/classes/java/security/cert/CertPath.java b/src/java.base/share/classes/java/security/cert/CertPath.java index ffbbf0291b1..54c47c36119 100644 --- a/src/java.base/share/classes/java/security/cert/CertPath.java +++ b/src/java.base/share/classes/java/security/cert/CertPath.java @@ -111,6 +111,7 @@ * generally not difficult, since the {@code CertPath} and * {@code List} objects in question are immutable. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @see CertificateFactory * @see CertPathBuilder * diff --git a/src/java.base/share/classes/java/security/cert/CertPathBuilder.java b/src/java.base/share/classes/java/security/cert/CertPathBuilder.java index de1a86312c4..692bfa0fb8e 100644 --- a/src/java.base/share/classes/java/security/cert/CertPathBuilder.java +++ b/src/java.base/share/classes/java/security/cert/CertPathBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -90,6 +90,7 @@ * threads each manipulating a different {@code CertPathBuilder} instance * need not synchronize. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @see CertPath * * @since 1.4 @@ -154,6 +155,7 @@ protected CertPathBuilder(CertPathBuilderSpi builderSpi, Provider provider, * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code CertPathBuilder} object that implements the * specified algorithm * @@ -194,6 +196,7 @@ public static CertPathBuilder getInstance(String algorithm) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code CertPathBuilder} object that implements the * specified algorithm * @@ -237,6 +240,7 @@ public static CertPathBuilder getInstance(String algorithm, String provider) * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code CertPathBuilder} object that implements the * specified algorithm * diff --git a/src/java.base/share/classes/java/security/cert/CertPathValidator.java b/src/java.base/share/classes/java/security/cert/CertPathValidator.java index c79283b536f..539bee34192 100644 --- a/src/java.base/share/classes/java/security/cert/CertPathValidator.java +++ b/src/java.base/share/classes/java/security/cert/CertPathValidator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -92,6 +92,7 @@ * threads each manipulating a different {@code CertPathValidator} * instance need not synchronize. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @see CertPath * * @since 1.4 @@ -155,6 +156,7 @@ protected CertPathValidator(CertPathValidatorSpi validatorSpi, * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code CertPathValidator} object that implements the * specified algorithm * @@ -195,6 +197,7 @@ public static CertPathValidator getInstance(String algorithm) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code CertPathValidator} object that implements the * specified algorithm * @@ -239,6 +242,7 @@ public static CertPathValidator getInstance(String algorithm, * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code CertPathValidator} object that implements the * specified algorithm * diff --git a/src/java.base/share/classes/java/security/cert/CertStore.java b/src/java.base/share/classes/java/security/cert/CertStore.java index 3801a1fbcaf..ce213a7c2e8 100644 --- a/src/java.base/share/classes/java/security/cert/CertStore.java +++ b/src/java.base/share/classes/java/security/cert/CertStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -84,6 +84,7 @@ * Multiple threads may concurrently invoke the static methods defined in * this class with no ill effects. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @since 1.4 * @author Sean Mullan, Steve Hanna */ @@ -216,6 +217,7 @@ public final Collection getCRLs(CRLSelector selector) * * @param params the initialization parameters (may be {@code null}). * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code CertStore} object that implements the specified * {@code CertStore} type * @@ -282,6 +284,7 @@ private static CertStore handleException(NoSuchAlgorithmException e) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code CertStore} object that implements the * specified type * @@ -343,6 +346,7 @@ public static CertStore getInstance(String type, * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code CertStore} object that implements the * specified type * diff --git a/src/java.base/share/classes/java/security/cert/Certificate.java b/src/java.base/share/classes/java/security/cert/Certificate.java index 618026c894d..50e70da0689 100644 --- a/src/java.base/share/classes/java/security/cert/Certificate.java +++ b/src/java.base/share/classes/java/security/cert/Certificate.java @@ -79,6 +79,7 @@ public abstract class Certificate implements java.io.Serializable { * "{@docRoot}/../specs/security/standard-names.html#certificatefactory-types"> * Java Security Standard Algorithm Names Specification * for information about standard certificate types. + * @spec security/standard-names.html Java Security Standard Algorithm Names */ protected Certificate(String type) { this.type = type; diff --git a/src/java.base/share/classes/java/security/cert/CertificateFactory.java b/src/java.base/share/classes/java/security/cert/CertificateFactory.java index fb47ca29af1..3ee375c163c 100644 --- a/src/java.base/share/classes/java/security/cert/CertificateFactory.java +++ b/src/java.base/share/classes/java/security/cert/CertificateFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2022, 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 @@ -109,6 +109,7 @@ * Consult the release documentation for your implementation to see if any * other types or encodings are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Hemma Prafullchandra * @author Jan Luehe * @author Sean Mullan @@ -176,6 +177,7 @@ protected CertificateFactory(CertificateFactorySpi certFacSpi, * Java Security Standard Algorithm Names Specification * for information about standard certificate types. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a certificate factory object for the specified type * * @throws CertificateException if no {@code Provider} supports a @@ -219,6 +221,7 @@ public static final CertificateFactory getInstance(String type) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a certificate factory object for the specified type * * @throws CertificateException if a {@code CertificateFactorySpi} @@ -265,6 +268,7 @@ public static final CertificateFactory getInstance(String type, * for information about standard certificate types. * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a certificate factory object for the specified type * * @throws CertificateException if a {@code CertificateFactorySpi} @@ -369,6 +373,7 @@ public final Certificate generateCertificate(InputStream inStream) * {@code remove} method result in an * {@code UnsupportedOperationException}. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return an {@code Iterator} over the names of the supported * {@code CertPath} encodings (as {@code String}s) * @since 1.4 @@ -407,6 +412,7 @@ public final CertPath generateCertPath(InputStream inStream) * * @param inStream an {@code InputStream} containing the data * @param encoding the encoding used for the data + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code CertPath} initialized with the data from the * {@code InputStream} * @throws CertificateException if an exception occurs while decoding or diff --git a/src/java.base/share/classes/java/security/cert/CertificateFactorySpi.java b/src/java.base/share/classes/java/security/cert/CertificateFactorySpi.java index 7a782dcc659..1bf346198e6 100644 --- a/src/java.base/share/classes/java/security/cert/CertificateFactorySpi.java +++ b/src/java.base/share/classes/java/security/cert/CertificateFactorySpi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2022, 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 @@ -198,6 +198,7 @@ public CertPath engineGenerateCertPath(InputStream inStream, * existing service providers, this method cannot be {@code abstract} * and by default throws an {@code UnsupportedOperationException}. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return an {@code Iterator} over the names of the supported * {@code CertPath} encodings (as {@code String}s) * @throws UnsupportedOperationException if the method is not supported diff --git a/src/java.base/share/classes/java/security/spec/ECGenParameterSpec.java b/src/java.base/share/classes/java/security/spec/ECGenParameterSpec.java index 4d506726c9f..553793fa469 100644 --- a/src/java.base/share/classes/java/security/spec/ECGenParameterSpec.java +++ b/src/java.base/share/classes/java/security/spec/ECGenParameterSpec.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 @@ -50,6 +50,7 @@ public class ECGenParameterSpec extends NamedParameterSpec { * "{@docRoot}/../specs/security/standard-names.html#ecgenparameterspec"> * Java Security Standard Algorithm Names Specification for * information about standard names. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @throws NullPointerException if {@code stdName} is null. */ public ECGenParameterSpec(String stdName) { diff --git a/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java b/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java index 8bb23d08df3..e9838efdaf1 100644 --- a/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java +++ b/src/java.base/share/classes/java/security/spec/EncodedKeySpec.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 @@ -74,15 +74,17 @@ public EncodedKeySpec(byte[] encodedKey) { * * @param encodedKey the encoded key. The contents of the * array are copied to protect against subsequent modification. - * @param algorithm the algorithm name of the encoded key - * See the KeyFactory section in the + * @param algorithm the algorithm name of the encoded key. + * See the AsymmetricKey Algorithms section in the + * * Java Security Standard Algorithm Names Specification - * for information about standard algorithm names. + * for information about standard asymmetric key algorithm names. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @throws NullPointerException if {@code encodedKey} * or {@code algorithm} is null. * @throws IllegalArgumentException if {@code algorithm} is * the empty string {@code ""} + * @spec security/standard-names.html Java Security Standard Algorithm Names * @since 9 */ protected EncodedKeySpec(byte[] encodedKey, String algorithm) { diff --git a/src/java.base/share/classes/java/security/spec/NamedParameterSpec.java b/src/java.base/share/classes/java/security/spec/NamedParameterSpec.java index d50426b6ccf..c4091705df0 100644 --- a/src/java.base/share/classes/java/security/spec/NamedParameterSpec.java +++ b/src/java.base/share/classes/java/security/spec/NamedParameterSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -36,6 +36,7 @@ * "{@docRoot}/../specs/security/standard-names.html#namedparameterspec"> * Java Security Standard Algorithm Names Specification. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @since 11 * */ @@ -131,6 +132,7 @@ public class NamedParameterSpec implements AlgorithmParameterSpec { * Java Security Standard Algorithm Names Specification for * information about standard names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @throws NullPointerException if {@code stdName} is null. */ public NamedParameterSpec(String stdName) { diff --git a/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java b/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java index 73d79a41321..af7f135d7c4 100644 --- a/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java +++ b/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, 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 @@ -83,15 +83,17 @@ public PKCS8EncodedKeySpec(byte[] encodedKey) { * @param encodedKey the key, which is assumed to be * encoded according to the PKCS #8 standard. The contents of * the array are copied to protect against subsequent modification. - * @param algorithm the algorithm name of the encoded private key - * See the KeyFactory section in the + * @param algorithm the algorithm name of the encoded private key. + * See the AsymmetricKey Algorithms section in the + * * Java Security Standard Algorithm Names Specification - * for information about standard algorithm names. + * for information about standard asymmetric key algorithm names. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @throws NullPointerException if {@code encodedKey} * or {@code algorithm} is null. * @throws IllegalArgumentException if {@code algorithm} is * the empty string {@code ""} + * @spec security/standard-names.html Java Security Standard Algorithm Names * @since 9 */ public PKCS8EncodedKeySpec(byte[] encodedKey, String algorithm) { diff --git a/src/java.base/share/classes/java/security/spec/PSSParameterSpec.java b/src/java.base/share/classes/java/security/spec/PSSParameterSpec.java index a05ce1b4b7a..504154b2360 100644 --- a/src/java.base/share/classes/java/security/spec/PSSParameterSpec.java +++ b/src/java.base/share/classes/java/security/spec/PSSParameterSpec.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 @@ -140,6 +140,7 @@ public class PSSParameterSpec implements AlgorithmParameterSpec { * getMGFParameters(). * @param saltLen the length of salt in bytes * @param trailerField the value of the trailer field + * @spec security/standard-names.html Java Security Standard Algorithm Names * @throws NullPointerException if {@code mdName}, or {@code mgfName} * is null * @throws IllegalArgumentException if {@code saltLen} or diff --git a/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java b/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java index 7de4a2a1417..a405104cd07 100644 --- a/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java +++ b/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, 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 @@ -73,15 +73,17 @@ public X509EncodedKeySpec(byte[] encodedKey) { * @param encodedKey the key, which is assumed to be * encoded according to the X.509 standard. The contents of the * array are copied to protect against subsequent modification. - * @param algorithm the algorithm name of the encoded public key - * See the KeyFactory section in the + * @param algorithm the algorithm name of the encoded public key. + * See the AsymmetricKey Algorithms section in the + * * Java Security Standard Algorithm Names Specification - * for information about standard algorithm names. + * for information about standard asymmetric key algorithm names. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @throws NullPointerException if {@code encodedKey} * or {@code algorithm} is null. * @throws IllegalArgumentException if {@code algorithm} is * the empty string {@code ""} + * @spec security/standard-names.html Java Security Standard Algorithm Names * @since 9 */ public X509EncodedKeySpec(byte[] encodedKey, String algorithm) { diff --git a/src/java.base/share/classes/java/util/Base64.java b/src/java.base/share/classes/java/util/Base64.java index 60b6c18c078..ed1a4a8d638 100644 --- a/src/java.base/share/classes/java/util/Base64.java +++ b/src/java.base/share/classes/java/util/Base64.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, 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 @@ -81,7 +81,7 @@ * @since 1.8 */ -public class Base64 { +public final class Base64 { private Base64() {} diff --git a/src/java.base/share/classes/java/util/Collections.java b/src/java.base/share/classes/java/util/Collections.java index 2afb94af114..ec08168e2a2 100644 --- a/src/java.base/share/classes/java/util/Collections.java +++ b/src/java.base/share/classes/java/util/Collections.java @@ -82,7 +82,7 @@ * @since 1.2 */ -public class Collections { +public final class Collections { // Suppresses default constructor, ensuring non-instantiability. private Collections() { } diff --git a/src/java.base/share/classes/java/util/Currency.java b/src/java.base/share/classes/java/util/Currency.java index 789eefad5d5..9f8b94acbd7 100644 --- a/src/java.base/share/classes/java/util/Currency.java +++ b/src/java.base/share/classes/java/util/Currency.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -444,8 +444,8 @@ public static Currency getInstance(Locale locale) { public static Set getAvailableCurrencies() { synchronized(Currency.class) { if (available == null) { + var sysTime = System.currentTimeMillis(); available = new HashSet<>(256); - // Add simple currencies first for (char c1 = 'A'; c1 <= 'Z'; c1 ++) { for (char c2 = 'A'; c2 <= 'Z'; c2 ++) { @@ -467,7 +467,7 @@ public static Set getAvailableCurrencies() { SpecialCaseEntry scEntry = specialCasesList.get(index); if (scEntry.cutOverTime == Long.MAX_VALUE - || System.currentTimeMillis() < scEntry.cutOverTime) { + || sysTime < scEntry.cutOverTime) { available.add(getInstance(scEntry.oldCurrency, scEntry.oldCurrencyFraction, scEntry.oldCurrencyNumericCode)); diff --git a/src/java.base/share/classes/java/util/FormattableFlags.java b/src/java.base/share/classes/java/util/FormattableFlags.java index 92c020f9991..b73baa39c2a 100644 --- a/src/java.base/share/classes/java/util/FormattableFlags.java +++ b/src/java.base/share/classes/java/util/FormattableFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2010, 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 @@ -33,7 +33,7 @@ * * @since 1.5 */ -public class FormattableFlags { +public final class FormattableFlags { // Explicit instantiation of this class is prohibited. private FormattableFlags() {} diff --git a/src/java.base/share/classes/java/util/TimeZone.java b/src/java.base/share/classes/java/util/TimeZone.java index 7c7e24814c3..52d06a858b0 100644 --- a/src/java.base/share/classes/java/util/TimeZone.java +++ b/src/java.base/share/classes/java/util/TimeZone.java @@ -41,6 +41,7 @@ import java.io.Serializable; import java.time.ZoneId; import java.time.ZoneOffset; +import java.util.stream.Stream; import jdk.internal.util.StaticProperty; import sun.util.calendar.ZoneInfo; @@ -545,7 +546,7 @@ public boolean observesDaylightTime() { * cannot be understood. * @throws NullPointerException if {@code ID} is {@code null} */ - public static synchronized TimeZone getTimeZone(String ID) { + public static TimeZone getTimeZone(String ID) { return getTimeZone(ID, true); } @@ -615,24 +616,63 @@ private static TimeZone getTimeZone(String ID, boolean fallback) { /** * Gets the available IDs according to the given time zone offset in milliseconds. * + * @apiNote Consider using {@link #availableIDs(int)} which returns + * a stream of the available time zone IDs according to the given offset. + * * @param rawOffset the given time zone GMT offset in milliseconds. * @return an array of IDs, where the time zone for that ID has * the specified GMT offset. For example, "America/Phoenix" and "America/Denver" * both have GMT-07:00, but differ in daylight saving behavior. * @see #getRawOffset() + * @see #availableIDs(int) */ - public static synchronized String[] getAvailableIDs(int rawOffset) { + public static String[] getAvailableIDs(int rawOffset) { return ZoneInfo.getAvailableIDs(rawOffset); } /** - * Gets all the available IDs supported. - * @return an array of IDs. + * {@return an array of the available IDs supported} + * + * @apiNote Consider using {@link #availableIDs()} which returns + * a stream of the available time zone IDs. + * + * @see #availableIDs() */ - public static synchronized String[] getAvailableIDs() { + public static String[] getAvailableIDs() { return ZoneInfo.getAvailableIDs(); } + /** + * Gets the available IDs according to the given time zone offset in milliseconds. + * + * @implNote Unlike {@link #getAvailableIDs(int)}, this method does + * not create a copy of the {@code TimeZone} IDs array. + * + * @param rawOffset the given time zone GMT offset in milliseconds. + * @return a stream of IDs, where the time zone for that ID has + * the specified GMT offset. For example, "America/Phoenix" and "America/Denver" + * both have GMT-07:00, but differ in daylight saving behavior. + * @see #getRawOffset() + * @see #getAvailableIDs(int) + * @since 25 + */ + public static Stream availableIDs(int rawOffset) { + return ZoneInfo.availableIDs(rawOffset); + } + + /** + * {@return a stream of the available IDs supported} + * + * @implNote Unlike {@link #getAvailableIDs()}, this method does + * not create a copy of the {@code TimeZone} IDs array. + * + * @since 25 + * @see #getAvailableIDs() + */ + public static Stream availableIDs() { + return ZoneInfo.availableIDs(); + } + /** * Gets the platform defined TimeZone ID. **/ diff --git a/src/java.base/share/classes/java/util/concurrent/Executors.java b/src/java.base/share/classes/java/util/concurrent/Executors.java index f804e225790..49cf497c20b 100644 --- a/src/java.base/share/classes/java/util/concurrent/Executors.java +++ b/src/java.base/share/classes/java/util/concurrent/Executors.java @@ -68,7 +68,7 @@ * @since 1.5 * @author Doug Lea */ -public class Executors { +public final class Executors { /** * Creates a thread pool that reuses a fixed number of threads diff --git a/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java b/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java index d6c45c7b04f..917678b5f1e 100644 --- a/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java +++ b/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java @@ -139,7 +139,7 @@ * * @since 1.5 */ -public class LockSupport { +public final class LockSupport { private LockSupport() {} // Cannot be instantiated. private static void setBlocker(Thread t, Object arg) { diff --git a/src/java.base/share/classes/javax/crypto/Cipher.java b/src/java.base/share/classes/javax/crypto/Cipher.java index 8187f863b5c..3de732c6687 100644 --- a/src/java.base/share/classes/javax/crypto/Cipher.java +++ b/src/java.base/share/classes/javax/crypto/Cipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -169,6 +169,7 @@ * RFC 5116: An Interface and Algorithms for Authenticated Encryption * @spec https://www.rfc-editor.org/info/rfc7539 * RFC 7539: ChaCha20 and Poly1305 for IETF Protocols + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Jan Luehe * @see KeyGenerator * @see SecretKey @@ -520,6 +521,7 @@ private static Transform getTransform(Service s, * Java Security Standard Algorithm Names Specification * for information about standard transformation names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code Cipher} object that implements the requested * transformation * @@ -611,6 +613,7 @@ public static final Cipher getInstance(String transformation) * * @param provider the name of the provider * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code Cipher} object that implements the requested * transformation * @@ -683,6 +686,7 @@ private String getProviderName() { * * @param provider the provider * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code Cipher} object that implements the requested * transformation * diff --git a/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java b/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java index d360b3577a0..63686b8433f 100644 --- a/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java +++ b/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -129,6 +129,7 @@ public final String getName() { * Java Security Standard Algorithm Names Specification * for information about standard exemption mechanism names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code ExemptionMechanism} object * * @throws NoSuchAlgorithmException if no {@code Provider} supports an @@ -170,6 +171,7 @@ public static final ExemptionMechanism getInstance(String algorithm) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code ExemptionMechanism} object * * @throws IllegalArgumentException if the {@code provider} @@ -214,6 +216,7 @@ public static final ExemptionMechanism getInstance(String algorithm, * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code ExemptionMechanism} object * * @throws IllegalArgumentException if the {@code provider} diff --git a/src/java.base/share/classes/javax/crypto/KDF.java b/src/java.base/share/classes/javax/crypto/KDF.java index 0ee0904c1c2..5c9c7e71ce4 100644 --- a/src/java.base/share/classes/javax/crypto/KDF.java +++ b/src/java.base/share/classes/javax/crypto/KDF.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 @@ -222,6 +222,7 @@ public KDFParameters getParameters() { * Java Security Standard Algorithm Names Specification for * information about standard KDF algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code KDF} object * * @throws NoSuchAlgorithmException @@ -256,6 +257,7 @@ public static KDF getInstance(String algorithm) * @param provider * the provider to use for this key derivation * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code KDF} object * * @throws NoSuchAlgorithmException @@ -291,6 +293,7 @@ public static KDF getInstance(String algorithm, String provider) * @param provider * the provider to use for this key derivation * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code KDF} object * * @throws NoSuchAlgorithmException @@ -332,6 +335,7 @@ public static KDF getInstance(String algorithm, Provider provider) * the {@code KDFParameters} used to configure the derivation * algorithm or {@code null} if no parameters are provided * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code KDF} object * * @throws NoSuchAlgorithmException @@ -375,6 +379,7 @@ public static KDF getInstance(String algorithm, * @param provider * the provider to use for this key derivation * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code KDF} object * * @throws NoSuchAlgorithmException @@ -428,6 +433,7 @@ public static KDF getInstance(String algorithm, * @param provider * the provider to use for this key derivation * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a {@code KDF} object * * @throws NoSuchAlgorithmException @@ -477,7 +483,11 @@ private static KDF handleException(NoSuchAlgorithmException e) * Derives a key, returned as a {@code SecretKey} object. * * @param alg - * the algorithm of the resultant {@code SecretKey} object + * the algorithm of the resultant {@code SecretKey} object. + * See the SecretKey Algorithms section in the + * + * Java Security Standard Algorithm Names Specification + * for information about standard secret key algorithm names. * @param derivationSpec * the object describing the inputs to the derivation function * @@ -494,6 +504,7 @@ private static KDF handleException(NoSuchAlgorithmException e) * * @see Delayed Provider * Selection + * @spec security/standard-names.html Java Security Standard Algorithm Names * */ public SecretKey deriveKey(String alg, diff --git a/src/java.base/share/classes/javax/crypto/KDFSpi.java b/src/java.base/share/classes/javax/crypto/KDFSpi.java index dcd2029c0c0..e2625a1930d 100644 --- a/src/java.base/share/classes/javax/crypto/KDFSpi.java +++ b/src/java.base/share/classes/javax/crypto/KDFSpi.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 @@ -115,7 +115,11 @@ protected KDFSpi(KDFParameters kdfParameters) * result of {@code deriveData}. * * @param alg - * the algorithm of the resultant {@code SecretKey} object + * the algorithm of the resultant {@code SecretKey} object. + * See the SecretKey Algorithms section in the + * + * Java Security Standard Algorithm Names Specification + * for information about standard secret key algorithm names. * @param derivationSpec * derivation parameters * @@ -129,6 +133,7 @@ protected KDFSpi(KDFParameters kdfParameters) * if {@code alg} is empty or invalid * @throws NullPointerException * if {@code alg} or {@code derivationSpec} is null + * @spec security/standard-names.html Java Security Standard Algorithm Names */ protected abstract SecretKey engineDeriveKey(String alg, AlgorithmParameterSpec derivationSpec) @@ -154,4 +159,4 @@ protected abstract byte[] engineDeriveData( AlgorithmParameterSpec derivationSpec) throws InvalidAlgorithmParameterException; -} \ No newline at end of file +} diff --git a/src/java.base/share/classes/javax/crypto/KEM.java b/src/java.base/share/classes/javax/crypto/KEM.java index 3cb053c194c..927b36ba25c 100644 --- a/src/java.base/share/classes/javax/crypto/KEM.java +++ b/src/java.base/share/classes/javax/crypto/KEM.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 @@ -222,7 +222,13 @@ public Encapsulated encapsulate() { * to be returned, inclusive * @param to the final index of the shared secret byte array * to be returned, exclusive - * @param algorithm the algorithm name for the secret key that is returned + * @param algorithm the algorithm name for the secret key that is returned. + * See the SecretKey Algorithms section in the + * + * Java Security Standard Algorithm Names Specification + * for information about standard secret key algorithm names. + * Specify "Generic" if the output will be used as the input keying + * material of a key derivation function (KDF). * @return a {@link Encapsulated} object containing a portion of * the shared secret, key encapsulation message, and optional * parameters. The portion of the shared secret is a @@ -237,6 +243,7 @@ public Encapsulated encapsulate() { * @throws UnsupportedOperationException if the combination of * {@code from}, {@code to}, and {@code algorithm} * is not supported by the encapsulator + * @spec security/standard-names.html Java Security Standard Algorithm Names */ public Encapsulated encapsulate(int from, int to, String algorithm) { return e.engineEncapsulate(from, to, algorithm); @@ -345,7 +352,13 @@ public SecretKey decapsulate(byte[] encapsulation) throws DecapsulateException { * to be returned, inclusive * @param to the final index of the shared secret byte array * to be returned, exclusive - * @param algorithm the algorithm name for the secret key that is returned + * @param algorithm the algorithm name for the secret key that is returned. + * See the SecretKey Algorithms section in the + * + * Java Security Standard Algorithm Names Specification + * for information about standard secret key algorithm names. + * Specify "Generic" if the output will be used as the input keying + * material of a key derivation function (KDF). * @return a portion of the shared secret as a {@code SecretKey} * containing the bytes of the secret ranging from {@code from} * to {@code to}, exclusive, and an algorithm name as specified. @@ -361,6 +374,7 @@ public SecretKey decapsulate(byte[] encapsulation) throws DecapsulateException { * @throws UnsupportedOperationException if the combination of * {@code from}, {@code to}, and {@code algorithm} * is not supported by the decapsulator + * @spec security/standard-names.html Java Security Standard Algorithm Names */ public SecretKey decapsulate(byte[] encapsulation, int from, int to, String algorithm) @@ -531,6 +545,7 @@ private KEM(String algorithm, DelayedKEM delayed) { * "{@docRoot}/../specs/security/standard-names.html#kem-algorithms"> * Java Security Standard Algorithm Names Specification * for information about standard KEM algorithm names. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KEM} object * @throws NoSuchAlgorithmException if no {@code Provider} supports a * {@code KEM} implementation for the specified algorithm @@ -568,6 +583,7 @@ public static KEM getInstance(String algorithm) * for information about standard KEM algorithm names. * @param provider the provider. If {@code null}, this method is equivalent * to {@link #getInstance(String)}. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KEM} object * @throws NoSuchAlgorithmException if a {@code provider} is specified and * it does not support the specified KEM algorithm, @@ -599,6 +615,7 @@ public static KEM getInstance(String algorithm, Provider provider) * for information about standard KEM algorithm names. * @param provider the provider. If {@code null}, this method is equivalent * to {@link #getInstance(String)}. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KEM} object * @throws NoSuchAlgorithmException if a {@code provider} is specified and * it does not support the specified KEM algorithm, diff --git a/src/java.base/share/classes/javax/crypto/KEMSpi.java b/src/java.base/share/classes/javax/crypto/KEMSpi.java index 61d13aeb024..6f6eefedbb9 100644 --- a/src/java.base/share/classes/javax/crypto/KEMSpi.java +++ b/src/java.base/share/classes/javax/crypto/KEMSpi.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 @@ -129,7 +129,13 @@ interface EncapsulatorSpi { * to be returned, inclusive * @param to the final index of the shared secret byte array * to be returned, exclusive - * @param algorithm the algorithm name for the secret key that is returned + * @param algorithm the algorithm name for the secret key that is returned. + * See the SecretKey Algorithms section in the + * + * Java Security Standard Algorithm Names Specification + * for information about standard secret key algorithm names. + * Specify "Generic" if the output will be used as the input keying + * material of a key derivation function (KDF). * @return an {@link KEM.Encapsulated} object containing a portion of * the shared secret as a key with the specified algorithm, * key encapsulation message, and optional parameters. @@ -141,6 +147,7 @@ interface EncapsulatorSpi { * is not supported by the encapsulator * @see KEM.Encapsulated * @see KEM.Encapsulator#encapsulate(int, int, String) + * @spec security/standard-names.html Java Security Standard Algorithm Names */ KEM.Encapsulated engineEncapsulate(int from, int to, String algorithm); @@ -188,7 +195,13 @@ interface DecapsulatorSpi { * to be returned, inclusive * @param to the final index of the shared secret byte array * to be returned, exclusive - * @param algorithm the algorithm name for the secret key that is returned + * @param algorithm the algorithm name for the secret key that is returned. + * See the SecretKey Algorithms section in the + * + * Java Security Standard Algorithm Names Specification + * for information about standard secret key algorithm names. + * Specify "Generic" if the output will be used as the input keying + * material of a key derivation function (KDF). * @return a portion of the shared secret as a {@code SecretKey} with * the specified algorithm * @throws DecapsulateException if an error occurs during the @@ -201,6 +214,7 @@ interface DecapsulatorSpi { * {@code from}, {@code to}, and {@code algorithm} * is not supported by the decapsulator * @see KEM.Decapsulator#decapsulate(byte[], int, int, String) + * @spec security/standard-names.html Java Security Standard Algorithm Names */ SecretKey engineDecapsulate(byte[] encapsulation, int from, int to, String algorithm) throws DecapsulateException; diff --git a/src/java.base/share/classes/javax/crypto/KeyAgreement.java b/src/java.base/share/classes/javax/crypto/KeyAgreement.java index 5e2ceb185aa..4b3a3fd1cf7 100644 --- a/src/java.base/share/classes/javax/crypto/KeyAgreement.java +++ b/src/java.base/share/classes/javax/crypto/KeyAgreement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -71,6 +71,7 @@ * Consult the release documentation for your implementation to see if any * other algorithms are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Jan Luehe * * @see KeyGenerator @@ -170,6 +171,7 @@ public final String getAlgorithm() { * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KeyAgreement} object * * @throws NoSuchAlgorithmException if no {@code Provider} supports a @@ -217,6 +219,7 @@ public static final KeyAgreement getInstance(String algorithm) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KeyAgreement} object * * @throws IllegalArgumentException if the {@code provider} @@ -261,6 +264,7 @@ public static final KeyAgreement getInstance(String algorithm, * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KeyAgreement} object * * @throws IllegalArgumentException if the {@code provider} @@ -662,18 +666,30 @@ public final int generateSecret(byte[] sharedSecret, int offset) * {@code generateSecret} to change the private information used in * subsequent operations. * - * @param algorithm the requested secret-key algorithm - * - * @return the shared secret key + * @param algorithm the requested secret key algorithm. This is different + * from the {@code KeyAgreement} algorithm provided to the + * {@code getInstance} method. See the SecretKey Algorithms section in the + * + * Java Security Standard Algorithm Names Specification + * for information about standard secret key algorithm names. + * Specify "Generic" if the output will be used as the input keying + * material of a key derivation function (KDF). + * + * @return the shared secret key. The length of the key material + * may be adjusted to be compatible with the specified algorithm, + * regardless of whether the key is extractable. If {@code algorithm} + * is specified as "Generic" and it is supported by the implementation, + * the full shared secret is returned. * * @exception IllegalStateException if this key agreement has not been * initialized or if {@code doPhase} has not been called to supply the * keys for all parties in the agreement - * @exception NoSuchAlgorithmException if the specified secret-key - * algorithm is not available - * @exception InvalidKeyException if the shared secret-key material cannot + * @exception NoSuchAlgorithmException if the specified secret key + * algorithm is not supported + * @exception InvalidKeyException if the shared secret key material cannot * be used to generate a secret key of the specified algorithm (e.g., * the key material is too short) + * @spec security/standard-names.html Java Security Standard Algorithm Names */ public final SecretKey generateSecret(String algorithm) throws IllegalStateException, NoSuchAlgorithmException, diff --git a/src/java.base/share/classes/javax/crypto/KeyAgreementSpi.java b/src/java.base/share/classes/javax/crypto/KeyAgreementSpi.java index a4c242e46cc..84d68a39725 100644 --- a/src/java.base/share/classes/javax/crypto/KeyAgreementSpi.java +++ b/src/java.base/share/classes/javax/crypto/KeyAgreementSpi.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 @@ -205,18 +205,30 @@ protected abstract int engineGenerateSecret(byte[] sharedSecret, * {@code generateSecret} to change the private information used in * subsequent operations. * - * @param algorithm the requested secret key algorithm - * - * @return the shared secret key + * @param algorithm the requested secret key algorithm. This is different + * from the {@code KeyAgreement} algorithm provided to the + * {@code getInstance} method. See the SecretKey Algorithms section in the + * + * Java Security Standard Algorithm Names Specification + * for information about standard secret key algorithm names. + * Specify "Generic" if the output will be used as the input keying + * material of a key derivation function (KDF). + * + * @return the shared secret key. The length of the key material + * may be adjusted to be compatible with the specified algorithm, + * regardless of whether the key is extractable. If {@code algorithm} + * is specified as "Generic" and it is supported by the implementation, + * the full shared secret is returned. * * @exception IllegalStateException if this key agreement has not been * initialized or if {@code doPhase} has not been called to supply the * keys for all parties in the agreement - * @exception NoSuchAlgorithmException if the requested secret key - * algorithm is not available + * @exception NoSuchAlgorithmException if the specified secret key + * algorithm is not supported * @exception InvalidKeyException if the shared secret key material cannot * be used to generate a secret key of the requested algorithm type (e.g., * the key material is too short) + * @spec security/standard-names.html Java Security Standard Algorithm Names */ protected abstract SecretKey engineGenerateSecret(String algorithm) throws IllegalStateException, NoSuchAlgorithmException, diff --git a/src/java.base/share/classes/javax/crypto/KeyGenerator.java b/src/java.base/share/classes/javax/crypto/KeyGenerator.java index ad112e6ffeb..02d0bd75753 100644 --- a/src/java.base/share/classes/javax/crypto/KeyGenerator.java +++ b/src/java.base/share/classes/javax/crypto/KeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -109,6 +109,7 @@ * Consult the release documentation for your implementation to see if any * other algorithms are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Jan Luehe * * @see SecretKey @@ -226,6 +227,7 @@ public final String getAlgorithm() { * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KeyGenerator} object * * @throws NoSuchAlgorithmException if no {@code Provider} supports a @@ -262,6 +264,7 @@ public static final KeyGenerator getInstance(String algorithm) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KeyGenerator} object * * @throws IllegalArgumentException if the {@code provider} @@ -305,6 +308,7 @@ public static final KeyGenerator getInstance(String algorithm, * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code KeyGenerator} object * * @throws IllegalArgumentException if the {@code provider} diff --git a/src/java.base/share/classes/javax/crypto/Mac.java b/src/java.base/share/classes/javax/crypto/Mac.java index d4de87304b3..fb1eb2c310a 100644 --- a/src/java.base/share/classes/javax/crypto/Mac.java +++ b/src/java.base/share/classes/javax/crypto/Mac.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, 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 @@ -66,6 +66,7 @@ * Consult the release documentation for your implementation to see if any * other algorithms are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Jan Luehe * * @since 1.4 @@ -165,6 +166,7 @@ public final String getAlgorithm() { * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code Mac} object * * @throws NoSuchAlgorithmException if no {@code Provider} supports a @@ -210,6 +212,7 @@ public static final Mac getInstance(String algorithm) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code Mac} object * * @throws IllegalArgumentException if the {@code provider} @@ -251,6 +254,7 @@ public static final Mac getInstance(String algorithm, String provider) * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code Mac} object * * @throws IllegalArgumentException if the {@code provider} is diff --git a/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java b/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java index 1156c40b77c..49b8605ad4d 100644 --- a/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java +++ b/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -68,6 +68,7 @@ * Consult the release documentation for your implementation to see if any * other algorithms are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Jan Luehe * * @see SecretKey @@ -146,6 +147,7 @@ private SecretKeyFactory(String algorithm) throws NoSuchAlgorithmException { * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code SecretKeyFactory} object * * @throws NoSuchAlgorithmException if no {@code Provider} supports a @@ -183,6 +185,7 @@ public static final SecretKeyFactory getInstance(String algorithm) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code SecretKeyFactory} object * * @throws IllegalArgumentException if the {@code provider} @@ -227,6 +230,7 @@ public static final SecretKeyFactory getInstance(String algorithm, * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code SecretKeyFactory} object * * @throws IllegalArgumentException if the {@code provider} diff --git a/src/java.base/share/classes/javax/crypto/spec/SecretKeySpec.java b/src/java.base/share/classes/javax/crypto/spec/SecretKeySpec.java index d36510a21a8..be185cb34ad 100644 --- a/src/java.base/share/classes/javax/crypto/spec/SecretKeySpec.java +++ b/src/java.base/share/classes/javax/crypto/spec/SecretKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, 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 @@ -93,9 +93,10 @@ public class SecretKeySpec implements KeySpec, SecretKey { * the array are copied to protect against subsequent modification. * @param algorithm the name of the secret-key algorithm to be associated * with the given key material. - * See the - * Java Security Standard Algorithm Names document - * for information about standard algorithm names. + * See the SecretKey Algorithms section in the + * + * Java Security Standard Algorithm Names Specification + * for information about standard secret key algorithm names. * @exception IllegalArgumentException if algorithm * is null or key is null or empty. * @@ -137,9 +138,10 @@ public SecretKeySpec(byte[] key, String algorithm) { * @param len the length of the key material. * @param algorithm the name of the secret-key algorithm to be associated * with the given key material. - * See the - * Java Security Standard Algorithm Names document - * for information about standard algorithm names. + * See the SecretKey Algorithms section in the + * + * Java Security Standard Algorithm Names Specification + * for information about standard secret key algorithm names. * @exception IllegalArgumentException if algorithm * is null or key is null, empty, or too short, * i.e. {@code key.length-offset * for information about standard protocol names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code SSLContext} object * * @throws NoSuchAlgorithmException if no {@code Provider} supports a @@ -200,6 +202,7 @@ public static SSLContext getInstance(String protocol) * * @param provider the name of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code SSLContext} object * * @throws IllegalArgumentException if the provider name is @@ -242,6 +245,7 @@ public static SSLContext getInstance(String protocol, String provider) * * @param provider an instance of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code SSLContext} object * * @throws IllegalArgumentException if the provider is {@code null} diff --git a/src/java.base/share/classes/javax/net/ssl/SSLEngine.java b/src/java.base/share/classes/javax/net/ssl/SSLEngine.java index 6d066ea5ca9..228750e080c 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLEngine.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLEngine.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 @@ -917,6 +917,7 @@ public abstract SSLEngineResult unwrap(ByteBuffer src, * Algorithm Names Specification, and may also include other cipher * suites that the provider supports. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return an array of cipher suite names * @see #getEnabledCipherSuites() * @see #setEnabledCipherSuites(String[]) @@ -943,6 +944,7 @@ public abstract SSLEngineResult unwrap(ByteBuffer src, * Algorithm Names Specification, and may also include other cipher * suites that the provider supports. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return an array of cipher suite names * @see #getSupportedCipherSuites() * @see #setEnabledCipherSuites(String[]) @@ -970,6 +972,7 @@ public abstract SSLEngineResult unwrap(ByteBuffer src, * on why a specific cipher suite may never be used on an engine. * * @param suites Names of all the cipher suites to enable + * @spec security/standard-names.html Java Security Standard Algorithm Names * @throws IllegalArgumentException when one or more of the ciphers * named by the parameter is not supported, or when the * parameter is null. diff --git a/src/java.base/share/classes/javax/net/ssl/SSLParameters.java b/src/java.base/share/classes/javax/net/ssl/SSLParameters.java index e1f43994064..88fa6924899 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLParameters.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, 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 @@ -113,6 +113,7 @@ public SSLParameters() { * Algorithm Names Specification. Providers may support cipher suite * names not found in this list. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @param cipherSuites the array of ciphersuites (or null) */ @SuppressWarnings("this-escape") @@ -134,6 +135,7 @@ public SSLParameters(String[] cipherSuites) { * Algorithm Names Specification. Providers may support cipher suite * names not found in this list. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @param cipherSuites the array of ciphersuites (or null) * @param protocols the array of protocols (or null) */ @@ -158,6 +160,7 @@ private static String[] clone(String[] s) { * Algorithm Names Specification, and may also include other cipher suites * that the provider supports. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a copy of the array of ciphersuites or null if none * have been set. */ @@ -175,6 +178,7 @@ public String[] getCipherSuites() { * Algorithm Names Specification. Providers may support cipher suite * names not found in this list or might not use the recommended name * for a certain cipher suite. + * @spec security/standard-names.html Java Security Standard Algorithm Names */ public void setCipherSuites(String[] cipherSuites) { this.cipherSuites = clone(cipherSuites); @@ -749,6 +753,7 @@ public void setApplicationProtocols(String[] protocols) { * with the SunJSSE provider to override the provider-specific default * signature schemes. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return an array of signature scheme {@code Strings} or {@code null} if * none have been set. For non-null returns, this method will * return a new array each time it is invoked. The array is @@ -794,6 +799,7 @@ public String[] getSignatureSchemes() { * method will make a copy of this array. Providers should ignore * unknown signature scheme names while establishing the * SSL/TLS/DTLS connections. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @throws IllegalArgumentException if any element in the * {@code signatureSchemes} array is {@code null} or * {@linkplain String#isBlank() blank}. @@ -868,6 +874,7 @@ public void setSignatureSchemes(String[] signatureSchemes) { * {@systemProperty jdk.tls.namedGroups} system property with the SunJSSE * provider to override the provider-specific default named groups. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return an array of key exchange named group names {@code Strings} or * {@code null} if none have been set. For non-null returns, this * method will return a new array each time it is invoked. The @@ -913,6 +920,7 @@ public String[] getNamedGroups() { * This method will make a copy of this array. Providers should * ignore unknown named group scheme names while establishing the * SSL/TLS/DTLS connections. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @throws IllegalArgumentException if any element in the * {@code namedGroups} array is a duplicate, {@code null} or * {@linkplain String#isBlank() blank}. diff --git a/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java b/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java index b4afed41a1b..71cb304edbc 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -177,6 +177,7 @@ protected SSLServerSocket(int port, int backlog, InetAddress address) * Algorithm Names Specification, and may also include other cipher * suites that the provider supports. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return an array of cipher suites enabled * @see #getSupportedCipherSuites() * @see #setEnabledCipherSuites(String[]) @@ -211,6 +212,7 @@ protected SSLServerSocket(int port, int backlog, InetAddress address) * @exception IllegalArgumentException when one or more of ciphers * named by the parameter is not supported, or when * the parameter is null. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @see #getSupportedCipherSuites() * @see #getEnabledCipherSuites() */ @@ -233,6 +235,7 @@ protected SSLServerSocket(int port, int backlog, InetAddress address) * Algorithm Names Specification, and may also include other cipher * suites that the provider supports. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return an array of cipher suite names * @see #getEnabledCipherSuites() * @see #setEnabledCipherSuites(String[]) diff --git a/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java b/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java index 22f64f98f29..6a35a34e5f4 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.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 @@ -91,6 +91,7 @@ public static ServerSocketFactory getDefault() { * Algorithm Names Specification, and may also include other cipher * suites that the provider supports. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @see #getSupportedCipherSuites() * @return array of the cipher suites enabled by default */ @@ -112,6 +113,7 @@ public static ServerSocketFactory getDefault() { * Algorithm Names Specification, and may also include other cipher * suites that the provider supports. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return an array of cipher suite names * @see #getDefaultCipherSuites() */ diff --git a/src/java.base/share/classes/javax/net/ssl/SSLSocket.java b/src/java.base/share/classes/javax/net/ssl/SSLSocket.java index a77968ada16..a18c203320d 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLSocket.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -305,6 +305,7 @@ protected SSLSocket(InetAddress address, int port, * Algorithm Names Specification, and may also include other cipher * suites that the provider supports. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return an array of cipher suite names * @see #getEnabledCipherSuites() * @see #setEnabledCipherSuites(String []) @@ -331,6 +332,7 @@ protected SSLSocket(InetAddress address, int port, * Algorithm Names Specification, and may also include other cipher * suites that the provider supports. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return an array of cipher suite names * @see #getSupportedCipherSuites() * @see #setEnabledCipherSuites(String []) @@ -358,6 +360,7 @@ protected SSLSocket(InetAddress address, int port, * on why a specific ciphersuite may never be used on a connection. * * @param suites Names of all the cipher suites to enable + * @spec security/standard-names.html Java Security Standard Algorithm Names * @throws IllegalArgumentException when one or more of the ciphers * named by the parameter is not supported, or when the * parameter is null. diff --git a/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java b/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java index b90a9d4c25c..6d0815ef80d 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -109,6 +109,7 @@ static String getSecurityProperty(final String name) { * Algorithm Names Specification, and may also include other cipher suites * that the provider supports. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @see #getSupportedCipherSuites() * @return array of the cipher suites enabled by default */ @@ -128,6 +129,7 @@ static String getSecurityProperty(final String name) { * Algorithm Names Specification, and may also include other cipher suites * that the provider supports. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @see #getDefaultCipherSuites() * @return an array of cipher suite names */ diff --git a/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java b/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java index af08d97f0d2..76c76806403 100644 --- a/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java +++ b/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -48,6 +48,7 @@ * Consult the release documentation for your implementation to see if any * other algorithms are supported. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @since 1.4 * @see TrustManager */ @@ -138,6 +139,7 @@ public final String getAlgorithm() { * Algorithm Names Specification for information about standard * algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code TrustManagerFactory} object * * @throws NoSuchAlgorithmException if no {@code Provider} supports a @@ -177,6 +179,7 @@ public static final TrustManagerFactory getInstance(String algorithm) * Algorithm Names Specification for information about standard * algorithm names. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @param provider the name of the provider. * * @return the new {@code TrustManagerFactory} object @@ -224,6 +227,7 @@ public static final TrustManagerFactory getInstance(String algorithm, * * @param provider an instance of the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code TrustManagerFactory} object * * @throws IllegalArgumentException if the provider is {@code null} diff --git a/src/java.base/share/classes/javax/security/auth/login/Configuration.java b/src/java.base/share/classes/javax/security/auth/login/Configuration.java index bebf5f6901a..6e69d0746ff 100644 --- a/src/java.base/share/classes/javax/security/auth/login/Configuration.java +++ b/src/java.base/share/classes/javax/security/auth/login/Configuration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, 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 @@ -176,6 +176,7 @@ * Java Security Standard Algorithm Names Specification * for a list of standard Configuration types. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @since 1.4 * @see javax.security.auth.login.LoginContext * @see java.security.Security security properties @@ -268,6 +269,7 @@ public static void setConfiguration(Configuration configuration) { * * @param params parameters for the Configuration, which may be null. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code Configuration} object * * @throws IllegalArgumentException if the specified parameters @@ -324,6 +326,7 @@ public static Configuration getInstance(String type, * * @param provider the provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code Configuration} object * * @throws IllegalArgumentException if the specified provider @@ -387,6 +390,7 @@ public static Configuration getInstance(String type, * * @param provider the Provider. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the new {@code Configuration} object * * @throws IllegalArgumentException if the specified {@code Provider} diff --git a/src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java b/src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java index f4ba247caf1..db73083433f 100644 --- a/src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java +++ b/src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java @@ -471,10 +471,6 @@ public interface JavaLangAccess { */ Object classData(Class c); - int getCharsLatin1(long i, int index, byte[] buf); - - int getCharsUTF16(long i, int index, byte[] buf); - /** * Returns the {@link NativeLibraries} object associated with the provided class loader. * This is used by {@link SymbolLookup#loaderLookup()}. diff --git a/src/java.base/share/classes/jdk/internal/classfile/components/snippet-files/PackageSnippets.java b/src/java.base/share/classes/jdk/internal/classfile/components/snippet-files/PackageSnippets.java index 452e0188115..519ae096757 100644 --- a/src/java.base/share/classes/jdk/internal/classfile/components/snippet-files/PackageSnippets.java +++ b/src/java.base/share/classes/jdk/internal/classfile/components/snippet-files/PackageSnippets.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package java.lang.classfile.components.snippets; +package jdk.internal.classfile.components.snippet; import java.lang.classfile.*; import jdk.internal.classfile.components.ClassPrinter; diff --git a/src/java.base/share/classes/jdk/internal/foreign/SlicingAllocator.java b/src/java.base/share/classes/jdk/internal/foreign/SlicingAllocator.java index db7d476053e..6b1a071c2af 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/SlicingAllocator.java +++ b/src/java.base/share/classes/jdk/internal/foreign/SlicingAllocator.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 @@ -38,6 +38,22 @@ public SlicingAllocator(MemorySegment segment) { this.segment = segment; } + public long currentOffset() { + return sp; + } + + public void resetTo(long offset) { + if (offset < 0 || offset > sp) + throw new IllegalArgumentException(String.format("offset %d should be in [0, %d] ", offset, sp)); + this.sp = offset; + } + + public boolean canAllocate(long byteSize, long byteAlignment) { + long min = segment.address(); + long start = Utils.alignUp(min + sp, byteAlignment) - min; + return start + byteSize <= segment.byteSize(); + } + MemorySegment trySlice(long byteSize, long byteAlignment) { long min = segment.address(); long start = Utils.alignUp(min + sp, byteAlignment) - min; diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/BufferStack.java b/src/java.base/share/classes/jdk/internal/foreign/abi/BufferStack.java new file mode 100644 index 00000000000..150d5485602 --- /dev/null +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/BufferStack.java @@ -0,0 +1,122 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.internal.foreign.abi; + +import jdk.internal.foreign.SlicingAllocator; +import jdk.internal.misc.CarrierThreadLocal; +import jdk.internal.vm.annotation.ForceInline; + +import java.lang.foreign.Arena; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.SegmentAllocator; +import java.util.concurrent.locks.ReentrantLock; + +public class BufferStack { + private final long size; + + public BufferStack(long size) { + this.size = size; + } + + private final ThreadLocal tl = new CarrierThreadLocal<>() { + @Override + protected PerThread initialValue() { + return new PerThread(size); + } + }; + + @ForceInline + public Arena pushFrame(long size, long byteAlignment) { + return tl.get().pushFrame(size, byteAlignment); + } + + private static final class PerThread { + private final ReentrantLock lock = new ReentrantLock(); + private final SlicingAllocator stack; + + public PerThread(long size) { + this.stack = new SlicingAllocator(Arena.ofAuto().allocate(size)); + } + + @ForceInline + public Arena pushFrame(long size, long byteAlignment) { + boolean needsLock = Thread.currentThread().isVirtual() && !lock.isHeldByCurrentThread(); + if (needsLock && !lock.tryLock()) { + // Rare: another virtual thread on the same carrier competed for acquisition. + return Arena.ofConfined(); + } + if (!stack.canAllocate(size, byteAlignment)) { + if (needsLock) lock.unlock(); + return Arena.ofConfined(); + } + + return new Frame(needsLock, size, byteAlignment); + } + + private class Frame implements Arena { + private final boolean locked; + private final long parentOffset; + private final long topOfStack; + private final Arena scope = Arena.ofConfined(); + private final SegmentAllocator frame; + + @SuppressWarnings("restricted") + public Frame(boolean locked, long byteSize, long byteAlignment) { + this.locked = locked; + + parentOffset = stack.currentOffset(); + MemorySegment frameSegment = stack.allocate(byteSize, byteAlignment); + topOfStack = stack.currentOffset(); + frame = new SlicingAllocator(frameSegment.reinterpret(scope, null)); + } + + private void assertOrder() { + if (topOfStack != stack.currentOffset()) + throw new IllegalStateException("Out of order access: frame not top-of-stack"); + } + + @Override + @SuppressWarnings("restricted") + public MemorySegment allocate(long byteSize, long byteAlignment) { + return frame.allocate(byteSize, byteAlignment); + } + + @Override + public MemorySegment.Scope scope() { + return scope.scope(); + } + + @Override + public void close() { + assertOrder(); + scope.close(); + stack.resetTo(parentOffset); + if (locked) { + lock.unlock(); + } + } + } + } +} \ No newline at end of file diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/SharedUtils.java b/src/java.base/share/classes/jdk/internal/foreign/abi/SharedUtils.java index 9078920f677..feaa9fdb436 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/SharedUtils.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/SharedUtils.java @@ -382,26 +382,12 @@ static long pickChunkOffset(long chunkOffset, long byteWidth, int chunkWidth) { : chunkOffset; } - public static Arena newBoundedArena(long size) { - return new Arena() { - final Arena arena = Arena.ofConfined(); - final SegmentAllocator slicingAllocator = SegmentAllocator.slicingAllocator(arena.allocate(size)); - - @Override - public Scope scope() { - return arena.scope(); - } + private static final int LINKER_STACK_SIZE = Integer.getInteger("jdk.internal.foreign.LINKER_STACK_SIZE", 256); + private static final BufferStack LINKER_STACK = new BufferStack(LINKER_STACK_SIZE); - @Override - public void close() { - arena.close(); - } - - @Override - public MemorySegment allocate(long byteSize, long byteAlignment) { - return slicingAllocator.allocate(byteSize, byteAlignment); - } - }; + @ForceInline + public static Arena newBoundedArena(long size) { + return LINKER_STACK.pushFrame(size, 8); } public static Arena newEmptyArena() { diff --git a/src/java.base/share/classes/jdk/internal/misc/CDS.java b/src/java.base/share/classes/jdk/internal/misc/CDS.java index 8661a2b3ff2..e22baf72c82 100644 --- a/src/java.base/share/classes/jdk/internal/misc/CDS.java +++ b/src/java.base/share/classes/jdk/internal/misc/CDS.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 @@ -31,6 +31,10 @@ import java.io.InputStream; import java.io.IOException; import java.io.PrintStream; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.InvalidPathException; +import java.nio.file.Path; import java.util.Arrays; import java.util.ArrayList; import java.util.List; @@ -337,4 +341,112 @@ private static String dumpSharedArchive(boolean isStatic, String fileName) throw System.out.println("The process was attached by jcmd and dumped a " + (isStatic ? "static" : "dynamic") + " archive " + archiveFilePath); return archiveFilePath; } + + /** + * This class is used only by native JVM code at CDS dump time for loading + * "unregistered classes", which are archived classes that are intended to + * be loaded by custom class loaders during runtime. + * See src/hotspot/share/cds/unregisteredClasses.cpp. + */ + private static class UnregisteredClassLoader extends URLClassLoader { + private String currentClassName; + private Class currentSuperClass; + private Class[] currentInterfaces; + + /** + * Used only by native code. Construct an UnregisteredClassLoader for loading + * unregistered classes from the specified file. If the file doesn't exist, + * the exception will be caughted by native code which will print a warning message and continue. + * + * @param fileName path of the the JAR file to load unregistered classes from. + */ + private UnregisteredClassLoader(String fileName) throws InvalidPathException, IOException { + super(toURLArray(fileName), /*parent*/null); + currentClassName = null; + currentSuperClass = null; + currentInterfaces = null; + } + + private static URL[] toURLArray(String fileName) throws InvalidPathException, IOException { + if (!((new File(fileName)).exists())) { + throw new IOException("No such file: " + fileName); + } + return new URL[] { + // Use an intermediate File object to construct a URI/URL without + // authority component as URLClassPath can't handle URLs with a UNC + // server name in the authority component. + Path.of(fileName).toRealPath().toFile().toURI().toURL() + }; + } + + + /** + * Load the class of the given /name from the JAR file that was given to + * the constructor of the current UnregisteredClassLoader instance. This class must be + * a direct subclass of superClass. This class must be declared to implement + * the specified interfaces. + *

    + * This method must be called in a single threaded context. It will never be recursed (thus + * the asserts) + * + * @param name the name of the class to be loaded. + * @param superClass must not be null. The named class must have a super class. + * @param interfaces could be null if the named class does not implement any interfaces. + */ + private Class load(String name, Class superClass, Class[] interfaces) + throws ClassNotFoundException + { + assert currentClassName == null; + assert currentSuperClass == null; + assert currentInterfaces == null; + + try { + currentClassName = name; + currentSuperClass = superClass; + currentInterfaces = interfaces; + + return findClass(name); + } finally { + currentClassName = null; + currentSuperClass = null; + currentInterfaces = null; + } + } + + /** + * This method must be called from inside the load() method. The /name + * can be only: + *

      + *
    • the name parameter for load() + *
    • the name of the superClass parameter for load() + *
    • the name of one of the interfaces in interfaces parameter for load() + *
        + * + * For all other cases, a ClassNotFoundException will be thrown. + */ + protected Class findClass(final String name) + throws ClassNotFoundException + { + Objects.requireNonNull(currentClassName); + Objects.requireNonNull(currentSuperClass); + + if (name.equals(currentClassName)) { + // Note: the following call will call back to this.findClass(name) to + // resolve the super types of the named class. + return super.findClass(name); + } + if (name.equals(currentSuperClass.getName())) { + return currentSuperClass; + } + if (currentInterfaces != null) { + for (Class c : currentInterfaces) { + if (name.equals(c.getName())) { + return c; + } + } + } + + throw new ClassNotFoundException(name); + } + } } diff --git a/src/java.base/share/classes/jdk/internal/util/DecimalDigits.java b/src/java.base/share/classes/jdk/internal/util/DecimalDigits.java index 83438e59b82..47d1645862e 100644 --- a/src/java.base/share/classes/jdk/internal/util/DecimalDigits.java +++ b/src/java.base/share/classes/jdk/internal/util/DecimalDigits.java @@ -25,32 +25,36 @@ package jdk.internal.util; +import jdk.internal.misc.Unsafe; import jdk.internal.vm.annotation.Stable; +import static jdk.internal.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET; + /** * Digits class for decimal digits. * * @since 21 */ public final class DecimalDigits { + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); /** * Each element of the array represents the packaging of two ascii characters based on little endian:

        *

              *      00 -> '0' | ('0' << 8) -> 0x3030
        -     *      01 -> '1' | ('0' << 8) -> 0x3130
        -     *      02 -> '2' | ('0' << 8) -> 0x3230
        +     *      01 -> '0' | ('1' << 8) -> 0x3130
        +     *      02 -> '0' | ('2' << 8) -> 0x3230
              *
              *     ...
              *
        -     *      10 -> '0' | ('1' << 8) -> 0x3031
        +     *      10 -> '1' | ('0' << 8) -> 0x3031
              *      11 -> '1' | ('1' << 8) -> 0x3131
        -     *      12 -> '2' | ('1' << 8) -> 0x3231
        +     *      12 -> '1' | ('2' << 8) -> 0x3231
              *
              *     ...
              *
        -     *      97 -> '7' | ('9' << 8) -> 0x3739
        -     *      98 -> '8' | ('9' << 8) -> 0x3839
        +     *      97 -> '9' | ('7' << 8) -> 0x3739
        +     *      98 -> '9' | ('8' << 8) -> 0x3839
              *      99 -> '9' | ('9' << 8) -> 0x3939
              * 
        */ @@ -58,7 +62,7 @@ public final class DecimalDigits { private static final short[] DIGITS; static { - short[] digits = new short[10 * 10]; + short[] digits = new short[128]; for (int i = 0; i < 10; i++) { short hi = (short) (i + '0'); @@ -76,15 +80,6 @@ public final class DecimalDigits { private DecimalDigits() { } - /** - * For values from 0 to 99 return a short encoding a pair of ASCII-encoded digit characters in little-endian - * @param i value to convert - * @return a short encoding a pair of ASCII-encoded digit characters - */ - public static short digitPair(int i) { - return DIGITS[i]; - } - /** * Returns the string representation size for a given int value. * @@ -136,4 +131,305 @@ public static int stringSize(long x) { } return 19 + d; } + + /** + * Places characters representing the integer i into the + * character array buf. The characters are placed into + * the buffer backwards starting with the least significant + * digit at the specified index (exclusive), and working + * backwards from there. + * + * @implNote This method converts positive inputs into negative + * values, to cover the Integer.MIN_VALUE case. Converting otherwise + * (negative to positive) will expose -Integer.MIN_VALUE that overflows + * integer. + * + * @param i value to convert + * @param index next index, after the least significant digit + * @param buf target buffer, Latin1-encoded + * @return index of the most significant digit or minus sign, if present + */ + public static int getCharsLatin1(int i, int index, byte[] buf) { + // Used by trusted callers. Assumes all necessary bounds checks have been done by the caller. + int q; + int charPos = index; + + boolean negative = i < 0; + if (!negative) { + i = -i; + } + + // Generate two digits per iteration + while (i <= -100) { + q = i / 100; + charPos -= 2; + putPairLatin1(buf, charPos, (q * 100) - i); + i = q; + } + + // We know there are at most two digits left at this point. + if (i <= -10) { + charPos -= 2; + putPairLatin1(buf, charPos, -i); + } else { + putCharLatin1(buf, --charPos, '0' - i); + } + + if (negative) { + putCharLatin1(buf, --charPos, '-'); + } + return charPos; + } + + + /** + * Places characters representing the long i into the + * character array buf. The characters are placed into + * the buffer backwards starting with the least significant + * digit at the specified index (exclusive), and working + * backwards from there. + * + * @implNote This method converts positive inputs into negative + * values, to cover the Long.MIN_VALUE case. Converting otherwise + * (negative to positive) will expose -Long.MIN_VALUE that overflows + * long. + * + * @param i value to convert + * @param index next index, after the least significant digit + * @param buf target buffer, Latin1-encoded + * @return index of the most significant digit or minus sign, if present + */ + public static int getCharsLatin1(long i, int index, byte[] buf) { + // Used by trusted callers. Assumes all necessary bounds checks have been done by the caller. + long q; + int charPos = index; + + boolean negative = (i < 0); + if (!negative) { + i = -i; + } + + // Get 2 digits/iteration using longs until quotient fits into an int + while (i < Integer.MIN_VALUE) { + q = i / 100; + charPos -= 2; + putPairLatin1(buf, charPos, (int)((q * 100) - i)); + i = q; + } + + // Get 2 digits/iteration using ints + int q2; + int i2 = (int)i; + while (i2 <= -100) { + q2 = i2 / 100; + charPos -= 2; + putPairLatin1(buf, charPos, (q2 * 100) - i2); + i2 = q2; + } + + // We know there are at most two digits left at this point. + if (i2 <= -10) { + charPos -= 2; + putPairLatin1(buf, charPos, -i2); + } else { + putCharLatin1(buf, --charPos, '0' - i2); + } + + if (negative) { + putCharLatin1(buf, --charPos, '-'); + } + return charPos; + } + + + /** + * This is a variant of {@link DecimalDigits#getCharsLatin1(int, int, byte[])}, but for + * UTF-16 coder. + * + * @param i value to convert + * @param index next index, after the least significant digit + * @param buf target buffer, UTF16-coded. + * @return index of the most significant digit or minus sign, if present + */ + public static int getCharsUTF16(int i, int index, byte[] buf) { + // Used by trusted callers. Assumes all necessary bounds checks have been done by the caller. + int q; + int charPos = index; + + boolean negative = (i < 0); + if (!negative) { + i = -i; + } + + // Get 2 digits/iteration using ints + while (i <= -100) { + q = i / 100; + charPos -= 2; + putPairUTF16(buf, charPos, (q * 100) - i); + i = q; + } + + // We know there are at most two digits left at this point. + if (i <= -10) { + charPos -= 2; + putPairUTF16(buf, charPos, -i); + } else { + putCharUTF16(buf, --charPos, '0' - i); + } + + if (negative) { + putCharUTF16(buf, --charPos, '-'); + } + return charPos; + } + + + /** + * This is a variant of {@link DecimalDigits#getCharsLatin1(long, int, byte[])}, but for + * UTF-16 coder. + * + * @param i value to convert + * @param index next index, after the least significant digit + * @param buf target buffer, UTF16-coded. + * @return index of the most significant digit or minus sign, if present + */ + public static int getCharsUTF16(long i, int index, byte[] buf) { + // Used by trusted callers. Assumes all necessary bounds checks have been done by the caller. + long q; + int charPos = index; + + boolean negative = (i < 0); + if (!negative) { + i = -i; + } + + // Get 2 digits/iteration using longs until quotient fits into an int + while (i < Integer.MIN_VALUE) { + q = i / 100; + charPos -= 2; + putPairUTF16(buf, charPos, (int)((q * 100) - i)); + i = q; + } + + // Get 2 digits/iteration using ints + int q2; + int i2 = (int)i; + while (i2 <= -100) { + q2 = i2 / 100; + charPos -= 2; + putPairUTF16(buf, charPos, (q2 * 100) - i2); + i2 = q2; + } + + // We know there are at most two digits left at this point. + if (i2 <= -10) { + charPos -= 2; + putPairUTF16(buf, charPos, -i2); + } else { + putCharUTF16(buf, --charPos, '0' - i2); + } + + if (negative) { + putCharUTF16(buf, --charPos, '-'); + } + return charPos; + } + + /** + * This is a variant of {@link DecimalDigits#getCharsUTF16(long, int, byte[])}, but for + * UTF-16 coder. + * + * @param i value to convert + * @param index next index, after the least significant digit + * @param buf target buffer, UTF16-coded. + * @return index of the most significant digit or minus sign, if present + */ + public static int getChars(long i, int index, char[] buf) { + // Used by trusted callers. Assumes all necessary bounds checks have been done by the caller. + long q; + int charPos = index; + + boolean negative = (i < 0); + if (!negative) { + i = -i; + } + + // Get 2 digits/iteration using longs until quotient fits into an int + while (i < Integer.MIN_VALUE) { + q = i / 100; + charPos -= 2; + putPair(buf, charPos, (int)((q * 100) - i)); + i = q; + } + + // Get 2 digits/iteration using ints + int q2; + int i2 = (int)i; + while (i2 <= -100) { + q2 = i2 / 100; + charPos -= 2; + putPair(buf, charPos, (q2 * 100) - i2); + i2 = q2; + } + + // We know there are at most two digits left at this point. + if (i2 <= -10) { + charPos -= 2; + putPair(buf, charPos, -i2); + } else { + buf[--charPos] = (char) ('0' - i2); + } + + if (negative) { + buf[--charPos] = '-'; + } + return charPos; + } + + /** + * Insert the 2-chars integer into the buf as 2 decimal digit ASCII chars, + * only least significant 16 bits of {@code v} are used. + * @param buf byte buffer to copy into + * @param charPos insert point + * @param v to convert + */ + public static void putPair(char[] buf, int charPos, int v) { + int packed = DIGITS[v & 0x7f]; + buf[charPos ] = (char) (packed & 0xFF); + buf[charPos + 1] = (char) (packed >> 8); + } + + /** + * Insert the 2-bytes integer into the buf as 2 decimal digit ASCII bytes, + * only least significant 16 bits of {@code v} are used. + * @param buf byte buffer to copy into + * @param charPos insert point + * @param v to convert + */ + public static void putPairLatin1(byte[] buf, int charPos, int v) { + int packed = DIGITS[v & 0x7f]; + putCharLatin1(buf, charPos, packed & 0xFF); + putCharLatin1(buf, charPos + 1, packed >> 8); + } + + /** + * Insert the 2-chars integer into the buf as 2 decimal digit UTF16 bytes, + * only least significant 16 bits of {@code v} are used. + * @param buf byte buffer to copy into + * @param charPos insert point + * @param v to convert + */ + public static void putPairUTF16(byte[] buf, int charPos, int v) { + int packed = DIGITS[v & 0x7f]; + putCharUTF16(buf, charPos, packed & 0xFF); + putCharUTF16(buf, charPos + 1, packed >> 8); + } + + private static void putCharLatin1(byte[] buf, int charPos, int c) { + UNSAFE.putByte(buf, ARRAY_BYTE_BASE_OFFSET + (long) charPos, (byte) c); + } + + private static void putCharUTF16(byte[] buf, int charPos, int c) { + UNSAFE.putCharUnaligned(buf, ARRAY_BYTE_BASE_OFFSET + ((long) charPos << 1), (char) c); + } } diff --git a/src/java.base/share/classes/jdk/internal/util/OctalDigits.java b/src/java.base/share/classes/jdk/internal/util/OctalDigits.java deleted file mode 100644 index c41d0f75574..00000000000 --- a/src/java.base/share/classes/jdk/internal/util/OctalDigits.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.internal.util; - -import jdk.internal.access.JavaLangAccess; -import jdk.internal.access.SharedSecrets; -import jdk.internal.vm.annotation.Stable; - -/** - * Digits class for octal digits. - * - * @since 21 - */ -public final class OctalDigits { - private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess(); - - @Stable - private static final short[] DIGITS; - - static { - short[] digits = new short[8 * 8]; - - for (int i = 0; i < 8; i++) { - short lo = (short) (i + '0'); - - for (int j = 0; j < 8; j++) { - short hi = (short) ((j + '0') << 8); - digits[(i << 3) + j] = (short) (hi | lo); - } - } - - DIGITS = digits; - } - - /** - * Constructor. - */ - private OctalDigits() { - } - - /** - * Insert digits for long value in buffer from high index to low index. - * - * @param value value to convert - * @param index insert point + 1 - * @param buffer byte buffer to copy into - * - * @return the last index used - */ - public static int getCharsLatin1(long value, int index, byte[] buffer){ - while ((value & ~0x3F) != 0) { - int digits = DIGITS[((int) value) & 0x3F]; - value >>>= 6; - buffer[--index] = (byte) (digits >> 8); - buffer[--index] = (byte) (digits & 0xFF); - } - - int digits = DIGITS[(int) (value & 0x3F)]; - buffer[--index] = (byte) (digits >> 8); - - if (7 < value) { - buffer[--index] = (byte) (digits & 0xFF); - } - - return index; - } - - - /** - * This is a variant of {@link OctalDigits#getCharsLatin1(long, int, byte[])}, but for - * UTF-16 coder. - * - * @param value value to convert - * @param index insert point + 1 - * @param buffer byte buffer to copy into - * - * @return the last index used - */ - public static int getCharsUTF16(long value, int index, byte[] buffer){ - while ((value & ~0x3F) != 0) { - int pair = (int) DIGITS[((int) value) & 0x3F]; - JLA.putCharUTF16(buffer, --index, pair >> 8); - JLA.putCharUTF16(buffer, --index, pair & 0xFF); - value >>>= 6; - } - - int digits = DIGITS[(int) (value & 0x3F)]; - JLA.putCharUTF16(buffer, --index, digits >> 8); - - if (7 < value) { - JLA.putCharUTF16(buffer, --index, digits & 0xFF); - } - - return index; - } - - /** - * Calculate the number of digits required to represent the long. - * - * @param value value to convert - * - * @return number of digits - */ - public static int stringSize(long value) { - return value == 0 ? 1 : ((66 - Long.numberOfLeadingZeros(value)) / 3); - } -} diff --git a/src/java.base/share/classes/sun/net/www/protocol/file/FileURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/file/FileURLConnection.java index 0e0cde98ee0..8b8908445a9 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/file/FileURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/file/FileURLConnection.java @@ -46,17 +46,15 @@ public class FileURLConnection extends URLConnection { private static final String TEXT_PLAIN = "text/plain"; private static final String LAST_MODIFIED = "last-modified"; - String contentType; - InputStream is; + private final File file; + private InputStream is; + private List directoryListing; - File file; - String filename; - boolean isDirectory = false; - boolean exists = false; - List files; + private boolean isDirectory = false; + private boolean exists = false; - long length = -1; - long lastModified = 0; + private long length = -1; + private long lastModified = 0; protected FileURLConnection(URL u, File file) { super(u); @@ -71,20 +69,17 @@ protected FileURLConnection(URL u, File file) { */ public void connect() throws IOException { if (!connected) { - try { - filename = file.toString(); - isDirectory = file.isDirectory(); - if (isDirectory) { - String[] fileList = file.list(); - if (fileList == null) - throw new FileNotFoundException(filename + " exists, but is not accessible"); - files = Arrays.asList(fileList); - } else { - is = new BufferedInputStream(new FileInputStream(filename)); - } - } catch (IOException e) { - throw e; + + isDirectory = file.isDirectory(); + if (isDirectory) { + String[] fileList = file.list(); + if (fileList == null) + throw new FileNotFoundException(file.getPath() + " exists, but is not accessible"); + directoryListing = Arrays.asList(fileList); + } else { + is = new BufferedInputStream(new FileInputStream(file.getPath())); } + connected = true; } } @@ -109,11 +104,11 @@ private void initializeHeaders() { if (!isDirectory) { FileNameMap map = java.net.URLConnection.getFileNameMap(); - contentType = map.getContentTypeFor(filename); + String contentType = map.getContentTypeFor(file.getPath()); if (contentType != null) { properties.add(CONTENT_TYPE, contentType); } - properties.add(CONTENT_LENGTH, String.valueOf(length)); + properties.add(CONTENT_LENGTH, Long.toString(length)); /* * Format the last-modified field into the preferred @@ -179,32 +174,26 @@ public long getLastModified() { public synchronized InputStream getInputStream() throws IOException { - int iconHeight; - int iconWidth; - connect(); if (is == null) { if (isDirectory) { - FileNameMap map = java.net.URLConnection.getFileNameMap(); - StringBuilder sb = new StringBuilder(); - - if (files == null) { - throw new FileNotFoundException(filename); + if (directoryListing == null) { + throw new FileNotFoundException(file.getPath()); } - files.sort(Collator.getInstance()); + directoryListing.sort(Collator.getInstance()); - for (int i = 0 ; i < files.size() ; i++) { - String fileName = files.get(i); + StringBuilder sb = new StringBuilder(); + for (String fileName : directoryListing) { sb.append(fileName); sb.append("\n"); } // Put it into a (default) locale-specific byte-stream. is = new ByteArrayInputStream(sb.toString().getBytes()); } else { - throw new FileNotFoundException(filename); + throw new FileNotFoundException(file.getPath()); } } return is; diff --git a/src/java.base/share/classes/sun/security/ec/ECDHKeyAgreement.java b/src/java.base/share/classes/sun/security/ec/ECDHKeyAgreement.java index be3bdfdd639..8f6bdb8d80a 100644 --- a/src/java.base/share/classes/sun/security/ec/ECDHKeyAgreement.java +++ b/src/java.base/share/classes/sun/security/ec/ECDHKeyAgreement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, 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 @@ -29,6 +29,7 @@ import sun.security.util.ArrayUtil; import sun.security.util.CurveDB; import sun.security.util.ECUtil; +import sun.security.util.KeyUtil; import sun.security.util.NamedCurve; import sun.security.util.math.IntegerFieldModuloP; import sun.security.util.math.IntegerMontgomeryFieldModuloP; @@ -254,11 +255,11 @@ protected SecretKey engineGenerateSecret(String algorithm) if (algorithm == null) { throw new NoSuchAlgorithmException("Algorithm must not be null"); } - if (!(algorithm.equals("TlsPremasterSecret"))) { - throw new NoSuchAlgorithmException - ("Only supported for algorithm TlsPremasterSecret"); + if (!KeyUtil.isSupportedKeyAgreementOutputAlgorithm(algorithm)) { + throw new NoSuchAlgorithmException( + "Unsupported secret key algorithm: " + algorithm); } - return new SecretKeySpec(engineGenerateSecret(), "TlsPremasterSecret"); + return new SecretKeySpec(engineGenerateSecret(), algorithm); } private static diff --git a/src/java.base/share/classes/sun/security/ec/XDHKeyAgreement.java b/src/java.base/share/classes/sun/security/ec/XDHKeyAgreement.java index e2a625a55d9..01dce4c53e9 100644 --- a/src/java.base/share/classes/sun/security/ec/XDHKeyAgreement.java +++ b/src/java.base/share/classes/sun/security/ec/XDHKeyAgreement.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,6 +25,8 @@ package sun.security.ec; +import sun.security.util.KeyUtil; + import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; @@ -207,9 +209,9 @@ protected SecretKey engineGenerateSecret(String algorithm) throw new NoSuchAlgorithmException("Algorithm must not be null"); } - if (!(algorithm.equals("TlsPremasterSecret"))) { + if (!KeyUtil.isSupportedKeyAgreementOutputAlgorithm(algorithm)) { throw new NoSuchAlgorithmException( - "Only supported for algorithm TlsPremasterSecret"); + "Unsupported secret key algorithm: " + algorithm); } return new SecretKeySpec(engineGenerateSecret(), algorithm); } diff --git a/src/java.base/share/classes/sun/security/provider/certpath/OCSP.java b/src/java.base/share/classes/sun/security/provider/certpath/OCSP.java index a32d88605c5..8927f997cd6 100644 --- a/src/java.base/share/classes/sun/security/provider/certpath/OCSP.java +++ b/src/java.base/share/classes/sun/security/provider/certpath/OCSP.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, 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 @@ -67,7 +67,6 @@ public final class OCSP { private static final Debug debug = Debug.getInstance("certpath"); private static final int DEFAULT_CONNECT_TIMEOUT = 15000; - private static final int DEFAULT_READ_TIMEOUT = 15000; /** * Integer value indicating the timeout length, in milliseconds, to be @@ -83,7 +82,7 @@ public final class OCSP { * zero is interpreted as an infinite timeout. */ private static final int READ_TIMEOUT = initializeTimeout( - "com.sun.security.ocsp.readtimeout", DEFAULT_READ_TIMEOUT); + "com.sun.security.ocsp.readtimeout", CONNECT_TIMEOUT); /** * Boolean value indicating whether OCSP client can use GET for OCSP diff --git a/src/java.base/share/classes/sun/security/util/KeyUtil.java b/src/java.base/share/classes/sun/security/util/KeyUtil.java index 6eb5acfade3..224167653f7 100644 --- a/src/java.base/share/classes/sun/security/util/KeyUtil.java +++ b/src/java.base/share/classes/sun/security/util/KeyUtil.java @@ -424,5 +424,10 @@ public static String hashAlgFromHSS(PublicKey publicKey) throw new NoSuchAlgorithmException("Cannot decode public key", e); } } + + public static boolean isSupportedKeyAgreementOutputAlgorithm(String alg) { + return alg.equalsIgnoreCase("TlsPremasterSecret") + || alg.equalsIgnoreCase("Generic"); + } } diff --git a/src/java.base/share/classes/sun/security/validator/CADistrustPolicy.java b/src/java.base/share/classes/sun/security/validator/CADistrustPolicy.java index e8f821686fd..9c64402c123 100644 --- a/src/java.base/share/classes/sun/security/validator/CADistrustPolicy.java +++ b/src/java.base/share/classes/sun/security/validator/CADistrustPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -67,6 +67,22 @@ void checkDistrust(String variant, X509Certificate[] chain) } EntrustTLSPolicy.checkDistrust(chain); } + }, + + /** + * Distrust TLS Server certificates anchored by a CAMERFIRMA root CA and + * issued after April 15, 2025. If enabled, this policy is currently + * enforced by the PKIX and SunX509 TrustManager implementations + * of the SunJSSE provider implementation. + */ + CAMERFIRMA_TLS { + void checkDistrust(String variant, X509Certificate[] chain) + throws ValidatorException { + if (!variant.equals(Validator.VAR_TLS_SERVER)) { + return; + } + CamerfirmaTLSPolicy.checkDistrust(chain); + } }; /** diff --git a/src/java.base/share/classes/sun/security/validator/CamerfirmaTLSPolicy.java b/src/java.base/share/classes/sun/security/validator/CamerfirmaTLSPolicy.java new file mode 100644 index 00000000000..591a7a26c68 --- /dev/null +++ b/src/java.base/share/classes/sun/security/validator/CamerfirmaTLSPolicy.java @@ -0,0 +1,114 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package sun.security.validator; + +import java.security.cert.X509Certificate; +import java.time.LocalDate; +import java.time.Month; +import java.time.ZoneOffset; +import java.util.Date; +import java.util.Map; +import java.util.Set; + +import sun.security.util.Debug; +import sun.security.x509.X509CertImpl; + +/** + * This class checks if Camerfirma issued TLS Server certificates should be + * restricted. + */ +final class CamerfirmaTLSPolicy { + + private static final Debug debug = Debug.getInstance("certpath"); + + // SHA-256 certificate fingerprints of distrusted roots + private static final Set FINGERPRINTS = Set.of( + // cacerts alias: camerfirmachamberscommerceca + // DN: CN=Chambers of Commerce Root, + // OU=http://www.chambersign.org, + // O=AC Camerfirma SA CIF A82743287, C=EU + "0C258A12A5674AEF25F28BA7DCFAECEEA348E541E6F5CC4EE63B71B361606AC3", + // cacerts alias: camerfirmachambersca + // DN: CN=Chambers of Commerce Root - 2008, + // O=AC Camerfirma S.A., SERIALNUMBER=A82743287, + // L=Madrid (see current address at www.camerfirma.com/address), + // C=EU + "063E4AFAC491DFD332F3089B8542E94617D893D7FE944E10A7937EE29D9693C0", + // cacerts alias: camerfirmachambersignca + // DN: CN=Global Chambersign Root - 2008, + // O=AC Camerfirma S.A., SERIALNUMBER=A82743287, + // L=Madrid (see current address at www.camerfirma.com/address), + // C=EU + "136335439334A7698016A0D324DE72284E079D7B5220BB8FBD747816EEBEBACA" + ); + + // Any TLS Server certificate that is anchored by one of the Camerfirma + // roots above and is issued after this date will be distrusted. + private static final LocalDate APRIL_15_2025 = + LocalDate.of(2025, Month.APRIL, 15); + + /** + * This method assumes the eeCert is a TLS Server Cert and chains back to + * the anchor. + * + * @param chain the end-entity's certificate chain. The end entity cert + * is at index 0, the trust anchor at index n-1. + * @throws ValidatorException if the certificate is distrusted + */ + static void checkDistrust(X509Certificate[] chain) + throws ValidatorException { + X509Certificate anchor = chain[chain.length-1]; + String fp = fingerprint(anchor); + if (fp == null) { + throw new ValidatorException("Cannot generate fingerprint for " + + "trust anchor of TLS server certificate"); + } + if (FINGERPRINTS.contains(fp)) { + Date notBefore = chain[0].getNotBefore(); + LocalDate ldNotBefore = LocalDate.ofInstant(notBefore.toInstant(), + ZoneOffset.UTC); + // reject if certificate is issued after April 15, 2025 + checkNotBefore(ldNotBefore, APRIL_15_2025, anchor); + } + } + + private static String fingerprint(X509Certificate cert) { + return X509CertImpl.getFingerprint("SHA-256", cert, debug); + } + + private static void checkNotBefore(LocalDate notBeforeDate, + LocalDate distrustDate, X509Certificate anchor) + throws ValidatorException { + if (notBeforeDate.isAfter(distrustDate)) { + throw new ValidatorException + ("TLS Server certificate issued after " + distrustDate + + " and anchored by a distrusted legacy Camerfirma root CA: " + + anchor.getSubjectX500Principal(), + ValidatorException.T_UNTRUSTED_CERT, anchor); + } + } + + private CamerfirmaTLSPolicy() {} +} diff --git a/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java b/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java index 8cbfd77d5be..9de9400c34a 100644 --- a/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java +++ b/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -31,6 +31,7 @@ import java.util.Map; import java.util.SimpleTimeZone; import java.util.TimeZone; +import java.util.stream.Stream; /** * ZoneInfo is an implementation subclass of {@link @@ -562,6 +563,27 @@ public static String[] getAvailableIDs(int rawOffset) { return ZoneInfoFile.getZoneIds(rawOffset); } + /** + * Gets all available IDs supported in the Java run-time. + * + * @return a stream of time zone IDs. + */ + public static Stream availableIDs() { + return ZoneInfoFile.zoneIds(); + } + + /** + * Gets all available IDs that have the same value as the + * specified raw GMT offset. + * + * @param rawOffset the GMT offset in milliseconds. This + * value should not include any daylight saving time. + * @return a stream of time zone IDs. + */ + public static Stream availableIDs(int rawOffset) { + return ZoneInfoFile.zoneIds(rawOffset); + } + /** * Gets the ZoneInfo for the given ID. * diff --git a/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java b/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java index 267b57cc56d..874bbd59b0f 100644 --- a/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java +++ b/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, 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 @@ -45,6 +45,7 @@ import java.util.Map; import java.util.SimpleTimeZone; import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Stream; import java.util.zip.CRC32; import jdk.internal.util.StaticProperty; @@ -59,7 +60,7 @@ public final class ZoneInfoFile { /** * Gets all available IDs supported in the Java run-time. * - * @return a set of time zone IDs. + * @return an array of time zone IDs. */ public static String[] getZoneIds() { var shortIDs = ZoneId.SHORT_IDS.keySet(); @@ -92,11 +93,35 @@ public static String[] getZoneIds(int rawOffset) { // sorted list, though the specification does not // specify it. Keep the same behavior for better // compatibility. - String[] list = ids.toArray(new String[ids.size()]); + String[] list = ids.toArray(new String[0]); Arrays.sort(list); return list; } + /** + * Gets all available IDs supported in the Java run-time. + * + * @return a stream of time zone IDs. + */ + public static Stream zoneIds() { + return Stream.concat(Arrays.stream(regions), + ZoneId.SHORT_IDS.keySet().stream()); + } + + /** + * Gets all available IDs that have the same value as the + * specified raw GMT offset. + * + * @param rawOffset the GMT offset in milliseconds. This + * value should not include any daylight saving time. + * @return a stream of time zone IDs. + */ + public static Stream zoneIds(int rawOffset) { + return zoneIds() + .filter(id -> getZoneInfo(id).getRawOffset() == rawOffset) + .sorted(); // Sort the IDs, see getZoneIds(int) + } + public static ZoneInfo getZoneInfo(String zoneId) { if (zoneId == null) { return null; diff --git a/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java b/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java index 9ff28e11e51..ae5e64280bc 100644 --- a/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java +++ b/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java @@ -55,7 +55,7 @@ public class CLDRTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl { private static final String NO_INHERITANCE_MARKER = "\u2205\u2205\u2205"; private static class AVAILABLE_IDS { static final String[] INSTANCE = - Arrays.stream(ZoneInfoFile.getZoneIds()) + ZoneInfoFile.zoneIds() .sorted() .toArray(String[]::new); } diff --git a/src/java.base/share/conf/security/java.security b/src/java.base/share/conf/security/java.security index 9ebf844ac76..9234d25a516 100644 --- a/src/java.base/share/conf/security/java.security +++ b/src/java.base/share/conf/security/java.security @@ -1323,6 +1323,9 @@ jdk.sasl.disabledMechanisms= # ENTRUST_TLS : Distrust TLS Server certificates anchored by # an Entrust root CA and issued after November 11, 2024. # +# CAMERFIRMA_TLS : Distrust TLS Server certificates anchored by +# a Camerfirma root CA and issued after April 15, 2025. +# # Leading and trailing whitespace surrounding each value are ignored. # Unknown values are ignored. If the property is commented out or set to the # empty String, no policies are enforced. @@ -1334,7 +1337,7 @@ jdk.sasl.disabledMechanisms= # jdk.certpath.disabledAlgorithms; those restrictions are still enforced even # if this property is not enabled. # -jdk.security.caDistrustPolicies=SYMANTEC_TLS,ENTRUST_TLS +jdk.security.caDistrustPolicies=SYMANTEC_TLS,ENTRUST_TLS,CAMERFIRMA_TLS # # FilePermission path canonicalization diff --git a/src/java.base/share/data/tzdata/VERSION b/src/java.base/share/data/tzdata/VERSION index 740427424a6..9c056fac345 100644 --- a/src/java.base/share/data/tzdata/VERSION +++ b/src/java.base/share/data/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2024b +tzdata2025a diff --git a/src/java.base/share/data/tzdata/antarctica b/src/java.base/share/data/tzdata/antarctica index 058d8d6a7a2..87787d31cfe 100644 --- a/src/java.base/share/data/tzdata/antarctica +++ b/src/java.base/share/data/tzdata/antarctica @@ -197,6 +197,8 @@ Zone Antarctica/Mawson 0 - -00 1954 Feb 13 # France & Italy - year-round base # Concordia, -750600+1232000, since 2005 +# https://en.wikipedia.org/wiki/Concordia_Station +# Can use Asia/Singapore, which it has agreed with since inception. # Germany - year-round base # Neumayer III, -704080-0081602, since 2009 diff --git a/src/java.base/share/data/tzdata/asia b/src/java.base/share/data/tzdata/asia index 5c8568f334a..b0a6fa01d20 100644 --- a/src/java.base/share/data/tzdata/asia +++ b/src/java.base/share/data/tzdata/asia @@ -3688,21 +3688,70 @@ Zone Asia/Hebron 2:20:23 - LMT 1900 Oct # be immediately followed by 1845-01-01; see R.H. van Gent's # History of the International Date Line # https://webspace.science.uu.nl/~gent0113/idl/idl_philippines.htm -# The rest of the data entries are from Shanks & Pottenger. - -# From Jesper Nørgaard Welen (2006-04-26): -# ... claims that Philippines had DST last time in 1990: -# http://story.philippinetimes.com/p.x/ct/9/id/145be20cc6b121c0/cid/3e5bbccc730d258c/ -# [a story dated 2006-04-25 by Cris Larano of Dow Jones Newswires, -# but no details] - -# From Paul Eggert (2014-08-14): -# The following source says DST may be instituted November-January and again -# March-June, but this is not definite. It also says DST was last proclaimed -# during the Ramos administration (1992-1998); but again, no details. -# Carcamo D. PNoy urged to declare use of daylight saving time. -# Philippine Star 2014-08-05 -# http://www.philstar.com/headlines/2014/08/05/1354152/pnoy-urged-declare-use-daylight-saving-time + +# From P Chan (2021-05-10): +# Here's a fairly comprehensive article in Japanese: +# https://wiki.suikawiki.org/n/Philippine%20Time +# (2021-05-16): +# According to the references listed in the article, +# the periods that the Philippines (Manila) observed DST or used +9 are: +# +# 1936-10-31 24:00 to 1937-01-15 24:00 +# (Proclamation No. 104, Proclamation No. 126) +# 1941-12-15 24:00 to 1945-11-30 24:00 +# (Proclamation No. 789, Proclamation No. 20) +# 1954-04-11 24:00 to 1954-06-04 24:00 +# (Proclamation No. 13, Proclamation No. 33) +# 1977-03-27 24:00 to 1977-09-21 24:00 +# (Proclamation No. 1629, Proclamation No. 1641) +# 1990-05-21 00:00 to 1990-07-28 24:00 +# (National Emergency Memorandum Order No. 17, Executive Order No. 415) +# +# Proclamation No. 104 ... October 30, 1936 +# https://www.officialgazette.gov.ph/1936/10/30/proclamation-no-104-s-1936/ +# Proclamation No. 126 ... January 15, 1937 +# https://www.officialgazette.gov.ph/1937/01/15/proclamation-no-126-s-1937/ +# Proclamation No. 789 ... December 13, 1941 +# https://www.officialgazette.gov.ph/1941/12/13/proclamation-no-789-s-1941/ +# Proclamation No. 20 ... November 11, 1945 +# https://www.officialgazette.gov.ph/1945/11/11/proclamation-no-20-s-1945/ +# Proclamation No. 13 ... April 6, 1954 +# https://www.officialgazette.gov.ph/1954/04/06/proclamation-no-13-s-1954/ +# Proclamation No. 33 ... June 3, 1954 +# https://www.officialgazette.gov.ph/1954/06/03/proclamation-no-33-s-1954/ +# Proclamation No. 1629 ... March 25, 1977 +# https://www.officialgazette.gov.ph/1977/03/25/proclamation-no-1629-s-1977/ +# Proclamation No. 1641 ...May 26, 1977 +# https://www.officialgazette.gov.ph/1977/05/26/proclamation-no-1641-s-1977/ +# National Emergency Memorandum Order No. 17 ... May 2, 1990 +# https://www.officialgazette.gov.ph/1990/05/02/national-emergency-memorandum-order-no-17-s-1990/ +# Executive Order No. 415 ... July 20, 1990 +# https://www.officialgazette.gov.ph/1990/07/20/executive-order-no-415-s-1990/ +# +# During WWII, Proclamation No. 789 fixed two periods of DST. The first period +# was set to continue only until January 31, 1942. But Manila was occupied by +# the Japanese earlier in the month.... +# +# For the date of the adoption of standard time, Shank[s] gives 1899-05-11. +# The article is not able to state the basis of that. I guess it was based on +# a US War Department Circular issued on that date. +# https://books.google.com/books?id=JZ1PAAAAYAAJ&pg=RA3-PA8 +# +# However, according to other sources, standard time was adopted on +# 1899-09-06. Also, the LMT was GMT+8:03:52 +# https://books.google.com/books?id=MOYIAQAAIAAJ&pg=PA521 +# https://books.google.com/books?id=lSnqqatpYikC&pg=PA21 +# +# From Paul Eggert (2024-09-05): +# The penultimate URL in P Chan's email refers to page 521 of +# Selga M, The Time Service in the Philippines. +# Proc Pan-Pacific Science Congress. Vol. 1 (1923), 519-532. +# It says, "The change from the meridian 120° 58' 04" to the 120th implied a +# change of 3 min. 52s.26 in time; consequently on 6th September, 1899, +# Manila Observatory gave the noon signal 3 min. 52s.26 later than before". +# +# Wikipedia says the US declared Manila liberated on March 4, 1945; +# this doesn't affect clocks, just our time zone abbreviation and DST flag. # From Paul Goyette (2018-06-15) with URLs updated by Guy Harris (2024-02-15): # In the Philippines, there is a national law, Republic Act No. 10535 @@ -3720,24 +3769,26 @@ Zone Asia/Hebron 2:20:23 - LMT 1900 Oct # influence of the sources. There is no current abbreviation for DST, # so use "PDT", the usual American style. -# From P Chan (2021-05-10): -# Here's a fairly comprehensive article in Japanese: -# https://wiki.suikawiki.org/n/Philippine%20Time -# From Paul Eggert (2021-05-10): -# The info in the Japanese table has not been absorbed (yet) below. - # Rule NAME FROM TO - IN ON AT SAVE LETTER/S -Rule Phil 1936 only - Nov 1 0:00 1:00 D -Rule Phil 1937 only - Feb 1 0:00 0 S -Rule Phil 1954 only - Apr 12 0:00 1:00 D -Rule Phil 1954 only - Jul 1 0:00 0 S -Rule Phil 1978 only - Mar 22 0:00 1:00 D -Rule Phil 1978 only - Sep 21 0:00 0 S +Rule Phil 1936 only - Oct 31 24:00 1:00 D +Rule Phil 1937 only - Jan 15 24:00 0 S +Rule Phil 1941 only - Dec 15 24:00 1:00 D +# The following three rules were canceled by Japan: +#Rule Phil 1942 only - Jan 31 24:00 0 S +#Rule Phil 1942 only - Mar 1 0:00 1:00 D +#Rule Phil 1942 only - Jun 30 24:00 0 S +Rule Phil 1945 only - Nov 30 24:00 0 S +Rule Phil 1954 only - Apr 11 24:00 1:00 D +Rule Phil 1954 only - Jun 4 24:00 0 S +Rule Phil 1977 only - Mar 27 24:00 1:00 D +Rule Phil 1977 only - Sep 21 24:00 0 S +Rule Phil 1990 only - May 21 0:00 1:00 D +Rule Phil 1990 only - Jul 28 24:00 0 S # Zone NAME STDOFF RULES FORMAT [UNTIL] -Zone Asia/Manila -15:56:00 - LMT 1844 Dec 31 - 8:04:00 - LMT 1899 May 11 - 8:00 Phil P%sT 1942 May - 9:00 - JST 1944 Nov +Zone Asia/Manila -15:56:08 - LMT 1844 Dec 31 + 8:03:52 - LMT 1899 Sep 6 4:00u + 8:00 Phil P%sT 1942 Feb 11 24:00 + 9:00 - JST 1945 Mar 4 8:00 Phil P%sT # Bahrain diff --git a/src/java.base/share/data/tzdata/australasia b/src/java.base/share/data/tzdata/australasia index 09698826a49..d659d1fb4b1 100644 --- a/src/java.base/share/data/tzdata/australasia +++ b/src/java.base/share/data/tzdata/australasia @@ -1262,10 +1262,10 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila # The 1992 ending date used in the rules is a best guess; # it matches what was used in the past. -# The Australian Bureau of Meteorology FAQ -# http://www.bom.gov.au/faq/faqgen.htm -# (1999-09-27) writes that Giles Meteorological Station uses -# South Australian time even though it's located in Western Australia. +# From Christopher Hunt (2006-11-21), after an advance warning +# from Jesper Nørgaard Welen (2006-11-01): +# WA are trialing DST for three years. +# http://www.parliament.wa.gov.au/parliament/bills.nsf/9A1B183144403DA54825721200088DF1/$File/Bill175-1B.pdf # From Paul Eggert (2018-04-01): # The Guardian Express of Perth, Australia reported today that the @@ -1277,54 +1277,10 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila # https://www.communitynews.com.au/guardian-express/news/exclusive-daylight-savings-coming-wa-summer-2018/ # [The article ends with "Today's date is April 1."] -# Queensland - -# From Paul Eggert (2018-02-26): -# I lack access to the following source for Queensland DST: -# Pearce C. History of daylight saving time in Queensland. -# Queensland Hist J. 2017 Aug;23(6):389-403 -# https://search.informit.com.au/documentSummary;dn=994682348436426;res=IELHSS - -# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06): -# # The state of QUEENSLAND.. [ Courtesy Qld. Dept Premier Econ&Trade Devel ] -# # [ Dec 1990 ] -# ... -# Zone Australia/Queensland 10:00 AQ %sST -# ... -# Rule AQ 1971 only - Oct lastSun 2:00 1:00 D -# Rule AQ 1972 only - Feb lastSun 3:00 0 E -# Rule AQ 1989 max - Oct lastSun 2:00 1:00 D -# Rule AQ 1990 max - Mar Sun>=1 3:00 0 E - -# From Bradley White (1989-12-24): -# "Australia/Queensland" now observes daylight time (i.e. from -# October 1989). - -# From Bradley White (1991-03-04): -# A recent excerpt from an Australian newspaper... -# ...Queensland...[has] agreed to end daylight saving -# at 3am tomorrow (March 3)... - -# From John Mackin (1991-03-06): -# I can certainly confirm for my part that Daylight Saving in NSW did in fact -# end on Sunday, 3 March. I don't know at what hour, though. (It surprised -# me.) - -# From Bradley White (1992-03-08): -# ...there was recently a referendum in Queensland which resulted -# in the experimental daylight saving system being abandoned. So, ... -# ... -# Rule QLD 1989 1991 - Oct lastSun 2:00 1:00 D -# Rule QLD 1990 1992 - Mar Sun>=1 3:00 0 S -# ... - -# From Arthur David Olson (1992-03-08): -# The chosen rules the union of the 1971/1972 change and the 1989-1992 changes. - -# From Christopher Hunt (2006-11-21), after an advance warning -# from Jesper Nørgaard Welen (2006-11-01): -# WA are trialing DST for three years. -# http://www.parliament.wa.gov.au/parliament/bills.nsf/9A1B183144403DA54825721200088DF1/$File/Bill175-1B.pdf +# The Australian Bureau of Meteorology FAQ +# http://www.bom.gov.au/faq/faqgen.htm +# (1999-09-27) writes that Giles Meteorological Station uses +# South Australian time even though it's located in Western Australia. # From Rives McDow (2002-04-09): # The most interesting region I have found consists of three towns on the @@ -1382,6 +1338,59 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila # For lack of better info, assume the tradition dates back to the # introduction of standard time in 1895. +# From Stuart Bishop (2024-11-12): +# An article discussing the in-use but technically unofficial timezones +# in the Western Australian portion of the Nullarbor Plain. +# https://www.abc.net.au/news/2024-11-22/outback-wa-properties-strange-time-zones/104542494 +# From Paul Eggert (2024-11-12): +# As the article says, the Eyre Bird Observatory and nearby sheep stations +# can use Tokyo time. Other possibilities include Asia/Chita, Asia/Seoul, +# and Asia/Jayapura. + +# Queensland + +# From Paul Eggert (2018-02-26): +# I lack access to the following source for Queensland DST: +# Pearce C. History of daylight saving time in Queensland. +# Queensland Hist J. 2017 Aug;23(6):389-403 +# https://search.informit.com.au/documentSummary;dn=994682348436426;res=IELHSS + +# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06): +# # The state of QUEENSLAND.. [ Courtesy Qld. Dept Premier Econ&Trade Devel ] +# # [ Dec 1990 ] +# ... +# Zone Australia/Queensland 10:00 AQ %sST +# ... +# Rule AQ 1971 only - Oct lastSun 2:00 1:00 D +# Rule AQ 1972 only - Feb lastSun 3:00 0 E +# Rule AQ 1989 max - Oct lastSun 2:00 1:00 D +# Rule AQ 1990 max - Mar Sun>=1 3:00 0 E + +# From Bradley White (1989-12-24): +# "Australia/Queensland" now observes daylight time (i.e. from +# October 1989). + +# From Bradley White (1991-03-04): +# A recent excerpt from an Australian newspaper... +# ...Queensland...[has] agreed to end daylight saving +# at 3am tomorrow (March 3)... + +# From John Mackin (1991-03-06): +# I can certainly confirm for my part that Daylight Saving in NSW did in fact +# end on Sunday, 3 March. I don't know at what hour, though. (It surprised +# me.) + +# From Bradley White (1992-03-08): +# ...there was recently a referendum in Queensland which resulted +# in the experimental daylight saving system being abandoned. So, ... +# ... +# Rule QLD 1989 1991 - Oct lastSun 2:00 1:00 D +# Rule QLD 1990 1992 - Mar Sun>=1 3:00 0 S +# ... + +# From Arthur David Olson (1992-03-08): +# The chosen rules the union of the 1971/1972 change and the 1989-1992 changes. + # southeast Australia # diff --git a/src/java.base/share/data/tzdata/etcetera b/src/java.base/share/data/tzdata/etcetera index 780c835819d..41660b05dba 100644 --- a/src/java.base/share/data/tzdata/etcetera +++ b/src/java.base/share/data/tzdata/etcetera @@ -74,6 +74,10 @@ Link Etc/GMT GMT # so we moved the names into the Etc subdirectory. # Also, the time zone abbreviations are now compatible with %z. +# There is no "Etc/Unknown" entry, as CLDR says that "Etc/Unknown" +# corresponds to an unknown or invalid time zone, and things would get +# confusing if Etc/Unknown were made valid here. + Zone Etc/GMT-14 14 - %z Zone Etc/GMT-13 13 - %z Zone Etc/GMT-12 12 - %z diff --git a/src/java.base/share/data/tzdata/europe b/src/java.base/share/data/tzdata/europe index df203f218d1..7ba6c679609 100644 --- a/src/java.base/share/data/tzdata/europe +++ b/src/java.base/share/data/tzdata/europe @@ -1170,7 +1170,7 @@ Zone Atlantic/Faroe -0:27:04 - LMT 1908 Jan 11 # Tórshavn # However, Greenland will change to Daylight Saving Time again in 2024 # and onwards. -# From a contributor who wishes to remain anonymous for now (2023-10-29): +# From Jule Dabars (2023-10-29): # https://www.dr.dk/nyheder/seneste/i-nat-skal-uret-stilles-en-time-tilbage-men-foerste-gang-sker-det-ikke-i-groenland # with a link to that page: # https://naalakkersuisut.gl/Nyheder/2023/10/2710_sommertid diff --git a/src/java.base/share/data/tzdata/factory b/src/java.base/share/data/tzdata/factory index a05346a301d..e5e7d88f5f6 100644 --- a/src/java.base/share/data/tzdata/factory +++ b/src/java.base/share/data/tzdata/factory @@ -31,5 +31,15 @@ # time zone abbreviation "-00", indicating that the actual time zone # is unknown. +# TZ="Factory" was added to TZDB in 1989, and in 2016 its abbreviation +# was changed to "-00" from a longish English-language error message. +# Around 2010, CLDR added "Etc/Unknown" for use with TZDB, to stand +# for an unknown or invalid time zone. These two notions differ: +# TZ="Factory" is a valid timezone, so tzalloc("Factory") succeeds, whereas +# TZ="Etc/Unknown" is invalid and tzalloc("Etc/Unknown") fails. +# Also, a downstream distributor could modify Factory to be a +# default timezone suitable for the devices it manufactures, +# whereas that cannot happen for Etc/Unknown. + # Zone NAME STDOFF RULES FORMAT Zone Factory 0 - -00 diff --git a/src/java.base/share/data/tzdata/leapseconds b/src/java.base/share/data/tzdata/leapseconds index 63a76620dbf..042a32b052c 100644 --- a/src/java.base/share/data/tzdata/leapseconds +++ b/src/java.base/share/data/tzdata/leapseconds @@ -92,11 +92,11 @@ Leap 2016 Dec 31 23:59:60 + S # Any additional leap seconds will come after this. # This Expires line is commented out for now, # so that pre-2020a zic implementations do not reject this file. -#Expires 2025 Jun 28 00:00:00 +#Expires 2025 Dec 28 00:00:00 # POSIX timestamps for the data in this file: -#updated 1720104763 (2024-07-04 14:52:43 UTC) -#expires 1751068800 (2025-06-28 00:00:00 UTC) +#updated 1736208000 (2025-01-07 00:00:00 UTC) +#expires 1766880000 (2025-12-28 00:00:00 UTC) # Updated through IERS Bulletin C (https://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat) -# File expires on 28 June 2025 +# File expires on 28 December 2025 diff --git a/src/java.base/share/data/tzdata/northamerica b/src/java.base/share/data/tzdata/northamerica index c95e7d0e643..0a54e63becc 100644 --- a/src/java.base/share/data/tzdata/northamerica +++ b/src/java.base/share/data/tzdata/northamerica @@ -50,9 +50,12 @@ # in New York City (1869-10). His 1870 proposal was based on Washington, DC, # but in 1872-05 he moved the proposed origin to Greenwich. -# From Paul Eggert (2018-03-20): +# From Paul Eggert (2024-11-18): # Dowd's proposal left many details unresolved, such as where to draw -# lines between time zones. The key individual who made time zones +# lines between time zones. Sandford Fleming of the Canadian Pacific Railway +# argued for Dowd's proposal in 1876, and Cleveland Abbe of the American +# Meteorology Society published a report in 1879 recommending four US time +# zones based on GMT. However, the key individual who made time zones # work in the US was William Frederick Allen - railway engineer, # managing editor of the Travelers' Guide, and secretary of the # General Time Convention, a railway standardization group. Allen @@ -2654,7 +2657,7 @@ Zone America/Dawson -9:17:40 - LMT 1900 Aug 20 # http://puentelibre.mx/noticia/ciudad_juarez_cambio_horario_noviembre_2022/ # Rule NAME FROM TO - IN ON AT SAVE LETTER/S -Rule Mexico 1931 only - April 30 0:00 1:00 D +Rule Mexico 1931 only - Apr 30 0:00 1:00 D Rule Mexico 1931 only - Oct 1 0:00 0 S Rule Mexico 1939 only - Feb 5 0:00 1:00 D Rule Mexico 1939 only - Jun 25 0:00 0 S diff --git a/src/java.base/share/data/tzdata/southamerica b/src/java.base/share/data/tzdata/southamerica index 3824202546a..0a5859600e8 100644 --- a/src/java.base/share/data/tzdata/southamerica +++ b/src/java.base/share/data/tzdata/southamerica @@ -1710,7 +1710,7 @@ Rule Para 2005 2009 - Mar Sun>=8 0:00 0 - # and that on the first Sunday of the month of October, it is to be set # forward 60 minutes, in all the territory of the Paraguayan Republic. # ... -Rule Para 2010 max - Oct Sun>=1 0:00 1:00 - +Rule Para 2010 2024 - Oct Sun>=1 0:00 1:00 - Rule Para 2010 2012 - Apr Sun>=8 0:00 0 - # # From Steffen Thorsen (2013-03-07): @@ -1729,14 +1729,35 @@ Rule Para 2010 2012 - Apr Sun>=8 0:00 0 - # https://www.abc.com.py/politica/2023/07/12/promulgacion-el-cambio-de-hora-sera-por-ley/ # From Carlos Raúl Perasso (2023-07-27): # http://silpy.congreso.gov.py/descarga/ley-144138 -Rule Para 2013 max - Mar Sun>=22 0:00 0 - +Rule Para 2013 2024 - Mar Sun>=22 0:00 0 - +# +# From Heitor David Pinto (2024-09-24): +# Today the Congress of Paraguay passed a bill to observe UTC-3 permanently.... +# The text of the bill says that it would enter into force on the first +# Sunday in October 2024, the same date currently scheduled to start DST.... +# https://silpy.congreso.gov.py/web/expediente/132531 +# (2024-10-14): +# The president approved the law on 11 October 2024, +# and it was officially published on 14 October 2024. +# https://www.gacetaoficial.gov.py/index/detalle_publicacion/89723 +# The text of the law says that it enters into force on the first +# Sunday in October 2024 (6 October 2024). But the constitution +# prohibits retroactive effect, and the civil code says that laws +# enter into force on the day after their publication or on the day +# that they specify, and it also says that they don't have retroactive +# effect. So I think that the time change on 6 October 2024 should +# still be considered as DST according to the previous law, and +# permanently UTC-3 from 15 October 2024 according to the new law.... +# https://www.constituteproject.org/constitution/Paraguay_2011 +# https://www.oas.org/dil/esp/codigo_civil_paraguay.pdf # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Asuncion -3:50:40 - LMT 1890 -3:50:40 - AMT 1931 Oct 10 # Asunción Mean Time -4:00 - %z 1972 Oct -3:00 - %z 1974 Apr - -4:00 Para %z + -4:00 Para %z 2024 Oct 15 + -3:00 - %z # Peru # diff --git a/src/java.base/share/man/java.md b/src/java.base/share/man/java.md index 78b763f5786..49a74daea06 100644 --- a/src/java.base/share/man/java.md +++ b/src/java.base/share/man/java.md @@ -4004,6 +4004,110 @@ JVM will execute without loading any CDS archives. In addition, if you try to create a CDS archive with any of these 3 options specified, the JVM will report an error. +## Ahead-of-Time Cache + +The JDK supports ahead-of-time (AOT) optimizations that can be performed before an +application is executed. One example is Class Data Sharing (CDS), as described above, +that parses classes ahead of time. AOT optimizations can improve the start-up and +warm-up performance of Java applications. + +The Ahead-of-Time Cache (AOTCache) is a container introduced in JDK 24 for +storing artifacts produced by AOT optimizations. The AOTCache currently contains +Java classes and heap objects. The plans is to include other types of artifacts, +such as execution profiles and compiled methods, in future JDK releases. + +An AOTCache is specific to a combination of the following: + +- A particular application (as expressed by `-classpath`, `-jar`, or `--module-path`.) +- A particular JDK release. +- A particular OS and CPU architecture. + +If any of the above changes, you must recreate the AOTCache. + +The deployment of the AOTCache is divided into three phases: + +- **Training:** We execute the application with a representative work-load + to gather statistical data that tell us what artifacts should be included + into the AOTCache. The data are saved in an *AOT Configuration* file. + +- **Assembly:** We use the AOT Configuration file to produce an AOTCache. + +- **Production:** We execute the application with the AOTCache for better + start-up and warm-up performance. + +The AOTCache can be used with the following command-line options: + +`-XX:AOTCache:=`*cachefile* +: Specifies the location of the AOTCache. The standard extension for *cachefile* is `.aot`. + If `-XX:AOTCache` is specified but `-XX:AOTMode` is not specified, + then `AOTMode` will be given the value of `auto`. + +`-XX:AOTConfiguration:=`*configfile* +: Specifies the AOT Configuration file for the JVM to write to or read from. + This option can be used only with `-XX:AOTMode=record` and `-XX:AOTMode=create`. + The standard extension for *configfile* is `.aotconfig`. + +`-XX:+AOTMode:=`*mode* +: *mode* must be one of the following: `off`, `record`, `create`, `auto`, or `on`. + +- `off`: AOTCache is not used. + +- `record`: Execute the application in the Training phase. + `-XX:AOTConfiguration=`*configfile* must be specified. The JVM gathers + statistical data and stores them into *configfile*. + +- `create`: Perform the Assembly phase. `-XX:AOTConfiguration=`*configfile* + and `-XX:AOTCache=`*cachefile* must be specified. The JVM reads the statistical + data from *configfile* and writes the optimization artifacts into *cachefile*. + Note that the application itself is not executed in this phase. + +- `auto` or `on`: These modes should be used in the Production phase. + If `-XX:AOTCache=`*cachefile* is specified, the JVM tries to + load *cachefile* as the AOTCache. Otherwise, the JVM tries to load + a *default CDS archive* from the JDK installation directory as the AOTCache. + + The loading of an AOTCache can fail for a number of reasons: + + - You are trying to use the AOTCache with an incompatible application, JDK release, + or OS/CPU. + + - The specified AOTCache file does not exist or is not accessible. + + - Incompatible JVM options are used (for example, certain JVMTI options). + + Since AOTCache is an optimization feature, there's no guarantee that it will be + compatible with all possible JVM options. See [JEP 483](https://openjdk.org/jeps/483), + section **Consistency of training and subsequent runs** for a representitive + list of scenarios that may be incompatible with the AOTCache for JDK 24. + + These scenarios usually involve arbitrary modification of classes for diagnostic + purposes and are typically not relevant for production environments. + + When the AOTCache fails to load: + + - If `AOTMode` is `auto`, the JVM will continue execution without using the + AOTCache. This is the recommended mode for production environments, especially + when you may not have complete control of the command-line (e.g., your + application's launch script may allow users to inject options to the command-line). + This allows your application to function correctly, although sometimes it may not + benefit from the AOTCache. + + - If `AOTMode` is `on`, the JVM will print an error message and exit immediately. This + mode should be used only as a "fail-fast" debugging aid to check if your command-line + options are compatible with the AOTCache. An alternative is to run your application with + `-XX:AOTMode=auto -Xlog:cds` to see if the AOTCache can be used or not. + +`-XX:+AOTClassLinking` +: If this options is specified with `-XX:AOTMode=create`, the JVM will perform more + advanced optimizations (such as ahead-of-time resolution of invokedynamic instructions) + when creating the AOTCache. As a result, the appication will see further improvements + in start-up and warm-up performance. + + Using `-XX:+AOTClassLinking` will impose further restrictions on command-line options + that can be used in the Production phase. Please see [JEP 483](https://openjdk.org/jeps/483) for a + detailed discussion of `-XX:+AOTClassLinking` and its restrictions. + + ## Performance Tuning Examples You can use the Java advanced runtime options to optimize the performance of diff --git a/src/java.base/share/man/keytool.md b/src/java.base/share/man/keytool.md index 8484ec6b5b3..19ba8c34912 100644 --- a/src/java.base/share/man/keytool.md +++ b/src/java.base/share/man/keytool.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 1998, 2024, 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 @@ -1661,7 +1661,7 @@ To import a certificate for the CA, complete the following process: The `cacerts` keystore ships with a set of root certificates issued by the CAs of [the Oracle Java Root Certificate program]( - http://www.oracle.com/technetwork/java/javase/javasecarootcertsprogram-1876540.html). + https://www.oracle.com/java/technologies/javase/carootcertsprogram.html). If you request a signed certificate from a CA, and a certificate authenticating that CA's public key hasn't been added to `cacerts`, then you must import a certificate from that CA as a trusted certificate. diff --git a/src/java.base/share/native/libzip/zip_util.c b/src/java.base/share/native/libzip/zip_util.c index 8f2f19c66a2..c327d337659 100644 --- a/src/java.base/share/native/libzip/zip_util.c +++ b/src/java.base/share/native/libzip/zip_util.c @@ -72,11 +72,9 @@ static void freeCEN(jzfile *); static jint INITIAL_META_COUNT = 2; /* initial number of entries in meta name array */ /* - * Declare library specific JNI_Onload entry if static build + * Declare library specific JNI_Onload entry */ -#ifdef STATIC_BUILD DEF_STATIC_JNI_OnLoad -#endif /* * The ZFILE_* functions exist to provide some platform-independence with diff --git a/src/java.base/unix/classes/sun/net/PortConfig.java b/src/java.base/unix/classes/sun/net/PortConfig.java index 428870c9222..e0130ac2acb 100644 --- a/src/java.base/unix/classes/sun/net/PortConfig.java +++ b/src/java.base/unix/classes/sun/net/PortConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -54,7 +54,7 @@ private PortConfig() {} break; case AIX: // The ephemeral port is OS version dependent on AIX: - // http://publib.boulder.ibm.com/infocenter/aix/v7r1/topic/com.ibm.aix.rsct315.admin/bl503_ephport.htm + // https://www.ibm.com/support/pages/node/886227 // However, on AIX 5.3 / 6.1 / 7.1 we always see the // settings below by using: // /usr/sbin/no -a | fgrep ephemeral diff --git a/src/java.base/unix/native/libjava/ProcessEnvironment_md.c b/src/java.base/unix/native/libjava/ProcessEnvironment_md.c index 46ccc5db071..556ef609422 100644 --- a/src/java.base/unix/native/libjava/ProcessEnvironment_md.c +++ b/src/java.base/unix/native/libjava/ProcessEnvironment_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, 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 @@ -37,8 +37,8 @@ * The declaration is standardized as part of UNIX98, but there is * no standard (not even de-facto) header file where the * declaration is to be found. See: - * http://www.opengroup.org/onlinepubs/009695399/functions/environ.html - * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_02.html + * https://pubs.opengroup.org/onlinepubs/009695399/functions/environ.html + * https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_02.html * * "All identifiers in this volume of IEEE Std 1003.1-2001, except * environ, are defined in at least one of the headers" (!) diff --git a/src/java.base/unix/native/libjava/ProcessImpl_md.c b/src/java.base/unix/native/libjava/ProcessImpl_md.c index 12b071a7e52..f79b8123b11 100644 --- a/src/java.base/unix/native/libjava/ProcessImpl_md.c +++ b/src/java.base/unix/native/libjava/ProcessImpl_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -109,7 +109,7 @@ * Note that when using posix_spawn(3), we exec twice: first a tiny binary called * the jspawnhelper, then in the jspawnhelper we do the pre-exec work and exec a * second time, this time the target binary (similar to the "exec-twice-technique" - * described in http://mail.openjdk.org/pipermail/core-libs-dev/2018-September/055333.html). + * described in https://mail.openjdk.org/pipermail/core-libs-dev/2018-September/055333.html). * * This is a JDK-specific implementation detail which just happens to be * implemented for jdk.lang.Process.launchMechanism=POSIX_SPAWN. @@ -203,8 +203,7 @@ setSIGCHLDHandler(JNIEnv *env) * non-standard-compliant, and we shouldn't rely on it. * * References: - * http://www.opengroup.org/onlinepubs/7908799/xsh/exec.html - * http://www.pasc.org/interps/unofficial/db/p1003.1/pasc-1003.1-132.html + * https://pubs.opengroup.org/onlinepubs/7908799/xsh/exec.html */ struct sigaction sa; sa.sa_handler = SIG_DFL; diff --git a/src/java.base/unix/native/libjava/childproc.c b/src/java.base/unix/native/libjava/childproc.c index 4d196bfe93e..a768b166a9a 100644 --- a/src/java.base/unix/native/libjava/childproc.c +++ b/src/java.base/unix/native/libjava/childproc.c @@ -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 @@ -144,7 +144,7 @@ readFully(int fd, void *buf, size_t nbyte) buf = (void *) (((char *)buf) + n); } else if (errno == EINTR) { /* Strange signals like SIGJVM1 are possible at any time. - * See http://www.dreamsongs.com/WorseIsBetter.html */ + * See https://dreamsongs.com/WorseIsBetter.html */ } else { return -1; } diff --git a/src/java.base/unix/native/libjava/childproc.h b/src/java.base/unix/native/libjava/childproc.h index d70a58a22da..7de19467148 100644 --- a/src/java.base/unix/native/libjava/childproc.h +++ b/src/java.base/unix/native/libjava/childproc.h @@ -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 @@ -37,8 +37,8 @@ * The declaration is standardized as part of UNIX98, but there is * no standard (not even de-facto) header file where the * declaration is to be found. See: - * http://www.opengroup.org/onlinepubs/009695399/functions/environ.html - * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_02.html + * https://pubs.opengroup.org/onlinepubs/009695399/functions/environ.html + * https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_02.html * * "All identifiers in this volume of IEEE Std 1003.1-2001, except * environ, are defined in at least one of the headers" (!) diff --git a/src/java.desktop/share/classes/java/beans/beancontext/package-info.java b/src/java.desktop/share/classes/java/beans/beancontext/package-info.java index 25c38996dee..be9ab453359 100644 --- a/src/java.desktop/share/classes/java/beans/beancontext/package-info.java +++ b/src/java.desktop/share/classes/java/beans/beancontext/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, 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 @@ -30,12 +30,15 @@ * context can be nested within another bean context. This package also * contains events and listener interface for beans being added and removed from * a bean context. - * - * This package has been deprecated and may be removed in a future version of the Java Platform - * There is no replacement. - * + *

        + * These APIs are now both obsolete and express an anti-pattern of component + * assembly and interaction. + *

        + * This package has been deprecated and may be removed in a future version of + * the Java Platform. There is no replacement. + *

        * All of the classes and interfaces in this package have been terminally deprecated. - * + *

        * Users are advised to migrate their applications to other technologies. * * @since 1.2 diff --git a/src/java.desktop/share/classes/javax/swing/event/ListSelectionEvent.java b/src/java.desktop/share/classes/javax/swing/event/ListSelectionEvent.java index c0e04878d63..6225e55186f 100644 --- a/src/java.desktop/share/classes/javax/swing/event/ListSelectionEvent.java +++ b/src/java.desktop/share/classes/javax/swing/event/ListSelectionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, 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 @@ -26,11 +26,11 @@ package javax.swing.event; import java.util.EventObject; -import javax.swing.*; +import javax.swing.ListSelectionModel; /** - * An event that characterizes a change in selection. The change is limited to a + * An event that characterizes a change in selection. The change is limited to * a single inclusive interval. The selection of at least one index within the * range will have changed. A decent {@code ListSelectionModel} implementation * will keep the range as small as possible. {@code ListSelectionListeners} will @@ -53,9 +53,9 @@ @SuppressWarnings("serial") // Same-version serialization only public class ListSelectionEvent extends EventObject { - private int firstIndex; - private int lastIndex; - private boolean isAdjusting; + private final int firstIndex; + private final int lastIndex; + private final boolean isAdjusting; /** * Represents a change in selection status between {@code firstIndex} and @@ -64,8 +64,8 @@ public class ListSelectionEvent extends EventObject * have changed. * * @param source the {@code Object} on which the event initially occurred - * @param firstIndex the first index in the range, <= lastIndex - * @param lastIndex the last index in the range, >= firstIndex + * @param firstIndex the first index in the range, <= {@code lastIndex} + * @param lastIndex the last index in the range, >= {@code firstIndex} * @param isAdjusting whether or not this is one in a series of * multiple events, where changes are still being made */ @@ -111,7 +111,7 @@ public ListSelectionEvent(Object source, int firstIndex, int lastIndex, * Returns a {@code String} that displays and identifies this * object's properties. * - * @return a String representation of this object + * @return a string representation of this object */ public String toString() { String properties = diff --git a/src/java.desktop/share/classes/javax/swing/text/html/CSS.java b/src/java.desktop/share/classes/javax/swing/text/html/CSS.java index 60e8ca95b14..ec4d3c932f9 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/CSS.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/CSS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, 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 @@ -1097,7 +1097,7 @@ private static int getTableBorder(AttributeSet tableAttr) { * up a translation from StyleConstants (i.e. the well known * attributes) to the associated CSS attributes. */ - private static final Hashtable styleConstantToCssMap = new Hashtable(17); + private static final Map styleConstantToCssMap; /** Maps from HTML value to a CSS value. Used in internal mapping. */ private static final Hashtable htmlValueToCssValueMap = new Hashtable(8); /** Maps from CSS value (string) to internal value. */ @@ -1167,38 +1167,40 @@ private static int getTableBorder(AttributeSet tableAttr) { ); // initialize StyleConstants mapping - styleConstantToCssMap.put(StyleConstants.FontFamily, - CSS.Attribute.FONT_FAMILY); - styleConstantToCssMap.put(StyleConstants.FontSize, - CSS.Attribute.FONT_SIZE); - styleConstantToCssMap.put(StyleConstants.Bold, - CSS.Attribute.FONT_WEIGHT); - styleConstantToCssMap.put(StyleConstants.Italic, - CSS.Attribute.FONT_STYLE); - styleConstantToCssMap.put(StyleConstants.Underline, - CSS.Attribute.TEXT_DECORATION); - styleConstantToCssMap.put(StyleConstants.StrikeThrough, - CSS.Attribute.TEXT_DECORATION); - styleConstantToCssMap.put(StyleConstants.Superscript, - CSS.Attribute.VERTICAL_ALIGN); - styleConstantToCssMap.put(StyleConstants.Subscript, - CSS.Attribute.VERTICAL_ALIGN); - styleConstantToCssMap.put(StyleConstants.Foreground, - CSS.Attribute.COLOR); - styleConstantToCssMap.put(StyleConstants.Background, - CSS.Attribute.BACKGROUND_COLOR); - styleConstantToCssMap.put(StyleConstants.FirstLineIndent, - CSS.Attribute.TEXT_INDENT); - styleConstantToCssMap.put(StyleConstants.LeftIndent, - CSS.Attribute.MARGIN_LEFT); - styleConstantToCssMap.put(StyleConstants.RightIndent, - CSS.Attribute.MARGIN_RIGHT); - styleConstantToCssMap.put(StyleConstants.SpaceAbove, - CSS.Attribute.MARGIN_TOP); - styleConstantToCssMap.put(StyleConstants.SpaceBelow, - CSS.Attribute.MARGIN_BOTTOM); - styleConstantToCssMap.put(StyleConstants.Alignment, - CSS.Attribute.TEXT_ALIGN); + styleConstantToCssMap = Map.ofEntries( + Map.entry(StyleConstants.FontFamily, + CSS.Attribute.FONT_FAMILY), + Map.entry(StyleConstants.FontSize, + CSS.Attribute.FONT_SIZE), + Map.entry(StyleConstants.Bold, + CSS.Attribute.FONT_WEIGHT), + Map.entry(StyleConstants.Italic, + CSS.Attribute.FONT_STYLE), + Map.entry(StyleConstants.Underline, + CSS.Attribute.TEXT_DECORATION), + Map.entry(StyleConstants.StrikeThrough, + CSS.Attribute.TEXT_DECORATION), + Map.entry(StyleConstants.Superscript, + CSS.Attribute.VERTICAL_ALIGN), + Map.entry(StyleConstants.Subscript, + CSS.Attribute.VERTICAL_ALIGN), + Map.entry(StyleConstants.Foreground, + CSS.Attribute.COLOR), + Map.entry(StyleConstants.Background, + CSS.Attribute.BACKGROUND_COLOR), + Map.entry(StyleConstants.FirstLineIndent, + CSS.Attribute.TEXT_INDENT), + Map.entry(StyleConstants.LeftIndent, + CSS.Attribute.MARGIN_LEFT), + Map.entry(StyleConstants.RightIndent, + CSS.Attribute.MARGIN_RIGHT), + Map.entry(StyleConstants.SpaceAbove, + CSS.Attribute.MARGIN_TOP), + Map.entry(StyleConstants.SpaceBelow, + CSS.Attribute.MARGIN_BOTTOM), + Map.entry(StyleConstants.Alignment, + CSS.Attribute.TEXT_ALIGN) + ); // HTML->CSS htmlValueToCssValueMap.put("disc", CSS.Value.DISC); diff --git a/src/java.desktop/share/classes/sun/print/PathGraphics.java b/src/java.desktop/share/classes/sun/print/PathGraphics.java index 7a82ffb4a48..9a45b06657f 100644 --- a/src/java.desktop/share/classes/sun/print/PathGraphics.java +++ b/src/java.desktop/share/classes/sun/print/PathGraphics.java @@ -934,7 +934,7 @@ boolean printedSimpleGlyphVector(GlyphVector g, float x, float y) { /* If we reach here we have mapped all the glyphs back * one-to-one to simple unicode chars that we know are in the font. - * We can call "drawChars" on each one of them in turn, setting + * We can call "drawString" on each one of them in turn, setting * the position based on the glyph positions. * There's typically overhead in this. If numGlyphs is 'large', * it may even be better to try printGlyphVector() in this case. @@ -942,15 +942,28 @@ boolean printedSimpleGlyphVector(GlyphVector g, float x, float y) { * should be able to recover the text from simple glyph vectors * and we can avoid penalising the more common case - although * this is already a minority case. + * If we do use "drawString" on each character, we need to use a + * font without translation transform, since the font translation + * transform will already be reflected in the glyph positions, and + * we do not want to apply the translation twice. */ if (numGlyphs > 10 && printGlyphVector(g, x, y)) { return true; } + Font font2 = font; + if (font.isTransformed()) { + AffineTransform t = font.getTransform(); + if ((t.getType() & AffineTransform.TYPE_TRANSLATION) != 0) { + t.setTransform(t.getScaleX(), t.getShearY(), t.getShearX(), t.getScaleY(), 0, 0); + font2 = font.deriveFont(t); + } + } + for (int i=0; i #include "jni_util.h" -#define IMGEXTERN -#include "imageInitIDs.h" + +/* BufferedImage ids */ +jfieldID g_BImgRasterID; +jfieldID g_BImgTypeID; +jfieldID g_BImgCMID; +jmethodID g_BImgGetRGBMID; +jmethodID g_BImgSetRGBMID; + +/* Raster ids */ +jfieldID g_RasterWidthID; +jfieldID g_RasterHeightID; +jfieldID g_RasterMinXID; +jfieldID g_RasterMinYID; +jfieldID g_RasterBaseOriginXID; +jfieldID g_RasterBaseOriginYID; +jfieldID g_RasterSampleModelID; +jfieldID g_RasterDataBufferID; +jfieldID g_RasterNumDataElementsID; +jfieldID g_RasterNumBandsID; + +jfieldID g_BCRdataID; +jfieldID g_BCRscanstrID; +jfieldID g_BCRpixstrID; +jfieldID g_BCRdataOffsetsID; +jfieldID g_BCRtypeID; +jfieldID g_BPRdataID; +jfieldID g_BPRscanstrID; +jfieldID g_BPRpixstrID; +jfieldID g_BPRtypeID; +jfieldID g_BPRdataBitOffsetID; +jfieldID g_SCRdataID; +jfieldID g_SCRscanstrID; +jfieldID g_SCRpixstrID; +jfieldID g_SCRdataOffsetsID; +jfieldID g_SCRtypeID; +jfieldID g_ICRdataID; +jfieldID g_ICRscanstrID; +jfieldID g_ICRpixstrID; +jfieldID g_ICRdataOffsetsID; +jfieldID g_ICRtypeID; + +/* Color Model ids */ +jfieldID g_CMnBitsID; +jfieldID g_CMcspaceID; +jfieldID g_CMnumComponentsID; +jfieldID g_CMsuppAlphaID; +jfieldID g_CMisAlphaPreID; +jfieldID g_CMtransparencyID; +jfieldID g_CMcsTypeID; +jfieldID g_CMis_sRGBID; +jmethodID g_CMgetRGBdefaultMID; + +jfieldID g_ICMtransIdxID; +jfieldID g_ICMmapSizeID; +jfieldID g_ICMrgbID; + +/* Sample Model ids */ +jfieldID g_SMWidthID; +jfieldID g_SMHeightID; +jmethodID g_SMGetPixelsMID; +jmethodID g_SMSetPixelsMID; + +/* Single Pixel Packed Sample Model ids */ +jfieldID g_SPPSMmaskArrID; +jfieldID g_SPPSMmaskOffID; +jfieldID g_SPPSMnBitsID; +jfieldID g_SPPSMmaxBitID; + +/* Kernel ids */ +jfieldID g_KernelWidthID; +jfieldID g_KernelHeightID; +jfieldID g_KernelDataID; JNIEXPORT void JNICALL Java_java_awt_image_BufferedImage_initIDs(JNIEnv *env, jclass cls) { diff --git a/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.h b/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.h index c1c7a61680a..b042c091b3a 100644 --- a/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.h +++ b/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.h @@ -28,80 +28,76 @@ #include "jni.h" -#ifndef IMGEXTERN -# define IMGEXTERN extern -#endif - /* BufferedImage ids */ -IMGEXTERN jfieldID g_BImgRasterID; -IMGEXTERN jfieldID g_BImgTypeID; -IMGEXTERN jfieldID g_BImgCMID; -IMGEXTERN jmethodID g_BImgGetRGBMID; -IMGEXTERN jmethodID g_BImgSetRGBMID; +extern jfieldID g_BImgRasterID; +extern jfieldID g_BImgTypeID; +extern jfieldID g_BImgCMID; +extern jmethodID g_BImgGetRGBMID; +extern jmethodID g_BImgSetRGBMID; /* Raster ids */ -IMGEXTERN jfieldID g_RasterWidthID; -IMGEXTERN jfieldID g_RasterHeightID; -IMGEXTERN jfieldID g_RasterMinXID; -IMGEXTERN jfieldID g_RasterMinYID; -IMGEXTERN jfieldID g_RasterBaseOriginXID; -IMGEXTERN jfieldID g_RasterBaseOriginYID; -IMGEXTERN jfieldID g_RasterSampleModelID; -IMGEXTERN jfieldID g_RasterDataBufferID; -IMGEXTERN jfieldID g_RasterNumDataElementsID; -IMGEXTERN jfieldID g_RasterNumBandsID; +extern jfieldID g_RasterWidthID; +extern jfieldID g_RasterHeightID; +extern jfieldID g_RasterMinXID; +extern jfieldID g_RasterMinYID; +extern jfieldID g_RasterBaseOriginXID; +extern jfieldID g_RasterBaseOriginYID; +extern jfieldID g_RasterSampleModelID; +extern jfieldID g_RasterDataBufferID; +extern jfieldID g_RasterNumDataElementsID; +extern jfieldID g_RasterNumBandsID; -IMGEXTERN jfieldID g_BCRdataID; -IMGEXTERN jfieldID g_BCRscanstrID; -IMGEXTERN jfieldID g_BCRpixstrID; -IMGEXTERN jfieldID g_BCRdataOffsetsID; -IMGEXTERN jfieldID g_BCRtypeID; -IMGEXTERN jfieldID g_BPRdataID; -IMGEXTERN jfieldID g_BPRscanstrID; -IMGEXTERN jfieldID g_BPRpixstrID; -IMGEXTERN jfieldID g_BPRtypeID; -IMGEXTERN jfieldID g_BPRdataBitOffsetID; -IMGEXTERN jfieldID g_SCRdataID; -IMGEXTERN jfieldID g_SCRscanstrID; -IMGEXTERN jfieldID g_SCRpixstrID; -IMGEXTERN jfieldID g_SCRdataOffsetsID; -IMGEXTERN jfieldID g_SCRtypeID; -IMGEXTERN jfieldID g_ICRdataID; -IMGEXTERN jfieldID g_ICRscanstrID; -IMGEXTERN jfieldID g_ICRpixstrID; -IMGEXTERN jfieldID g_ICRdataOffsetsID; -IMGEXTERN jfieldID g_ICRtypeID; +extern jfieldID g_BCRdataID; +extern jfieldID g_BCRscanstrID; +extern jfieldID g_BCRpixstrID; +extern jfieldID g_BCRdataOffsetsID; +extern jfieldID g_BCRtypeID; +extern jfieldID g_BPRdataID; +extern jfieldID g_BPRscanstrID; +extern jfieldID g_BPRpixstrID; +extern jfieldID g_BPRtypeID; +extern jfieldID g_BPRdataBitOffsetID; +extern jfieldID g_SCRdataID; +extern jfieldID g_SCRscanstrID; +extern jfieldID g_SCRpixstrID; +extern jfieldID g_SCRdataOffsetsID; +extern jfieldID g_SCRtypeID; +extern jfieldID g_ICRdataID; +extern jfieldID g_ICRscanstrID; +extern jfieldID g_ICRpixstrID; +extern jfieldID g_ICRdataOffsetsID; +extern jfieldID g_ICRtypeID; /* Color Model ids */ -IMGEXTERN jfieldID g_CMnBitsID; -IMGEXTERN jfieldID g_CMcspaceID; -IMGEXTERN jfieldID g_CMnumComponentsID; -IMGEXTERN jfieldID g_CMsuppAlphaID; -IMGEXTERN jfieldID g_CMisAlphaPreID; -IMGEXTERN jfieldID g_CMtransparencyID; -IMGEXTERN jfieldID g_CMcsTypeID; -IMGEXTERN jfieldID g_CMis_sRGBID; -IMGEXTERN jmethodID g_CMgetRGBdefaultMID; +extern jfieldID g_CMnBitsID; +extern jfieldID g_CMcspaceID; +extern jfieldID g_CMnumComponentsID; +extern jfieldID g_CMsuppAlphaID; +extern jfieldID g_CMisAlphaPreID; +extern jfieldID g_CMtransparencyID; +extern jfieldID g_CMcsTypeID; +extern jfieldID g_CMis_sRGBID; +extern jmethodID g_CMgetRGBdefaultMID; -IMGEXTERN jfieldID g_ICMtransIdxID; -IMGEXTERN jfieldID g_ICMmapSizeID; -IMGEXTERN jfieldID g_ICMrgbID; +extern jfieldID g_ICMtransIdxID; +extern jfieldID g_ICMmapSizeID; +extern jfieldID g_ICMrgbID; /* Sample Model ids */ -IMGEXTERN jfieldID g_SMWidthID; -IMGEXTERN jfieldID g_SMHeightID; -IMGEXTERN jmethodID g_SMGetPixelsMID; -IMGEXTERN jmethodID g_SMSetPixelsMID; +extern jfieldID g_SMWidthID; +extern jfieldID g_SMHeightID; +extern jmethodID g_SMGetPixelsMID; +extern jmethodID g_SMSetPixelsMID; /* Single Pixel Packed Sample Model ids */ -IMGEXTERN jfieldID g_SPPSMmaskArrID; -IMGEXTERN jfieldID g_SPPSMmaskOffID; -IMGEXTERN jfieldID g_SPPSMnBitsID; -IMGEXTERN jfieldID g_SPPSMmaxBitID; +extern jfieldID g_SPPSMmaskArrID; +extern jfieldID g_SPPSMmaskOffID; +extern jfieldID g_SPPSMnBitsID; +extern jfieldID g_SPPSMmaxBitID; /* Kernel ids */ -IMGEXTERN jfieldID g_KernelWidthID; -IMGEXTERN jfieldID g_KernelHeightID; -IMGEXTERN jfieldID g_KernelDataID; +extern jfieldID g_KernelWidthID; +extern jfieldID g_KernelHeightID; +extern jfieldID g_KernelDataID; #endif /* IMAGEINITIDS_H */ diff --git a/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java b/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java index 5881ba55ef3..4c6b451b7e4 100644 --- a/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java +++ b/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.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 @@ -51,7 +51,6 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -import java.util.Arrays; import sun.awt.X11.XBaseWindow; import com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection; @@ -521,6 +520,20 @@ public boolean isRunningOnWayland() { // application icons). private static final WindowFocusListener waylandWindowFocusListener; + private static boolean containsWaylandWindowFocusListener(Window window) { + if (window == null) { + return false; + } + + for (WindowFocusListener focusListener : window.getWindowFocusListeners()) { + if (focusListener == waylandWindowFocusListener) { + return true; + } + } + + return false; + } + static { if (isOnWayland()) { waylandWindowFocusListener = new WindowAdapter() { @@ -530,13 +543,22 @@ public void windowLostFocus(WindowEvent e) { Window oppositeWindow = e.getOppositeWindow(); // The focus can move between the window calling the popup, - // and the popup window itself. + // and the popup window itself or its children. // We only dismiss the popup in other cases. if (oppositeWindow != null) { - if (window == oppositeWindow.getParent() ) { + if (containsWaylandWindowFocusListener(oppositeWindow.getOwner())) { addWaylandWindowFocusListenerToWindow(oppositeWindow); return; } + + Window owner = window.getOwner(); + while (owner != null) { + if (owner == oppositeWindow) { + return; + } + owner = owner.getOwner(); + } + if (window.getParent() == oppositeWindow) { return; } @@ -557,11 +579,11 @@ public void windowLostFocus(WindowEvent e) { } private static void addWaylandWindowFocusListenerToWindow(Window window) { - if (!Arrays - .asList(window.getWindowFocusListeners()) - .contains(waylandWindowFocusListener) - ) { + if (!containsWaylandWindowFocusListener(window)) { window.addWindowFocusListener(waylandWindowFocusListener); + for (Window ownedWindow : window.getOwnedWindows()) { + addWaylandWindowFocusListenerToWindow(ownedWindow); + } } } diff --git a/src/java.desktop/unix/native/common/awt/CUPSfuncs.c b/src/java.desktop/unix/native/common/awt/CUPSfuncs.c index 7594bd2c62a..7c60d824067 100644 --- a/src/java.desktop/unix/native/common/awt/CUPSfuncs.c +++ b/src/java.desktop/unix/native/common/awt/CUPSfuncs.c @@ -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 @@ -574,10 +574,10 @@ Java_sun_print_CUPSPrinter_getPageSizes(JNIEnv *env, // paper width and height dims[i*6] = size->width; dims[(i*6)+1] = size->length; - // paper printable area + // paper printable area. x and y coordinates of the lower left corner, width and height dims[(i*6)+2] = size->left; - dims[(i*6)+3] = size->top; - dims[(i*6)+4] = size->right; + dims[(i*6)+3] = size->top - size->bottom; + dims[(i*6)+4] = size->right - size->left; dims[(i*6)+5] = size->bottom; } } diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/fp_pipewire.h b/src/java.desktop/unix/native/libawt_xawt/awt/fp_pipewire.h deleted file mode 100644 index d39f7c833b7..00000000000 --- a/src/java.desktop/unix/native/libawt_xawt/awt/fp_pipewire.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#ifdef HEADLESS -#error This file should not be included in headless library -#endif -#ifndef _FP_PIPEWIRE_H -#define _FP_PIPEWIRE_H - - -struct pw_buffer *(*fp_pw_stream_dequeue_buffer)(struct pw_stream *stream); -const char * (*fp_pw_stream_state_as_string)(enum pw_stream_state state); -int (*fp_pw_stream_queue_buffer)(struct pw_stream *stream, - struct pw_buffer *buffer); -int (*fp_pw_stream_set_active)(struct pw_stream *stream, bool active); - -int (*fp_pw_stream_connect)( - struct pw_stream *stream, - enum pw_direction direction, - uint32_t target_id, - enum pw_stream_flags flags, - const struct spa_pod **params, - uint32_t n_params); - -struct pw_stream *(*fp_pw_stream_new)( - struct pw_core *core, - const char *name, - struct pw_properties *props -); -void (*fp_pw_stream_add_listener)(struct pw_stream *stream, - struct spa_hook *listener, - const struct pw_stream_events *events, - void *data); -int (*fp_pw_stream_disconnect)(struct pw_stream *stream); -void (*fp_pw_stream_destroy)(struct pw_stream *stream); - - -void (*fp_pw_init)(int *argc, char **argv[]); - -struct pw_core * -(*fp_pw_context_connect_fd)(struct pw_context *context, - int fd, - struct pw_properties *properties, - size_t user_data_size); - -int (*fp_pw_core_disconnect)(struct pw_core *core); - -struct pw_context * (*fp_pw_context_new)(struct pw_loop *main_loop, - struct pw_properties *props, - size_t user_data_size); - -struct pw_thread_loop * -(*fp_pw_thread_loop_new)(const char *name, const struct spa_dict *props); -struct pw_loop * (*fp_pw_thread_loop_get_loop)(struct pw_thread_loop *loop); -void (*fp_pw_thread_loop_signal)(struct pw_thread_loop *loop, - bool wait_for_accept); -void (*fp_pw_thread_loop_wait)(struct pw_thread_loop *loop); -void (*fp_pw_thread_loop_accept)(struct pw_thread_loop *loop); -int (*fp_pw_thread_loop_start)(struct pw_thread_loop *loop); -void (*fp_pw_thread_loop_stop)(struct pw_thread_loop *loop); -void (*fp_pw_thread_loop_destroy)(struct pw_thread_loop *loop); -void (*fp_pw_thread_loop_lock)(struct pw_thread_loop *loop); -void (*fp_pw_thread_loop_unlock)(struct pw_thread_loop *loop); - -struct pw_properties * (*fp_pw_properties_new)(const char *key, ...); - - -#endif //_FP_PIPEWIRE_H diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/screencast_pipewire.c b/src/java.desktop/unix/native/libawt_xawt/awt/screencast_pipewire.c index e81bd5410b3..09585964ac8 100644 --- a/src/java.desktop/unix/native/libawt_xawt/awt/screencast_pipewire.c +++ b/src/java.desktop/unix/native/libawt_xawt/awt/screencast_pipewire.c @@ -31,7 +31,63 @@ #include "jni_util.h" #include "awt.h" #include "screencast_pipewire.h" -#include "fp_pipewire.h" + +struct pw_buffer *(*fp_pw_stream_dequeue_buffer)(struct pw_stream *stream); +const char * (*fp_pw_stream_state_as_string)(enum pw_stream_state state); +int (*fp_pw_stream_queue_buffer)(struct pw_stream *stream, + struct pw_buffer *buffer); +int (*fp_pw_stream_set_active)(struct pw_stream *stream, bool active); + +int (*fp_pw_stream_connect)( + struct pw_stream *stream, + enum pw_direction direction, + uint32_t target_id, + enum pw_stream_flags flags, + const struct spa_pod **params, + uint32_t n_params); + +struct pw_stream *(*fp_pw_stream_new)( + struct pw_core *core, + const char *name, + struct pw_properties *props +); +void (*fp_pw_stream_add_listener)(struct pw_stream *stream, + struct spa_hook *listener, + const struct pw_stream_events *events, + void *data); +int (*fp_pw_stream_disconnect)(struct pw_stream *stream); +void (*fp_pw_stream_destroy)(struct pw_stream *stream); + + +void (*fp_pw_init)(int *argc, char **argv[]); + +struct pw_core * +(*fp_pw_context_connect_fd)(struct pw_context *context, + int fd, + struct pw_properties *properties, + size_t user_data_size); + +int (*fp_pw_core_disconnect)(struct pw_core *core); + +struct pw_context * (*fp_pw_context_new)(struct pw_loop *main_loop, + struct pw_properties *props, + size_t user_data_size); + +struct pw_thread_loop * +(*fp_pw_thread_loop_new)(const char *name, const struct spa_dict *props); +struct pw_loop * (*fp_pw_thread_loop_get_loop)(struct pw_thread_loop *loop); +void (*fp_pw_thread_loop_signal)(struct pw_thread_loop *loop, + bool wait_for_accept); +void (*fp_pw_thread_loop_wait)(struct pw_thread_loop *loop); +void (*fp_pw_thread_loop_accept)(struct pw_thread_loop *loop); +int (*fp_pw_thread_loop_start)(struct pw_thread_loop *loop); +void (*fp_pw_thread_loop_stop)(struct pw_thread_loop *loop); +void (*fp_pw_thread_loop_destroy)(struct pw_thread_loop *loop); +void (*fp_pw_thread_loop_lock)(struct pw_thread_loop *loop); +void (*fp_pw_thread_loop_unlock)(struct pw_thread_loop *loop); + +struct pw_properties * (*fp_pw_properties_new)(const char *key, ...); + #include #include "gtk_interface.h" diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java index e53cc798e61..790dc85166b 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, 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 @@ -33,6 +33,7 @@ import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Rectangle; +import java.awt.geom.AffineTransform; import javax.swing.JComponent; import javax.swing.JProgressBar; @@ -128,38 +129,43 @@ protected void paintDeterminate(Graphics g, JComponent c) { if (xp != null) { boolean vertical = (progressBar.getOrientation() == JProgressBar.VERTICAL); boolean isLeftToRight = WindowsGraphicsUtils.isLeftToRight(c); - int barRectWidth = progressBar.getWidth(); - int barRectHeight = progressBar.getHeight()-1; + Graphics2D g2 = (Graphics2D) g; + AffineTransform at = g2.getTransform(); + double scaleX = at.getScaleX(); + double scaleY = at.getScaleY(); + + int barRectWidth = (int)Math.ceil(progressBar.getWidth() * scaleX); + int barRectHeight = (int)Math.ceil(progressBar.getHeight() * scaleY); + // amount of progress to draw - int amountFull = getAmountFull(null, barRectWidth, barRectHeight); + int amountFull = (int)(getAmountFull(null, barRectWidth, barRectHeight) / scaleX); paintXPBackground(g, vertical, barRectWidth, barRectHeight); + // Paint progress if (progressBar.isStringPainted()) { // Do not paint the standard stripes from the skin, because they obscure // the text g.setColor(progressBar.getForeground()); - barRectHeight -= 2; - barRectWidth -= 2; if (barRectWidth <= 0 || barRectHeight <= 0) { return; } - Graphics2D g2 = (Graphics2D)g; g2.setStroke(new BasicStroke((float)(vertical ? barRectWidth : barRectHeight), BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); if (!vertical) { if (isLeftToRight) { - g2.drawLine(2, barRectHeight / 2 + 1, - amountFull - 2, barRectHeight / 2 + 1); + g2.drawLine(0, barRectHeight / 2, + amountFull, barRectHeight / 2); } else { g2.drawLine(2 + barRectWidth, barRectHeight / 2 + 1, 2 + barRectWidth - (amountFull - 2), barRectHeight / 2 + 1); } - paintString(g, 0, 0, barRectWidth, barRectHeight, amountFull, null); + paintString(g, 0, 0, (int)(barRectWidth / scaleX), + (int)(barRectHeight / scaleY), amountFull, null); } else { g2.drawLine(barRectWidth/2 + 1, barRectHeight + 1, barRectWidth/2 + 1, barRectHeight + 1 - amountFull + 2); diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java b/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java index 57848c01a0a..75e8fa42da0 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java @@ -523,18 +523,19 @@ public void drawString(String str, float x, float y, float awScale = getAwScale(scaleFactorX, scaleFactorY); int iangle = getAngle(ptx); + double devangle = Math.atan2(deviceTransform.getShearY(), deviceTransform.getScaleY()); ptx = new Point2D.Double(1.0, 0.0); deviceTransform.deltaTransform(ptx, ptx); double advanceScaleX = Math.sqrt(ptx.x*ptx.x+ptx.y*ptx.y); pty = new Point2D.Double(0.0, 1.0); deviceTransform.deltaTransform(pty, pty); - double advanceScaleY = Math.sqrt(pty.x*pty.x+pty.y*pty.y); + double advanceScaleY = -Math.sqrt(pty.x*pty.x+pty.y*pty.y); Font2D font2D = FontUtilities.getFont2D(font); if (font2D instanceof TrueTypeFont) { textOut(str, font, (TrueTypeFont)font2D, frc, - scaledFontSizeY, iangle, awScale, + scaledFontSizeY, iangle, devangle, awScale, advanceScaleX, advanceScaleY, x, y, devpos.x, devpos.y, targetW); } else if (font2D instanceof CompositeFont) { @@ -565,7 +566,7 @@ public void drawString(String str, float x, float y, String substr = new String(chars, startChar,endChar-startChar); PhysicalFont slotFont = compFont.getSlotFont(slot); textOut(substr, font, slotFont, frc, - scaledFontSizeY, iangle, awScale, + scaledFontSizeY, iangle, devangle, awScale, advanceScaleX, advanceScaleY, userx, usery, devx, devy, 0f); Rectangle2D bds = font.getStringBounds(substr, frc); @@ -628,22 +629,11 @@ protected boolean printGlyphVector(GlyphVector gv, float x, float y) { */ Point2D.Float userpos = new Point2D.Float(x, y); /* Add the position of the first glyph - its not always 0,0 */ + /* This glyph position includes the font's transform translation, if any */ Point2D g0pos = gv.getGlyphPosition(0); userpos.x += (float)g0pos.getX(); userpos.y += (float)g0pos.getY(); Point2D.Float devpos = new Point2D.Float(); - - /* Already have the translate from the deviceTransform, - * but the font may have a translation component too. - */ - if (font.isTransformed()) { - AffineTransform fontTx = font.getTransform(); - float translateX = (float)(fontTx.getTranslateX()); - float translateY = (float)(fontTx.getTranslateY()); - if (Math.abs(translateX) < 0.00001) translateX = 0f; - if (Math.abs(translateY) < 0.00001) translateY = 0f; - userpos.x += translateX; userpos.y += translateY; - } deviceTransform.transform(userpos, devpos); if (getClip() != null) { @@ -688,13 +678,14 @@ protected boolean printGlyphVector(GlyphVector gv, float x, float y) { float awScale = getAwScale(scaleFactorX, scaleFactorY); int iangle = getAngle(ptx); + double devangle = Math.atan2(deviceTransform.getShearY(), deviceTransform.getScaleY()); ptx = new Point2D.Double(1.0, 0.0); deviceTransform.deltaTransform(ptx, ptx); double advanceScaleX = Math.sqrt(ptx.x*ptx.x+ptx.y*ptx.y); pty = new Point2D.Double(0.0, 1.0); deviceTransform.deltaTransform(pty, pty); - double advanceScaleY = Math.sqrt(pty.x*pty.x+pty.y*pty.y); + double advanceScaleY = -Math.sqrt(pty.x*pty.x+pty.y*pty.y); int numGlyphs = gv.getNumGlyphs(); int[] glyphCodes = gv.getGlyphCodes(0, numGlyphs, null); @@ -754,6 +745,8 @@ protected boolean printGlyphVector(GlyphVector gv, float x, float y) { */ AffineTransform advanceTransform = AffineTransform.getScaleInstance(advanceScaleX, advanceScaleY); + advanceTransform.rotate(devangle); // radians + advanceTransform.rotate(iangle * Math.PI / 1800.0); // 1/10 degrees -> radians float[] glyphAdvPos = new float[glyphPos.length]; advanceTransform.transform(glyphPos, 0, //source @@ -830,7 +823,8 @@ protected boolean printGlyphVector(GlyphVector gv, float x, float y) { private void textOut(String str, Font font, PhysicalFont font2D, FontRenderContext frc, - float deviceSize, int rotation, float awScale, + float deviceSize, int iangle, double devangle, + float awScale, double scaleFactorX, double scaleFactorY, float userx, float usery, float devx, float devy, float targetW) { @@ -838,8 +832,7 @@ private void textOut(String str, String family = font2D.getFamilyName(null); int style = font.getStyle() | font2D.getStyle(); WPrinterJob wPrinterJob = (WPrinterJob)getPrinterJob(); - boolean setFont = wPrinterJob.setFont(family, deviceSize, style, - rotation, awScale); + boolean setFont = wPrinterJob.setFont(family, deviceSize, style, iangle, awScale); if (!setFont) { super.drawString(str, userx, usery, font, frc, targetW); return; @@ -873,6 +866,8 @@ private void textOut(String str, */ AffineTransform advanceTransform = AffineTransform.getScaleInstance(scaleFactorX, scaleFactorY); + advanceTransform.rotate(devangle); // radians + advanceTransform.rotate(iangle * Math.PI / 1800.0); // 1/10 degrees -> radians float[] glyphAdvPos = new float[glyphPos.length]; advanceTransform.transform(glyphPos, 0, //source diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp index f632da02162..d5bbdc51b0b 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2110,20 +2110,49 @@ HICON CreateIconFromRaster(JNIEnv* env, jintArray iconRaster, jint w, jint h) void AwtWindow::SetIconData(JNIEnv* env, jintArray iconRaster, jint w, jint h, jintArray smallIconRaster, jint smw, jint smh) { + HICON hNewIcon = NULL; + HICON hNewIconSm = NULL; + + try { + hNewIcon = CreateIconFromRaster(env, iconRaster, w, h); + if (env->ExceptionCheck()) { + if (hNewIcon != NULL) { + DestroyIcon(hNewIcon); + } + return; + } + + hNewIconSm = CreateIconFromRaster(env, smallIconRaster, smw, smh); + if (env->ExceptionCheck()) { + if (hNewIcon != NULL) { + DestroyIcon(hNewIcon); + } + if (hNewIconSm != NULL) { + DestroyIcon(hNewIconSm); + } + return; + } + } catch (...) { + if (hNewIcon != NULL) { + DestroyIcon(hNewIcon); + } + if (hNewIconSm != NULL) { + DestroyIcon(hNewIconSm); + } + return; + } + HICON hOldIcon = NULL; HICON hOldIconSm = NULL; - //Destroy previous icon if it isn't inherited if ((m_hIcon != NULL) && !m_iconInherited) { hOldIcon = m_hIcon; } - m_hIcon = NULL; if ((m_hIconSm != NULL) && !m_iconInherited) { hOldIconSm = m_hIconSm; } - m_hIconSm = NULL; - m_hIcon = CreateIconFromRaster(env, iconRaster, w, h); - JNU_CHECK_EXCEPTION(env); - m_hIconSm = CreateIconFromRaster(env, smallIconRaster, smw, smh); + + m_hIcon = hNewIcon; + m_hIconSm = hNewIconSm; m_iconInherited = (m_hIcon == NULL); if (m_iconInherited) { @@ -2136,8 +2165,11 @@ void AwtWindow::SetIconData(JNIEnv* env, jintArray iconRaster, jint w, jint h, m_iconInherited = FALSE; } } + DoUpdateIcon(); EnumThreadWindows(AwtToolkit::MainThread(), UpdateOwnedIconCallback, (LPARAM)this); + + // Destroy previous icons if they were not inherited if (hOldIcon != NULL) { DestroyIcon(hOldIcon); } diff --git a/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java b/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java index 36fe54ecc66..5526f7a0f90 100644 --- a/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java +++ b/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java @@ -122,7 +122,7 @@ private synchronized ServerNotifForwarder getServerNotifFwd() { } public String getConnectionId() throws IOException { - // We should call reqIncomming() here... shouldn't we? + // reqIncoming()/rspOutgoing() could be here, but never have been. return connectionId; } @@ -1495,20 +1495,7 @@ private T unwrap(final MarshalledObject mo, try { ClassLoader old = setCcl(cl); try { - if (subject != null) { - try { - return Subject.callAs(subject, () -> wrappedClass.cast(mo.get())); - } catch (CompletionException ce) { - Throwable thr = ce.getCause(); - if (thr instanceof Exception e) { - throw e; - } else { - throw new RuntimeException(thr); - } - } - } else { - return wrappedClass.cast(mo.get()); - } + return wrappedClass.cast(mo.get()); } finally { setCcl(old); } diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/Introspector.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/Introspector.java index 374dd57a4ee..a6aa5fea55a 100644 --- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/Introspector.java +++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/Introspector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -64,7 +64,6 @@ * @since 1.5 */ public class Introspector { - public static final boolean ALLOW_NONPUBLIC_MBEAN = Boolean.parseBoolean(System.getProperty("jdk.jmx.mbeans.allowNonPublic")); /* * ------------------------------------------ @@ -517,8 +516,7 @@ private static Class implementsMBean(Class c, String clName) { Class[] interfaces = c.getInterfaces(); for (int i = 0;i < interfaces.length; i++) { if (interfaces[i].getName().equals(clMBeanName) && - (Modifier.isPublic(interfaces[i].getModifiers()) || - ALLOW_NONPUBLIC_MBEAN)) { + Modifier.isPublic(interfaces[i].getModifiers())) { return Util.cast(interfaces[i]); } } diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanAnalyzer.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanAnalyzer.java index 06d2d05a527..b72c8f6748e 100644 --- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanAnalyzer.java +++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanAnalyzer.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 @@ -107,8 +107,7 @@ private MBeanAnalyzer(Class mbeanType, if (!mbeanType.isInterface()) { throw new NotCompliantMBeanException("Not an interface: " + mbeanType.getName()); - } else if (!Modifier.isPublic(mbeanType.getModifiers()) && - !Introspector.ALLOW_NONPUBLIC_MBEAN) { + } else if (!Modifier.isPublic(mbeanType.getModifiers())) { throw new NotCompliantMBeanException("Interface is not public: " + mbeanType.getName()); } diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/MXBeanLookup.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/MXBeanLookup.java index 0027710d06a..19df1e9c695 100644 --- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/MXBeanLookup.java +++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/MXBeanLookup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, 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 @@ -144,11 +144,8 @@ synchronized void addReference(ObjectName name, Object mxbean) throws InstanceAlreadyExistsException { ObjectName existing = mxbeanToObjectName.get(mxbean); if (existing != null) { - String multiname = System.getProperty("jmx.mxbean.multiname"); - if (!"true".equalsIgnoreCase(multiname)) { - throw new InstanceAlreadyExistsException( + throw new InstanceAlreadyExistsException( "MXBean already registered with name " + existing); - } } mxbeanToObjectName.put(mxbean, name); } diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/PerInterface.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/PerInterface.java index 6684e0390cf..f8cab63c484 100644 --- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/PerInterface.java +++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/PerInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, 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 @@ -108,8 +108,7 @@ Object invoke(Object resource, String operation, Object[] params, final List list = ops.get(operation); if (list == null) { final String msg = "No such operation: " + operation; - return noSuchMethod(msg, resource, operation, params, signature, - cookie); + throw new ReflectionException(new NoSuchMethodException(operation + sigString(signature)), msg); } if (signature == null) signature = new String[0]; @@ -131,83 +130,11 @@ Object invoke(Object resource, String operation, Object[] params, msg = "Operation " + operation + " exists but not with " + "this signature: " + badSig; } - return noSuchMethod(msg, resource, operation, params, signature, - cookie); + throw new ReflectionException(new NoSuchMethodException(operation + badSig), msg); } return introspector.invokeM(found.method, resource, params, cookie); } - /* - * This method is called when invoke doesn't find the named method. - * Before throwing an exception, we check to see whether the - * jmx.invoke.getters property is set, and if so whether the method - * being invoked might be a getter or a setter. If so we invoke it - * and return the result. This is for compatibility - * with code based on JMX RI 1.0 or 1.1 which allowed invoking getters - * and setters. It is *not* recommended that new code use this feature. - * - * Since this method is either going to throw an exception or use - * functionality that is strongly discouraged, we consider that its - * performance is not very important. - * - * A simpler way to implement the functionality would be to add the getters - * and setters to the operations map when jmx.invoke.getters is set. - * However, that means that the property is consulted when an MBean - * interface is being introspected and not thereafter. Previously, - * the property was consulted on every invocation. So this simpler - * implementation could potentially break code that sets and unsets - * the property at different times. - */ - @SuppressWarnings("removal") - private Object noSuchMethod(String msg, Object resource, String operation, - Object[] params, String[] signature, - Object cookie) - throws MBeanException, ReflectionException { - - // Construct the exception that we will probably throw - final NoSuchMethodException nsme = - new NoSuchMethodException(operation + sigString(signature)); - final ReflectionException exception = - new ReflectionException(nsme, msg); - - if (introspector.isMXBean()) - throw exception; // No compatibility requirement here - - // Is the compatibility property set? - String invokeGettersS = System.getProperty("jmx.invoke.getters"); - if (invokeGettersS == null) - throw exception; - - int rest = 0; - Map methods = null; - if (signature == null || signature.length == 0) { - if (operation.startsWith("get")) - rest = 3; - else if (operation.startsWith("is")) - rest = 2; - if (rest != 0) - methods = getters; - } else if (signature.length == 1 && - operation.startsWith("set")) { - rest = 3; - methods = setters; - } - - if (rest != 0) { - String attrName = operation.substring(rest); - M method = methods.get(attrName); - if (method != null && introspector.getName(method).equals(operation)) { - String[] msig = introspector.getSignature(method); - if ((signature == null && msig.length == 0) || - Arrays.equals(signature, msig)) { - return introspector.invokeM(method, resource, params, cookie); - } - } - } - - throw exception; - } - private String sigString(String[] signature) { StringBuilder b = new StringBuilder("("); if (signature != null) { diff --git a/src/java.management/share/classes/com/sun/jmx/remote/security/HashedPasswordManager.java b/src/java.management/share/classes/com/sun/jmx/remote/security/HashedPasswordManager.java index c50b22fade6..a247ba66533 100644 --- a/src/java.management/share/classes/com/sun/jmx/remote/security/HashedPasswordManager.java +++ b/src/java.management/share/classes/com/sun/jmx/remote/security/HashedPasswordManager.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 @@ -84,6 +84,7 @@ * A user generated hashed password file can also be used instead of a * clear-text password file. If generated by the user, hashed passwords must * follow the format specified above. + * @spec security/standard-names.html Java Security Standard Algorithm Names */ public final class HashedPasswordManager { diff --git a/src/java.management/share/classes/com/sun/jmx/remote/util/EnvHelp.java b/src/java.management/share/classes/com/sun/jmx/remote/util/EnvHelp.java index a64db45c22f..54d1f45c6ce 100644 --- a/src/java.management/share/classes/com/sun/jmx/remote/util/EnvHelp.java +++ b/src/java.management/share/classes/com/sun/jmx/remote/util/EnvHelp.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 @@ -262,21 +262,11 @@ public static Throwable getCause(Throwable t) { public static int getNotifBufferSize(Map env) { int defaultQueueSize = 1000; // default value - // keep it for the compatibility for the fix: - // 6174229: Environment parameter should be notification.buffer.size - // instead of buffer.size - final String oldP = "jmx.remote.x.buffer.size"; - // the default value re-specified in the system try { String s = System.getProperty(BUFFER_SIZE_PROPERTY); if (s != null) { defaultQueueSize = Integer.parseInt(s); - } else { // try the old one - s = System.getProperty(oldP); - if (s != null) { - defaultQueueSize = Integer.parseInt(s); - } } } catch (RuntimeException e) { logger.warning("getNotifBufferSize", @@ -292,10 +282,6 @@ public static int getNotifBufferSize(Map env) { queueSize = (int)EnvHelp.getIntegerAttribute(env,BUFFER_SIZE_PROPERTY, defaultQueueSize,0, Integer.MAX_VALUE); - } else { // try the old one - queueSize = (int)EnvHelp.getIntegerAttribute(env,oldP, - defaultQueueSize,0, - Integer.MAX_VALUE); } } catch (RuntimeException e) { logger.warning("getNotifBufferSize", diff --git a/src/java.management/share/classes/java/lang/management/ManagementPermission.java b/src/java.management/share/classes/java/lang/management/ManagementPermission.java index 2dbee65e5cb..7c9958d72cb 100644 --- a/src/java.management/share/classes/java/lang/management/ManagementPermission.java +++ b/src/java.management/share/classes/java/lang/management/ManagementPermission.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 @@ -31,6 +31,7 @@ * @apiNote * This permission cannot be used for controlling access to resources * as the Security Manager is no longer supported. + * Consequently this class is deprecated for removal in a future release. * * @author Mandy Chung * @since 1.5 @@ -41,8 +42,11 @@ * @see java.security.PermissionCollection * @see java.lang.SecurityManager * + * @deprecated This class was only useful in conjunction with the Security Manager, + * which is no longer supported. There is no replacement for this class. + * */ - +@Deprecated(since="25", forRemoval=true) public final class ManagementPermission extends java.security.BasicPermission { private static final long serialVersionUID = 1897496590799378737L; diff --git a/src/java.management/share/classes/javax/management/JMX.java b/src/java.management/share/classes/javax/management/JMX.java index 82b14c691b4..7cc3884b6df 100644 --- a/src/java.management/share/classes/javax/management/JMX.java +++ b/src/java.management/share/classes/javax/management/JMX.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, 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 @@ -375,8 +375,7 @@ public static T newMXBeanProxy(MBeanServerConnection connection, public static boolean isMXBeanInterface(Class interfaceClass) { if (!interfaceClass.isInterface()) return false; - if (!Modifier.isPublic(interfaceClass.getModifiers()) && - !Introspector.ALLOW_NONPUBLIC_MBEAN) { + if (!Modifier.isPublic(interfaceClass.getModifiers())) { return false; } MXBean a = interfaceClass.getAnnotation(MXBean.class); diff --git a/src/java.management/share/classes/javax/management/MBeanPermission.java b/src/java.management/share/classes/javax/management/MBeanPermission.java index 46717846cb3..abc3cdda7a8 100644 --- a/src/java.management/share/classes/javax/management/MBeanPermission.java +++ b/src/java.management/share/classes/javax/management/MBeanPermission.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 @@ -161,9 +161,14 @@ * @apiNote * This permission cannot be used for controlling access to resources * as the Security Manager is no longer supported. + * Consequently this class is deprecated for removal in a future release. + * + * @deprecated This class was only useful in conjunction with the Security Manager, + * which is no longer supported. There is no replacement for this class. * * @since 1.5 */ +@Deprecated(since="25", forRemoval=true) public class MBeanPermission extends Permission { private static final long serialVersionUID = -2416928705275160661L; diff --git a/src/java.management/share/classes/javax/management/MBeanServerPermission.java b/src/java.management/share/classes/javax/management/MBeanServerPermission.java index dc77d605912..c59c3e5ec35 100644 --- a/src/java.management/share/classes/javax/management/MBeanServerPermission.java +++ b/src/java.management/share/classes/javax/management/MBeanServerPermission.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 @@ -67,9 +67,14 @@ * @apiNote * This permission cannot be used for controlling access to resources * as the Security Manager is no longer supported. + * Consequently this class is deprecated for removal in a future release. + * + * @deprecated This class was only useful in conjunction with the Security Manager, + * which is no longer supported. There is no replacement for this class. * * @since 1.5 */ +@Deprecated(since="25", forRemoval=true) public class MBeanServerPermission extends BasicPermission { private static final long serialVersionUID = -5661980843569388590L; @@ -334,6 +339,7 @@ public PermissionCollection newPermissionCollection() { * implementation from defining a PermissionCollection there with an * optimized "implies" method. */ +@SuppressWarnings("removal") class MBeanServerPermissionCollection extends PermissionCollection { /** @serial Null if no permissions in collection, otherwise a single permission that is the union of all permissions that diff --git a/src/java.management/share/classes/javax/management/MBeanTrustPermission.java b/src/java.management/share/classes/javax/management/MBeanTrustPermission.java index d961fe47193..2929b5c6097 100644 --- a/src/java.management/share/classes/javax/management/MBeanTrustPermission.java +++ b/src/java.management/share/classes/javax/management/MBeanTrustPermission.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 @@ -44,9 +44,14 @@ * @apiNote * This permission cannot be used for controlling access to resources * as the Security Manager is no longer supported. + * Consequently this class is deprecated for removal in a future release. + * + * @deprecated This class was only useful in conjunction with the Security Manager, + * which is no longer supported. There is no replacement for this class. * * @since 1.5 */ +@Deprecated(since="25", forRemoval=true) public class MBeanTrustPermission extends BasicPermission { private static final long serialVersionUID = -2952178077029018140L; diff --git a/src/java.management/share/classes/javax/management/openmbean/OpenType.java b/src/java.management/share/classes/javax/management/openmbean/OpenType.java index a81359a7fe9..de2663bdc7f 100644 --- a/src/java.management/share/classes/javax/management/openmbean/OpenType.java +++ b/src/java.management/share/classes/javax/management/openmbean/OpenType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -194,10 +194,7 @@ private void checkClassNameOverride() throws SecurityException { if (this.getClass().getClassLoader() == null) return; // We trust bootstrap classes. if (overridesGetClassName(this.getClass())) { - if (System.getProperty("jmx.extend.open.types") == null) { - throw new SecurityException("Cannot override getClassName() " + - "unless -Djmx.extend.open.types"); - } + throw new SecurityException("Cannot override getClassName()"); } } diff --git a/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java b/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java index 94c804d9029..d670d2da782 100644 --- a/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java +++ b/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -143,16 +143,9 @@ public TabularDataSupport(TabularType tabularType, int initialCapacity, float lo List tmpNames = tabularType.getIndexNames(); this.indexNamesArray = tmpNames.toArray(new String[tmpNames.size()]); - // Since LinkedHashMap was introduced in SE 1.4, it's conceivable even - // if very unlikely that we might be the server of a 1.3 client. In - // that case you'll need to set this property. See CR 6334663. - boolean useHashMap = Boolean.getBoolean("jmx.tabular.data.hash.map"); - // Construct the empty contents HashMap // - this.dataMap = useHashMap ? - new HashMap<>(initialCapacity, loadFactor) : - new LinkedHashMap<>(initialCapacity, loadFactor); + this.dataMap = new LinkedHashMap<>(initialCapacity, loadFactor); } diff --git a/src/java.management/share/classes/javax/management/remote/SubjectDelegationPermission.java b/src/java.management/share/classes/javax/management/remote/SubjectDelegationPermission.java index e2346e92bd5..9c5f4f05927 100644 --- a/src/java.management/share/classes/javax/management/remote/SubjectDelegationPermission.java +++ b/src/java.management/share/classes/javax/management/remote/SubjectDelegationPermission.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 @@ -56,9 +56,14 @@ * @apiNote * This permission cannot be used for controlling access to resources * as the Security Manager is no longer supported. + * Consequently this class is deprecated for removal in a future release. + * + * @deprecated This class was only useful in conjunction with the Security Manager, + * which is no longer supported. There is no replacement for this class. * * @since 1.5 */ +@Deprecated(since="25", forRemoval=true) public final class SubjectDelegationPermission extends BasicPermission { private static final long serialVersionUID = 1481618113008682343L; diff --git a/src/java.net.http/share/classes/java/net/http/HttpResponse.java b/src/java.net.http/share/classes/java/net/http/HttpResponse.java index b9ea775532d..41a439d5519 100644 --- a/src/java.net.http/share/classes/java/net/http/HttpResponse.java +++ b/src/java.net.http/share/classes/java/net/http/HttpResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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 @@ -51,6 +51,7 @@ import java.util.stream.Stream; import javax.net.ssl.SSLSession; import jdk.internal.net.http.BufferingSubscriber; +import jdk.internal.net.http.LimitingSubscriber; import jdk.internal.net.http.LineSubscriberAdapter; import jdk.internal.net.http.ResponseBodyHandlers.FileDownloadBodyHandler; import jdk.internal.net.http.ResponseBodyHandlers.PathBodyHandler; @@ -748,6 +749,33 @@ public static BodyHandler buffering(BodyHandler downstreamHandler, .buffering(downstreamHandler.apply(responseInfo), bufferSize); } + + /** + * {@return a {@code BodyHandler} that limits the number of body bytes + * that are delivered to the given {@code downstreamHandler}} + *

        + * If the number of body bytes received exceeds the given + * {@code capacity}, {@link BodySubscriber#onError(Throwable) onError} + * is called on the downstream {@code BodySubscriber} with an + * {@link IOException} indicating that the capacity is exceeded, and + * the upstream subscription is cancelled. + * + * @param downstreamHandler the downstream handler to pass received data to + * @param capacity the maximum number of bytes that are allowed + * @throws IllegalArgumentException if {@code capacity} is negative + * @since 25 + */ + public static BodyHandler limiting(BodyHandler downstreamHandler, long capacity) { + Objects.requireNonNull(downstreamHandler, "downstreamHandler"); + if (capacity < 0) { + throw new IllegalArgumentException("capacity must not be negative: " + capacity); + } + return responseInfo -> { + BodySubscriber downstreamSubscriber = downstreamHandler.apply(responseInfo); + return BodySubscribers.limiting(downstreamSubscriber, capacity); + }; + } + } /** @@ -1350,5 +1378,30 @@ public static BodySubscriber mapping(BodySubscriber upstream, { return new ResponseSubscribers.MappingSubscriber<>(upstream, mapper); } + + /** + * {@return a {@code BodySubscriber} that limits the number of body + * bytes that are delivered to the given {@code downstreamSubscriber}} + *

        + * If the number of body bytes received exceeds the given + * {@code capacity}, {@link BodySubscriber#onError(Throwable) onError} + * is called on the downstream {@code BodySubscriber} with an + * {@link IOException} indicating that the capacity is exceeded, and + * the upstream subscription is cancelled. + * + * @param downstreamSubscriber the downstream subscriber to pass received data to + * @param capacity the maximum number of bytes that are allowed + * @throws IllegalArgumentException if {@code capacity} is negative + * @since 25 + */ + public static BodySubscriber limiting(BodySubscriber downstreamSubscriber, long capacity) { + Objects.requireNonNull(downstreamSubscriber, "downstreamSubscriber"); + if (capacity < 0) { + throw new IllegalArgumentException("capacity must not be negative: " + capacity); + } + return new LimitingSubscriber<>(downstreamSubscriber, capacity); + } + } + } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/LimitingSubscriber.java b/src/java.net.http/share/classes/jdk/internal/net/http/LimitingSubscriber.java new file mode 100644 index 00000000000..f1fd8e69a62 --- /dev/null +++ b/src/java.net.http/share/classes/jdk/internal/net/http/LimitingSubscriber.java @@ -0,0 +1,148 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.net.http; + +import jdk.internal.net.http.ResponseSubscribers.TrustedSubscriber; +import jdk.internal.net.http.common.Utils; + +import java.io.IOException; +import java.net.http.HttpResponse.BodySubscriber; +import java.nio.ByteBuffer; +import java.util.List; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.Flow.Subscription; + +import static java.util.Objects.requireNonNull; + +/** + * A subscriber limiting the maximum number of bytes that are allowed to be consumed by a downstream subscriber. + * + * @param the response type + */ +public final class LimitingSubscriber implements TrustedSubscriber { + + private final BodySubscriber downstreamSubscriber; + + private final long capacity; + + private State state; + + private long length; + + private interface State { + + State TERMINATED = new State() {}; + + record Subscribed(Subscription subscription) implements State {} + + } + + /** + * @param downstreamSubscriber the downstream subscriber to pass received data to + * @param capacity the maximum number of bytes that are allowed + * @throws IllegalArgumentException if {@code capacity} is negative + */ + public LimitingSubscriber(BodySubscriber downstreamSubscriber, long capacity) { + if (capacity < 0) { + throw new IllegalArgumentException("capacity must not be negative: " + capacity); + } + this.downstreamSubscriber = requireNonNull(downstreamSubscriber, "downstreamSubscriber"); + this.capacity = capacity; + } + + @Override + public void onSubscribe(Subscription subscription) { + requireNonNull(subscription, "subscription"); + if (state != null) { + subscription.cancel(); + } else { + state = new State.Subscribed(subscription); + downstreamSubscriber.onSubscribe(subscription); + } + } + + @Override + public void onNext(List buffers) { + + // Check arguments + requireNonNull(buffers, "buffers"); + assert Utils.hasRemaining(buffers); + + // Short-circuit if not subscribed + if (!(state instanceof State.Subscribed subscribed)) { + return; + } + + // See if we may consume the input + boolean lengthAllocated = allocateLength(buffers); + if (lengthAllocated) { + downstreamSubscriber.onNext(buffers); + } else { // Otherwise, trigger failure + state = State.TERMINATED; + downstreamSubscriber.onError(new IOException("body exceeds capacity: " + capacity)); + subscribed.subscription.cancel(); + } + + } + + private boolean allocateLength(List buffers) { + long bufferLength = Utils.remaining(buffers); + long nextLength; + try { + nextLength = Math.addExact(length, bufferLength); + } catch (ArithmeticException _) { + return false; + } + if (nextLength > capacity) { + return false; + } + length = nextLength; + return true; + } + + @Override + public void onError(Throwable throwable) { + requireNonNull(throwable, "throwable"); + if (state instanceof State.Subscribed) { + state = State.TERMINATED; + downstreamSubscriber.onError(throwable); + } + } + + @Override + public void onComplete() { + if (state instanceof State.Subscribed) { + state = State.TERMINATED; + downstreamSubscriber.onComplete(); + } + } + + @Override + public CompletionStage getBody() { + return downstreamSubscriber.getBody(); + } + +} diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java index bf5486f4d32..9040552beb7 100644 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.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 @@ -101,6 +101,7 @@ * necessary locking. Multiple threads each manipulating a different * TransformService instance need not synchronize. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Sean Mullan * @author JSR 105 Expert Group * @since 1.6 @@ -153,6 +154,7 @@ protected TransformService() {} * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms"> * Java Security Standard Algorithm Names Specification for a list of * standard mechanism types. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a new TransformService * @throws NullPointerException if algorithm or * mechanismType is null @@ -215,6 +217,7 @@ protected TransformService() {} * Java Security Standard Algorithm Names Specification for a list of * standard mechanism types. * @param provider the Provider object + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a new TransformService * @throws NullPointerException if provider, * algorithm, or mechanismType is @@ -277,6 +280,7 @@ protected TransformService() {} * Java Security Standard Algorithm Names Specification for a list of * standard mechanism types. * @param provider the string name of the provider + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a new TransformService * @throws NoSuchProviderException if the specified provider is not * registered in the security provider list diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java index 07fb9a271f2..4af0591691a 100644 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.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 @@ -143,6 +143,7 @@ * necessary locking. Multiple threads each manipulating a different * XMLSignatureFactory instance need not synchronize. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Sean Mullan * @author JSR 105 Expert Group * @since 1.6 @@ -186,6 +187,7 @@ protected XMLSignatureFactory() {} * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms"> * Java Security Standard Algorithm Names Specification for a list of * standard mechanism types. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a new XMLSignatureFactory * @throws NullPointerException if mechanismType is * null @@ -234,6 +236,7 @@ public static XMLSignatureFactory getInstance(String mechanismType) { * Java Security Standard Algorithm Names Specification for a list of * standard mechanism types. * @param provider the Provider object + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a new XMLSignatureFactory * @throws NullPointerException if provider or * mechanismType is null @@ -287,6 +290,7 @@ public static XMLSignatureFactory getInstance(String mechanismType, * Java Security Standard Algorithm Names Specification for a list of * standard mechanism types. * @param provider the string name of the provider + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a new XMLSignatureFactory * @throws NoSuchProviderException if the specified provider is not * registered in the security provider list diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java index be5e4cef367..09f8a12e486 100644 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.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 @@ -99,6 +99,7 @@ * Multiple threads each manipulating a different KeyInfoFactory * instance need not synchronize. * + * @spec security/standard-names.html Java Security Standard Algorithm Names * @author Sean Mullan * @author JSR 105 Expert Group * @since 1.6 @@ -142,6 +143,7 @@ protected KeyInfoFactory() {} * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms"> * Java Security Standard Algorithm Names Specification for a list * of standard mechanism types. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a new KeyInfoFactory * @throws NullPointerException if mechanismType is * null @@ -189,6 +191,7 @@ public static KeyInfoFactory getInstance(String mechanismType) { * Java Security Standard Algorithm Names Specification for a list * of standard mechanism types. * @param provider the Provider object + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a new KeyInfoFactory * @throws NullPointerException if mechanismType or * provider are null @@ -241,6 +244,7 @@ public static KeyInfoFactory getInstance(String mechanismType, * Java Security Standard Algorithm Names Specification for a list * of standard mechanism types. * @param provider the string name of the provider + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return a new KeyInfoFactory * @throws NoSuchProviderException if the specified provider is not * registered in the security provider list diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java index a6f8370a2d7..bcdb0f59f5c 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) - * @LastModified: May 2022 + * @LastModified: Dec 2024 */ public class XSLTErrorResources_de extends ListResourceBundle { @@ -1197,7 +1197,7 @@ public Object[][] getContents() "Das Feature \"{0}\" kann nicht f\u00FCr diese TransformerFactory festgelegt werden."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, - "Verwendung des Erweiterungselements \"{0}\" ist nicht zul\u00E4ssig, wenn das Feature f\u00FCr die sichere Verarbeitung auf \"true\" gesetzt ist."}, + "Verwendung der Erweiterungsfunktion \"{0}\" ist nicht zul\u00E4ssig, wenn die Erweiterungsfunktionen vom Feature f\u00FCr die sichere Verarbeitung oder der Eigenschaft \"jdk.xml.enableExtensionFunctions\" deaktiviert wurden. Setzen Sie \"jdk.xml.enableExtensionFunctions\" auf \"true\", um die Erweiterungsfunktionen zu aktivieren."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "Pr\u00E4fix f\u00FCr Null-Namespace-URI kann nicht abgerufen werden."}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java index cf8a0f2563b..8555d69597b 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) - * @LastModified: May 2022 + * @LastModified: Dec 2024 */ public class XSLTErrorResources_ja extends ListResourceBundle { @@ -1197,7 +1197,7 @@ public Object[][] getContents() "\u6A5F\u80FD''{0}''\u3092\u3053\u306ETransformerFactory\u306B\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002"}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, - "\u30BB\u30AD\u30E5\u30A2\u51E6\u7406\u6A5F\u80FD\u304Ctrue\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u3068\u304D\u3001\u62E1\u5F35\u8981\u7D20''{0}''\u306E\u4F7F\u7528\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"}, + "\u30BB\u30AD\u30E5\u30A2\u51E6\u7406\u6A5F\u80FD\u307E\u305F\u306F\u30D7\u30ED\u30D1\u30C6\u30A3''jdk.xml.enableExtensionFunctions''\u306B\u3088\u3063\u3066\u62E1\u5F35\u95A2\u6570\u304C\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u308B\u3068\u304D\u3001\u62E1\u5F35\u95A2\u6570''{0}''\u306E\u4F7F\u7528\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002\u62E1\u5F35\u95A2\u6570\u3092\u6709\u52B9\u306B\u3059\u308B\u306B\u306F\u3001''jdk.xml.enableExtensionFunctions''\u3092''true''\u306B\u8A2D\u5B9A\u3057\u307E\u3059\u3002"}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "null\u306E\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9URI\u306B\u3064\u3044\u3066\u63A5\u982D\u8F9E\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3002"}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java index dc7ecef28f8..c5ae6af08c0 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) - * @LastModified: May 2022 + * @LastModified: Dec 2024 */ public class XSLTErrorResources_zh_CN extends ListResourceBundle { @@ -1197,7 +1197,7 @@ public Object[][] getContents() "\u65E0\u6CD5\u5BF9\u6B64 TransformerFactory \u8BBE\u7F6E\u529F\u80FD ''{0}''\u3002"}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, - "\u5F53\u5B89\u5168\u5904\u7406\u529F\u80FD\u8BBE\u7F6E\u4E3A\u201C\u771F\u201D\u65F6, \u4E0D\u5141\u8BB8\u4F7F\u7528\u6269\u5C55\u5143\u7D20 ''{0}''\u3002"}, + "\u5F53\u6269\u5C55\u51FD\u6570\u88AB\u5B89\u5168\u5904\u7406\u529F\u80FD\u6216\u5C5E\u6027 ''jdk.xml.enableExtensionFunctions'' \u7981\u7528\u65F6\uFF0C\u4E0D\u5141\u8BB8\u4F7F\u7528\u6269\u5C55\u51FD\u6570 ''{0}''\u3002\u8981\u542F\u7528\u6269\u5C55\u51FD\u6570\uFF0C\u8BF7\u5C06 ''jdk.xml.enableExtensionFunctions'' \u8BBE\u7F6E\u4E3A ''true''\u3002"}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "\u65E0\u6CD5\u83B7\u53D6\u7A7A\u540D\u79F0\u7A7A\u95F4 uri \u7684\u524D\u7F00\u3002"}, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java index 12ec243bbc9..c16620ec7b1 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java @@ -24,7 +24,7 @@ /** * @author Morten Jorgensen - * @LastModified: Nov 2024 + * @LastModified: Dec 2024 */ public class ErrorMessages_de extends ListResourceBundle { @@ -548,6 +548,12 @@ public Object[][] getContents() {ErrorMsg.DATA_CONVERSION_ERR, "Datentyp \"{0}\" kann nicht in \"{1}\" konvertiert werden."}, + /* + * Note to translators: property name "jdk.xml.enableExtensionFunctions" + * and value "true" should not be translated. + */ + {ErrorMsg.UNSUPPORTED_EXT_FUNC_ERR, + "Verwendung der Erweiterungsfunktion \"{0}\" ist nicht zul\u00E4ssig, wenn die Erweiterungsfunktionen vom Feature f\u00FCr die sichere Verarbeitung oder der Eigenschaft \"jdk.xml.enableExtensionFunctions\" deaktiviert wurden. Setzen Sie \"jdk.xml.enableExtensionFunctions\" auf \"true\", um die Erweiterungsfunktionen zu aktivieren."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java index 5e03673aef5..48f7d63f353 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java @@ -24,7 +24,7 @@ /** * @author Morten Jorgensen - * @LastModified: Nov 2024 + * @LastModified: Dec 2024 */ public class ErrorMessages_ja extends ListResourceBundle { @@ -548,6 +548,12 @@ public Object[][] getContents() {ErrorMsg.DATA_CONVERSION_ERR, "\u30C7\u30FC\u30BF\u578B''{0}''\u3092''{1}''\u306B\u5909\u63DB\u3067\u304D\u307E\u305B\u3093\u3002"}, + /* + * Note to translators: property name "jdk.xml.enableExtensionFunctions" + * and value "true" should not be translated. + */ + {ErrorMsg.UNSUPPORTED_EXT_FUNC_ERR, + "\u30BB\u30AD\u30E5\u30A2\u51E6\u7406\u6A5F\u80FD\u307E\u305F\u306F\u30D7\u30ED\u30D1\u30C6\u30A3''jdk.xml.enableExtensionFunctions''\u306B\u3088\u3063\u3066\u62E1\u5F35\u95A2\u6570\u304C\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u308B\u3068\u304D\u3001\u62E1\u5F35\u95A2\u6570''{0}''\u306E\u4F7F\u7528\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002\u62E1\u5F35\u95A2\u6570\u3092\u6709\u52B9\u306B\u3059\u308B\u306B\u306F\u3001''jdk.xml.enableExtensionFunctions''\u3092''true''\u306B\u8A2D\u5B9A\u3057\u307E\u3059\u3002"}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java index 728abc0df37..0affded17e3 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java @@ -24,7 +24,7 @@ /** * @author Morten Jorgensen - * @LastModified: Nov 2024 + * @LastModified: Dec 2024 */ public class ErrorMessages_zh_CN extends ListResourceBundle { @@ -548,6 +548,12 @@ public Object[][] getContents() {ErrorMsg.DATA_CONVERSION_ERR, "\u65E0\u6CD5\u5C06\u6570\u636E\u7C7B\u578B ''{0}'' \u8F6C\u6362\u4E3A ''{1}''\u3002"}, + /* + * Note to translators: property name "jdk.xml.enableExtensionFunctions" + * and value "true" should not be translated. + */ + {ErrorMsg.UNSUPPORTED_EXT_FUNC_ERR, + "\u5F53\u6269\u5C55\u51FD\u6570\u88AB\u5B89\u5168\u5904\u7406\u529F\u80FD\u6216\u5C5E\u6027 ''jdk.xml.enableExtensionFunctions'' \u7981\u7528\u65F6\uFF0C\u4E0D\u5141\u8BB8\u4F7F\u7528\u6269\u5C55\u51FD\u6570 ''{0}''\u3002\u8981\u542F\u7528\u6269\u5C55\u51FD\u6570\uFF0C\u8BF7\u5C06 ''jdk.xml.enableExtensionFunctions'' \u8BBE\u7F6E\u4E3A ''true''\u3002"}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_de.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_de.java index dadea4ba3b0..c93e05d74e4 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_de.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_de.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -25,6 +24,7 @@ /** * @author Morten Jorgensen + * @LastModified: Dec 2024 */ public class ErrorMessages_de extends ListResourceBundle { @@ -275,10 +275,10 @@ public Object[][] getContents() "Ein Attribut, dessen Wert ein NCName sein muss, hatte den Wert \"{0}\""}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, - "Verwendung der Erweiterungsfunktion \"{0}\" ist nicht zul\u00E4ssig, wenn das Feature f\u00FCr die sichere Verarbeitung auf \"true\" gesetzt ist."}, + "Verwendung der Erweiterungsfunktion \"{0}\" ist nicht zul\u00E4ssig, wenn die Erweiterungsfunktionen vom Feature f\u00FCr die sichere Verarbeitung oder der Eigenschaft \"jdk.xml.enableExtensionFunctions\" deaktiviert wurden. Setzen Sie \"jdk.xml.enableExtensionFunctions\" auf \"true\", um die Erweiterungsfunktionen zu aktivieren."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, - "Verwendung des Erweiterungselements \"{0}\" ist nicht zul\u00E4ssig, wenn das Feature f\u00FCr die sichere Verarbeitung auf \"true\" gesetzt ist."}, + "Verwendung des Erweiterungselements \"{0}\" ist nicht zul\u00E4ssig, wenn die Erweiterungsfunktionen vom Feature f\u00FCr die sichere Verarbeitung oder der Eigenschaft \"jdk.xml.enableExtensionFunctions\" deaktiviert wurden. Setzen Sie \"jdk.xml.enableExtensionFunctions\" auf \"true\", um die Erweiterungsfunktionen zu aktivieren."}, }; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ja.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ja.java index 8108e8f7218..941c1c38c00 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ja.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ja.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -25,6 +24,7 @@ /** * @author Morten Jorgensen + * @LastModified: Dec 2024 */ public class ErrorMessages_ja extends ListResourceBundle { @@ -275,10 +275,10 @@ public Object[][] getContents() "\u5024\u304CNCName\u3067\u3042\u308B\u3053\u3068\u304C\u5FC5\u8981\u306A\u5C5E\u6027\u306E\u5024\u304C''{0}''\u3067\u3057\u305F"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, - "\u30BB\u30AD\u30E5\u30A2\u51E6\u7406\u6A5F\u80FD\u304Ctrue\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u3068\u304D\u3001\u62E1\u5F35\u95A2\u6570''{0}''\u306E\u4F7F\u7528\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"}, + "\u30BB\u30AD\u30E5\u30A2\u51E6\u7406\u6A5F\u80FD\u307E\u305F\u306F\u30D7\u30ED\u30D1\u30C6\u30A3''jdk.xml.enableExtensionFunctions''\u306B\u3088\u3063\u3066\u62E1\u5F35\u95A2\u6570\u304C\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u308B\u3068\u304D\u3001\u62E1\u5F35\u95A2\u6570''{0}''\u306E\u4F7F\u7528\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002\u62E1\u5F35\u95A2\u6570\u3092\u6709\u52B9\u306B\u3059\u308B\u306B\u306F\u3001''jdk.xml.enableExtensionFunctions''\u3092''true''\u306B\u8A2D\u5B9A\u3057\u307E\u3059\u3002"}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, - "\u30BB\u30AD\u30E5\u30A2\u51E6\u7406\u6A5F\u80FD\u304Ctrue\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u3068\u304D\u3001\u62E1\u5F35\u8981\u7D20''{0}''\u306E\u4F7F\u7528\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"}, + "\u30BB\u30AD\u30E5\u30A2\u51E6\u7406\u6A5F\u80FD\u307E\u305F\u306F\u30D7\u30ED\u30D1\u30C6\u30A3''jdk.xml.enableExtensionFunctions''\u306B\u3088\u3063\u3066\u62E1\u5F35\u95A2\u6570\u304C\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u308B\u3068\u304D\u3001\u62E1\u5F35\u8981\u7D20''{0}''\u306E\u4F7F\u7528\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002\u62E1\u5F35\u95A2\u6570\u3092\u6709\u52B9\u306B\u3059\u308B\u306B\u306F\u3001''jdk.xml.enableExtensionFunctions''\u3092''true''\u306B\u8A2D\u5B9A\u3057\u307E\u3059\u3002"}, }; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java index 076b06d50db..55484c2b10c 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -25,6 +24,7 @@ /** * @author Morten Jorgensen + * @LastModified: Dec 2024 */ public class ErrorMessages_zh_CN extends ListResourceBundle { @@ -275,10 +275,10 @@ public Object[][] getContents() "\u5176\u503C\u5FC5\u987B\u4E3A NCName \u7684\u5C5E\u6027\u5177\u6709\u503C ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, - "\u5F53\u5B89\u5168\u5904\u7406\u529F\u80FD\u8BBE\u7F6E\u4E3A\u201C\u771F\u201D\u65F6, \u4E0D\u5141\u8BB8\u4F7F\u7528\u6269\u5C55\u51FD\u6570 ''{0}''\u3002"}, + "\u5F53\u6269\u5C55\u51FD\u6570\u88AB\u5B89\u5168\u5904\u7406\u529F\u80FD\u6216\u5C5E\u6027 ''jdk.xml.enableExtensionFunctions'' \u7981\u7528\u65F6\uFF0C\u4E0D\u5141\u8BB8\u4F7F\u7528\u6269\u5C55\u51FD\u6570 ''{0}''\u3002\u8981\u542F\u7528\u6269\u5C55\u51FD\u6570\uFF0C\u8BF7\u5C06 ''jdk.xml.enableExtensionFunctions'' \u8BBE\u7F6E\u4E3A ''true''\u3002"}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, - "\u5F53\u5B89\u5168\u5904\u7406\u529F\u80FD\u8BBE\u7F6E\u4E3A\u201C\u771F\u201D\u65F6, \u4E0D\u5141\u8BB8\u4F7F\u7528\u6269\u5C55\u5143\u7D20 ''{0}''\u3002"}, + "\u5F53\u6269\u5C55\u51FD\u6570\u88AB\u5B89\u5168\u5904\u7406\u529F\u80FD\u6216\u5C5E\u6027 ''jdk.xml.enableExtensionFunctions'' \u7981\u7528\u65F6\uFF0C\u4E0D\u5141\u8BB8\u4F7F\u7528\u6269\u5C55\u5143\u7D20 ''{0}''\u3002\u8981\u542F\u7528\u6269\u5C55\u51FD\u6570\uFF0C\u8BF7\u5C06 ''jdk.xml.enableExtensionFunctions'' \u8BBE\u7F6E\u4E3A ''true''\u3002"}, }; } diff --git a/src/java.xml/share/classes/javax/xml/catalog/Catalog.java b/src/java.xml/share/classes/javax/xml/catalog/Catalog.java index bab7152543e..47dbe35c53f 100644 --- a/src/java.xml/share/classes/javax/xml/catalog/Catalog.java +++ b/src/java.xml/share/classes/javax/xml/catalog/Catalog.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 @@ -29,8 +29,7 @@ /** * The Catalog class represents an entity Catalog as defined by - * + * * XML Catalogs, OASIS Standard V1.1, 7 October 2005. *

        * A catalog is an XML file that contains a root {@code catalog} entry with a list diff --git a/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java b/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java index 4376bbe9fdf..32936c30e0f 100644 --- a/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java +++ b/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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 @@ -137,10 +137,9 @@ * [2] The value shall be exactly as listed in this table, case-sensitive. * Any unspecified value will result in {@link IllegalArgumentException}. *

        - * [3] The Catalog specification defined complex rules on - * - * the prefer attribute. Although the prefer can be public or system, the - * specification actually made system the preferred option, that is, no matter + * [3] The Catalog specification + * defined complex rules on the prefer attribute. Although it can be public or system, + * the specification made {@code system} the preferred option, that is, no matter * the option, a system entry is always used if found. Public entries are only * considered if the prefer is public and system entries are not found. It is * therefore recommended that the prefer attribute be set as public diff --git a/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java b/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java index 41336526e13..f859754b0db 100644 --- a/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java +++ b/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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 @@ -52,7 +52,7 @@ private CatalogManager() { * those referenced by the {@code nextCatalog} elements in the main catalog. *

        * As specified in - * + * * XML Catalogs, OASIS Standard V1.1, if a catalog entry is invalid, it * is ignored. In case all entries are invalid, the resulting Catalog object * will contain no Catalog elements. Any matching operation using the Catalog @@ -126,7 +126,7 @@ public static CatalogResolver catalogResolver(Catalog catalog, CatalogResolver.N * those referenced by the {@code nextCatalog} elements in the main catalog. *

        * As specified in - * + * * XML Catalogs, OASIS Standard V1.1, if a catalog entry is invalid, it * is ignored. In case all entries are invalid, the resulting CatalogResolver * object will contain no valid catalog. Any resolution operation using the diff --git a/src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.java b/src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.java index 3fd4b6a7858..fd6556bafc4 100644 --- a/src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.java +++ b/src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.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 @@ -40,7 +40,7 @@ * Transform {@link javax.xml.transform.URIResolver}, and resolves * external references using catalogs. *

        - * The + * The * Catalog Standard distinguished {@code external identifiers} from {@code uri entries} * as being used to solely identify DTDs, while {@code uri entries} for * other resources such as stylesheets and schema. The Java APIs, such as diff --git a/src/java.xml/share/classes/javax/xml/catalog/Normalizer.java b/src/java.xml/share/classes/javax/xml/catalog/Normalizer.java index 01f1554a6b4..0c01d27437a 100644 --- a/src/java.xml/share/classes/javax/xml/catalog/Normalizer.java +++ b/src/java.xml/share/classes/javax/xml/catalog/Normalizer.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,8 +32,7 @@ /** * The Normalizer is responsible for normalizing Public and System Identifiers * as specified in section 6.2, 6.3 and 6.4 of the specification - * * + * * XML Catalogs, OASIS Standard V1.1, 7 October 2005. * * @since 9 diff --git a/src/java.xml/share/classes/javax/xml/catalog/package-info.java b/src/java.xml/share/classes/javax/xml/catalog/package-info.java index 70db1b31a6c..62a8f769a07 100644 --- a/src/java.xml/share/classes/javax/xml/catalog/package-info.java +++ b/src/java.xml/share/classes/javax/xml/catalog/package-info.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 @@ -26,8 +26,8 @@ /** * * Provides the classes for implementing - * - * XML Catalogs OASIS Standard V1.1, 7 October 2005. + * + * XML Catalogs OASIS Standard V1.1, 7 October 2005. * *

        * The Catalog API defines a standard solution for resolving external resources diff --git a/src/java.xml/share/classes/javax/xml/namespace/QName.java b/src/java.xml/share/classes/javax/xml/namespace/QName.java index 94121d0d334..aaab6ae5333 100644 --- a/src/java.xml/share/classes/javax/xml/namespace/QName.java +++ b/src/java.xml/share/classes/javax/xml/namespace/QName.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 @@ -50,9 +50,9 @@ * only the Namespace URI and local part.

        * *

        If not specified, the Namespace URI is set to {@link - * javax.xml.XMLConstants#NULL_NS_URI XMLConstants.NULL_NS_URI}. + * XMLConstants#NULL_NS_URI XMLConstants.NULL_NS_URI}. * If not specified, the prefix is set to {@link - * javax.xml.XMLConstants#DEFAULT_NS_PREFIX + * XMLConstants#DEFAULT_NS_PREFIX * XMLConstants.DEFAULT_NS_PREFIX}.

        * *

        QName is immutable.

        @@ -89,13 +89,13 @@ public class QName implements Serializable { * and local part.

        * *

        If the Namespace URI is null, it is set to - * {@link javax.xml.XMLConstants#NULL_NS_URI + * {@link XMLConstants#NULL_NS_URI * XMLConstants.NULL_NS_URI}. This value represents no * explicitly defined Namespace as defined by the Namespaces * in XML specification. This action preserves compatible * behavior with QName 1.0. Explicitly providing the {@link - * javax.xml.XMLConstants#NULL_NS_URI + * XMLConstants#NULL_NS_URI * XMLConstants.NULL_NS_URI} value is the preferred coding * style.

        * @@ -105,11 +105,11 @@ public class QName implements Serializable { * compatible behavior with QName 1.0.

        * *

        When using this constructor, the prefix is set to {@link - * javax.xml.XMLConstants#DEFAULT_NS_PREFIX + * XMLConstants#DEFAULT_NS_PREFIX * XMLConstants.DEFAULT_NS_PREFIX}.

        * *

        The Namespace URI is not validated as a - * URI reference. + * URI reference. * The local part is not validated as a * NCName * as specified in Namespaces @@ -134,13 +134,13 @@ public QName(final String namespaceURI, final String localPart) { * local part and prefix.

        * *

        If the Namespace URI is null, it is set to - * {@link javax.xml.XMLConstants#NULL_NS_URI + * {@link XMLConstants#NULL_NS_URI * XMLConstants.NULL_NS_URI}. This value represents no * explicitly defined Namespace as defined by the Namespaces * in XML specification. This action preserves compatible * behavior with QName 1.0. Explicitly providing the {@link - * javax.xml.XMLConstants#NULL_NS_URI + * XMLConstants#NULL_NS_URI * XMLConstants.NULL_NS_URI} value is the preferred coding * style.

        * @@ -151,12 +151,12 @@ public QName(final String namespaceURI, final String localPart) { * *

        If the prefix is null, an * IllegalArgumentException is thrown. Use {@link - * javax.xml.XMLConstants#DEFAULT_NS_PREFIX + * XMLConstants#DEFAULT_NS_PREFIX * XMLConstants.DEFAULT_NS_PREFIX} to explicitly indicate that no * prefix is present or the prefix is not relevant.

        * *

        The Namespace URI is not validated as a - * URI reference. + * URI reference. * The local part and prefix are not validated as a * NCName * as specified in Namespaces @@ -204,9 +204,9 @@ public QName(String namespaceURI, String localPart, String prefix) { * compatible behavior with QName 1.0.

        * *

        When using this constructor, the Namespace URI is set to - * {@link javax.xml.XMLConstants#NULL_NS_URI + * {@link XMLConstants#NULL_NS_URI * XMLConstants.NULL_NS_URI} and the prefix is set to {@link - * javax.xml.XMLConstants#DEFAULT_NS_PREFIX + * XMLConstants#DEFAULT_NS_PREFIX * XMLConstants.DEFAULT_NS_PREFIX}.

        * *

        In an XML context, all Element and Attribute names exist @@ -329,28 +329,14 @@ public final int hashCode() { } /** - *

        String representation of this - * QName.

        - * - *

        The commonly accepted way of representing a QName - * as a String was - * defined - * by James Clark. Although this is not a standard - * specification, it is in common use, e.g. {@link - * javax.xml.transform.Transformer#setParameter(String name, Object value)}. - * This implementation represents a QName as: - * "{" + Namespace URI + "}" + local part. If the Namespace URI - * .equals(XMLConstants.NULL_NS_URI), only the - * local part is returned. An appropriate use of this method is - * for debugging or logging for human consumption.

        - * - *

        Note the prefix value is NOT - * returned as part of the String representation.

        - * - *

        This method satisfies the general contract of {@link - * java.lang.Object#toString() Object.toString()}.

        - * - * @return String representation of this QName + * {@return the string representation of this {@code QName}} + * The format is: + *
         {@code
        +     *     {NamespaceURI}LocalPart
        +     * }
        + * If {@code NamespaceURI} is {@code null}, only {@code LocalPart} is returned. + * + * @apiNote The {@code Prefix} is not returned in the string representation. */ public String toString() { if (namespaceURI.equals(XMLConstants.NULL_NS_URI)) { @@ -361,48 +347,25 @@ public String toString() { } /** - *

        QName derived from parsing the formatted - * String.

        - * - *

        If the String is null or does not conform to - * {@link #toString() QName.toString()} formatting, an - * IllegalArgumentException is thrown.

        - * - *

        The String MUST be in the - * form returned by {@link #toString() QName.toString()}.

        - * - *

        The commonly accepted way of representing a QName - * as a String was - * defined - * by James Clark. Although this is not a standard - * specification, it is in common use, e.g. {@link - * javax.xml.transform.Transformer#setParameter(String name, Object value)}. - * This implementation parses a String formatted - * as: "{" + Namespace URI + "}" + local part. If the Namespace - * URI .equals(XMLConstants.NULL_NS_URI), only the - * local part should be provided.

        - * - *

        The prefix value CANNOT be - * represented in the String and will be set to - * {@link javax.xml.XMLConstants#DEFAULT_NS_PREFIX - * XMLConstants.DEFAULT_NS_PREFIX}.

        - * - *

        This method does not do full validation of the resulting - * QName. - *

        The Namespace URI is not validated as a - * URI reference. - * The local part is not validated as a + * {@return a {@code QName} from its string representation} + * The string representation must be in the format returned by {@link #toString()}: + *

         {@code
        +     *     {NamespaceURI}LocalPart
        +     * }
        + * Since the {@code Prefix} is not represented in the string form, it will be + * set to {@link XMLConstants#DEFAULT_NS_PREFIX XMLConstants.DEFAULT_NS_PREFIX}. + * + * @apiNote This method does not perform full validation of the resulting + * {@code QName}. The {@code NamespaceURI} is not validated as a + * URI reference. + * The {@code LocalPart} is not validated as a * NCName * as specified in - * Namespaces in XML.

        - * - * @param qNameAsString String representation - * of the QName - * - * @throws IllegalArgumentException When qNameAsString is - * null or malformed + * Namespaces in XML. * - * @return QName corresponding to the given String + * @param qNameAsString the string representation of the {@code QName} + * @throws IllegalArgumentException if {@code qNameAsString} is {@code null} + * or malformed * @see #toString() QName.toString() */ public static QName valueOf(String qNameAsString) { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java index 80b1e9d7ea9..980ce060c33 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java @@ -401,12 +401,12 @@ public Iterable analyze(Iterable classes) final ListBuffer results = new ListBuffer<>(); try { if (classes == null) { - handleFlowResults(compiler.flow(compiler.attribute(compiler.todo)), results); + handleFlowResults(compiler.warn(compiler.flow(compiler.attribute(compiler.todo))), results); } else { Filter f = new Filter() { @Override public void process(Env env) { - handleFlowResults(compiler.flow(compiler.attribute(env)), results); + handleFlowResults(compiler.warn(compiler.flow(compiler.attribute(env))), results); } }; f.run(compiler.todo, classes); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java index b7fac8948c9..53abf99ed7d 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -399,6 +399,11 @@ public static EnumSet asFlagSet(long flags) { */ public static final long RESTRICTED = 1L<<62; // MethodSymbols + /** + * Flag to indicate type annotations have been queued for field initializers. + */ + public static final long FIELD_INIT_TYPE_ANNOTATIONS_QUEUED = 1L<<53; // VarSymbols + /** * Flag to indicate that the class/interface was declared with the non-sealed modifier. */ diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java index ec71f71f6fa..76931675220 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -1788,10 +1788,11 @@ public Object getConstantValue() { // Mirror API } public void setLazyConstValue(final Env env, + final Env enclosingEnv, final Attr attr, final JCVariableDecl variable) { - setData((Callable)() -> attr.attribLazyConstantValue(env, variable, type)); + setData((Callable)() -> attr.attribLazyConstantValue(env, enclosingEnv, variable, type)); } /** diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java index b0ed2da6cd9..6f97aabcf3d 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java @@ -851,6 +851,7 @@ void attribAnnotationTypes(List annotations, * @see VarSymbol#setLazyConstValue */ public Object attribLazyConstantValue(Env env, + Env enclosingEnv, JCVariableDecl variable, Type type) { @@ -859,6 +860,7 @@ public Object attribLazyConstantValue(Env env, final JavaFileObject prevSource = log.useSource(env.toplevel.sourcefile); try { + doQueueScanTreeAndTypeAnnotateForVarInit(variable, enclosingEnv); Type itype = attribExpr(variable.init, env, type); if (variable.isImplicitlyTyped()) { //fixup local variable type @@ -1282,11 +1284,7 @@ public void visitVarDef(JCVariableDecl tree) { } } } else { - if (tree.init != null) { - // Field initializer expression need to be entered. - annotate.queueScanTreeAndTypeAnnotate(tree.init, env, tree.sym, tree.pos()); - annotate.flush(); - } + doQueueScanTreeAndTypeAnnotateForVarInit(tree, env); } VarSymbol v = tree.sym; @@ -1339,6 +1337,17 @@ public void visitVarDef(JCVariableDecl tree) { } } + private void doQueueScanTreeAndTypeAnnotateForVarInit(JCVariableDecl tree, Env env) { + if (tree.init != null && + (tree.mods.flags & Flags.FIELD_INIT_TYPE_ANNOTATIONS_QUEUED) == 0 && + env.info.scope.owner.kind != MTH && env.info.scope.owner.kind != VAR) { + tree.mods.flags |= Flags.FIELD_INIT_TYPE_ANNOTATIONS_QUEUED; + // Field initializer expression need to be entered. + annotate.queueScanTreeAndTypeAnnotate(tree.init, env, tree.sym, tree.pos()); + annotate.flush(); + } + } + private boolean isNonArgsMethodInObject(Name name) { for (Symbol s : syms.objectType.tsym.members().getSymbolsByName(name, s -> s.kind == MTH)) { if (s.type.getParameterTypes().isEmpty()) { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java index 76a05d6e1d3..c6c17e6811f 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, 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 @@ -301,7 +301,7 @@ public void visitVarDef(JCVariableDecl tree) { needsLazyConstValue(tree.init)) { Env initEnv = getInitEnv(tree, env); initEnv.info.enclVar = v; - v.setLazyConstValue(initEnv(tree, initEnv), attr, tree); + v.setLazyConstValue(initEnv(tree, initEnv), env, attr, tree); } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties index 130a644da94..8761d334157 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties @@ -839,8 +839,6 @@ compiler.misc.user.selected.completion.failure=Von Benutzer ausgewählter Abschl # 0: collection of string compiler.err.proc.no.explicit.annotation.processing.requested=Klassennamen "{0}" werden nur akzeptiert, wenn die Annotationsverarbeitung explizit angefordert wird -compiler.err.proc.no.service=ServiceLoader konnte nicht verwendet werden und ist für Annotationsverarbeitung erforderlich. - # 0: string, 1: string compiler.err.proc.processor.bad.option.name=Ungültiger Optionsname "{0}" von Prozessor "{1}" angegeben @@ -2300,7 +2298,7 @@ compiler.misc.feature.flexible.constructors=Flexible Konstruktoren compiler.misc.feature.module.imports=Modulimporte # L10N: do not localize: transitive -compiler.misc.feature.java.base.transitive=transitive Modifikator für java.base +compiler.misc.feature.java.base.transitive=Modifikator "transitive" für java.base compiler.warn.underscore.as.identifier=Ab Release 9 ist "_" ein Schlüsselwort und kann nicht als ID verwendet werden @@ -2668,7 +2666,7 @@ compiler.misc.locn.module_path=Anwendungsmodulpfad compiler.misc.cant.resolve.modules=Module können nicht aufgelöst werden -compiler.misc.bad.requires.flag=Ungültiges requires-Kennzeichen: {0} +compiler.misc.bad.requires.flag=Ungültiges Kennzeichen für "requires java.base": {0} # 0: string compiler.err.invalid.module.specifier=Modulbezeichner nicht zulässig: {0} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties index 2c108edf692..9ab2862407f 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties @@ -839,8 +839,6 @@ compiler.misc.user.selected.completion.failure=クラス名によるユーザー # 0: collection of string compiler.err.proc.no.explicit.annotation.processing.requested=クラス名''{0}''が受け入れられるのは、注釈処理が明示的にリクエストされた場合のみです -compiler.err.proc.no.service=サービス・ローダーが使用できませんでしたが、注釈処理に必要です。 - # 0: string, 1: string compiler.err.proc.processor.bad.option.name=プロセッサ''{1}''によって指定されたオプション名''{0}''が不正です @@ -2300,7 +2298,7 @@ compiler.misc.feature.flexible.constructors=柔軟なコンストラクタ compiler.misc.feature.module.imports=モジュール・インポート # L10N: do not localize: transitive -compiler.misc.feature.java.base.transitive=java.baseの推移的修飾子 +compiler.misc.feature.java.base.transitive=java.baseのtransitive 修飾子 compiler.warn.underscore.as.identifier=リリース9から''_''はキーワードなので識別子として使用することはできません @@ -2668,7 +2666,7 @@ compiler.misc.locn.module_path=アプリケーション・モジュール・パ compiler.misc.cant.resolve.modules=モジュールを解決できません -compiler.misc.bad.requires.flag=不正な必須フラグ: {0} +compiler.misc.bad.requires.flag="requires java.base"のフラグが無効です: {0} # 0: string compiler.err.invalid.module.specifier=モジュール指定子は許可されません: {0} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties index c841c3715fc..52a6ec23e51 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties @@ -839,8 +839,6 @@ compiler.misc.user.selected.completion.failure=按类名列出的用户选择输 # 0: collection of string compiler.err.proc.no.explicit.annotation.processing.requested=仅当显式请求批注处理时才接受类名称 ''{0}'' -compiler.err.proc.no.service=ServiceLoader 不可用, 但它是批注处理所必需的。 - # 0: string, 1: string compiler.err.proc.processor.bad.option.name=处理程序 ''{1}'' 提供的选项名称 ''{0}'' 错误 @@ -2300,7 +2298,7 @@ compiler.misc.feature.flexible.constructors=灵活构造器 compiler.misc.feature.module.imports=模块导入 # L10N: do not localize: transitive -compiler.misc.feature.java.base.transitive=java.base 的过渡修饰符 +compiler.misc.feature.java.base.transitive=java.base 的 transitive 修饰符 compiler.warn.underscore.as.identifier=从发行版 9 开始, ''_'' 为关键字, 不能用作标识符 @@ -2668,7 +2666,7 @@ compiler.misc.locn.module_path=应用程序模块路径 compiler.misc.cant.resolve.modules=无法解析模块 -compiler.misc.bad.requires.flag=错误的请求标记:{0} +compiler.misc.bad.requires.flag="requires java.base" 的标记无效:{0} # 0: string compiler.err.invalid.module.specifier=不允许模块说明符: {0} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties index efcc594ca6c..0c67a60aa0a 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties @@ -82,8 +82,6 @@ launcher.error=Fehler:\u0020 launcher.err.no.args=kein Pfad für Quelldatei -launcher.err.security.manager=Quellcode-Launcher kann nicht mit aktiviertem Sicherheitsmanager verwendet werden - # 0: string launcher.err.invalid.filename=ungültiger Pfad für Quelldatei: {0} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties index 72e2478bff3..ef4d0f1f9e0 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties @@ -82,8 +82,6 @@ launcher.error=エラー:\u0020 launcher.err.no.args=ソース・ファイルのパスがありません -launcher.err.security.manager=セキュリティ・マネージャが有効な状態でソースコード・ランチャを使用することはできません - # 0: string launcher.err.invalid.filename=ソース・ファイルの無効なパス: {0} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties index 9382ac9e348..a442cfe1e68 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties @@ -82,8 +82,6 @@ launcher.error=错误:\u0020 launcher.err.no.args=无源文件的路径 -launcher.err.security.manager=无法在启用安全管理器的情况下使用源代码启动程序 - # 0: string launcher.err.invalid.filename=源文件的路径无效:{0} diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.java index 53728219d8b..ec5e03cc15a 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.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 @@ -33,6 +33,8 @@ import static sun.security.pkcs11.TemplateManager.*; import sun.security.pkcs11.wrapper.*; +import sun.security.util.KeyUtil; + import static sun.security.pkcs11.wrapper.PKCS11Constants.*; /** @@ -168,9 +170,9 @@ protected SecretKey engineGenerateSecret(String algorithm) if (algorithm == null) { throw new NoSuchAlgorithmException("Algorithm must not be null"); } - if (!algorithm.equals("TlsPremasterSecret")) { - throw new NoSuchAlgorithmException - ("Only supported for algorithm TlsPremasterSecret"); + if (!KeyUtil.isSupportedKeyAgreementOutputAlgorithm(algorithm)) { + throw new NoSuchAlgorithmException( + "Unsupported secret key algorithm: " + algorithm); } return nativeGenerateSecret(algorithm); } diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyAgreement.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyAgreement.java index 6c010a4a513..183135ce7e1 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyAgreement.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyAgreement.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 @@ -268,20 +268,19 @@ protected SecretKey engineGenerateSecret(String algorithm) throw new NoSuchAlgorithmException("Algorithm must not be null"); } - if (algorithm.equals("TlsPremasterSecret")) { + if (KeyUtil.isSupportedKeyAgreementOutputAlgorithm(algorithm)) { // For now, only perform native derivation for TlsPremasterSecret - // as that is required for FIPS compliance. + // and Generic algorithms. TlsPremasterSecret is required for + // FIPS compliance and Generic is required for input to KDF. // For other algorithms, there are unresolved issues regarding // how this should work in JCE plus a Solaris truncation bug. // (bug not yet filed). return nativeGenerateSecret(algorithm); } - if (!algorithm.equalsIgnoreCase("TlsPremasterSecret") && - !AllowKDF.VALUE) { - - throw new NoSuchAlgorithmException("Unsupported secret key " - + "algorithm: " + algorithm); + if (!AllowKDF.VALUE) { + throw new NoSuchAlgorithmException( + "Unsupported secret key algorithm: " + algorithm); } byte[] secret = engineGenerateSecret(); @@ -295,8 +294,6 @@ protected SecretKey engineGenerateSecret(String algorithm) keyLen = 24; } else if (algorithm.equalsIgnoreCase("Blowfish")) { keyLen = Math.min(56, secret.length); - } else if (algorithm.equalsIgnoreCase("TlsPremasterSecret")) { - keyLen = secret.length; } else { throw new NoSuchAlgorithmException ("Unknown algorithm " + algorithm); @@ -340,7 +337,8 @@ private SecretKey nativeGenerateSecret(String algorithm) int keyLen = (int)lenAttributes[0].getLong(); SecretKey key = P11Key.secretKey (session, keyID, algorithm, keyLen << 3, attributes); - if ("RAW".equals(key.getFormat())) { + if ("RAW".equals(key.getFormat()) + && algorithm.equalsIgnoreCase("TlsPremasterSecret")) { // Workaround for Solaris bug 6318543. // Strip leading zeroes ourselves if possible (key not sensitive). // This should be removed once the Solaris fix is available diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/DeoptimizeObjectsALotThread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/DeoptimizeObjectsALotThread.java new file mode 100644 index 00000000000..b79d43948a2 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/DeoptimizeObjectsALotThread.java @@ -0,0 +1,42 @@ +/* + * 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 sun.jvm.hotspot.runtime; + +import java.io.*; + +import sun.jvm.hotspot.debugger.Address; + +public class DeoptimizeObjectsALotThread extends JavaThread { + + public DeoptimizeObjectsALotThread (Address addr) { + super(addr); + } + + public boolean isJavaThread() { return false; } + public boolean isHiddenFromExternalView() { return true; } + + public boolean isDeoptimizeObjectsALotThread() { return true; } + +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Thread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Thread.java index d9828b06e26..f9f2f578928 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Thread.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Thread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -89,6 +89,7 @@ public long allocatedBytes() { public boolean isServiceThread() { return false; } public boolean isMonitorDeflationThread() { return false; } public boolean isAttachListenerThread() { return false; } + public boolean isDeoptimizeObjectsALotThread() { return false; } /** Memory operations */ public void oopsDo(AddressVisitor oopVisitor) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java index e2e0c989425..b772959b811 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -155,19 +155,23 @@ private static synchronized void initialize(TypeDataBase db) { virtualConstructor.addMapping("NotificationThread", NotificationThread.class); virtualConstructor.addMapping("StringDedupThread", StringDedupThread.class); virtualConstructor.addMapping("AttachListenerThread", AttachListenerThread.class); + + /* Only add DeoptimizeObjectsALotThread if it is actually present in the type database. */ + if (db.lookupType("DeoptimizeObjectsALotThread", false) != null) { + virtualConstructor.addMapping("DeoptimizeObjectsALotThread", DeoptimizeObjectsALotThread.class); + } } public Threads() { _list = VMObjectFactory.newObject(ThreadsList.class, threadListField.getValue()); } - /** NOTE: this returns objects of type JavaThread, CompilerThread, - JvmtiAgentThread, NotificationThread, MonitorDeflationThread, - StringDedupThread, AttachListenerThread and ServiceThread. - The latter seven subclasses of the former. Most operations - (fetching the top frame, etc.) are only allowed to be performed on - a "pure" JavaThread. For this reason, {@link - sun.jvm.hotspot.runtime.JavaThread#isJavaThread} has been + /** NOTE: this returns objects of type JavaThread or one if its subclasses: + CompilerThread, JvmtiAgentThread, NotificationThread, MonitorDeflationThread, + StringDedupThread, AttachListenerThread, DeoptimizeObjectsALotThread and + ServiceThread. Most operations (fetching the top frame, etc.) are only + allowed to be performed on a "pure" JavaThread. For this reason, + {@link sun.jvm.hotspot.runtime.JavaThread#isJavaThread} has been changed from the definition in the VM (which returns true for all of these thread types) to return true for JavaThreads and false for the seven subclasses. FIXME: should reconsider the @@ -195,7 +199,7 @@ public JavaThread createJavaThreadWrapper(Address threadAddr) { } catch (Exception e) { throw new RuntimeException("Unable to deduce type of thread from address " + threadAddr + " (expected type JavaThread, CompilerThread, MonitorDeflationThread, AttachListenerThread," + - " StringDedupThread, NotificationThread, ServiceThread or JvmtiAgentThread)", e); + " DeoptimizeObjectsALotThread, StringDedupThread, NotificationThread, ServiceThread or JvmtiAgentThread)", e); } } diff --git a/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java b/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java index 3ff0f2663a2..97ccd65dd05 100644 --- a/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java +++ b/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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 @@ -181,6 +181,7 @@ public Builder(PrivateKey privateKey, CertPath certPath) { * "{@docRoot}/../specs/security/standard-names.html#messagedigest-algorithms"> * Java Cryptography Architecture Standard Algorithm Name * Documentation for information about standard algorithm names. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the {@code JarSigner.Builder} itself. * @throws NoSuchAlgorithmException if {@code algorithm} is not available. */ @@ -202,6 +203,7 @@ public Builder digestAlgorithm(String algorithm) throws NoSuchAlgorithmException * Java Cryptography Architecture Standard Algorithm Name * Documentation for information about standard algorithm names. * @param provider the provider. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the {@code JarSigner.Builder} itself. * @throws NoSuchAlgorithmException if {@code algorithm} is not * available in the specified provider. @@ -227,6 +229,7 @@ public Builder digestAlgorithm(String algorithm, Provider provider) * "{@docRoot}/../specs/security/standard-names.html#signature-algorithms"> * Java Cryptography Architecture Standard Algorithm Name * Documentation for information about standard algorithm names. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the {@code JarSigner.Builder} itself. * @throws NoSuchAlgorithmException if {@code algorithm} is not available. * @throws IllegalArgumentException if {@code algorithm} is not @@ -254,6 +257,7 @@ public Builder signatureAlgorithm(String algorithm) * Java Cryptography Architecture Standard Algorithm Name * Documentation for information about standard algorithm names. * @param provider the provider. + * @spec security/standard-names.html Java Security Standard Algorithm Names * @return the {@code JarSigner.Builder} itself. * @throws NoSuchAlgorithmException if {@code algorithm} is not * available in the specified provider. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java index 9b6b1c831b1..7170c6bcc8a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.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 @@ -347,7 +347,7 @@ private void addStylesheets(HtmlTree head) { private void addStylesheet(HtmlTree head, DocPath stylesheet) { head.add(HtmlTree.LINK("stylesheet", "text/css", - pathToRoot.resolve(stylesheet).getPath(), "Style")); + pathToRoot.resolve(stylesheet).getPath())); } private void addScripts(HtmlTree head) { diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/HtmlTree.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/HtmlTree.java index 4c2477babf5..d6642390335 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/HtmlTree.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/HtmlTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2024, 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 @@ -779,15 +779,13 @@ public static HtmlTree LI(HtmlStyle style, Content body) { * @param rel the relevance of the link: the {@code rel} attribute * @param type the type of link: the {@code type} attribute * @param href the path for the link: the {@code href} attribute - * @param title title for the link: the {@code title} attribute * @return the element */ - public static HtmlTree LINK(String rel, String type, String href, String title) { + public static HtmlTree LINK(String rel, String type, String href) { return new HtmlTree(HtmlTag.LINK) .put(HtmlAttr.REL, rel) .put(HtmlAttr.TYPE, type) - .put(HtmlAttr.HREF, href) - .put(HtmlAttr.TITLE, title); + .put(HtmlAttr.HREF, href); } /** diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties index 7c156a61b3a..6df60ada590 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties @@ -65,17 +65,19 @@ main.extended.help.footer=Bei Optionen, die eine erfordern, ist de main.runtime.image.linking.cap.enabled=aktiviert main.runtime.image.linking.cap.disabled=deaktiviert main.runtime.image.linking.cap.sect.header=Funktionen: -main.runtime.image.linking.cap.msg=\ Assemblierung von Laufzeitimage {0} +main.runtime.image.linking.cap.msg=\ Verknüpfung von Laufzeitimage {0} error.prefix=Fehler: warn.prefix=Warnung: -err.runtime.link.not.linkable.runtime=Dieses JDK unterstützt keine Assemblierung vom aktuellen Laufzeitimage -err.runtime.link.jdk.jlink.prohibited=Dieses JDK enthält keine als Pakete verpackten Module und kann nicht verwendet werden, um ein anderes Image mit dem Modul jdk.jlink zu erstellen -err.runtime.link.packaged.mods=Dieses JDK enthält keine als Pakete verpackten Module. "--keep-packaged-modules" wird nicht unterstützt -err.runtime.link.modified.file={0} wurde modifiziert -err.runtime.link.patched.module=Datei {0} nicht im Modulimage gefunden. "--patch-module" wird beim Verknüpfen aus dem Laufzeitimage nicht unterstützt -err.empty.module.path=leerer Modulpfad +err.runtime.link.not.linkable.runtime=Dieses JDK unterstützt keine Verknüpfung vom aktuellen Laufzeitimage +err.runtime.link.jdk.jlink.prohibited=Dieses JDK enthält keine verpackten Module und kann nicht verwendet werden, um ein anderes Image mit dem Modul jdk.jlink zu erstellen +err.runtime.link.packaged.mods=Dieses JDK enthält keine verpackten Module. "--keep-packaged-modules" wird nicht unterstützt +err.runtime.link.modified.file={0} wurde geändert +err.runtime.link.patched.module=jlink unterstützt keine Verknüpfung vom Laufzeitimage unter einer gepatchten Laufzeit mit --patch-module +err.no.module.path=--module-path Option muss mit --add-modules ALL-MODULE-PATH angegeben werden +err.empty.module.path=Kein Modul im Modulpfad "{0}" mit --add-modules ALL-MODULE-PATH gefunden +err.limit.modules=--limit-modules nicht mit --add-modules ALL-MODULE-PATH zulässig err.jlink.version.mismatch=jlink-Version {0}.{1} stimmt nicht mit Ziel-java.base-Version {2}.{3} überein err.automatic.module:automatisches Modul kann nicht mit jlink verwendet werden: {0} aus {1} err.unknown.byte.order:unbekannte Bytereihenfolge {0} @@ -116,5 +118,5 @@ no.suggested.providers=Option --bind-services ist angegeben. Keine weiteren Prov suggested.providers.header=Vorgeschlagene Provider providers.header=Provider -runtime.link.info=Assemblierung basierend auf dem aktuellen Laufzeitimage +runtime.link.info=Verknüpfung basierend auf dem aktuellen Laufzeitimage runtime.link.jprt.path.extra=(Laufzeitimage) diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties index 66cf161c1fc..ef82d3bb461 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties @@ -74,8 +74,10 @@ err.runtime.link.not.linkable.runtime=このJDKでは、現在のランタイム err.runtime.link.jdk.jlink.prohibited=このJDKは、パッケージ化されたモジュールを含んでおらず、jdk.jlinkモジュールによる別のイメージの作成に使用できません err.runtime.link.packaged.mods=このJDKにはパッケージ化されたモジュールがありません。--keep-packaged-modulesはサポートされていません err.runtime.link.modified.file={0}が変更されました -err.runtime.link.patched.module=ファイル{0}がモジュール・イメージに見つかりません。ランタイム・イメージからリンクする際、--patch-moduleはサポートされていません -err.empty.module.path=空のモジュール・パス +err.runtime.link.patched.module=--patch-moduleを使用してパッチ済ランタイムで実行する際、jlinkではランタイム・イメージからのリンクをサポートしていません +err.no.module.path=--module-pathオプションは--add-modules ALL-MODULE-PATHで指定する必要があります +err.empty.module.path=モジュール・パス''{0}''に--add-modules ALL-MODULE-PATHを使用したモジュールが見つかりません +err.limit.modules=--limit-modulesは--add-modules ALL-MODULE-PATHとともに指定できません err.jlink.version.mismatch=jlinkバージョン{0}.{1}がターゲットのjava.baseバージョン{2}.{3}と一致しません err.automatic.module:jlinkでは自動モジュールは使用できません: {1}からの{0} err.unknown.byte.order:不明なバイト順{0} diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties index 532e981bfac..12989131e65 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties @@ -74,8 +74,10 @@ err.runtime.link.not.linkable.runtime=此 JDK 不支持从当前运行时映像 err.runtime.link.jdk.jlink.prohibited=此 JDK 不包含打包模块,无法用于使用 jdk.jlink 模块创建其他映像 err.runtime.link.packaged.mods=此 JDK 没有打包模块。不支持 --keep-packaged-modules err.runtime.link.modified.file=已修改 {0} -err.runtime.link.patched.module=在模块映像中未找到文件 {0}。从运行时映像链接时,不支持 --patch-module -err.empty.module.path=空模块路径 +err.runtime.link.patched.module=当使用 --patch-module 在打补丁的运行时上运行时,jlink 不支持从当前运行时映像链接 +err.no.module.path=--module-path 选项必须与 --add-modules ALL-MODULE-PATH 一起指定 +err.empty.module.path=在随 --add-modules ALL-MODULE-PATH 提供的模块路径 ''{0}'' 中找不到模块 +err.limit.modules=不允许将 --limit-modules 与 --add-modules ALL-MODULE-PATH 一起使用 err.jlink.version.mismatch=jlink 版本 {0}.{1} 与目标 java.base 版本 {2}.{3} 不匹配 err.automatic.module:自动模块不能用于来自 {1} 的 jlink: {0} err.unknown.byte.order:未知的字节顺序 {0} diff --git a/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_de.properties index 84abaee4ce3..a5896e94abb 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_de.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_de.properties @@ -57,7 +57,7 @@ main.opt.man-pages=Speicherort der Manpages main.opt.target-platform=Zielplattform main.opt.target-platform.arg=target-platform main.opt.module-path=Modulpfad -main.opt.hash-modules=Berechnet und erfasst Hashes zur Bindung eines in ein Package integrierten Moduls an Module, die dem angegebenen entsprechen und direkt oder indirekt davon abhängen. Die Hashes werden in der erstellten JMOD-Datei oder in einer JMOD- oder modularen JAR-Datei in dem Modulpfad erfasst, der im jmod-Hashbefehl angegeben ist. +main.opt.hash-modules=Berechnet und erfasst Hashes zur Bindung eines verpackten Moduls an Module, die dem angegebenen entsprechen und direkt oder indirekt davon abhängen. Die Hashes werden in der erstellten JMOD-Datei oder in einer JMOD- oder modularen JAR-Datei in dem Modulpfad erfasst, der im jmod-Hashbefehl angegeben ist. main.opt.do-not-resolve-by-default=Aus dem Standard-Root-Set von Modulen ausschließen main.opt.warn-if-resolved=Hinweis für ein Tool, eine Warnung auszugeben, wenn das Modul aufgelöst wird, entweder "deprecated", "deprecated-for-removal" oder "incubating" main.opt.date=Datum und Uhrzeit für die Zeitstempel von Einträgen, angegeben im erweiterten Datums-/Uhrzeitformat mit Zeitunterschied und optionaler Zeitzone nach ISO-8601. Beispiel: "2022-02-12T12:30:00-05:00" diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties index f060abe314f..31d6e11d70c 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties @@ -25,8 +25,8 @@ # MSG_Help=Verwendung: jpackage \n\nBeispielverwendungen:\n--------------\n Generiert ein für das Hostsystem geeignetes Anwendungspackage:\n Für eine modulare Anwendung:\n jpackage -n name -p modulePath -m moduleName/className\n Für eine nicht modulare Anwendung:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n Aus einem vorab erstellten Anwendungsimage:\n jpackage -n name --app-image appImageDir\n Generiert ein Anwendungsimage:\n Für eine modulare Anwendung:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n Für eine nicht modulare Anwendung:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n Um eigene Optionen für jlink anzugeben, führen Sie jlink separat aus:\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage\n Generiert ein Java Runtime-Package:\n jpackage -n name --runtime-image \n{6}\nAllgemeine Optionen:\n @ \n Liest Optionen und/oder Modus aus einer Datei \n Diese Option kann mehrmals verwendet werden.\n --type -t \n Der zu erstellende Packagetyp\n Gültige Werte: {1} \n Bei fehlender Angabe dieser Option wird ein plattformabhängiger\n Standardtyp erstellt.\n --app-version \n Version der Anwendung und/oder des Packages\n --copyright \n Copyright für die Anwendung\n --description \n Beschreibung der Anwendung\n --help -h \n Gibt den Verwendungstext mit einer Liste und Beschreibung jeder gültigen\n Option für die aktuelle Plattform an den Ausgabestream aus und beendet den Vorgang\n --icon \n Pfad des Symbols für das Anwendungspackage\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --name -n \n Name der Anwendung und/oder des Packages\n --dest -d \n Pfad, in den die generierte Ausgabedatei abgelegt wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Standardmäßig wird das aktuelle Arbeitsverzeichnis verwendet.\n --temp \n Pfad eines neuen oder leeren Verzeichnisses zum Erstellen temporärer Dateien\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Falls angegeben, wird das temporäre Verzeichnis beim Abschließen der Aufgabe\n nicht entfernt und muss manuell entfernt werden.\n Bei fehlender Angabe wird ein temporäres Verzeichnis erstellt und\n beim Abschließen der Aufgabe entfernt.\n --vendor \n Anbieter der Anwendung\n --verbose\n Aktiviert Ausgabe im Verbose-Modus\n --version\n Gibt die Produktversion an den Outputstream aus und beendet den Vorgang.\n\nOptionen für das Erstellen des Laufzeitimages:\n --add-modules [,...]\n Eine per Komma (",") getrennte Liste hinzuzufügender Module\n Diese Modulliste wird zusammen mit dem Hauptmodul (sofern angegeben)\n als Argument --add-module an jlink übergeben.\n Bei fehlender Angabe wird entweder nur das Hauptmodul (sofern --module\n angegeben ist) oder das Standardset an Modulen (sofern --main-jar \n angegeben ist) verwendet.\n Diese Option kann mehrmals verwendet werden.\n --module-path -p ...\n \ -Eine per {0} getrennte Pfadliste\n Jeder Pfad ist entweder ein Verzeichnis mit Modulen oder der Pfad zu einer\n JAR-Datei eines Moduls.\n (Jeder Pfad ist absolut oder relativ zum aktuellen Verzeichnis.)\n Diese Option kann mehrmals verwendet werden.\n --jlink-options \n Eine per Leerzeichen getrennte Liste mit an jlink zu übergebenden Optionen \n Bei fehlender Angabe wird standardmäßig "--strip-native-commands \n --strip-debug --no-man-pages --no-header-files" verwendet. \n Diese Option kann mehrmals verwendet werden.\n --runtime-image \n Pfad des vordefinierten Laufzeitimages, das in\n das Anwendungsimage kopiert wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Wenn --runtime-image nicht angegeben wird, führt jpackage jlink aus, um\n das Laufzeitimage mit folgenden Optionen zu erstellen:\n --strip-debug, --no-header-files, --no-man-pages und\n --strip-native-commands.\n\nOptionen für das Erstellen des Anwendungsimages:\n --input -i \n Pfad des Eingabeverzeichnisses mit den in das Package zu integrierenden Dateien\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Alle Dateien im Eingabeverzeichnis werden in das Package für das\n Anwendungsimage integriert.\n --app-content [,...]\n Eine per Komma getrennte Liste mit Pfaden zu Dateien und/oder Verzeichnissen,\n die zur Anwendungs-Payload hinzugefügt werden sollen.\n Diese Option kann mehrmals verwendet werden.\n\nOptionen für das Erstellen des Anwendungs-Launchers:\n --add-launcher =\n Name des Launchers sowie ein Pfad zu einer Eigenschaftendatei mit\n einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Die Schlüssel "module", "main-jar", "main-class", "description",\n "arguments", "java-options", "app-version", "icon",\n "launcher-as-service",\n "win-console", "win-shortcut", "win-menu",\n "linux-app-category" und "linux-shortcut" können verwendet werden.\n Diese Optionen werden den ursprünglichen Befehlszeilenoptionen hinzugefügt\n (oder überschreiben diese), um einen zusätzlichen, alternativen Launcher zu erstellen.\n Der Hauptanwendungs-Launcher wird aus den Befehlszeilenoptionen\n erstellt. Mit dieser Option können zusätzliche alternative Launcher\n erstellt werden. Außerdem kann diese Option mehrmals verwendet werden,\n um mehrere zusätzliche Launcher zu erstellen. \n --arguments \n Befehlszeilenargumente, die an die Hauptklasse übergeben werden, falls\n keine Befehlszeilenargumente an den Launcher übergeben werden\n Diese Option kann mehrmals verwendet werden.\n --java-options \n Optionen, die an Java Runtime übergeben werden\n Diese Option kann mehrmals verwendet werden.\n --main-class \n Qualifizierter Name der auszuführenden Anwendungshauptklasse\n Diese Option kann nur bei Angabe von --main-jar verwendet werden.\n --main-jar \n Die Haupt-JAR-Datei der Anwendung, die die Hauptklasse enthält\n (angegeben als Pfad relativ zum Eingabepfad)\n Es kann entweder die Option --module oder die Option --main-jar angegeben werden, nicht jedoch\n beides.\n --module -m [/]\n Das Hauptmodul (und optional die Hauptklasse) der Anwendung\n Dieses Modul muss unter dem Modulpfad gespeichert sein.\n Bei Angabe dieser Option wird \ -das Hauptmodul\n im Java Runtime-Image verknüpft. Es kann entweder die Option --module oder die Option --main-jar\n angegeben werden, nicht jedoch beides.\n{2}\nOptionen für das Erstellen des Anwendungspackages:\n --about-url \n URL der Homepage der Anwendung\n --app-image \n {5} (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --file-associations \n Pfad zu einer Eigenschaftendatei mit einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Mit den Schlüsseln "extension", "mime-type", "icon" und "description"\n kann die Verknüpfung beschrieben werden.\n Diese Option kann mehrmals verwendet werden.\n --install-dir \n {4} --license-file \n Pfad zur Lizenzdatei\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --resource-dir \n Pfad zum Überschreiben von jpackage-Ressourcen\n Symbole, Vorlagendateien und weitere Ressourcen von jpackage können\n durch Hinzufügen von Ersetzungsressourcen zu diesem Verzeichnis überschrieben werden.\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --runtime-image \n Pfad des zu installierenden vordefinierten Laufzeitimages\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Option muss beim Erstellen eines Laufzeitpackages angegeben werden.\n --launcher-as-service\n Anforderung zum Erstellen eines Installationsprogramms, das den\n Hauptanwendungs-Launcher als Hintergrundserviceanwendung registriert.\n\nPlattformabhängige Optionen für das Erstellen des Anwendungspackages:\n{3} +Eine per {0} getrennte Pfadliste\n Jeder Pfad ist entweder ein Verzeichnis mit Modulen oder der Pfad zu einer\n JAR-Datei eines Moduls.\n (Jeder Pfad ist absolut oder relativ zum aktuellen Verzeichnis.)\n Diese Option kann mehrmals verwendet werden.\n --jlink-options \n Eine per Leerzeichen getrennte Liste mit an jlink zu übergebenden Optionen \n Bei fehlender Angabe wird standardmäßig "--strip-native-commands \n --strip-debug --no-man-pages --no-header-files" verwendet. \n Diese Option kann mehrmals verwendet werden.\n --runtime-image \n Pfad des vordefinierten Laufzeitimages, das in\n das Anwendungsimage kopiert wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Wenn --runtime-image nicht angegeben wird, führt jpackage jlink aus, um\n das Laufzeitimage mit folgenden Optionen zu erstellen:\n --strip-debug, --no-header-files, --no-man-pages und\n --strip-native-commands.\n\nOptionen für das Erstellen des Anwendungsimages:\n --input -i \n Pfad des Eingabeverzeichnisses mit den zu verpackenden Dateien\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Alle Dateien im Eingabeverzeichnis werden verpackt für das\n Anwendungsimage integriert.\n --app-content [,...]\n Eine per Komma getrennte Liste mit Pfaden zu Dateien und/oder Verzeichnissen,\n die zur Anwendungs-Payload hinzugefügt werden sollen.\n Diese Option kann mehrmals verwendet werden.\n\nOptionen für das Erstellen des Anwendungs-Launchers:\n --add-launcher =\n Name des Launchers sowie ein Pfad zu einer Eigenschaftendatei mit\n einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Die Schlüssel "module", "main-jar", "main-class", "description",\n "arguments", "java-options", "app-version", "icon",\n "launcher-as-service",\n "win-console", "win-shortcut", "win-menu",\n "linux-app-category" und "linux-shortcut" können verwendet werden.\n Diese Optionen werden den ursprünglichen Befehlszeilenoptionen hinzugefügt\n (oder überschreiben diese), um einen zusätzlichen, alternativen Launcher zu erstellen.\n Der Hauptanwendungs-Launcher wird aus den Befehlszeilenoptionen\n erstellt. Mit dieser Option können zusätzliche alternative Launcher\n erstellt werden. Außerdem kann diese Option mehrmals verwendet werden,\n um mehrere zusätzliche Launcher zu erstellen. \n --arguments \n Befehlszeilenargumente, die an die Hauptklasse übergeben werden, falls\n keine Befehlszeilenargumente an den Launcher übergeben werden\n Diese Option kann mehrmals verwendet werden.\n --java-options \n Optionen, die an Java Runtime übergeben werden\n Diese Option kann mehrmals verwendet werden.\n --main-class \n Qualifizierter Name der auszuführenden Anwendungshauptklasse\n Diese Option kann nur bei Angabe von --main-jar verwendet werden.\n --main-jar \n Die Haupt-JAR-Datei der Anwendung, die die Hauptklasse enthält\n (angegeben als Pfad relativ zum Eingabepfad)\n Es kann entweder die Option --module oder die Option --main-jar angegeben werden, nicht jedoch\n beides.\n --module -m [/]\n Das Hauptmodul (und optional die Hauptklasse) der Anwendung\n Dieses Modul muss unter dem Modulpfad gespeichert sein.\n Bei Angabe dieser Option wird das Hauptmodul\n \ +im Java Runtime-Image verknüpft. Es kann entweder die Option --module oder die Option --main-jar\n angegeben werden, nicht jedoch beides.\n{2}\nOptionen für das Erstellen des Anwendungspackages:\n --about-url \n URL der Homepage der Anwendung\n --app-image \n {5} (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --file-associations \n Pfad zu einer Eigenschaftendatei mit einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Mit den Schlüsseln "extension", "mime-type", "icon" und "description"\n kann die Verknüpfung beschrieben werden.\n Diese Option kann mehrmals verwendet werden.\n --install-dir \n {4} --license-file \n Pfad zur Lizenzdatei\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --resource-dir \n Pfad zum Überschreiben von jpackage-Ressourcen\n Symbole, Vorlagendateien und weitere Ressourcen von jpackage können\n durch Hinzufügen von Ersetzungsressourcen zu diesem Verzeichnis überschrieben werden.\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --runtime-image \n Pfad des zu installierenden vordefinierten Laufzeitimages\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Option muss beim Erstellen eines Laufzeitpackages angegeben werden.\n --launcher-as-service\n Anforderung zum Erstellen eines Installationsprogramms, das den\n Hauptanwendungs-Launcher als Hintergrundserviceanwendung registriert.\n\nPlattformabhängige Optionen für das Erstellen des Anwendungspackages:\n{3} MSG_Help_win_launcher=\nPlattformabhängige Option für das Erstellen des Anwendungs-Launchers:\n --win-console\n Erstellt einen Konsolen-Launcher für die Anwendung. Sollte für\n Anwendungen angegeben werden, die Konsoleninteraktionen erfordern\n MSG_Help_win_install=\ --win-dir-chooser\n Fügt ein Dialogfeld hinzu, in dem der Benutzer das Verzeichnis auswählen kann, in dem\n das Produkt installiert wird.\n --win-help-url \n URL, unter der der Benutzer weitere Informationen oder technische Unterstützung erhält\n --win-menu\n Anforderung zum Hinzufügen einer Startmenüverknüpfung für diese Anwendung\n --win-menu-group \n Startmenügruppe, in der diese Anwendung abgelegt wird\n --win-per-user-install\n Anforderung zum Ausführen einer Installation pro Benutzer\n --win-shortcut\n Anforderung zum Hinzufügen einer Desktopverknüpfung für diese Anwendung\n --win-shortcut-prompt\n Fügt ein Dialogfeld hinzu, in dem der Benutzer auswählen kann, ob Verknüpfungen\n vom Installationsprogramm erstellt werden sollen.\n --win-update-url \n URL verfügbarer Anwendungsupdateinformationen\n --win-upgrade-uuid \n UUID, die mit Upgrades für dieses Package verknüpft ist\n diff --git a/src/jdk.jpackage/share/native/applauncher/JvmLauncher.cpp b/src/jdk.jpackage/share/native/applauncher/JvmLauncher.cpp index 5997b80fa5f..83f45c2cdfe 100644 --- a/src/jdk.jpackage/share/native/applauncher/JvmLauncher.cpp +++ b/src/jdk.jpackage/share/native/applauncher/JvmLauncher.cpp @@ -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 @@ -259,7 +259,8 @@ struct JliLaunchData { int initJvmlLauncherData(JvmlLauncherData* ptr) const { // Store path to JLI library just behind JvmlLauncherData header. - char* curPtr = reinterpret_cast(ptr + 1); + JvmlLauncherData dummy; + char* curPtr = reinterpret_cast((ptr ? ptr : &dummy) + 1); { const size_t count = sizeof(char) * (jliLibPath.size() + 1 /* trailing zero */); @@ -304,7 +305,7 @@ struct JliLaunchData { curPtr = copyStrings(envVarValues, ptr, offsetof(JvmlLauncherData, envVarValues), curPtr); - const size_t bufferSize = curPtr - reinterpret_cast(ptr); + const size_t bufferSize = curPtr - reinterpret_cast(ptr ? ptr : &dummy); if (ptr) { LOG_TRACE(tstrings::any() << "Initialized " << bufferSize << " bytes at " << ptr << " address"); diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties index 31a0ebeab24..b6561747ce0 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties @@ -57,6 +57,8 @@ error.unlock-resource=Aufheben der Sperre nicht erfolgreich: {0} error.read-wix-l10n-file=Datei {0} konnte nicht geparst werden error.extract-culture-from-wix-l10n-file=Kulturwert konnte nicht aus Datei {0} gelesen werden error.short-path-conv-fail=Kurze Version des Pfades "{0}" konnte nicht abgerufen werden +error.missing-service-installer=Serviceinstallationsprogramm "service-installer.exe" nicht im Ressourcenverzeichnis gefunden +error.missing-service-installer.advice=Fügen Sie das Serviceinstallationsprogramm "service-installer.exe" zum Ressourcenverzeichnis hinzu message.icon-not-ico=Das angegebene Symbol "{0}" ist keine ICO-Datei und wird nicht verwendet. Stattdessen wird das Standardsymbol verwendet. message.potential.windows.defender.issue=Warnung: Windows Defender verhindert eventuell die korrekte Ausführung von jpackage. Wenn ein Problem auftritt, deaktivieren Sie das Echtzeitmonitoring, oder fügen Sie einen Ausschluss für das Verzeichnis "{0}" hinzu. diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties index 57391db9087..5dbf0eaa058 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties @@ -57,6 +57,8 @@ error.unlock-resource=ロック解除に失敗しました: {0} error.read-wix-l10n-file={0}ファイルの解析に失敗しました error.extract-culture-from-wix-l10n-file={0}ファイルからのカルチャの値の読取りに失敗しました error.short-path-conv-fail="{0}"パスの短縮バージョンの取得に失敗しました +error.missing-service-installer=リソース・ディレクトリに'service-installer.exe'サービス・インストーラが見つかりません +error.missing-service-installer.advice=リソース・ディレクトリに'service-installer.exe'サービス・インストーラを追加します message.icon-not-ico=指定したアイコン"{0}"はICOファイルではなく、使用されません。デフォルト・アイコンがその位置に使用されます。 message.potential.windows.defender.issue=警告: Windows Defenderが原因でjpackageが機能しないことがあります。問題が発生した場合は、リアルタイム・モニタリングを無効にするか、ディレクトリ"{0}"の除外を追加することにより、問題に対処できます。 diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties index bd93fc5951e..2fb4e8e40e7 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties @@ -57,6 +57,8 @@ error.unlock-resource=无法解锁:{0} error.read-wix-l10n-file=无法解析 {0} 文件 error.extract-culture-from-wix-l10n-file=无法从 {0} 文件读取文化值 error.short-path-conv-fail=无法获取简短形式的 "{0}" 路径 +error.missing-service-installer=在资源目录中找不到 'service-installer.exe' 服务安装程序 +error.missing-service-installer.advice=将 'service-installer.exe' 服务安装程序添加到资源目录 message.icon-not-ico=指定的图标 "{0}" 不是 ICO 文件, 不会使用。将使用默认图标代替。 message.potential.windows.defender.issue=警告:Windows Defender 可能会阻止 jpackage 正常工作。如果存在问题,可以通过禁用实时监视或者为目录 "{0}" 添加排除项来解决。 diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties index 7554b380e5f..dbd4a5183c3 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties @@ -306,7 +306,7 @@ help.set.mode = Erstellt einen benutzerdefinierten Feedbackmodus (optional durch help.set.prompt.summary = Legt die Prompts fest -help.set.prompt = Legt die Prompts fest. Es müssen sowohl der normale als auch der Fortsetzungs-Prompt festgelegt werden:\n\n\t/set prompt "" ""\n\nZeigt den normalen und den Fortsetzungs-Prompt an:\n\n\t/set prompt []\n\nDabei gilt: ist der Name eines zuvor definierten Feedbackmodus.\n und sind in Anführungszeichen gesetzte Zeichenfolgen, die als Eingabe-Prompts ausgegeben werden.\nOptional können beide "%%s" enthalten. Dies wird durch die nächste Snippet-ID ersetzt.\nDer Eingabe wird unter Umständen keine ID zugewiesen, wenn es sich z.B. um einen Fehler oder Befehl handelt.\nDer Fortsetzungs-Prompt wird in einem mehrzeiligen Snippet in der zweiten und allen nachfolgenden Zeilen verwendet.\n\nBei fehlender Angabe von werden die aktuell festgelegten Prompts angezeigt.\nBei Angabe des werden nur die Prompts für diesen Modus angezeigt.\nBeispiel:\n\t/set prompt mymode\nZeigt die für den Modus "mymode" festgelegten Prompts an\n +help.set.prompt = Legt die Prompts fest. Es müssen sowohl der normale als auch der Fortsetzungs-Prompt festgelegt werden:\n\n\t/set prompt "" ""\n\nZeigt den normalen und den Fortsetzungs-Prompt an:\n\n\t/set prompt []\n\nDabei gilt: ist der Name eines zuvor definierten Feedbackmodus.\n und sind in Anführungszeichen gesetzte Zeichenfolgen, die als Eingabe-Prompts ausgegeben werden.\nOptional können beide "%s" enthalten. Dieses Element wird durch die nächste Snippet-ID ersetzt.\nDer Eingabe wird unter Umständen keine ID zugewiesen, wenn es sich z.B. um einen Fehler oder Befehl handelt.\nDer Fortsetzungs-Prompt wird in einem mehrzeiligen Snippet in der zweiten und allen nachfolgenden Zeilen verwendet.\n\nBei fehlender Angabe von werden die aktuell festgelegten Prompts angezeigt.\nBei Angabe des werden nur die Prompts für diesen Modus angezeigt.\nBeispiel:\n\t/set prompt mymode\nZeigt die für den Modus "mymode" festgelegten Prompts an\n help.set.editor.summary =Legt den mit dem /edit-Befehl zu startenden Befehl fest diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties index ab62e05ca8b..14a88c56b70 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties @@ -313,7 +313,7 @@ feedback'を使用します。\n\n'-retain'オプションが使用されてい help.set.prompt.summary = プロンプトを設定します -help.set.prompt = プロンプトを設定します。標準プロンプトと続行プロンプトの両方を設定する必要があります:\n\n\t/set prompt "" ""\n\n標準プロンプトと続行プロンプトを表示します:\n\n\t/set prompt []\n\nは事前に定義されたフィードバック・モードの名前です。\nおよびは入力プロンプトとして出力される引用符で囲まれた文字列です。\nオプションで、両方とも、次のスニペットIDで置き換えられる'%%s'を含むことができます --\n入力した内容がそのIDに割り当てられない場合があります。たとえば、エラーまたはコマンドである場合などです。\n続行プロンプトは複数行スニペットの2行目以降で使用されます。\n\nのない形式は、現在設定されているプロンプトを表示します。\nが指定されている場合、そのモードのプロンプトのみが表示されます。\n例:\n\t/set prompt mymode\nモードmymodeに設定されているプロンプトを表示します\n +help.set.prompt = プロンプトを設定します。標準プロンプトと続行プロンプトの両方を設定する必要があります:\n\n\t/set prompt "" ""\n\n標準プロンプトと続行プロンプトを表示します:\n\n\t/set prompt []\n\nは事前に定義されたフィードバック・モードの名前です。\nおよびは入力プロンプトとして出力される引用符で囲まれた文字列です。\nオプションで、両方とも、次のスニペットIDで置き換えられる'%s'を含むことができます --\n入力した内容がそのIDに割り当てられない場合があります。たとえば、エラーまたはコマンドである場合などです。\n続行プロンプトは複数行スニペットの2行目以降で使用されます。\n\nのない形式は、現在設定されているプロンプトを表示します。\nが指定されている場合、そのモードのプロンプトのみが表示されます。\n例:\n\t/set prompt mymode\nモードmymodeに設定されているプロンプトを表示します\n help.set.editor.summary =/editコマンドで起動するコマンドを指定します diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_zh_CN.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_zh_CN.properties index 6290f8c05fb..0bbc5d76404 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_zh_CN.properties +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_zh_CN.properties @@ -308,7 +308,7 @@ help.set.mode = 创建用户定义的反馈模式, 也可以选择从现有模 help.set.prompt.summary = 设置提示 -help.set.prompt = 设置提示。必须同时设置正常提示和更多提示:\n\n\t/set prompt <模式> "<提示>" "<更多提示>"\n\n显示正常提示和更多提示:\n\n\t/set prompt [<模式>]\n\n其中 <模式> 是以前定义的反馈模式名称。\n而 <提示> 和 <更多提示> 是作为输入提示输出的带引号的字符串;\n它们均可选择性地包含 '%%s',该变量将被替换为下一个片段 ID --\n请注意,可能无法向所输入内容分配该 ID,例如这可能是一个错误或命令。\n更多提示在多行片段的第二行以及后续行上使用。\n\n不带 <提示> 的格式显示当前设置的提示。\n指定 <模式> 时,将仅显示该模式的提示。\n示例:\n\t/set prompt mymode\n显示为模式 mymode 设置的提示\n +help.set.prompt = 设置提示。必须同时设置正常提示和更多提示:\n\n\t/set prompt <模式> "<提示>" "<更多提示>"\n\n显示正常提示和更多提示:\n\n\t/set prompt [<模式>]\n\n其中 <模式> 是以前定义的反馈模式名称。\n而 <提示> 和 <更多提示> 是作为输入提示输出的带引号的字符串。\n它们均可包含 '%s'(可选),该变量将被替换为下一个片段 ID --\n请注意,可能无法向所输入内容分配该 ID,例如这可能是一个错误或命令。\n更多提示在多行片段的第二行以及后续行中使用。\n\n不带 <提示> 的格式显示当前设置的提示。\n指定 <模式> 时,将仅显示该模式的提示。\n示例:\n\t/set prompt mymode\n显示为模式 mymode 设置的提示\n help.set.editor.summary =指定要为 /edit 命令启动的命令 diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java index fcf32ff42e7..82b0151d86c 100644 --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.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 @@ -36,6 +36,7 @@ * A timeout handler for jtreg, which gathers information about the timed out * process and its children. */ +@SuppressWarnings("restricted") public class GatherProcessInfoTimeoutHandler extends TimeoutHandler { private static final boolean HAS_NATIVE_LIBRARY; static { diff --git a/test/failure_handler/src/share/conf/mac.properties b/test/failure_handler/src/share/conf/mac.properties index 6a1c9fb4e77..e04b49e0fcf 100644 --- a/test/failure_handler/src/share/conf/mac.properties +++ b/test/failure_handler/src/share/conf/mac.properties @@ -89,8 +89,9 @@ environment=\ process.ps process.top \ memory.vmstat \ files \ - net.netstat.anv net.netstat.av net.netstat.aL net.netstat.m net.netstat.s \ + net.netstat.anv net.netstat.av net.netstat.aL net.netstat.m net.netstat.s net.netstat.g net.netstat.r \ net.ifconfig net.hostsfile \ + fw.up \ scutil.nwi scutil.proxy \ screenshot ################################################################################ @@ -132,6 +133,8 @@ net.netstat.anv.args=-anv net.netstat.aL.args=-aL net.netstat.m.args=-mm net.netstat.s.args=-s +net.netstat.g.args=-gs +net.netstat.r.args=-rn net.ifconfig.app=ifconfig net.ifconfig.args=-a @@ -144,4 +147,7 @@ scutil.proxy.args=--proxy screenshot.app=screencapture screenshot.args=-x screen1.png screen2.png screen3.png screen4.png screen5.png + +fw.app=/usr/libexec/ApplicationFirewall/socketfilterfw +fw.up.args=--getglobalstate ################################################################################ diff --git a/test/hotspot/gtest/memory/test_virtualspace.cpp b/test/hotspot/gtest/memory/test_virtualspace.cpp index 9414958b812..d3fed31da0b 100644 --- a/test/hotspot/gtest/memory/test_virtualspace.cpp +++ b/test/hotspot/gtest/memory/test_virtualspace.cpp @@ -544,7 +544,7 @@ class TestVirtualSpace : AllStatic { ReservedSpace reserved = reserve_memory(reserve_size_aligned, mode); - EXPECT_TRUE(reserved.is_reserved()); + ASSERT_TRUE(reserved.is_reserved()); VirtualSpace vs; bool initialized = initialize_virtual_space(vs, reserved, mode); @@ -564,9 +564,7 @@ class TestVirtualSpace : AllStatic { EXPECT_LT(vs.actual_committed_size(), commit_size + commit_granularity); } - if (reserved.is_reserved()) { - MemoryReserver::release(reserved); - } + MemoryReserver::release(reserved); } static void test_virtual_space_actual_committed_space_one_large_page() { @@ -580,7 +578,7 @@ class TestVirtualSpace : AllStatic { large_page_size, large_page_size); - EXPECT_TRUE(reserved.is_reserved()); + ASSERT_TRUE(reserved.is_reserved()); VirtualSpace vs; bool initialized = vs.initialize(reserved, 0); @@ -590,9 +588,7 @@ class TestVirtualSpace : AllStatic { EXPECT_EQ(vs.actual_committed_size(), large_page_size); - if (reserved.is_reserved()) { - MemoryReserver::release(reserved); - } + MemoryReserver::release(reserved); } static void test_virtual_space_actual_committed_space() { diff --git a/test/hotspot/jtreg/compiler/c2/TestReduceAllocationAndPointerComparisons.java b/test/hotspot/jtreg/compiler/c2/TestReduceAllocationAndPointerComparisons.java new file mode 100644 index 00000000000..0cd4fbc0d12 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/TestReduceAllocationAndPointerComparisons.java @@ -0,0 +1,64 @@ +/* + * 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 8347718 + * @summary Check that Reduce Allocation Merges correctly handle "NE" pointer comparisons. + * @requires vm.flagless & vm.compiler2.enabled & vm.opt.final.EliminateAllocations + * @run main/othervm -XX:CompileCommand=compileonly,*TestReduceAllocationAndPointerComparisons*::* + * -XX:CompileCommand=dontinline,*TestReduceAllocationAndPointerComparisons*::* + * -XX:-TieredCompilation -Xcomp -server + * compiler.c2.TestReduceAllocationAndPointerComparisons + * @run main compiler.c2.TestReduceAllocationAndPointerComparisons + */ + +package compiler.c2; + +public class TestReduceAllocationAndPointerComparisons { + public static void main(String[] args) { + for (int i=0; i<50000; i++) { + if (test(true) == false) { + throw new RuntimeException("Unexpected result."); + } + } + } + + public static boolean test(boolean b) { + MyClass obj = new MyClass(); + + for (int i = 0; i < 100_000; ++i) { } + + obj = b ? obj : new MyClass(); + obj = b ? obj : new MyClass(); + + if (obj == null) { + return false; + } + + return b; + } + + static class MyClass { + } +} diff --git a/test/hotspot/jtreg/compiler/ciReplay/InliningBase.java b/test/hotspot/jtreg/compiler/ciReplay/InliningBase.java index e3ec7527123..fbe2e89a45d 100644 --- a/test/hotspot/jtreg/compiler/ciReplay/InliningBase.java +++ b/test/hotspot/jtreg/compiler/ciReplay/InliningBase.java @@ -86,31 +86,31 @@ public InlineEntry(String klass, String method, String reason) { } public boolean isNormalInline() { - return reason.equals("inline (hot)"); + return reason.startsWith("inline (hot)"); } public boolean isForcedByReplay() { - return reason.equals("force inline by ciReplay"); + return reason.startsWith("force inline by ciReplay"); } public boolean isDisallowedByReplay() { - return reason.equals("failed to inline: disallowed by ciReplay"); + return reason.startsWith("failed to inline: disallowed by ciReplay"); } public boolean isUnloadedSignatureClasses() { - return reason.equals("failed to inline: unloaded signature classes"); + return reason.startsWith("failed to inline: unloaded signature classes"); } public boolean isForcedIncrementalInlineByReplay() { - return reason.equals("force (incremental) inline by ciReplay"); + return reason.startsWith("force (incremental) inline by ciReplay"); } public boolean isForcedInline() { - return reason.equals("force inline by annotation"); + return reason.startsWith("force inline by annotation"); } public boolean isTooDeep() { - return reason.equals("failed to inline: inlining too deep"); + return reason.startsWith("failed to inline: inlining too deep"); } @Override diff --git a/test/hotspot/jtreg/compiler/inlining/LateInlinePrinting.java b/test/hotspot/jtreg/compiler/inlining/LateInlinePrinting.java new file mode 100644 index 00000000000..09ed466f299 --- /dev/null +++ b/test/hotspot/jtreg/compiler/inlining/LateInlinePrinting.java @@ -0,0 +1,101 @@ +/* + * 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 + * 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 8319850 + * @summary PrintInlining should print which methods are late inlines + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @requires vm.flagless + * + * @run driver compiler.inlining.LateInlinePrinting + */ + +package compiler.inlining; + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class LateInlinePrinting { + public static class TestLateInlining { + public static void main(String[] args) { + for (int i = 0; i < 20_000; i++) { + test1(); + test2(); + } + } + + private static void test1() { + test3(); + testFailInline(); + testFailInline(); + test2(); + } + + private static void test2() { + inlined1(); + inlined2(); + } + + private static void test3() {} + + private static void testFailInline() {} + + private static void inlined1() {} + + private static void inlined2() {} + } + + + public static void main(String[] args) throws Exception { + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( + "-XX:-TieredCompilation", "-XX:-UseOnStackReplacement", "-XX:-BackgroundCompilation", + "-XX:+PrintCompilation", + "-XX:CompileCommand=compileonly,compiler.inlining.LateInlinePrinting$TestLateInlining::test1", + "-XX:CompileCommand=compileonly,compiler.inlining.LateInlinePrinting$TestLateInlining::test2", + "-XX:CompileCommand=quiet", "-XX:+PrintInlining", "-XX:+AlwaysIncrementalInline", + "-XX:CompileCommand=dontinline,compiler.inlining.LateInlinePrinting$TestLateInlining::testFailInline", + TestLateInlining.class.getName() + ); + + OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); + analyzer.shouldHaveExitValue(0); + + analyzer.shouldContain(""" +compiler.inlining.LateInlinePrinting$TestLateInlining::test2 (7 bytes) + @ 0 compiler.inlining.LateInlinePrinting$TestLateInlining::inlined1 (1 bytes) inline (hot) late inline succeeded + @ 3 compiler.inlining.LateInlinePrinting$TestLateInlining::inlined2 (1 bytes) inline (hot) late inline succeeded + """); + analyzer.shouldContain(""" +compiler.inlining.LateInlinePrinting$TestLateInlining::test1 (13 bytes) + @ 0 compiler.inlining.LateInlinePrinting$TestLateInlining::test3 (1 bytes) inline (hot) late inline succeeded + @ 3 compiler.inlining.LateInlinePrinting$TestLateInlining::testFailInline (1 bytes) failed to inline: disallowed by CompileCommand + @ 6 compiler.inlining.LateInlinePrinting$TestLateInlining::testFailInline (1 bytes) failed to inline: disallowed by CompileCommand + @ 9 compiler.inlining.LateInlinePrinting$TestLateInlining::test2 (7 bytes) inline (hot) late inline succeeded + @ 0 compiler.inlining.LateInlinePrinting$TestLateInlining::inlined1 (1 bytes) inline (hot) late inline succeeded + @ 3 compiler.inlining.LateInlinePrinting$TestLateInlining::inlined2 (1 bytes) inline (hot) late inline succeeded + """); + } +} diff --git a/test/hotspot/jtreg/compiler/inlining/TestDuplicatedLateInliningOutput.java b/test/hotspot/jtreg/compiler/inlining/TestDuplicatedLateInliningOutput.java index 2b967968ea2..ebc5a827ea4 100644 --- a/test/hotspot/jtreg/compiler/inlining/TestDuplicatedLateInliningOutput.java +++ b/test/hotspot/jtreg/compiler/inlining/TestDuplicatedLateInliningOutput.java @@ -45,12 +45,12 @@ public class TestDuplicatedLateInliningOutput { public static void main(String[] args) throws Exception { test( NonConstantReceiverLauncher.class, - "@ (\\d+)\\s+java\\.lang\\.invoke\\.LambdaForm\\$DMH\\/0x[0-9a-f]+::invokeStatic \\(\\d+ bytes\\)\\s+force inline by annotation", + "@ (\\d+)\\s+java\\.lang\\.invoke\\.MethodHandle::invokeBasic\\(\\)V \\(\\d+ bytes\\)\\s+failed to inline: receiver not constant\\s+callee changed to\\s+java\\.lang\\.invoke\\.LambdaForm\\$DMH\\/0x[0-9a-f]+::invokeStatic \\(\\d+ bytes\\)\\s+force inline by annotation\\s+late inline succeeded \\(method handle\\)", "@ (\\d+)\\s+java\\.lang\\.invoke\\.MethodHandle::invokeBasic\\(\\)V \\(\\d+ bytes\\)\\s+failed to inline: receiver not constant"); test( VirtualCallLauncher.class, - "@ (\\d+)\\s+compiler\\.inlining\\.TestDuplicatedLateInliningOutput\\$VirtualCallLauncher\\$B::lateInlined2 \\(\\d+ bytes\\)\\s+inline \\(hot\\)", + "@ (\\d+)\\s+compiler\\.inlining\\.TestDuplicatedLateInliningOutput\\$VirtualCallLauncher\\$A::lateInlined2 \\(\\d+ bytes\\)\\s+failed to inline: virtual call\\s+callee changed to\\s+\\s+compiler\\.inlining\\.TestDuplicatedLateInliningOutput\\$VirtualCallLauncher\\$B::lateInlined2 \\(\\d+ bytes\\)\\s+inline \\(hot\\)\\s+late inline succeeded", "@ (\\d+)\\s+compiler\\.inlining\\.TestDuplicatedLateInliningOutput\\$VirtualCallLauncher\\$A::lateInlined2 \\(\\d+ bytes\\)\\s+failed to inline: virtual call" ); } @@ -75,7 +75,7 @@ private static void test(Class launcher, String pattern1, String pattern2) th int index = IntStream.range(0, lines.size()) .filter(i -> lines.get(i).trim().matches(pattern1)) .findFirst() - .orElseThrow(() -> new Exception("No inlining found")); + .orElseThrow(() -> new Exception("No inlining found" + pattern1)); if (lines.get(index - 1).trim().matches(pattern2)) { throw new Exception("Both failure and success message found"); diff --git a/test/hotspot/jtreg/compiler/intrinsics/TestArrayGuardWithInterfaces.java b/test/hotspot/jtreg/compiler/intrinsics/TestArrayGuardWithInterfaces.java new file mode 100644 index 00000000000..b9c26222c16 --- /dev/null +++ b/test/hotspot/jtreg/compiler/intrinsics/TestArrayGuardWithInterfaces.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. + */ + +import java.lang.reflect.Array; +import jdk.test.lib.Asserts; + +/** + * @test + * @bug 8348631 + * @summary Test folding of array guards used by intrinsics. + * @library /test/lib + * @run main/othervm -Xcomp -XX:-TieredCompilation + * -XX:CompileCommand=compileonly,TestArrayGuardWithInterfaces::test* + * TestArrayGuardWithInterfaces + */ +public class TestArrayGuardWithInterfaces { + + public static interface MyInterface { } + + public static int test1(Object obj) { + // Should be folded, arrays can never imlement 'MyInterface' + return Array.getLength((MyInterface)obj); + } + + public static int test2(Object obj) { + // Should not be folded, arrays implement 'Cloneable' + return Array.getLength((Cloneable)obj); + } + + public static void main(String[] args) { + // Warmup + Class c = MyInterface.class; + Array.getLength(args); + + try { + test1(null); + throw new RuntimeException("No exception thrown"); + } catch (Exception e) { + // Expected + } + Asserts.assertEQ(test2(new int[1]), 1); + } +} diff --git a/test/hotspot/jtreg/compiler/intrinsics/TestContinuationPinningAndEA.java b/test/hotspot/jtreg/compiler/intrinsics/TestContinuationPinningAndEA.java new file mode 100644 index 00000000000..e2ce8312eb3 --- /dev/null +++ b/test/hotspot/jtreg/compiler/intrinsics/TestContinuationPinningAndEA.java @@ -0,0 +1,77 @@ +/* + * 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 8347997 + * @summary Test that Continuation.pin() and unpin() intrinsics work with EA. + * @modules java.base/jdk.internal.vm + * @run main TestContinuationPinningAndEA + */ + +import jdk.internal.vm.Continuation; + +public class TestContinuationPinningAndEA { + + static class FailsEA { + final Object o; + + public FailsEA() throws Throwable { + o = new Object(); + Continuation.pin(); + Continuation.unpin(); + } + } + + static class Crashes { + final Object o; + + public Crashes() throws Throwable { + Continuation.pin(); + Continuation.unpin(); + o = new Object(); + } + } + + static void test_FailsEA() throws Throwable { + for (int i = 0; i < 10_000; ++i) { + new FailsEA(); + } + } + + static void test_Crashes() throws Throwable { + for (int i = 0; i < 10_000; ++i) { + new Crashes(); + } + } + + public static void main(String[] args) throws Throwable { + int iterations = 100; + for (int i = 0; i < iterations; ++i) { + test_FailsEA(); + } + for (int i = 0; i < iterations; ++i) { + test_Crashes(); + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/README.md b/test/hotspot/jtreg/compiler/lib/ir_framework/README.md index c807a2651b6..6bdae262599 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/README.md +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/README.md @@ -178,6 +178,7 @@ The framework provides various stress and debug flags. They should mainly be use - `-DVerbose=true`: Enable more fain-grained logging (slows the execution down). - `-DReproduce=true`: Flag to use when directly running a test VM to bypass dependencies to the driver VM state (for example, when reproducing an issue). - `-DPrintTimes=true`: Print the execution time measurements of each executed test. +- `-DPrintRuleMatchingTime=true`: Print the time of matching IR rules per method. Slows down the execution as the rules are warmed up before meassurement. - `-DVerifyVM=true`: The framework runs the test VM with additional verification flags (slows the execution down). - `-DExcluceRandom=true`: The framework randomly excludes some methods from compilation. IR verification is disabled completely with this flag. - `-DFlipC1C2=true`: The framework compiles all `@Test` annotated method with C1 if a C2 compilation would have been applied and vice versa. IR verification is disabled completely with this flag. diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java b/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java index caef911f73a..889bd39413b 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.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 @@ -148,6 +148,7 @@ public class TestFramework { ); public static final boolean VERBOSE = Boolean.getBoolean("Verbose"); + public static final boolean PRINT_RULE_MATCHING_TIME = Boolean.getBoolean("PrintRuleMatchingTime"); public static final boolean TESTLIST = !System.getProperty("Test", "").isEmpty(); public static final boolean EXCLUDELIST = !System.getProperty("Exclude", "").isEmpty(); private static final boolean REPORT_STDOUT = Boolean.getBoolean("ReportStdout"); diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/IRMethod.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/IRMethod.java index dbd431d22e0..714af5c6519 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/IRMethod.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/IRMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, 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 @@ -39,6 +39,8 @@ import java.util.ArrayList; import java.util.List; +import static compiler.lib.ir_framework.TestFramework.PRINT_RULE_MATCHING_TIME; + /** * This class represents a {@link Test @Test} annotated method that has an associated non-empty list of applicable * {@link IR @IR} rules. @@ -83,6 +85,20 @@ public String name() { */ @Override public MatchResult match() { - return new IRMethodMatchResult(method, matcher.match()); + if (!PRINT_RULE_MATCHING_TIME) { + return new IRMethodMatchResult(method, matcher.match()); + } + + List match; + for (int i = 0; i < 10; i++) { // warm up + match = matcher.match(); + } + + long startTime = System.nanoTime(); + match = matcher.match(); + long endTime = System.nanoTime(); + long duration = (endTime - startTime); + System.out.println("Verifying IR rules for " + name() + ": " + duration + " ns = " + (duration / 1000000) + " ms"); + return new IRMethodMatchResult(method, match); } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java index c59f432f5ff..7f7aa3f5b32 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java @@ -43,6 +43,7 @@ public class TestFrameworkSocket implements AutoCloseable { public static final String STDOUT_PREFIX = "[STDOUT]"; public static final String TESTLIST_TAG = "[TESTLIST]"; public static final String DEFAULT_REGEX_TAG = "[DEFAULT_REGEX]"; + public static final String PRINT_TIMES_TAG = "[PRINT_TIMES]"; // Static fields used for test VM only. private static final String SERVER_PORT_PROPERTY = "ir.framework.server.port"; @@ -123,6 +124,12 @@ public static void write(String msg, String tag) { /** * Only called by test VM to write to server socket. + *

        + * The test VM is spawned by the main jtreg VM. The stdout of the test VM is hidden + * unless the Verbose or ReportStdout flag is used. TestFrameworkSocket is used by the parent jtreg + * VM and the test VM to communicate. By sending the prints through the TestFrameworkSocket with the + * parameter stdout set to true, the parent VM will print the received messages to its stdout, making it + * visible to the user. */ public static void write(String msg, String tag, boolean stdout) { if (REPRODUCE) { diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java index 4e601ec9739..e4f49d494d2 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.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 @@ -38,6 +38,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import static compiler.lib.ir_framework.shared.TestFrameworkSocket.PRINT_TIMES_TAG; + /** * This class' main method is called from {@link TestFramework} and represents the so-called "test VM". The class is * the heart of the framework and is responsible for executing all the specified tests in the test class. It uses the @@ -883,9 +885,10 @@ private void runTests() { // Print execution times if (VERBOSE || PRINT_TIMES) { - System.out.println(System.lineSeparator() + System.lineSeparator() + "Test execution times:"); + TestFrameworkSocket.write("Test execution times:", PRINT_TIMES_TAG, true); for (Map.Entry entry : durations.entrySet()) { - System.out.format("%-10s%15d ns%n", entry.getValue() + ":", entry.getKey()); + TestFrameworkSocket.write(String.format("%-25s%15d ns%n", entry.getValue() + ":", entry.getKey()), + PRINT_TIMES_TAG, true); } } diff --git a/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java b/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java index 5ecc01aa2bc..a60354ec2fc 100644 --- a/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java +++ b/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java @@ -23,6 +23,8 @@ package java.lang; +import jdk.internal.util.DecimalDigits; + /** * A helper class to get access to package-private members */ @@ -117,11 +119,17 @@ public static int codePointCountSB(byte[] val, int beginIndex, int endIndex) { } public static int getChars(int i, int begin, int end, byte[] value) { - return StringUTF16.getChars(i, begin, end, value); + StringUTF16.checkBoundsBeginEnd(begin, end, value); + int pos = DecimalDigits.getCharsUTF16(i, end, value); + assert begin == pos; + return pos; } public static int getChars(long l, int begin, int end, byte[] value) { - return StringUTF16.getChars(l, begin, end, value); + StringUTF16.checkBoundsBeginEnd(begin, end, value); + int pos = DecimalDigits.getCharsUTF16(l, end, value); + assert begin == pos; + return pos; } public static boolean contentEquals(byte[] v1, byte[] v2, int len) { diff --git a/test/hotspot/jtreg/runtime/Safepoint/TestAbortOnVMOperationTimeout.java b/test/hotspot/jtreg/runtime/Safepoint/TestAbortOnVMOperationTimeout.java index a2c3f944db8..d14c9627314 100644 --- a/test/hotspot/jtreg/runtime/Safepoint/TestAbortOnVMOperationTimeout.java +++ b/test/hotspot/jtreg/runtime/Safepoint/TestAbortOnVMOperationTimeout.java @@ -68,6 +68,7 @@ public static void testWith(int delay, boolean shouldPass) throws Exception { "-XX:+AbortVMOnVMOperationTimeout", "-XX:AbortVMOnVMOperationTimeoutDelay=" + delay, "-Xmx256m", + "-XX:NewSize=64m", "-XX:+UseSerialGC", "-XX:-CreateCoredumpOnCrash", "-Xlog:gc*=info", diff --git a/test/hotspot/jtreg/runtime/cds/appcds/AOTFlags.java b/test/hotspot/jtreg/runtime/cds/appcds/AOTFlags.java index 3a678eefc5b..98ff155abfa 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/AOTFlags.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/AOTFlags.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 @@ -59,7 +59,7 @@ static void positiveTests() throws Exception { out.shouldContain("Hello World"); out.shouldHaveExitValue(0); - // (2) Assembly Phase + // (2) Assembly Phase (AOTClassLinking unspecified -> should be enabled by default) pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:AOTMode=create", "-XX:AOTConfiguration=" + aotConfigFile, @@ -77,6 +77,7 @@ static void positiveTests() throws Exception { "-Xlog:cds", "-cp", appJar, helloClass); out = CDSTestUtils.executeAndLog(pb, "prod"); + out.shouldContain("Using AOT-linked classes: true (static archive: has aot-linked classes)"); out.shouldContain("Opened archive hello.aot."); out.shouldContain("Hello World"); out.shouldHaveExitValue(0); @@ -107,7 +108,7 @@ static void positiveTests() throws Exception { out.shouldContain("Hello World"); out.shouldHaveExitValue(0); - // (5) AOTMode=on + // (6) AOTMode=on pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:AOTCache=" + aotCacheFile, "--show-version", @@ -119,6 +120,30 @@ static void positiveTests() throws Exception { out.shouldContain("Opened archive hello.aot."); out.shouldContain("Hello World"); out.shouldHaveExitValue(0); + + // (7) Assembly Phase with -XX:-AOTClassLinking + pb = ProcessTools.createLimitedTestJavaProcessBuilder( + "-XX:AOTMode=create", + "-XX:-AOTClassLinking", + "-XX:AOTConfiguration=" + aotConfigFile, + "-XX:AOTCache=" + aotCacheFile, + "-Xlog:cds", + "-cp", appJar); + out = CDSTestUtils.executeAndLog(pb, "asm"); + out.shouldContain("Dumping shared data to file:"); + out.shouldMatch("cds.*hello[.]aot"); + out.shouldHaveExitValue(0); + + // (8) Production Run with AOTCache, which was created with -XX:-AOTClassLinking + pb = ProcessTools.createLimitedTestJavaProcessBuilder( + "-XX:AOTCache=" + aotCacheFile, + "-Xlog:cds", + "-cp", appJar, helloClass); + out = CDSTestUtils.executeAndLog(pb, "prod"); + out.shouldContain("Using AOT-linked classes: false (static archive: no aot-linked classes)"); + out.shouldContain("Opened archive hello.aot."); + out.shouldContain("Hello World"); + out.shouldHaveExitValue(0); } static void negativeTests() throws Exception { diff --git a/test/hotspot/jtreg/runtime/cds/appcds/customLoader/ClassListFormatE.java b/test/hotspot/jtreg/runtime/cds/appcds/customLoader/ClassListFormatE.java index b5386c54afb..2beb39d0b39 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/customLoader/ClassListFormatE.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/customLoader/ClassListFormatE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, 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 @@ -49,14 +49,15 @@ public static void main(String[] args) throws Throwable { //---------------------------------------------------------------------- // TESTGROUP E: super class and interfaces //---------------------------------------------------------------------- - dumpShouldFail( + dumpShouldPass( "TESTCASE E1: missing interfaces: keyword", appJar, classlist( "Hello", "java/lang/Object id: 1", "CustomLoadee2 id: 1 super: 1 source: " + customJarPath ), - "Class CustomLoadee2 implements the interface CustomInterface2_ia, but no interface has been specified in the input line"); + "java.lang.NoClassDefFoundError: CustomInterface2_ia", + "Cannot find CustomLoadee2"); dumpShouldFail( "TESTCASE E2: missing one interface", @@ -67,7 +68,7 @@ appJar, classlist( "CustomInterface2_ib id: 3 super: 1 source: " + customJarPath, "CustomLoadee2 id: 4 super: 1 interfaces: 2 source: " + customJarPath ), - "The interface CustomInterface2_ib implemented by class CustomLoadee2 does not match any of the specified interface IDs"); + "The number of interfaces (1) specified in class list does not match the class file (2)"); dumpShouldFail( "TESTCASE E3: specifying an interface that's not implemented by the class", @@ -101,5 +102,15 @@ appJar, classlist( "CustomLoadee2 id: 5 super: 4 interfaces: 2 3 source: " + customJarPath ), "The specified super class CustomLoadee (id 4) does not match actual super class java.lang.Object"); + + dumpShouldPass( + "TESTCASE E6: JAR file doesn't exist", + appJar, classlist( + "Hello", + "java/lang/Object id: 1", + "NoSuchClass id: 2 super: 1 source: no_such_file.jar" + ), + "Cannot find NoSuchClass", + "java.io.IOException: No such file: no_such_file.jar"); } } diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 43d050d4e9c..c9051def927 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -1,6 +1,6 @@ ########################################################################### # -# Copyright (c) 2009, 2024, 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 @@ -636,8 +636,6 @@ sun/security/smartcardio/TestTransmit.java 8039280 generic- com/sun/security/sasl/gsskerb/AuthOnly.java 8039280 generic-all com/sun/security/sasl/gsskerb/ConfSecurityLayer.java 8039280 generic-all com/sun/security/sasl/gsskerb/NoSecurityLayer.java 8039280 generic-all -sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java 8039280 generic-all -sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8316183 linux-ppc64le @@ -799,7 +797,7 @@ java/awt/image/VolatileImage/VolatileImageConfigurationTest.java 8171069 macosx- 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/print/PrinterJob/PrintTextTest.java 8148334 macosx-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/TEST.ROOT b/test/jdk/TEST.ROOT index 1b08167ff34..db48d501707 100644 --- a/test/jdk/TEST.ROOT +++ b/test/jdk/TEST.ROOT @@ -47,7 +47,7 @@ # tests which require two displays connected. keys=headful sound printer multimon \ - i18n intermittent randomness jfr cgroups + i18n intermittent randomness cgroups # Tests that must run in othervm mode othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/swing javax/print \ diff --git a/test/jdk/java/awt/List/ItemEventTest/ItemEventTest.java b/test/jdk/java/awt/List/ItemEventTest/ItemEventTest.java index c5d45379905..ea0f339c92b 100644 --- a/test/jdk/java/awt/List/ItemEventTest/ItemEventTest.java +++ b/test/jdk/java/awt/List/ItemEventTest/ItemEventTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 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,8 +27,13 @@ * @bug 8033936 8172510 * @summary Verify that correct ItemEvent is received while selection & * deselection of multi select List items. + * @library /test/lib + * @build jdk.test.lib.Platform + * @run main ItemEventTest */ +// Pass -save to the test to enable screenshots at each select/deselect + import java.awt.AWTException; import java.awt.Event; import java.awt.FlowLayout; @@ -37,26 +42,30 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Robot; -import java.awt.event.KeyEvent; import java.awt.event.InputEvent; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - -public class ItemEventTest extends Frame -{ - List list; - final String expectedSelectionOrder; - StringBuilder actualSelectionOrder; - Robot robot; - - public ItemEventTest() - { - try { - robot = new Robot(); - } catch(AWTException e) { - throw new RuntimeException(e.getMessage()); - } - expectedSelectionOrder = "01230123"; +import java.awt.event.KeyEvent; +import java.awt.image.RenderedImage; +import java.io.File; +import java.io.IOException; + +import javax.imageio.ImageIO; + +import jdk.test.lib.Platform; + +public final class ItemEventTest extends Frame { + private static final String expectedSelectionOrder = "01230123"; + + private static boolean saveScreenshots; + + private final StringBuffer actualSelectionOrder + = new StringBuffer(expectedSelectionOrder.length()); + + private final List list; + private final Robot robot; + + private ItemEventTest() throws AWTException { + robot = new Robot(); + robot.setAutoWaitForIdle(true); list = new List(4, true); list.add("0"); @@ -65,71 +74,76 @@ public ItemEventTest() list.add("3"); add(list); + setSize(400,400); setLayout(new FlowLayout()); pack(); + setLocationRelativeTo(null); setVisible(true); robot.waitForIdle(); } @Override + @SuppressWarnings("deprecation") public boolean handleEvent(Event e) { - if (e.target instanceof List) { - if (e.id == Event.LIST_DESELECT || e.id == Event.LIST_SELECT) { - actualSelectionOrder.append(e.arg); - } + if ((e.target instanceof List) + && (e.id == Event.LIST_DESELECT + || e.id == Event.LIST_SELECT)) { + logEvent("handleEvent: ", e.arg); } return true; } - void testHandleEvent() { + private void logEvent(String method, Object listItem) { + actualSelectionOrder.append(listItem); + System.out.println(method + listItem); + } + + private void testHandleEvent() { // When no ItemListener is added to List, parent's handleEvent is // called with ItemEvent. performTest(); } - void testItemListener() { - list.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent ie) { - actualSelectionOrder.append(ie.getItem()); - } - }); + private void testItemListener() { + list.addItemListener(ie + -> logEvent("testItemListener: ", ie.getItem())); performTest(); } - void performTest() { - actualSelectionOrder = new StringBuilder(); - Point loc = list.getLocationOnScreen(); - Rectangle rect = list.getBounds(); - int dY = rect.height / list.getItemCount(); - loc = new Point(loc.x + 10, loc.y + 5); + private void performTest() { + actualSelectionOrder.setLength(0); + + final Rectangle rect = getListBoundsOnScreen(); + final int dY = rect.height / list.getItemCount(); + final Point loc = new Point(rect.x + rect.width / 2, + rect.y + dY / 2); - String osName = System.getProperty("os.name"); - boolean isMac = osName.contains("Mac") || osName.contains("mac"); - if(isMac) { + if (Platform.isOSX()) { robot.keyPress(KeyEvent.VK_META); - robot.waitForIdle(); } // First loop to select & Second loop to deselect the list items. for (int j = 0; j < 2; ++j) { for (int i = 0; i < list.getItemCount(); ++i) { robot.mouseMove(loc.x, loc.y + i * dY); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.waitForIdle(); - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.waitForIdle(); - robot.mouseRelease(InputEvent.BUTTON1_MASK); - robot.waitForIdle(); + + if (saveScreenshots) { + saveImage(robot.createScreenCapture(rect)); + } } } - if(isMac) { + if (Platform.isOSX()) { robot.keyRelease(KeyEvent.VK_META); } - if (!expectedSelectionOrder.equals(actualSelectionOrder.toString())) { - dispose(); + if (!expectedSelectionOrder.contentEquals(actualSelectionOrder)) { + saveImage(robot.createScreenCapture(rect)); + throw new RuntimeException("ItemEvent for selection & deselection" + " of multi select List's item is not correct" + " Expected : " + expectedSelectionOrder @@ -137,10 +151,32 @@ void performTest() { } } - public static void main(String args[]) { - ItemEventTest test = new ItemEventTest(); - test.testHandleEvent(); - test.testItemListener(); - test.dispose(); + private Rectangle getListBoundsOnScreen() { + return new Rectangle(list.getLocationOnScreen(), + list.getSize()); + } + + private static int imageNo = 0; + + private static void saveImage(RenderedImage image) { + try { + ImageIO.write(image, + "png", + new File(String.format("image-%02d.png", + ++imageNo))); + } catch (IOException ignored) { + } + } + + public static void main(String[] args) throws AWTException { + saveScreenshots = args.length > 0 && "-save".equals(args[0]); + + ItemEventTest test = new ItemEventTest(); + try { + test.testHandleEvent(); + test.testItemListener(); + } finally { + test.dispose(); + } } } diff --git a/test/jdk/java/awt/print/PrinterJob/PrintTextTest.java b/test/jdk/java/awt/print/PrinterJob/PrintTextTest.java index f2ec4e15a8a..7fb1167a847 100644 --- a/test/jdk/java/awt/print/PrinterJob/PrintTextTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PrintTextTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 6425068 7157659 8132890 + * @bug 6425068 7157659 8029204 8132890 8148334 8344637 * @key printer * @summary Confirm that text prints where we expect to the length we expect. * @library /java/awt/regtesthelpers diff --git a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java index 1426b97e3ca..95d925d7b3d 100644 --- a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java +++ b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -359,7 +359,7 @@ public enum Position {HORIZONTAL, VERTICAL, TOP_LEFT_CORNER} * the default values of {@value #ROWS} and {@value #COLUMNS} * for rows and columns. *

        - * See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for + * See {@link #PassFailJFrame(String,String,long,int,int)} for * more details. * * @param instructions the instructions for the tester @@ -382,7 +382,7 @@ public PassFailJFrame(String instructions) * and the default values of {@value #ROWS} and {@value #COLUMNS} * for rows and columns. *

        - * See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for + * See {@link #PassFailJFrame(String,String,long,int,int)} for * more details. * * @param instructions the instructions for the tester @@ -404,9 +404,8 @@ public PassFailJFrame(String instructions, long testTimeOut) * with the given title, instructions and timeout as well as * the default values of {@value #ROWS} and {@value #COLUMNS} * for rows and columns. - * The screenshot feature is not enabled, if you use this constructor. *

        - * See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for + * See {@link #PassFailJFrame(String,String,long,int,int)} for * more details. * * @param title the title of the instruction frame @@ -424,41 +423,11 @@ public PassFailJFrame(String title, String instructions, this(title, instructions, testTimeOut, ROWS, COLUMNS); } - /** - * Constructs a frame which displays test instructions and - * the Pass / Fail buttons - * with the given title, instructions, timeout, number of rows and columns. - * The screenshot feature is not enabled, if you use this constructor. - *

        - * See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for - * more details. - * - * @param title the title of the instruction frame - * @param instructions the instructions for the tester - * @param testTimeOut the test timeout in minutes - * @param rows the number of rows for the text component - * which displays test instructions - * @param columns the number of columns for the text component - * which displays test instructions - * - * @throws InterruptedException if the current thread is interrupted - * while waiting for EDT to finish creating UI components - * @throws InvocationTargetException if an exception is thrown while - * creating UI components on EDT - */ - public PassFailJFrame(String title, String instructions, - long testTimeOut, - int rows, int columns) - throws InterruptedException, InvocationTargetException { - this(title, instructions, testTimeOut, rows, columns, false); - } - /** * Constructs a frame which displays test instructions and * the Pass / Fail buttons * as well as supporting UI components with the given title, instructions, - * timeout, number of rows and columns, - * and screen capture functionality. + * timeout, number of rows and columns. * All the UI components are created on the EDT, so it is safe to call * the constructor on the main thread. *

        @@ -483,12 +452,6 @@ public PassFailJFrame(String title, String instructions, * the size of a text component which displays the instructions. * The preferred size of the instructions is calculated by * creating {@code new JTextArea(rows, columns)}. - *

        - * If you enable screenshots by setting the {@code screenCapture} - * parameter to {@code true}, a Screenshot button is added. - * Clicking the Screenshot button takes screenshots of - * all the monitors or all the windows registered with - * {@code PassFailJFrame}. * * @param title the title of the instruction frame * @param instructions the instructions for the tester @@ -497,8 +460,6 @@ public PassFailJFrame(String title, String instructions, * which displays test instructions * @param columns the number of columns for the text component * which displays test instructions - * @param screenCapture if set to {@code true}, enables screen capture - * functionality * * @throws InterruptedException if the current thread is interrupted * while waiting for EDT to finish creating UI components @@ -510,13 +471,11 @@ public PassFailJFrame(String title, String instructions, */ public PassFailJFrame(String title, String instructions, long testTimeOut, - int rows, int columns, - boolean screenCapture) + int rows, int columns) throws InterruptedException, InvocationTargetException { invokeOnEDT(() -> createUI(title, instructions, testTimeOut, - rows, columns, - screenCapture)); + rows, columns)); } /** @@ -613,8 +572,7 @@ private static void invokeOnEDTUncheckedException(Runnable doRun) { } private static void createUI(String title, String instructions, - long testTimeOut, int rows, int columns, - boolean enableScreenCapture) { + long testTimeOut, int rows, int columns) { frame = new JFrame(title); frame.setLayout(new BorderLayout()); @@ -623,7 +581,7 @@ private static void createUI(String title, String instructions, frame.add(createInstructionUIPanel(instructions, testTimeOut, rows, columns, - enableScreenCapture, + false, false, 0), BorderLayout.CENTER); frame.pack(); diff --git a/test/jdk/java/foreign/TestBufferStack.java b/test/jdk/java/foreign/TestBufferStack.java new file mode 100644 index 00000000000..bf1ada8854c --- /dev/null +++ b/test/jdk/java/foreign/TestBufferStack.java @@ -0,0 +1,157 @@ +/* + * 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 + * @modules java.base/jdk.internal.foreign.abi + * @build NativeTestHelper TestBufferStack + * @run testng/othervm --enable-native-access=ALL-UNNAMED TestBufferStack + */ + +import jdk.internal.foreign.abi.BufferStack; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.MemoryLayout; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.SegmentAllocator; +import java.lang.invoke.MethodHandle; +import java.time.Duration; +import java.util.Arrays; +import java.util.stream.IntStream; + +import static java.lang.foreign.MemoryLayout.structLayout; +import static java.lang.foreign.ValueLayout.*; +import static java.time.temporal.ChronoUnit.SECONDS; + +public class TestBufferStack extends NativeTestHelper { + @Test + public void testScopedAllocation() { + int stackSize = 128; + BufferStack stack = new BufferStack(stackSize); + MemorySegment stackSegment; + try (Arena frame1 = stack.pushFrame(3 * JAVA_INT.byteSize(), JAVA_INT.byteAlignment())) { + // Segments have expected sizes and are accessible and allocated consecutively in the same scope. + MemorySegment segment11 = frame1.allocate(JAVA_INT); + Assert.assertEquals(segment11.scope(), frame1.scope()); + Assert.assertEquals(segment11.byteSize(), JAVA_INT.byteSize()); + segment11.set(JAVA_INT, 0, 1); + stackSegment = segment11.reinterpret(stackSize); + + MemorySegment segment12 = frame1.allocate(JAVA_INT); + Assert.assertEquals(segment12.address(), segment11.address() + JAVA_INT.byteSize()); + Assert.assertEquals(segment12.byteSize(), JAVA_INT.byteSize()); + Assert.assertEquals(segment12.scope(), frame1.scope()); + segment12.set(JAVA_INT, 0, 1); + + MemorySegment segment2; + try (Arena frame2 = stack.pushFrame(JAVA_LONG.byteSize(), JAVA_LONG.byteAlignment())) { + Assert.assertNotEquals(frame2.scope(), frame1.scope()); + // same here, but a new scope. + segment2 = frame2.allocate(JAVA_LONG); + Assert.assertEquals(segment2.address(), segment12.address() + /*segment12 size + frame 1 spare + alignment constraint*/ 3 * JAVA_INT.byteSize()); + Assert.assertEquals(segment2.byteSize(), JAVA_LONG.byteSize()); + Assert.assertEquals(segment2.scope(), frame2.scope()); + segment2.set(JAVA_LONG, 0, 1); + + // Frames must be closed in stack order. + Assert.assertThrows(IllegalStateException.class, frame1::close); + } + // Scope is closed here, inner segments throw. + Assert.assertThrows(IllegalStateException.class, () -> segment2.get(JAVA_INT, 0)); + // A new stack frame allocates at the same location (but different scope) as the previous did. + try (Arena frame3 = stack.pushFrame(2 * JAVA_INT.byteSize(), JAVA_INT.byteAlignment())) { + MemorySegment segment3 = frame3.allocate(JAVA_INT); + Assert.assertEquals(segment3.scope(), frame3.scope()); + Assert.assertEquals(segment3.address(), segment12.address() + 2 * JAVA_INT.byteSize()); + } + + // Fallback arena behaves like regular stack frame. + MemorySegment outOfStack; + try (Arena hugeFrame = stack.pushFrame(1024, 4)) { + outOfStack = hugeFrame.allocate(4); + Assert.assertEquals(outOfStack.scope(), hugeFrame.scope()); + Assert.assertTrue(outOfStack.asOverlappingSlice(stackSegment).isEmpty()); + } + Assert.assertThrows(IllegalStateException.class, () -> outOfStack.get(JAVA_INT, 0)); + + // Outer segments are still accessible. + segment11.get(JAVA_INT, 0); + segment12.get(JAVA_INT, 0); + } + } + + @Test + public void stress() throws InterruptedException { + BufferStack stack = new BufferStack(256); + Thread[] vThreads = IntStream.range(0, 1024).mapToObj(_ -> + Thread.ofVirtual().start(() -> { + long threadId = Thread.currentThread().threadId(); + while (!Thread.interrupted()) { + for (int i = 0; i < 1_000_000; i++) { + try (Arena arena = stack.pushFrame(JAVA_LONG.byteSize(), JAVA_LONG.byteAlignment())) { + // Try to assert no two vThreads get allocated the same stack space. + MemorySegment segment = arena.allocate(JAVA_LONG); + JAVA_LONG.varHandle().setVolatile(segment, 0L, threadId); + Assert.assertEquals(threadId, (long) JAVA_LONG.varHandle().getVolatile(segment, 0L)); + } + } + Thread.yield(); // make sure the driver thread gets a chance. + } + })).toArray(Thread[]::new); + Thread.sleep(Duration.of(10, SECONDS)); + Arrays.stream(vThreads).forEach( + thread -> { + Assert.assertTrue(thread.isAlive()); + thread.interrupt(); + }); + } + + static { + System.loadLibrary("TestBufferStack"); + } + + private static final MemoryLayout HVAPoint3D = structLayout(NativeTestHelper.C_DOUBLE, C_DOUBLE, C_DOUBLE); + private static final MemorySegment UPCALL_MH = upcallStub(TestBufferStack.class, "recurse", FunctionDescriptor.of(HVAPoint3D, C_INT)); + private static final MethodHandle DOWNCALL_MH = downcallHandle("recurse", FunctionDescriptor.of(HVAPoint3D, C_INT, ADDRESS)); + + public static MemorySegment recurse(int depth) { + try { + return (MemorySegment) DOWNCALL_MH.invokeExact((SegmentAllocator) Arena.ofAuto(), depth, UPCALL_MH); + } catch (Throwable e) { + throw new RuntimeException(e); + } + } + + @Test + public void testDeepStack() throws Throwable { + // Each downcall and upcall require 48 bytes of stack. + // After five allocations we start falling back. + MemorySegment point = recurse(10); + Assert.assertEquals(point.getAtIndex(C_DOUBLE, 0), 12.0); + Assert.assertEquals(point.getAtIndex(C_DOUBLE, 1), 11.0); + Assert.assertEquals(point.getAtIndex(C_DOUBLE, 2), 10.0); + } +} diff --git a/test/jdk/java/foreign/libTestBufferStack.c b/test/jdk/java/foreign/libTestBufferStack.c new file mode 100644 index 00000000000..79eb32bf933 --- /dev/null +++ b/test/jdk/java/foreign/libTestBufferStack.c @@ -0,0 +1,39 @@ +/* + * 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 "export.h" + +typedef struct { double x, y, z; } HVAPoint3D; + +EXPORT HVAPoint3D recurse(int depth, HVAPoint3D (*cb)(int)) { + if (depth == 0) { + HVAPoint3D result = { 2, 1, 0}; + return result; + } + + HVAPoint3D result = cb(depth - 1); + result.x += 1; + result.y += 1; + result.z += 1; + return result; +} diff --git a/test/jdk/java/lang/module/ConfigurationTest.java b/test/jdk/java/lang/module/ConfigurationTest.java index da64f955fd6..b32d49ffb06 100644 --- a/test/jdk/java/lang/module/ConfigurationTest.java +++ b/test/jdk/java/lang/module/ConfigurationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, 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 @@ -23,13 +23,14 @@ /** * @test + * @bug 8142968 8299504 * @modules java.base/jdk.internal.access * java.base/jdk.internal.module * @library /test/lib * @build ConfigurationTest * jdk.test.lib.util.ModuleInfoWriter * jdk.test.lib.util.ModuleUtils - * @run testng ConfigurationTest + * @run junit ConfigurationTest * @summary Basic tests for java.lang.module.Configuration */ @@ -47,18 +48,20 @@ import java.nio.file.Paths; import java.util.List; import java.util.Set; +import java.util.stream.Stream; +import jdk.internal.access.SharedSecrets; +import jdk.internal.module.ModuleTarget; import jdk.test.lib.util.ModuleInfoWriter; import jdk.test.lib.util.ModuleUtils; -import jdk.internal.access.SharedSecrets; -import jdk.internal.module.ModuleTarget; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import static org.testng.Assert.*; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.CsvSource; +import static org.junit.jupiter.api.Assertions.*; -@Test -public class ConfigurationTest { +class ConfigurationTest { /** * Creates a "non-strict" builder for building a module. This allows the @@ -73,7 +76,8 @@ private static ModuleDescriptor.Builder newBuilder(String mn) { * Basic test of resolver * m1 requires m2, m2 requires m3 */ - public void testBasic() { + @Test + void testBasic() { ModuleDescriptor descriptor1 = newBuilder("m1") .requires("m2") .build(); @@ -125,7 +129,8 @@ public void testBasic() { * Basic test of "requires transitive": * m1 requires m2, m2 requires transitive m3 */ - public void testRequiresTransitive1() { + @Test + void testRequiresTransitive1() { // m1 requires m2, m2 requires transitive m3 ModuleDescriptor descriptor1 = newBuilder("m1") .requires("m2") @@ -177,7 +182,8 @@ public void testRequiresTransitive1() { * - Configuration cf1: m1, m2 requires transitive m1 * - Configuration cf2: m3 requires m2 */ - public void testRequiresTransitive2() { + @Test + void testRequiresTransitive2() { // cf1: m1 and m2, m2 requires transitive m1 @@ -238,7 +244,8 @@ public void testRequiresTransitive2() { * - Configuration cf1: m1 * - Configuration cf2: m2 requires transitive m1, m3 requires m2 */ - public void testRequiresTransitive3() { + @Test + void testRequiresTransitive3() { // cf1: m1 @@ -300,7 +307,8 @@ public void testRequiresTransitive3() { * - Configuration cf2: m2 requires transitive m1 * - Configuraiton cf3: m3 requires m2 */ - public void testRequiresTransitive4() { + @Test + void testRequiresTransitive4() { // cf1: m1 @@ -375,7 +383,8 @@ public void testRequiresTransitive4() { * - Configuration cf1: m1, m2 requires transitive m1 * - Configuration cf2: m3 requires transitive m2, m4 requires m3 */ - public void testRequiresTransitive5() { + @Test + void testRequiresTransitive5() { // cf1: m1, m2 requires transitive m1 @@ -452,7 +461,8 @@ public void testRequiresTransitive5() { * m2 is not observable * resolve m1 */ - public void testRequiresStatic1() { + @Test + void testRequiresStatic1() { ModuleDescriptor descriptor1 = newBuilder("m1") .requires(Set.of(Requires.Modifier.STATIC), "m2") .build(); @@ -474,7 +484,8 @@ public void testRequiresStatic1() { * m2 * resolve m1 */ - public void testRequiresStatic2() { + @Test + void testRequiresStatic2() { ModuleDescriptor descriptor1 = newBuilder("m1") .requires(Set.of(Requires.Modifier.STATIC), "m2") .build(); @@ -499,7 +510,8 @@ public void testRequiresStatic2() { * m2 * resolve m1, m2 */ - public void testRequiresStatic3() { + @Test + void testRequiresStatic3() { ModuleDescriptor descriptor1 = newBuilder("m1") .requires(Set.of(Requires.Modifier.STATIC), "m2") .build(); @@ -529,7 +541,8 @@ public void testRequiresStatic3() { * m2 requires static m2 * m3 */ - public void testRequiresStatic4() { + @Test + void testRequiresStatic4() { ModuleDescriptor descriptor1 = newBuilder("m1") .requires("m2") .requires("m3") @@ -570,7 +583,8 @@ public void testRequiresStatic4() { * - Configuration cf1: m1, m2 * - Configuration cf2: m3 requires m1, requires static m2 */ - public void testRequiresStatic5() { + @Test + void testRequiresStatic5() { ModuleDescriptor descriptor1 = newBuilder("m1") .build(); @@ -613,7 +627,8 @@ public void testRequiresStatic5() { * - Configuration cf1: m1 * - Configuration cf2: m3 requires m1, requires static m2 */ - public void testRequiresStatic6() { + @Test + void testRequiresStatic6() { ModuleDescriptor descriptor1 = newBuilder("m1") .build(); @@ -650,7 +665,8 @@ public void testRequiresStatic6() { * m2 requires transitive static m1 * m3 requires m2 */ - public void testRequiresStatic7() { + @Test + void testRequiresStatic7() { ModuleDescriptor descriptor1 = null; // not observable ModuleDescriptor descriptor2 = newBuilder("m2") @@ -683,7 +699,8 @@ public void testRequiresStatic7() { * - Configuration cf1: m2 requires transitive static m1 * - Configuration cf2: m3 requires m2 */ - public void testRequiresStatic8() { + @Test + void testRequiresStatic8() { ModuleDescriptor descriptor1 = null; // not observable ModuleDescriptor descriptor2 = newBuilder("m2") @@ -722,8 +739,8 @@ public void testRequiresStatic8() { * m1 uses p.S * m2 provides p.S */ - public void testServiceBinding1() { - + @Test + void testServiceBinding1() { ModuleDescriptor descriptor1 = newBuilder("m1") .exports("p") .uses("p.S") @@ -762,8 +779,8 @@ public void testServiceBinding1() { * m2 provides p.S1, m2 uses p.S2 * m3 provides p.S2 */ - public void testServiceBinding2() { - + @Test + void testServiceBinding2() { ModuleDescriptor descriptor1 = newBuilder("m1") .exports("p") .uses("p.S1") @@ -816,8 +833,8 @@ public void testServiceBinding2() { * - Configuration cf1: m1 uses p.S * - Configuration cf2: m2 provides p.S */ - public void testServiceBindingWithConfigurations1() { - + @Test + void testServiceBindingWithConfigurations1() { ModuleDescriptor descriptor1 = newBuilder("m1") .exports("p") .uses("p.S") @@ -862,8 +879,8 @@ public void testServiceBindingWithConfigurations1() { * - Configuration cf2: m3 provides p.S * m4 provides p.S */ - public void testServiceBindingWithConfigurations2() { - + @Test + void testServiceBindingWithConfigurations2() { ModuleDescriptor descriptor1 = newBuilder("m1") .exports("p") .uses("p.S") @@ -930,8 +947,8 @@ public void testServiceBindingWithConfigurations2() { * Test configuration cf2: m1 uses p.S, p@2.0 provides p.S * Test configuration cf2: m1 uses p.S */ - public void testServiceBindingWithConfigurations3() { - + @Test + void testServiceBindingWithConfigurations3() { ModuleDescriptor service = newBuilder("s") .exports("p") .build(); @@ -952,7 +969,7 @@ public void testServiceBindingWithConfigurations3() { // p@1.0 in cf1 ResolvedModule p = cf1.findModule("p").get(); - assertEquals(p.reference().descriptor(), provider_v1); + assertEquals(provider_v1, p.reference().descriptor()); ModuleDescriptor descriptor1 = newBuilder("m1") @@ -980,7 +997,7 @@ public void testServiceBindingWithConfigurations3() { // p should be found in cf2 p = cf2.findModule("p").get(); assertTrue(p.configuration() == cf2); - assertEquals(p.reference().descriptor(), provider_v2); + assertEquals(provider_v2, p.reference().descriptor()); // finder2 is the after ModuleFinder and so p@2.0 should not be located @@ -995,7 +1012,7 @@ public void testServiceBindingWithConfigurations3() { // p should be found in cf1 p = cf2.findModule("p").get(); assertTrue(p.configuration() == cf1); - assertEquals(p.reference().descriptor(), provider_v1); + assertEquals(provider_v1, p.reference().descriptor()); } @@ -1004,8 +1021,8 @@ public void testServiceBindingWithConfigurations3() { * * Module m2 can be found by both the before and after finders. */ - public void testWithTwoFinders1() { - + @Test + void testWithTwoFinders1() { ModuleDescriptor descriptor1 = newBuilder("m1") .requires("m2") .build(); @@ -1030,8 +1047,8 @@ public void testWithTwoFinders1() { ResolvedModule m1 = cf.findModule("m1").get(); ResolvedModule m2 = cf.findModule("m2").get(); - assertEquals(m1.reference().descriptor(), descriptor1); - assertEquals(m2.reference().descriptor(), descriptor2_v1); + assertEquals(descriptor1, m1.reference().descriptor()); + assertEquals(descriptor2_v1, m2.reference().descriptor()); } @@ -1041,8 +1058,8 @@ public void testWithTwoFinders1() { * The before and after ModuleFinders both locate a service provider module * named "m2" that provide implementations of the same service type. */ - public void testWithTwoFinders2() { - + @Test + void testWithTwoFinders2() { ModuleDescriptor descriptor1 = newBuilder("m1") .exports("p") .uses("p.S") @@ -1070,8 +1087,8 @@ public void testWithTwoFinders2() { ResolvedModule m1 = cf.findModule("m1").get(); ResolvedModule m2 = cf.findModule("m2").get(); - assertEquals(m1.reference().descriptor(), descriptor1); - assertEquals(m2.reference().descriptor(), descriptor2_v1); + assertEquals(descriptor1, m1.reference().descriptor()); + assertEquals(descriptor2_v1, m2.reference().descriptor()); } @@ -1079,8 +1096,8 @@ public void testWithTwoFinders2() { * Basic test for resolving a module that is located in the parent * configuration. */ - public void testResolvedInParent1() { - + @Test + void testResolvedInParent1() { ModuleDescriptor descriptor1 = newBuilder("m1") .build(); @@ -1101,8 +1118,8 @@ public void testResolvedInParent1() { * Basic test for resolving a module that has a dependency on a module * in the parent configuration. */ - public void testResolvedInParent2() { - + @Test + void testResolvedInParent2() { ModuleDescriptor descriptor1 = newBuilder("m1").build(); ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1); @@ -1142,12 +1159,12 @@ public void testResolvedInParent2() { * - Configuration cf2: m2 * - Configuration cf3(cf1,cf2): m3 requires m1, m2 */ - public void testResolvedInMultipleParents1() { - + @Test + void testResolvedInMultipleParents1() { // Configuration cf1: m1 ModuleDescriptor descriptor1 = newBuilder("m1").build(); Configuration cf1 = resolve(ModuleUtils.finderOf(descriptor1), "m1"); - assertEquals(cf1.parents(), List.of(Configuration.empty())); + assertEquals(List.of(Configuration.empty()), cf1.parents()); assertTrue(cf1.findModule("m1").isPresent()); ResolvedModule m1 = cf1.findModule("m1").get(); assertTrue(m1.configuration() == cf1); @@ -1155,7 +1172,7 @@ public void testResolvedInMultipleParents1() { // Configuration cf2: m2 ModuleDescriptor descriptor2 = newBuilder("m2").build(); Configuration cf2 = resolve(ModuleUtils.finderOf(descriptor2), "m2"); - assertEquals(cf2.parents(), List.of(Configuration.empty())); + assertEquals(List.of(Configuration.empty()), cf2.parents()); assertTrue(cf2.findModule("m2").isPresent()); ResolvedModule m2 = cf2.findModule("m2").get(); assertTrue(m2.configuration() == cf2); @@ -1171,7 +1188,7 @@ public void testResolvedInMultipleParents1() { List.of(cf1, cf2), // parents ModuleFinder.of(), Set.of("m3")); - assertEquals(cf3.parents(), List.of(cf1, cf2)); + assertEquals(List.of(cf1, cf2), cf3.parents()); assertTrue(cf3.findModule("m3").isPresent()); ResolvedModule m3 = cf3.findModule("m3").get(); assertTrue(m3.configuration() == cf3); @@ -1179,7 +1196,7 @@ public void testResolvedInMultipleParents1() { // check readability assertTrue(m1.reads().isEmpty()); assertTrue(m2.reads().isEmpty()); - assertEquals(m3.reads(), Set.of(m1, m2)); + assertEquals(Set.of(m1, m2), m3.reads()); } @@ -1193,11 +1210,12 @@ public void testResolvedInMultipleParents1() { * - Configuration cf3(cf3): m3 requires m1 * - Configuration cf4(cf2,cf3): m4 requires m1,m2,m3 */ - public void testResolvedInMultipleParents2() { + @Test + void testResolvedInMultipleParents2() { // Configuration cf1: m1 ModuleDescriptor descriptor1 = newBuilder("m1").build(); Configuration cf1 = resolve(ModuleUtils.finderOf(descriptor1), "m1"); - assertEquals(cf1.parents(), List.of(Configuration.empty())); + assertEquals( List.of(Configuration.empty()), cf1.parents()); assertTrue(cf1.findModule("m1").isPresent()); ResolvedModule m1 = cf1.findModule("m1").get(); assertTrue(m1.configuration() == cf1); @@ -1211,7 +1229,7 @@ public void testResolvedInMultipleParents2() { List.of(cf1), // parents ModuleFinder.of(), Set.of("m2")); - assertEquals(cf2.parents(), List.of(cf1)); + assertEquals(List.of(cf1), cf2.parents()); assertTrue(cf2.findModule("m2").isPresent()); ResolvedModule m2 = cf2.findModule("m2").get(); assertTrue(m2.configuration() == cf2); @@ -1225,7 +1243,7 @@ public void testResolvedInMultipleParents2() { List.of(cf1), // parents ModuleFinder.of(), Set.of("m3")); - assertEquals(cf3.parents(), List.of(cf1)); + assertEquals(List.of(cf1), cf3.parents()); assertTrue(cf3.findModule("m3").isPresent()); ResolvedModule m3 = cf3.findModule("m3").get(); assertTrue(m3.configuration() == cf3); @@ -1241,16 +1259,16 @@ public void testResolvedInMultipleParents2() { List.of(cf2, cf3), // parents ModuleFinder.of(), Set.of("m4")); - assertEquals(cf4.parents(), List.of(cf2, cf3)); + assertEquals(List.of(cf2, cf3), cf4.parents()); assertTrue(cf4.findModule("m4").isPresent()); ResolvedModule m4 = cf4.findModule("m4").get(); assertTrue(m4.configuration() == cf4); // check readability assertTrue(m1.reads().isEmpty()); - assertEquals(m2.reads(), Set.of(m1)); - assertEquals(m3.reads(), Set.of(m1)); - assertEquals(m4.reads(), Set.of(m1, m2, m3)); + assertEquals(Set.of(m1), m2.reads()); + assertEquals(Set.of(m1), m3.reads()); + assertEquals(Set.of(m1, m2, m3), m4.reads()); } @@ -1264,13 +1282,14 @@ public void testResolvedInMultipleParents2() { * - Configuration cf3: m1@3, m2@3, m3@3 * - Configuration cf4(cf1,cf2,cf3): m4 requires m1,m2,m3 */ - public void testResolvedInMultipleParents3() { + @Test + void testResolvedInMultipleParents3() { ModuleDescriptor descriptor1, descriptor2, descriptor3; // Configuration cf1: m1@1 descriptor1 = newBuilder("m1").version("1").build(); Configuration cf1 = resolve(ModuleUtils.finderOf(descriptor1), "m1"); - assertEquals(cf1.parents(), List.of(Configuration.empty())); + assertEquals(List.of(Configuration.empty()), cf1.parents()); // Configuration cf2: m1@2, m2@2 descriptor1 = newBuilder("m1").version("2").build(); @@ -1278,7 +1297,7 @@ public void testResolvedInMultipleParents3() { Configuration cf2 = resolve( ModuleUtils.finderOf(descriptor1, descriptor2), "m1", "m2"); - assertEquals(cf2.parents(), List.of(Configuration.empty())); + assertEquals(List.of(Configuration.empty()), cf2.parents()); // Configuration cf3: m1@3, m2@3, m3@3 descriptor1 = newBuilder("m1").version("3").build(); @@ -1287,7 +1306,7 @@ public void testResolvedInMultipleParents3() { Configuration cf3 = resolve( ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3), "m1", "m2", "m3"); - assertEquals(cf3.parents(), List.of(Configuration.empty())); + assertEquals(List.of(Configuration.empty()), cf3.parents()); // Configuration cf4(cf1,cf2,cf3): m4 requires m1,m2,m3 ModuleDescriptor descriptor4 = newBuilder("m4") @@ -1300,7 +1319,7 @@ public void testResolvedInMultipleParents3() { List.of(cf1, cf2, cf3), // parents ModuleFinder.of(), Set.of("m4")); - assertEquals(cf4.parents(), List.of(cf1, cf2, cf3)); + assertEquals(List.of(cf1, cf2, cf3), cf4.parents()); assertTrue(cf1.findModule("m1").isPresent()); assertTrue(cf2.findModule("m1").isPresent()); @@ -1333,7 +1352,7 @@ public void testResolvedInMultipleParents3() { assertTrue(m1_3.reads().isEmpty()); assertTrue(m2_3.reads().isEmpty()); assertTrue(m3_3.reads().isEmpty()); - assertEquals(m4.reads(), Set.of(m1_1, m2_2, m3_3)); + assertEquals(Set.of(m1_1, m2_2, m3_3), m4.reads()); } @@ -1341,7 +1360,8 @@ public void testResolvedInMultipleParents3() { * Basic test of using the beforeFinder to override a module in a parent * configuration. */ - public void testOverriding1() { + @Test + void testOverriding1() { ModuleDescriptor descriptor1 = newBuilder("m1").build(); ModuleFinder finder = ModuleUtils.finderOf(descriptor1); @@ -1359,7 +1379,8 @@ public void testOverriding1() { * Basic test of using the beforeFinder to override a module in a parent * configuration. */ - public void testOverriding2() { + @Test + void testOverriding2() { ModuleDescriptor descriptor1 = newBuilder("m1").build(); Configuration cf1 = resolve(ModuleUtils.finderOf(descriptor1), "m1"); assertTrue(cf1.modules().size() == 1); @@ -1398,8 +1419,8 @@ public void testOverriding2() { * - Configuration cf1: m1, m2 requires transitive m1 * - Configuration cf2: m1, m3 requires m2 */ - public void testOverriding3() { - + @Test + void testOverriding3() { ModuleDescriptor descriptor1 = newBuilder("m1") .build(); @@ -1452,40 +1473,40 @@ public void testOverriding3() { /** * Root module not found */ - @Test(expectedExceptions = { FindException.class }) - public void testRootNotFound() { - resolve(ModuleFinder.of(), "m1"); + @Test + void testRootNotFound() { + assertThrows(FindException.class, () -> resolve(ModuleFinder.of(), "m1")); } /** * Direct dependency not found */ - @Test(expectedExceptions = { FindException.class }) - public void testDirectDependencyNotFound() { + @Test + void testDirectDependencyNotFound() { ModuleDescriptor descriptor1 = newBuilder("m1").requires("m2").build(); ModuleFinder finder = ModuleUtils.finderOf(descriptor1); - resolve(finder, "m1"); + assertThrows(FindException.class, () -> resolve(finder, "m1")); } /** * Transitive dependency not found */ - @Test(expectedExceptions = { FindException.class }) - public void testTransitiveDependencyNotFound() { + @Test + void testTransitiveDependencyNotFound() { ModuleDescriptor descriptor1 = newBuilder("m1").requires("m2").build(); ModuleDescriptor descriptor2 = newBuilder("m2").requires("m3").build(); ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); - resolve(finder, "m1"); + assertThrows(FindException.class, () -> resolve(finder, "m1")); } /** * Service provider dependency not found */ - @Test(expectedExceptions = { FindException.class }) - public void testServiceProviderDependencyNotFound() { + @Test + void testServiceProviderDependencyNotFound() { // service provider dependency (on m3) not found @@ -1503,29 +1524,27 @@ public void testServiceProviderDependencyNotFound() { ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); // should throw ResolutionException because m3 is not found - Configuration cf = resolveAndBind(finder, "m1"); + assertThrows(FindException.class, () -> resolveAndBind(finder, "m1")); } /** * Simple cycle. */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testSimpleCycle() { + @Test + void testSimpleCycle() { ModuleDescriptor descriptor1 = newBuilder("m1").requires("m2").build(); ModuleDescriptor descriptor2 = newBuilder("m2").requires("m3").build(); ModuleDescriptor descriptor3 = newBuilder("m3").requires("m1").build(); - ModuleFinder finder - = ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3); - resolve(finder, "m1"); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3); + assertThrows(ResolutionException.class, () -> resolve(finder, "m1")); } /** * Basic test for detecting cycles involving a service provider module */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testCycleInProvider() { - + @Test + void testCycleInProvider() { ModuleDescriptor descriptor1 = newBuilder("m1") .exports("p") .uses("p.S") @@ -1543,7 +1562,7 @@ public void testCycleInProvider() { = ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3); // should throw ResolutionException because of the m2 <--> m3 cycle - resolveAndBind(finder, "m1"); + assertThrows(ResolutionException.class, () -> resolveAndBind(finder, "m1")); } @@ -1554,8 +1573,8 @@ public void testCycleInProvider() { * - Configuration cf1: m1, m2 requires transitive m1 * - Configuration cf2: m1 requires m2 */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testReadModuleWithSameNameAsSelf() { + @Test + void testReadModuleWithSameNameAsSelf() { ModuleDescriptor descriptor1_v1 = newBuilder("m1") .build(); @@ -1573,7 +1592,7 @@ public void testReadModuleWithSameNameAsSelf() { // resolve should throw ResolutionException ModuleFinder finder2 = ModuleUtils.finderOf(descriptor1_v2); - resolve(cf1, finder2, "m1"); + assertThrows(ResolutionException.class, () -> resolve(cf1, finder2, "m1")); } @@ -1585,8 +1604,8 @@ public void testReadModuleWithSameNameAsSelf() { * - Configuration cf2: m1, m3 requires transitive m1 * - Configuration cf3(cf1,cf2): m4 requires m2, m3 */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testReadTwoModuleWithSameName() { + @Test + void testReadTwoModuleWithSameName() { ModuleDescriptor descriptor1 = newBuilder("m1") .build(); @@ -1613,16 +1632,19 @@ public void testReadTwoModuleWithSameName() { // should throw ResolutionException as m4 will read modules named "m1". ModuleFinder finder3 = ModuleUtils.finderOf(descriptor4); - Configuration.resolve(finder3, List.of(cf1, cf2), ModuleFinder.of(), Set.of("m4")); + assertThrows(ResolutionException.class, + () -> Configuration.resolve(finder3, + List.of(cf1, cf2), + ModuleFinder.of(), + Set.of("m4"))); } /** * Test two modules exporting package p to a module that reads both. */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testPackageSuppliedByTwoOthers() { - + @Test + void testPackageSuppliedByTwoOthers() { ModuleDescriptor descriptor1 = newBuilder("m1") .requires("m2") .requires("m3") @@ -1640,7 +1662,7 @@ public void testPackageSuppliedByTwoOthers() { = ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3); // m2 and m3 export package p to module m1 - resolve(finder, "m1"); + assertThrows(ResolutionException.class, () -> resolve(finder, "m1")); } @@ -1648,9 +1670,8 @@ public void testPackageSuppliedByTwoOthers() { * Test the scenario where a module contains a package p and reads * a module that exports package p. */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testPackageSuppliedBySelfAndOther() { - + @Test + void testPackageSuppliedBySelfAndOther() { ModuleDescriptor descriptor1 = newBuilder("m1") .requires("m2") .packages(Set.of("p")) @@ -1663,7 +1684,7 @@ public void testPackageSuppliedBySelfAndOther() { ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); // m1 contains package p, module m2 exports package p to m1 - resolve(finder, "m1"); + assertThrows(ResolutionException.class, () -> resolve(finder, "m1")); } @@ -1671,7 +1692,8 @@ public void testPackageSuppliedBySelfAndOther() { * Test the scenario where a module contains a package p and reads * a module that also contains a package p. */ - public void testContainsPackageInSelfAndOther() { + @Test + void testContainsPackageInSelfAndOther() { ModuleDescriptor descriptor1 = newBuilder("m1") .requires("m2") .packages(Set.of("p")) @@ -1702,8 +1724,8 @@ public void testContainsPackageInSelfAndOther() { * Test the scenario where a module that exports a package that is also * exported by a module that it reads in a parent layer. */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testExportSamePackageAsBootLayer() { + @Test + void testExportSamePackageAsBootLayer() { ModuleDescriptor descriptor = newBuilder("m1") .requires("java.base") .exports("java.lang") @@ -1714,14 +1736,15 @@ public void testExportSamePackageAsBootLayer() { Configuration bootConfiguration = ModuleLayer.boot().configuration(); // m1 contains package java.lang, java.base exports package java.lang to m1 - resolve(bootConfiguration, finder, "m1"); + assertThrows(ResolutionException.class, () -> resolve(bootConfiguration, finder, "m1")); } /** * Test "uses p.S" where p is contained in the same module. */ - public void testContainsService1() { + @Test + void testContainsService1() { ModuleDescriptor descriptor1 = newBuilder("m1") .packages(Set.of("p")) .uses("p.S") @@ -1739,8 +1762,8 @@ public void testContainsService1() { /** * Test "uses p.S" where p is contained in a different module. */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testContainsService2() { + @Test + void testContainsService2() { ModuleDescriptor descriptor1 = newBuilder("m1") .packages(Set.of("p")) .build(); @@ -1753,14 +1776,15 @@ public void testContainsService2() { ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); // m2 does not read a module that exports p - resolve(finder, "m2"); + assertThrows(ResolutionException.class, () -> resolve(finder, "m2")); } /** * Test "provides p.S" where p is contained in the same module. */ - public void testContainsService3() { + @Test + void testContainsService3() { ModuleDescriptor descriptor1 = newBuilder("m1") .packages(Set.of("p", "q")) .provides("p.S", List.of("q.S1")) @@ -1778,8 +1802,8 @@ public void testContainsService3() { /** * Test "provides p.S" where p is contained in a different module. */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testContainsService4() { + @Test + void testContainsService4() { ModuleDescriptor descriptor1 = newBuilder("m1") .packages(Set.of("p")) .build(); @@ -1792,46 +1816,182 @@ public void testContainsService4() { ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); // m2 does not read a module that exports p - resolve(finder, "m2"); + assertThrows(ResolutionException.class, () -> resolve(finder, "m2")); } + /** + * Test uses optional service. + * + * module m1 { requires static m2; uses p.S; } + */ + @Test + void testUsesOptionalService1() { + ModuleDescriptor descriptor1 = newBuilder("m1") + .requires(Set.of(Requires.Modifier.STATIC), "m2") + .uses("p.S") + .build(); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1); + Configuration cf = resolve(finder, "m1"); + assertTrue(cf.modules().size() == 1); + assertTrue(cf.findModule("m1").isPresent()); + } /** - * Test "uses p.S" where p is not exported to the module. + * Test uses optional service. + * + * module m1 { requires m2; uses p.S; } + * module m2 { requires static transitive m3; } + */ + @Test + void testUsesOptionalService2() { + ModuleDescriptor descriptor1 = newBuilder("m1") + .requires("m2") + .uses("p.S") + .build(); + ModuleDescriptor descriptor2 = newBuilder("m2") + .requires(Set.of(Requires.Modifier.STATIC, Requires.Modifier.TRANSITIVE), "m3") + .build(); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); + Configuration cf = resolve(finder, "m1"); + assertTrue(cf.modules().size() == 2); + assertTrue(cf.findModule("m1").isPresent()); + assertTrue(cf.findModule("m2").isPresent()); + } + + /** + * Test uses optional service. + * + * module m1 { requires m2; uses p.S; } + * module m2 { requires transitive m3; } + * module m3 { requires static transitive m4; } */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testServiceTypePackageNotExported1() { + @Test + void testUsesOptionalService3() { ModuleDescriptor descriptor1 = newBuilder("m1") + .requires("m2") .uses("p.S") .build(); + ModuleDescriptor descriptor2 = newBuilder("m2") + .requires(Set.of(Requires.Modifier.TRANSITIVE), "m3") + .build(); + ModuleDescriptor descriptor3 = newBuilder("m3") + .requires(Set.of(Requires.Modifier.STATIC, Requires.Modifier.TRANSITIVE), "m4") + .build(); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3); + Configuration cf = resolve(finder, "m1"); + assertTrue(cf.modules().size() == 3); + assertTrue(cf.findModule("m1").isPresent()); + assertTrue(cf.findModule("m2").isPresent()); + assertTrue(cf.findModule("m3").isPresent()); + } + /** + * Test provides optional service. + * + * module m1 { requires static m2; provides p.S with q.P; } + */ + @Test + void testProvidesOptionalService1() { + ModuleDescriptor descriptor1 = newBuilder("m1") + .requires(Set.of(Requires.Modifier.STATIC), "m2") + .provides("p.S", List.of("q.P")) + .build(); ModuleFinder finder = ModuleUtils.finderOf(descriptor1); - - // m1 does not read a module that exports p - resolve(finder, "m1"); + Configuration cf = resolve(finder, "m1"); + assertTrue(cf.modules().size() == 1); + assertTrue(cf.findModule("m1").isPresent()); } + /** + * Test provides optional service. + * + * module m1 { requires m2; provides p.S with q.P; } + * module m2 { requires static transitive m3; } + */ + @Test + void testProvidesOptionalService2() { + ModuleDescriptor descriptor1 = newBuilder("m1") + .requires("m2") + .provides("p.S", List.of("q.P")) + .build(); + ModuleDescriptor descriptor2 = newBuilder("m2") + .requires(Set.of(Requires.Modifier.STATIC, Requires.Modifier.TRANSITIVE), "m3") + .build(); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); + Configuration cf = resolve(finder, "m1"); + assertTrue(cf.modules().size() == 2); + assertTrue(cf.findModule("m1").isPresent()); + assertTrue(cf.findModule("m2").isPresent()); + } /** - * Test "provides p.S" where p is not exported to the module. + * Test provides optional service. + * + * module m1 { requires m2; provides p.S with q.P; } + * module m2 { requires transitive m3; } + * module m3 { requires static transitive m4; } */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testServiceTypePackageNotExported2() { + @Test + void testProvidesOptionalService3() { ModuleDescriptor descriptor1 = newBuilder("m1") - .provides("p.S", List.of("q.T")) + .requires("m2") + .provides("p.S", List.of("q.P")) + .build(); + ModuleDescriptor descriptor2 = newBuilder("m2") + .requires(Set.of(Requires.Modifier.TRANSITIVE), "m3") .build(); + ModuleDescriptor descriptor3 = newBuilder("m3") + .requires(Set.of(Requires.Modifier.STATIC, Requires.Modifier.TRANSITIVE), "m4") + .build(); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3); + Configuration cf = resolve(finder, "m1"); + assertTrue(cf.modules().size() == 3); + assertTrue(cf.findModule("m1").isPresent()); + assertTrue(cf.findModule("m2").isPresent()); + assertTrue(cf.findModule("m3").isPresent()); + } + /** + * Test "uses p.S" where p is not exported to the module. + */ + @Test + void testServiceTypePackageNotExported1() { + ModuleDescriptor descriptor1 = newBuilder("m1") + .uses("p.S") + .build(); ModuleFinder finder = ModuleUtils.finderOf(descriptor1); - // m1 does not read a module that exports p - resolve(finder, "m1"); + // m1 does not read a module that exports p to m1 + assertThrows(ResolutionException.class, () -> resolve(finder, "m1")); + } + + /** + * Test "uses p.S" where p is not exported to the module. + * + * module m1 { requires m2; uses p.S; } + * module m2 { contains p; } + */ + @Test + void testServiceTypePackageNotExported2() { + ModuleDescriptor descriptor1 = newBuilder("m1") + .requires("m2") + .uses("p.S") + .build(); + ModuleDescriptor descriptor2 = newBuilder("m2") + .packages(Set.of("p")) + .build(); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); + + // m1 does not read a module that exports p to m1 + assertThrows(ResolutionException.class, () -> resolve(finder, "m1")); } /** * Test the empty configuration. */ - public void testEmptyConfiguration() { + @Test + void testEmptyConfiguration() { Configuration cf = Configuration.empty(); assertTrue(cf.parents().isEmpty()); @@ -1840,47 +2000,22 @@ public void testEmptyConfiguration() { assertFalse(cf.findModule("java.base").isPresent()); } - - // platform specific modules - - @DataProvider(name = "platformmatch") - public Object[][] createPlatformMatches() { - return new Object[][]{ - - { "", "" }, - { "linux-arm", "" }, - { "linux-arm", "linux-arm" }, - - }; - - }; - - @DataProvider(name = "platformmismatch") - public Object[][] createBad() { - return new Object[][] { - - { "linux-x64", "linux-arm" }, - { "linux-x64", "windows-x64" }, - - }; - } - /** * Test creating a configuration containing platform specific modules. */ - @Test(dataProvider = "platformmatch") - public void testPlatformMatch(String s1, String s2) throws IOException { - + @ParameterizedTest + @CsvSource({",", "linux-aarch64,", "linux-aarch64,linux-aarch64"}) + void testPlatformMatch(String targetPlatform1, String targetPlatform2) throws IOException { ModuleDescriptor base = ModuleDescriptor.newModule("java.base").build(); Path system = writeModule(base, null); ModuleDescriptor descriptor1 = ModuleDescriptor.newModule("m1") .requires("m2") .build(); - Path dir1 = writeModule(descriptor1, s1); + Path dir1 = writeModule(descriptor1, targetPlatform1); ModuleDescriptor descriptor2 = ModuleDescriptor.newModule("m2").build(); - Path dir2 = writeModule(descriptor2, s2); + Path dir2 = writeModule(descriptor2, targetPlatform2); ModuleFinder finder = ModuleFinder.of(system, dir1, dir2); @@ -1893,43 +2028,45 @@ public void testPlatformMatch(String s1, String s2) throws IOException { } /** - * Test attempting to create a configuration with modules for different - * platforms. + * Test attempting to create a configuration with modules for different platforms. */ - @Test(dataProvider = "platformmismatch", - expectedExceptions = FindException.class ) - public void testPlatformMisMatch(String s1, String s2) throws IOException { - testPlatformMatch(s1, s2); + @ParameterizedTest + @CsvSource({"linux-x64,linux-aarch64", "linux-x64,windows-x64"}) + void testPlatformMisMatch(String targetPlatform1, String targetPlatform2) throws IOException { + assertThrows(FindException.class, + () -> testPlatformMatch(targetPlatform1, targetPlatform2)); } // no parents - @Test(expectedExceptions = { IllegalArgumentException.class }) - public void testResolveRequiresWithNoParents() { + @Test + void testResolveRequiresWithNoParents() { ModuleFinder empty = ModuleFinder.of(); - Configuration.resolve(empty, List.of(), empty, Set.of()); + assertThrows(IllegalArgumentException.class, + () -> Configuration.resolve(empty, List.of(), empty, Set.of())); } - @Test(expectedExceptions = { IllegalArgumentException.class }) - public void testResolveRequiresAndUsesWithNoParents() { + @Test + void testResolveRequiresAndUsesWithNoParents() { ModuleFinder empty = ModuleFinder.of(); - Configuration.resolveAndBind(empty, List.of(), empty, Set.of()); + assertThrows(IllegalArgumentException.class, + () -> Configuration.resolveAndBind(empty, List.of(), empty, Set.of())); } // parents with modules for specific platforms - @Test(dataProvider = "platformmatch") - public void testResolveRequiresWithCompatibleParents(String s1, String s2) - throws IOException - { - ModuleDescriptor base = ModuleDescriptor.newModule("java.base").build(); + @ParameterizedTest + @CsvSource({",", "linux-aarch64,", "linux-aarch64,linux-aarch64"}) + void testResolveRequiresWithCompatibleParents(String targetPlatform1, + String targetPlatform2) throws IOException { + ModuleDescriptor base = ModuleDescriptor.newModule("java.base").build(); Path system = writeModule(base, null); ModuleDescriptor descriptor1 = ModuleDescriptor.newModule("m1").build(); - Path dir1 = writeModule(descriptor1, s1); + Path dir1 = writeModule(descriptor1, targetPlatform1); ModuleDescriptor descriptor2 = ModuleDescriptor.newModule("m2").build(); - Path dir2 = writeModule(descriptor2, s2); + Path dir2 = writeModule(descriptor2, targetPlatform2); ModuleFinder finder1 = ModuleFinder.of(system, dir1); Configuration cf1 = resolve(finder1, "m1"); @@ -1945,163 +2082,160 @@ public void testResolveRequiresWithCompatibleParents(String s1, String s2) } - @Test(dataProvider = "platformmismatch", - expectedExceptions = IllegalArgumentException.class ) - public void testResolveRequiresWithConflictingParents(String s1, String s2) - throws IOException - { - testResolveRequiresWithCompatibleParents(s1, s2); + @ParameterizedTest + @CsvSource({"linux-x64,linux-aarch64", "linux-x64,windows-x64"}) + void testResolveRequiresWithConflictingParents(String targetPlatform1, + String targetPlatform2) throws IOException { + assertThrows(IllegalArgumentException.class, + () -> testResolveRequiresWithCompatibleParents(targetPlatform1, targetPlatform2)); } // null handling - // finder1, finder2, roots - - - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresWithNull1() { - resolve((ModuleFinder)null, ModuleFinder.of()); + @Test + void testResolveRequiresWithNull1() { + assertThrows(NullPointerException.class, + () -> resolve((ModuleFinder) null, ModuleFinder.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresWithNull2() { - resolve(ModuleFinder.of(), (ModuleFinder)null); + @Test + void testResolveRequiresWithNull2() { + assertThrows(NullPointerException.class, + () -> resolve(ModuleFinder.of(), (ModuleFinder) null)); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresWithNull3() { + @Test + void testResolveRequiresWithNull3() { Configuration empty = Configuration.empty(); - Configuration.resolve(null, List.of(empty), ModuleFinder.of(), Set.of()); + assertThrows(NullPointerException.class, + () -> Configuration.resolve(null, List.of(empty), ModuleFinder.of(), Set.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresWithNull4() { + @Test + void testResolveRequiresWithNull4() { ModuleFinder empty = ModuleFinder.of(); - Configuration.resolve(empty, null, empty, Set.of()); + assertThrows(NullPointerException.class, + () -> Configuration.resolve(empty, null, empty, Set.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresWithNull5() { + @Test + void testResolveRequiresWithNull5() { Configuration cf = ModuleLayer.boot().configuration(); - Configuration.resolve(ModuleFinder.of(), List.of(cf), null, Set.of()); + assertThrows(NullPointerException.class, + () -> Configuration.resolve(ModuleFinder.of(), List.of(cf), null, Set.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresWithNull6() { + @Test + void testResolveRequiresWithNull6() { ModuleFinder empty = ModuleFinder.of(); Configuration cf = ModuleLayer.boot().configuration(); - Configuration.resolve(empty, List.of(cf), empty, null); + assertThrows(NullPointerException.class, + () -> Configuration.resolve(empty, List.of(cf), empty, null)); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresAndUsesWithNull1() { - resolveAndBind((ModuleFinder) null, ModuleFinder.of()); + @Test + void testResolveRequiresAndUsesWithNull1() { + assertThrows(NullPointerException.class, + () -> resolveAndBind((ModuleFinder) null, ModuleFinder.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresAndUsesWithNull2() { - resolveAndBind(ModuleFinder.of(), (ModuleFinder) null); + @Test + void testResolveRequiresAndUsesWithNull2() { + assertThrows(NullPointerException.class, + () -> resolveAndBind(ModuleFinder.of(), (ModuleFinder) null)); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresAndUsesWithNull3() { + @Test + void testResolveRequiresAndUsesWithNull3() { Configuration empty = Configuration.empty(); - Configuration.resolveAndBind(null, List.of(empty), ModuleFinder.of(), Set.of()); + assertThrows(NullPointerException.class, + () -> Configuration.resolveAndBind(null, List.of(empty), ModuleFinder.of(), Set.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresAndUsesWithNull4() { + @Test + void testResolveRequiresAndUsesWithNull4() { ModuleFinder empty = ModuleFinder.of(); - Configuration.resolveAndBind(empty, null, empty, Set.of()); + assertThrows(NullPointerException.class, + () -> Configuration.resolveAndBind(empty, null, empty, Set.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresAndUsesWithNull5() { + @Test + void testResolveRequiresAndUsesWithNull5() { Configuration cf = ModuleLayer.boot().configuration(); - Configuration.resolveAndBind(ModuleFinder.of(), List.of(cf), null, Set.of()); + assertThrows(NullPointerException.class, + () -> Configuration.resolveAndBind(ModuleFinder.of(), List.of(cf), null, Set.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresAndUsesWithNull6() { + @Test + void testResolveRequiresAndUsesWithNull6() { ModuleFinder empty = ModuleFinder.of(); Configuration cf = ModuleLayer.boot().configuration(); - Configuration.resolveAndBind(empty, List.of(cf), empty, null); + assertThrows(NullPointerException.class, + () -> Configuration.resolveAndBind(empty, List.of(cf), empty, null)); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testFindModuleWithNull() { - Configuration.empty().findModule(null); + @Test + void testFindModuleWithNull() { + assertThrows(NullPointerException.class, () -> Configuration.empty().findModule(null)); } // unmodifiable collections - @DataProvider(name = "configurations") - public Object[][] configurations() { - // empty, boot, and custom configurations - return new Object[][] { - { Configuration.empty(), null }, - { ModuleLayer.boot().configuration(), null }, - { resolve(ModuleFinder.of()), null }, - }; - } - - @Test(dataProvider = "configurations", - expectedExceptions = { UnsupportedOperationException.class }) - public void testUnmodifiableParents1(Configuration cf, Object ignore) { - cf.parents().add(Configuration.empty()); - } - - @Test(dataProvider = "configurations", - expectedExceptions = { UnsupportedOperationException.class }) - public void testUnmodifiableParents2(Configuration cf, Object ignore) { - cf.parents().remove(Configuration.empty()); + static Stream configurations() { + return Stream.of( + Configuration.empty(), + ModuleLayer.boot().configuration(), + resolve(ModuleFinder.of()) + ); } - @Test(dataProvider = "configurations", - expectedExceptions = { UnsupportedOperationException.class }) - public void testUnmodifiableModules1(Configuration cf, Object ignore) { - ResolvedModule module = ModuleLayer.boot() - .configuration() - .findModule("java.base") - .orElseThrow(); - cf.modules().add(module); + @ParameterizedTest + @MethodSource("configurations") + void testUnmodifiableParents(Configuration cf) { + assertThrows(UnsupportedOperationException.class, + () -> cf.parents().add(Configuration.empty())); + assertThrows(UnsupportedOperationException.class, + () -> cf.parents().remove(Configuration.empty())); } - @Test(dataProvider = "configurations", - expectedExceptions = { UnsupportedOperationException.class }) - public void testUnmodifiableModules2(Configuration cf, Object ignore) { + @ParameterizedTest + @MethodSource("configurations") + void testUnmodifiableModules(Configuration cf) { ResolvedModule module = ModuleLayer.boot() .configuration() .findModule("java.base") .orElseThrow(); - cf.modules().remove(module); + assertThrows(UnsupportedOperationException.class, + () -> cf.modules().add(module)); + assertThrows(UnsupportedOperationException.class, + () -> cf.modules().remove(module)); } /** * Invokes parent.resolve(...) */ - private Configuration resolve(Configuration parent, - ModuleFinder before, - ModuleFinder after, - String... roots) { + private static Configuration resolve(Configuration parent, + ModuleFinder before, + ModuleFinder after, + String... roots) { return parent.resolve(before, after, Set.of(roots)); } - private Configuration resolve(Configuration parent, - ModuleFinder before, - String... roots) { + private static Configuration resolve(Configuration parent, + ModuleFinder before, + String... roots) { return resolve(parent, before, ModuleFinder.of(), roots); } - private Configuration resolve(ModuleFinder before, - ModuleFinder after, - String... roots) { + private static Configuration resolve(ModuleFinder before, + ModuleFinder after, + String... roots) { return resolve(Configuration.empty(), before, after, roots); } - private Configuration resolve(ModuleFinder before, - String... roots) { + private static Configuration resolve(ModuleFinder before, + String... roots) { return resolve(Configuration.empty(), before, roots); } @@ -2109,27 +2243,27 @@ private Configuration resolve(ModuleFinder before, /** * Invokes parent.resolveAndBind(...) */ - private Configuration resolveAndBind(Configuration parent, - ModuleFinder before, - ModuleFinder after, - String... roots) { + private static Configuration resolveAndBind(Configuration parent, + ModuleFinder before, + ModuleFinder after, + String... roots) { return parent.resolveAndBind(before, after, Set.of(roots)); } - private Configuration resolveAndBind(Configuration parent, - ModuleFinder before, - String... roots) { + private static Configuration resolveAndBind(Configuration parent, + ModuleFinder before, + String... roots) { return resolveAndBind(parent, before, ModuleFinder.of(), roots); } - private Configuration resolveAndBind(ModuleFinder before, - ModuleFinder after, - String... roots) { + private static Configuration resolveAndBind(ModuleFinder before, + ModuleFinder after, + String... roots) { return resolveAndBind(Configuration.empty(), before, after, roots); } - private Configuration resolveAndBind(ModuleFinder before, - String... roots) { + private static Configuration resolveAndBind(ModuleFinder before, + String... roots) { return resolveAndBind(Configuration.empty(), before, roots); } @@ -2138,7 +2272,7 @@ private Configuration resolveAndBind(ModuleFinder before, * Writes a module-info.class. If {@code targetPlatform} is not null then * it includes the ModuleTarget class file attribute with the target platform. */ - static Path writeModule(ModuleDescriptor descriptor, String targetPlatform) + private static Path writeModule(ModuleDescriptor descriptor, String targetPlatform) throws IOException { ModuleTarget target; diff --git a/test/jdk/java/net/httpclient/HttpResponseLimitingTest.java b/test/jdk/java/net/httpclient/HttpResponseLimitingTest.java new file mode 100644 index 00000000000..b87e7ea8e49 --- /dev/null +++ b/test/jdk/java/net/httpclient/HttpResponseLimitingTest.java @@ -0,0 +1,418 @@ +/* + * 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 8328919 + * @summary tests `limiting()` in `HttpResponse.Body{Handlers,Subscribers}` + * @key randomness + * @library /test/lib + * /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.test.lib.RandomFactory + * jdk.test.lib.net.SimpleSSLContext + * @run junit HttpResponseLimitingTest + */ + +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestServer; +import jdk.test.lib.RandomFactory; +import jdk.test.lib.net.SimpleSSLContext; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import javax.net.ssl.SSLContext; +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpHeaders; +import java.net.http.HttpRequest; +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.BodySubscribers; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.Flow.Subscription; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static java.net.http.HttpClient.Builder.NO_PROXY; +import static java.nio.charset.StandardCharsets.UTF_8; +import static java.util.Arrays.copyOfRange; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; + +class HttpResponseLimitingTest { + + private static final Random RANDOM = RandomFactory.getRandom(); + + private static final byte[] RESPONSE_BODY = "random non-empty body".getBytes(UTF_8); + + private static final String RESPONSE_HEADER_NAME = "X-Excessive-Data"; + + /** + * A header value larger than {@link #RESPONSE_BODY} to verify that {@code limiting()} doesn't affect header parsing. + */ + private static final String RESPONSE_HEADER_VALUE = "!".repeat(RESPONSE_BODY.length + 1); + + private static final ServerClientPair HTTP1 = ServerClientPair.of(HttpClient.Version.HTTP_1_1, false); + + private static final ServerClientPair HTTPS1 = ServerClientPair.of(HttpClient.Version.HTTP_1_1, true); + + private static final ServerClientPair HTTP2 = ServerClientPair.of(HttpClient.Version.HTTP_2, false); + + private static final ServerClientPair HTTPS2 = ServerClientPair.of(HttpClient.Version.HTTP_2, true); + + private record ServerClientPair(HttpTestServer server, HttpClient client, HttpRequest request) { + + private static final SSLContext SSL_CONTEXT = createSslContext(); + + private static SSLContext createSslContext() { + try { + return new SimpleSSLContext().get(); + } catch (IOException exception) { + throw new UncheckedIOException(exception); + } + } + + private ServerClientPair { + try { + server.start(); + } catch (Exception serverException) { + try { + client.close(); + } catch (Exception clientException) { + Exception localClientException = new RuntimeException("failed closing client", clientException); + serverException.addSuppressed(localClientException); + } + throw new RuntimeException("failed closing server", serverException); + } + } + + private static ServerClientPair of(HttpClient.Version version, boolean secure) { + + // Create the server and the request URI + SSLContext sslContext = secure ? SSL_CONTEXT : null; + HttpTestServer server = createServer(version, sslContext); + String handlerPath = "/"; + String requestUriScheme = secure ? "https" : "http"; + URI requestUri = URI.create(requestUriScheme + "://" + server.serverAuthority() + handlerPath); + + // Register the request handler + server.addHandler( + (exchange) -> { + exchange.getResponseHeaders().addHeader(RESPONSE_HEADER_NAME, RESPONSE_HEADER_VALUE); + exchange.sendResponseHeaders(200, RESPONSE_BODY.length); + try (var outputStream = exchange.getResponseBody()) { + outputStream.write(RESPONSE_BODY); + } + exchange.close(); + }, + handlerPath); + + // Create the client and the request + HttpClient client = createClient(version, sslContext); + HttpRequest request = HttpRequest.newBuilder(requestUri).version(version).build(); + + // Create the pair + return new ServerClientPair(server, client, request); + + } + + private static HttpTestServer createServer(HttpClient.Version version, SSLContext sslContext) { + try { + return HttpTestServer.create(version, sslContext); + } catch (IOException exception) { + throw new UncheckedIOException(exception); + } + } + + private static HttpClient createClient(HttpClient.Version version, SSLContext sslContext) { + HttpClient.Builder builder = HttpClient.newBuilder().version(version).proxy(NO_PROXY); + if (sslContext != null) { + builder.sslContext(sslContext); + } + return builder.build(); + } + + private HttpResponse request(BodyHandler downstreamHandler, long capacity) throws Exception { + var handler = BodyHandlers.limiting(downstreamHandler, capacity); + return client.send(request, handler); + } + + @Override + public String toString() { + String version = client.version().toString(); + return client.sslContext() != null ? version.replaceFirst("_", "S_") : version; + } + + } + + @AfterAll + static void closeServerClientPairs() { + Exception[] exceptionRef = {null}; + Stream + .of(HTTP1, HTTPS1, HTTP2, HTTPS2) + .flatMap(pair -> Stream.of( + pair.client::close, + pair.server::stop)) + .forEach(closer -> { + try { + closer.run(); + } catch (Exception exception) { + if (exceptionRef[0] == null) { + exceptionRef[0] = exception; + } else { + exceptionRef[0].addSuppressed(exception); + } + } + }); + if (exceptionRef[0] != null) { + throw new RuntimeException("failed closing one or more server-client pairs", exceptionRef[0]); + } + } + + @ParameterizedTest + @MethodSource("sufficientCapacities") + void testSuccessOnSufficientCapacityForByteArray(ServerClientPair pair, long sufficientCapacity) throws Exception { + HttpResponse response = pair.request(BodyHandlers.ofByteArray(), sufficientCapacity); + verifyHeaders(response.headers()); + assertArrayEquals(RESPONSE_BODY, response.body()); + } + + @ParameterizedTest + @MethodSource("sufficientCapacities") + void testSuccessOnSufficientCapacityForInputStream(ServerClientPair pair, long sufficientCapacity) throws Exception { + HttpResponse response = pair.request(BodyHandlers.ofInputStream(), sufficientCapacity); + verifyHeaders(response.headers()); + try (InputStream responseBodyStream = response.body()) { + byte[] responseBodyBuffer = responseBodyStream.readAllBytes(); + assertArrayEquals(RESPONSE_BODY, responseBodyBuffer); + } + } + + static Arguments[] sufficientCapacities() { + long minExtremeCapacity = RESPONSE_BODY.length; + long maxExtremeCapacity = Long.MAX_VALUE; + long nonExtremeCapacity = RANDOM.nextLong(minExtremeCapacity + 1, maxExtremeCapacity); + return capacityArgs(minExtremeCapacity, nonExtremeCapacity, maxExtremeCapacity); + } + + @ParameterizedTest + @MethodSource("insufficientCapacities") + void testFailureOnInsufficientCapacityForByteArray(ServerClientPair pair, long insufficientCapacity) { + BodyHandler handler = responseInfo -> { + verifyHeaders(responseInfo.headers()); + return BodySubscribers.limiting(BodySubscribers.ofByteArray(), insufficientCapacity); + }; + var exception = assertThrows(IOException.class, () -> pair.request(handler, insufficientCapacity)); + assertEquals(exception.getMessage(), "body exceeds capacity: " + insufficientCapacity); + } + + @ParameterizedTest + @MethodSource("insufficientCapacities") + void testFailureOnInsufficientCapacityForInputStream(ServerClientPair pair, long insufficientCapacity) throws Exception { + HttpResponse response = pair.request(BodyHandlers.ofInputStream(), insufficientCapacity); + verifyHeaders(response.headers()); + try (InputStream responseBodyStream = response.body()) { + var exception = assertThrows(IOException.class, responseBodyStream::readAllBytes); + assertNotNull(exception.getCause()); + assertEquals(exception.getCause().getMessage(), "body exceeds capacity: " + insufficientCapacity); + } + } + + static Arguments[] insufficientCapacities() { + long minExtremeCapacity = 0; + long maxExtremeCapacity = RESPONSE_BODY.length - 1; + long nonExtremeCapacity = RANDOM.nextLong(minExtremeCapacity + 1, maxExtremeCapacity); + return capacityArgs(minExtremeCapacity, nonExtremeCapacity, maxExtremeCapacity); + } + + private static void verifyHeaders(HttpHeaders responseHeaders) { + List responseHeaderValues = responseHeaders.allValues(RESPONSE_HEADER_NAME); + assertEquals(List.of(RESPONSE_HEADER_VALUE), responseHeaderValues); + } + + @ParameterizedTest + @MethodSource("invalidCapacities") + void testFailureOnInvalidCapacityForHandler(long invalidCapacity) { + var exception = assertThrows( + IllegalArgumentException.class, + () -> BodyHandlers.limiting(BodyHandlers.ofByteArray(), invalidCapacity)); + assertEquals(exception.getMessage(), "capacity must not be negative: " + invalidCapacity); + } + + @ParameterizedTest + @MethodSource("invalidCapacities") + void testFailureOnInvalidCapacityForSubscriber(long invalidCapacity) { + var exception = assertThrows( + IllegalArgumentException.class, + () -> BodySubscribers.limiting(BodySubscribers.ofByteArray(), invalidCapacity)); + assertEquals(exception.getMessage(), "capacity must not be negative: " + invalidCapacity); + } + + static long[] invalidCapacities() { + long minExtremeCapacity = Long.MIN_VALUE; + long maxExtremeCapacity = -1; + long nonExtremeCapacity = RANDOM.nextLong(minExtremeCapacity + 1, maxExtremeCapacity); + return new long[]{minExtremeCapacity, nonExtremeCapacity, maxExtremeCapacity}; + } + + @Test + void testFailureOnNullDownstreamHandler() { + var exception = assertThrows(NullPointerException.class, () -> BodyHandlers.limiting(null, 0)); + assertEquals(exception.getMessage(), "downstreamHandler"); + } + + @Test + void testFailureOnNullDownstreamSubscriber() { + var exception = assertThrows(NullPointerException.class, () -> BodySubscribers.limiting(null, 0)); + assertEquals(exception.getMessage(), "downstreamSubscriber"); + } + + private static Arguments[] capacityArgs(long... capacities) { + return Stream + .of(HTTP1, HTTPS1, HTTP2, HTTPS2) + .flatMap(pair -> Arrays + .stream(capacities) + .mapToObj(capacity -> Arguments.of(pair, capacity))) + .toArray(Arguments[]::new); + } + + @Test + void testSubscriberForCompleteConsumption() { + + // Create the subscriber (with sufficient capacity) + ObserverSubscriber downstreamSubscriber = new ObserverSubscriber(); + int sufficientCapacity = RESPONSE_BODY.length; + BodySubscriber subscriber = BodySubscribers.limiting(downstreamSubscriber, sufficientCapacity); + + // Emit values + subscriber.onSubscribe(DummySubscription.INSTANCE); + byte[] responseBodyPart1 = {RESPONSE_BODY[0]}; + byte[] responseBodyPart2 = copyOfRange(RESPONSE_BODY, 1, RESPONSE_BODY.length); + List buffers = toByteBuffers(responseBodyPart1, responseBodyPart2); + subscriber.onNext(buffers); + + // Verify the downstream propagation + assertSame(buffers, downstreamSubscriber.lastBuffers); + assertNull(downstreamSubscriber.lastThrowable); + assertFalse(downstreamSubscriber.completed); + + } + + @Test + void testSubscriberForFailureOnExcess() { + + // Create the subscriber (with insufficient capacity) + ObserverSubscriber downstreamSubscriber = new ObserverSubscriber(); + int insufficientCapacity = 2; + BodySubscriber subscriber = BodySubscribers.limiting(downstreamSubscriber, insufficientCapacity); + + // Emit values + subscriber.onSubscribe(DummySubscription.INSTANCE); + byte[] responseBodyPart1 = {RESPONSE_BODY[0]}; + byte[] responseBodyPart2 = copyOfRange(RESPONSE_BODY, 1, RESPONSE_BODY.length); + List buffers = toByteBuffers(responseBodyPart1, responseBodyPart2); + subscriber.onNext(buffers); + + // Verify the downstream propagation + assertNull(downstreamSubscriber.lastBuffers); + assertNotNull(downstreamSubscriber.lastThrowable); + assertEquals( + "body exceeds capacity: " + insufficientCapacity, + downstreamSubscriber.lastThrowable.getMessage()); + assertFalse(downstreamSubscriber.completed); + + } + + private static List toByteBuffers(byte[]... buffers) { + return Arrays.stream(buffers).map(ByteBuffer::wrap).collect(Collectors.toList()); + } + + private static final class ObserverSubscriber implements BodySubscriber { + + private List lastBuffers; + + private Throwable lastThrowable; + + private boolean completed; + + @Override + public CompletionStage getBody() { + throw new UnsupportedOperationException(); + } + + @Override + public void onSubscribe(Subscription subscription) { + subscription.request(Long.MAX_VALUE); + } + + @Override + public void onNext(List buffers) { + lastBuffers = buffers; + } + + @Override + public void onError(Throwable throwable) { + lastThrowable = throwable; + } + + @Override + public void onComplete() { + completed = true; + } + + } + + private enum DummySubscription implements Subscription { + + INSTANCE; + + @Override + public void request(long n) { + // Do nothing + } + + @Override + public void cancel() { + // Do nothing + } + + } + +} diff --git a/test/jdk/java/security/KeyAgreement/Generic.java b/test/jdk/java/security/KeyAgreement/Generic.java new file mode 100644 index 00000000000..dcf212dbffe --- /dev/null +++ b/test/jdk/java/security/KeyAgreement/Generic.java @@ -0,0 +1,79 @@ +/* + * 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 8189441 + * @library /test/lib /test/jdk/sun/security/pkcs11 + * @summary make sure Generic is accepted by all KeyAgreement implementations + * @run main Generic builtin + * @run main/othervm Generic nss + * @run main/othervm -DCUSTOM_P11_CONFIG_NAME=p11-nss-sensitive.txt Generic nss + */ +import jdk.test.lib.Asserts; + +import javax.crypto.KeyAgreement; +import java.security.KeyPairGenerator; +import java.security.Provider; +import java.security.Security; +import java.util.List; + +public class Generic { + + public static void main(String[] args) throws Exception { + if (args[0].equals("nss")) { + test(PKCS11Test.getSunPKCS11(PKCS11Test.getNssConfig())); + } else { + for (var p : Security.getProviders()) { + test(p); + } + } + } + + static void test(Provider p) throws Exception { + for (var s : p.getServices()) { + if (s.getType().equalsIgnoreCase("KeyAgreement")) { + try { + System.out.println(s.getProvider().getName() + "." + s.getAlgorithm()); + var g = KeyPairGenerator.getInstance(ka2kpg(s.getAlgorithm()), p); + var kp1 = g.generateKeyPair(); + var kp2 = g.generateKeyPair(); + var ka = KeyAgreement.getInstance(s.getAlgorithm(), s.getProvider()); + for (var alg : List.of("TlsPremasterSecret", "Generic")) { + ka.init(kp1.getPrivate()); + ka.doPhase(kp2.getPublic(), true); + Asserts.assertEquals( + ka.generateSecret(alg).getAlgorithm(), alg); + } + } catch (Exception e) { + throw e; + } + } + } + } + + // Find key algorithm from KeyAgreement algorithm + private static String ka2kpg(String ka) { + return ka.equals("ECDH") ? "EC" : ka; + } +} diff --git a/test/jdk/java/security/Provider/InvalidServiceTest.java b/test/jdk/java/security/Provider/InvalidServiceTest.java new file mode 100644 index 00000000000..fd56e6b3286 --- /dev/null +++ b/test/jdk/java/security/Provider/InvalidServiceTest.java @@ -0,0 +1,49 @@ +/* + * 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 8344361 + * @summary Restore null return for invalid services + */ + +import java.security.Provider; + +public class InvalidServiceTest { + + public static void main(String[] args) throws Exception { + Provider p1 = new LProvider("LegacyFormat"); + // this returns a service with null class name. Helps exercise the code path + Provider.Service s1 = p1.getService("MessageDigest", "SHA-1"); + if (s1 != null) + throw new RuntimeException("expecting null service"); + } + + private static class LProvider extends Provider { + LProvider(String name) { + super(name, "1.0", null); + put("Signature.MD5withRSA", "com.foo.Sig"); + put("MessageDigest.SHA-1 ImplementedIn", "Software"); + } + } +} diff --git a/test/jdk/java/text/Format/DateFormat/DateFormatTest.java b/test/jdk/java/text/Format/DateFormat/DateFormatTest.java index a8e70ce6567..f0b30fa1065 100644 --- a/test/jdk/java/text/Format/DateFormat/DateFormatTest.java +++ b/test/jdk/java/text/Format/DateFormat/DateFormatTest.java @@ -24,7 +24,7 @@ /** * @test * @bug 4052223 4089987 4469904 4326988 4486735 8008577 8045998 8140571 - * 8190748 8216969 8174269 8347841 + * 8190748 8216969 8174269 8347841 8347955 * @summary test DateFormat and SimpleDateFormat. * @modules jdk.localedata * @run junit DateFormatTest @@ -91,7 +91,7 @@ public void TestWallyWedel() /* * A String array for the time zone ids. */ - String[] ids = Arrays.stream(TimeZone.getAvailableIDs()) + String[] ids = TimeZone.availableIDs() .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); /* diff --git a/test/jdk/java/util/Calendar/CalendarRegression.java b/test/jdk/java/util/Calendar/CalendarRegression.java index 93869e0af3b..7b0f2025005 100644 --- a/test/jdk/java/util/Calendar/CalendarRegression.java +++ b/test/jdk/java/util/Calendar/CalendarRegression.java @@ -30,7 +30,7 @@ * 4174361 4177484 4197699 4209071 4288792 4328747 4413980 4546637 4623997 * 4685354 4655637 4683492 4080631 4080631 4167995 4340146 4639407 * 4652815 4652830 4740554 4936355 4738710 4633646 4846659 4822110 4960642 - * 4973919 4980088 4965624 5013094 5006864 8152077 8347841 + * 4973919 4980088 4965624 5013094 5006864 8152077 8347841 8347955 * @library /java/text/testlib * @run junit CalendarRegression */ @@ -43,7 +43,6 @@ import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.time.ZoneId; -import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; @@ -78,7 +77,7 @@ public class CalendarRegression { public void Test4031502() { // This bug actually occurs on Windows NT as well, and doesn't // require the host zone to be set; it can be set in Java. - String[] ids = Arrays.stream(TimeZone.getAvailableIDs()) + String[] ids = TimeZone.availableIDs() .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); boolean bad = false; diff --git a/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java b/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java index 784998a9c32..288034729e1 100644 --- a/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4052440 8003267 8062588 8210406 8174269 8327434 8347841 + * @bug 4052440 8003267 8062588 8210406 8174269 8327434 8347841 8347955 * @summary TimeZoneNameProvider tests * @library providersrc/foobarutils * providersrc/barprovider @@ -74,7 +74,7 @@ public static void main(String[] s) { void test1() { List jreimplloc = Arrays.asList(LocaleProviderAdapter.forType(LocaleProviderAdapter.Type.CLDR).getTimeZoneNameProvider().getAvailableLocales()); List providerLocales = Arrays.asList(tznp.getAvailableLocales()); - String[] ids = Arrays.stream(TimeZone.getAvailableIDs()) + String[] ids = TimeZone.availableIDs() .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); diff --git a/test/jdk/java/util/TimeZone/AvailableIDsTest.java b/test/jdk/java/util/TimeZone/AvailableIDsTest.java new file mode 100644 index 00000000000..3992e5be7bc --- /dev/null +++ b/test/jdk/java/util/TimeZone/AvailableIDsTest.java @@ -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. + */ + +/* + * @test + * @bug 8347955 + * @summary Ensure underlying element equality of available tz ID methods + * @run junit AvailableIDsTest + */ + +import org.junit.jupiter.api.Test; + +import java.util.TimeZone; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + +public class AvailableIDsTest { + + // Validate the equality of the array and stream of available IDs + @Test + public void streamEqualsArrayTest() { + String[] tzs = TimeZone.getAvailableIDs(); + assertArrayEquals(tzs, TimeZone.availableIDs().toArray(String[]::new), + "availableIDs() and getAvailableIDs() do not have the same elements"); + } + + // Validate the equality of the array and stream of available IDs + // when passed an offset. Tests various offsets. + @ParameterizedTest + @ValueSource(ints = {21600000, 25200000, 28800000}) // 6:00, 7:00, 8:00 + public void streamEqualsArrayWithOffsetTest(int offset) { + String[] tzs = TimeZone.getAvailableIDs(offset); + assertArrayEquals(tzs, TimeZone.availableIDs(offset).toArray(String[]::new), + "availableIDs(int) and getAvailableIDs(int) do not have the same elements"); + } +} diff --git a/test/jdk/java/util/TimeZone/Bug5097350.java b/test/jdk/java/util/TimeZone/Bug5097350.java index 862d7f90a15..3c1083bbaa9 100644 --- a/test/jdk/java/util/TimeZone/Bug5097350.java +++ b/test/jdk/java/util/TimeZone/Bug5097350.java @@ -23,7 +23,7 @@ /* * @test - * @bug 5097350 8347841 + * @bug 5097350 8347841 8347955 * @summary Make sure that TimeZone.getTimeZone returns a clone of a cached TimeZone instance. */ @@ -33,7 +33,7 @@ public class Bug5097350 { public static void main(String[] args) { - String[] tzids = Arrays.stream(TimeZone.getAvailableIDs()) + String[] tzids = TimeZone.availableIDs() .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); List ids = new ArrayList<>(tzids.length + 10); diff --git a/test/jdk/java/util/TimeZone/Bug6329116.java b/test/jdk/java/util/TimeZone/Bug6329116.java index cd48bffdfa2..4f6f5f27eac 100644 --- a/test/jdk/java/util/TimeZone/Bug6329116.java +++ b/test/jdk/java/util/TimeZone/Bug6329116.java @@ -25,7 +25,7 @@ * @test * @bug 6329116 6756569 6757131 6758988 6764308 6796489 6834474 6609737 6507067 * 7039469 7090843 7103108 7103405 7158483 8008577 8059206 8064560 8072042 - * 8077685 8151876 8166875 8169191 8170316 8176044 8174269 8347841 + * 8077685 8151876 8166875 8169191 8170316 8176044 8174269 8347841 8347955 * @summary Make sure that timezone short display names are identical to Olson's data. * @run junit Bug6329116 */ @@ -46,7 +46,7 @@ public class Bug6329116 { // static Locale[] locales = Locale.getAvailableLocales(); static Locale[] locales = {Locale.US}; - static String[] timezones = Arrays.stream(TimeZone.getAvailableIDs()) + static String[] timezones = TimeZone.availableIDs() .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); diff --git a/test/jdk/java/util/TimeZone/Bug6772689.java b/test/jdk/java/util/TimeZone/Bug6772689.java index b2ce085fc22..a69dfd92563 100644 --- a/test/jdk/java/util/TimeZone/Bug6772689.java +++ b/test/jdk/java/util/TimeZone/Bug6772689.java @@ -23,13 +23,12 @@ /* * @test - * @bug 6772689 8347841 + * @bug 6772689 8347841 8347955 * @summary Test for standard-to-daylight transitions at midnight: * date stays on the given day. */ import java.time.ZoneId; -import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; @@ -46,7 +45,7 @@ public static void main(String[] args) { int errors = 0; Calendar cal = new GregorianCalendar(BEGIN_YEAR, MARCH, 1); - String[] tzids = Arrays.stream(TimeZone.getAvailableIDs()) + String[] tzids = TimeZone.availableIDs() .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); try { diff --git a/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java b/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java index 2ff278a583c..c1200445407 100644 --- a/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java +++ b/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, 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 @@ -130,7 +130,7 @@ public static void main(String[] args) { String displayName = zi.getDisplayName(false, TimeZone.SHORT, Locale.US); Locale.setDefault(originalLocale); if (!displayName.equals("GMT+05:00")) { - System.err.printf("Wrong display name for timezone Etc/GMT-5 : expected GMT+05:00, Actual " + displayName); + System.err.println("Wrong display name for timezone Etc/GMT-5 : expected GMT+05:00, Actual " + displayName); errors++; } diff --git a/test/jdk/java/util/TimeZone/DaylightTimeTest.java b/test/jdk/java/util/TimeZone/DaylightTimeTest.java index 006f03424ee..1b8c1c221bd 100644 --- a/test/jdk/java/util/TimeZone/DaylightTimeTest.java +++ b/test/jdk/java/util/TimeZone/DaylightTimeTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 6936350 8347841 + * @bug 6936350 8347841 8347955 * @summary Test case for TimeZone.observesDaylightTime() */ @@ -35,7 +35,7 @@ public class DaylightTimeTest { private static final int ONE_HOUR = 60 * 60 * 1000; // one hour private static final int INTERVAL = 24 * ONE_HOUR; // one day - private static final String[] ZONES = Arrays.stream(TimeZone.getAvailableIDs()) + private static final String[] ZONES = TimeZone.availableIDs() .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); private static int errors = 0; diff --git a/test/jdk/java/util/TimeZone/IDTest.java b/test/jdk/java/util/TimeZone/IDTest.java index 97bf971abc9..aaa7c7f65c1 100644 --- a/test/jdk/java/util/TimeZone/IDTest.java +++ b/test/jdk/java/util/TimeZone/IDTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4509255 5055567 6176318 7090844 8347841 + * @bug 4509255 5055567 6176318 7090844 8347841 8347955 * @summary Tests consistencies of time zone IDs. */ @@ -41,10 +41,10 @@ public static void main(String[] args) { Set ids = new HashSet<>(); Map> tree = new TreeMap<>(); - String[] tzs = Arrays.stream(TimeZone.getAvailableIDs()) + String[] tzs = TimeZone.availableIDs() .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); - String[] tzs2 = Arrays.stream(TimeZone.getAvailableIDs()) + String[] tzs2 = TimeZone.availableIDs() .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); if (tzs.length != tzs2.length) { @@ -89,10 +89,10 @@ public static void main(String[] args) { // Check the getAvailableIDs(int) call to return the same // set of IDs int offset = key.intValue(); - tzs = Arrays.stream(TimeZone.getAvailableIDs(offset)) + tzs = TimeZone.availableIDs(offset) .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); - tzs2 = Arrays.stream(TimeZone.getAvailableIDs(offset)) + tzs2 = TimeZone.availableIDs(offset) .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); if (!Arrays.equals(tzs, tzs2)) { diff --git a/test/jdk/java/util/TimeZone/ListTimeZones.java b/test/jdk/java/util/TimeZone/ListTimeZones.java index dad59a91a95..01d3bc771c5 100644 --- a/test/jdk/java/util/TimeZone/ListTimeZones.java +++ b/test/jdk/java/util/TimeZone/ListTimeZones.java @@ -23,7 +23,7 @@ /** * @test - * @bug 6851214 8347841 + * @bug 6851214 8347841 8347955 * @summary Allow 24:00 as a valid end/start DST time stamp * @run main ListTimeZones */ @@ -35,7 +35,7 @@ public class ListTimeZones{ public static void main(String[] args){ Date date = new Date(); - String[] TimeZoneIds = Arrays.stream(TimeZone.getAvailableIDs()) + String[] TimeZoneIds = TimeZone.availableIDs() .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); for(int i = 0; i < TimeZoneIds.length; i++){ diff --git a/test/jdk/java/util/TimeZone/TimeZoneData/VERSION b/test/jdk/java/util/TimeZone/TimeZoneData/VERSION index f40be22e9ab..5159b3786e3 100644 --- a/test/jdk/java/util/TimeZone/TimeZoneData/VERSION +++ b/test/jdk/java/util/TimeZone/TimeZoneData/VERSION @@ -1 +1 @@ -tzdata2024b +tzdata2025a diff --git a/test/jdk/java/util/TimeZone/TimeZoneData/aliases.txt b/test/jdk/java/util/TimeZone/TimeZoneData/aliases.txt index 3217f68b825..c8d855453c2 100644 --- a/test/jdk/java/util/TimeZone/TimeZoneData/aliases.txt +++ b/test/jdk/java/util/TimeZone/TimeZoneData/aliases.txt @@ -1,6 +1,3 @@ -Link Asia/Riyadh87 Mideast/Riyadh87 -Link Asia/Riyadh88 Mideast/Riyadh88 -Link Asia/Riyadh89 Mideast/Riyadh89 Link Australia/Sydney Australia/ACT #= Australia/Canberra Link Australia/Lord_Howe Australia/LHI Link Australia/Sydney Australia/NSW diff --git a/test/jdk/javax/management/Introspector/InvokeGettersTest.java b/test/jdk/javax/management/Introspector/InvokeGettersTest.java index 6036069a6f5..71e22ca3d71 100644 --- a/test/jdk/javax/management/Introspector/InvokeGettersTest.java +++ b/test/jdk/javax/management/Introspector/InvokeGettersTest.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 @@ -23,8 +23,8 @@ /* * @test - * @bug 6317101 - * @summary Test that the jmx.invoke.getters system property works + * @bug 6317101 8344976 + * @summary Test invocation after removal of the jmx.invoke.getters system property * @author Eamonn McManus * * @run clean InvokeGettersTest @@ -63,10 +63,7 @@ public static void main(String[] args) throws Exception { ObjectName on = new ObjectName("a:b=c"); mbs.registerMBean(new Thing(), on); if (test(mbs, on, false)) - System.out.println("OK: invoke without jmx.invoke.getters"); - System.setProperty("jmx.invoke.getters", "true"); - if (test(mbs, on, true)) - System.out.println("OK: invoke with jmx.invoke.getters"); + System.out.println("OK"); if (failure == null) System.out.println("TEST PASSED"); else @@ -117,7 +114,7 @@ private static boolean test(MBeanServer mbs, ObjectName on, System.out.println("isTrue got expected exception: " + e); } - // Following cases should fail whether or not jmx.invoke.getters is set + // Following cases should fail final Object[][] badInvokes = { {"isWhatsit", null, null}, {"getWhatsit", new Object[] {5}, new String[] {"int"}}, diff --git a/test/jdk/javax/management/MBeanServer/MBeanFallbackTest.java b/test/jdk/javax/management/MBeanServer/MBeanFallbackTest.java deleted file mode 100644 index 6cf508598de..00000000000 --- a/test/jdk/javax/management/MBeanServer/MBeanFallbackTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * 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 javax.management.MBeanServer; -import javax.management.MBeanServerFactory; -import javax.management.NotCompliantMBeanException; -import javax.management.ObjectName; - -/* - * @test - * @bug 8010285 - * @summary Test fallback for private MBean interfaces. - * It needs to be a separate class because the "jdk.jmx.mbeans.allowNonPublic" - * system property must be set before c.s.j.m.MBeanAnalyzer has been loaded. - * @author Jaroslav Bachorik - * - * @run clean MBeanFallbackTest - * @run build MBeanFallbackTest - * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true MBeanFallbackTest - */ -public class MBeanFallbackTest { - private static interface PrivateMBean { - public int[] getInts(); - } - - public static class Private implements PrivateMBean { - public int[] getInts() { - return new int[]{1,2,3}; - } - } - - private static int failures = 0; - - public static void main(String[] args) throws Exception { - testPrivate(PrivateMBean.class, new Private()); - - if (failures == 0) - System.out.println("Test passed"); - else - throw new Exception("TEST FAILURES: " + failures); - } - - private static void fail(String msg) { - failures++; - System.out.println("FAIL: " + msg); - } - - private static void success(String msg) { - System.out.println("OK: " + msg); - } - - private static void testPrivate(Class iface, Object bean) throws Exception { - try { - System.out.println("Registering a private MBean " + - iface.getName() + " ..."); - - MBeanServer mbs = MBeanServerFactory.newMBeanServer(); - ObjectName on = new ObjectName("test:type=Compliant"); - - mbs.registerMBean(bean, on); - success("Registered a private MBean - " + iface.getName()); - } catch (Exception e) { - Throwable t = e; - while (t != null && !(t instanceof NotCompliantMBeanException)) { - t = t.getCause(); - } - if (t != null) { - fail("MBean not registered"); - } else { - throw e; - } - } - } -} diff --git a/test/jdk/javax/management/mxbean/MXBeanFallbackTest.java b/test/jdk/javax/management/mxbean/MXBeanFallbackTest.java deleted file mode 100644 index 00fd1c454c2..00000000000 --- a/test/jdk/javax/management/mxbean/MXBeanFallbackTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. - * 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 8010285 - * @summary Test for the private MXBean interface fallback. - * It needs to be a separate class because the "jdk.jmx.mbeans.allowNonPublic" - * system property must be set before c.s.j.m.MBeanAnalyzer has been loaded. - * @author Jaroslav Bachorik - * - * @run clean MXBeanFallbackTest - * @run build MXBeanFallbackTest - * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true MXBeanFallbackTest - */ - -import javax.management.MBeanServer; -import javax.management.MBeanServerFactory; -import javax.management.NotCompliantMBeanException; -import javax.management.ObjectName; - -public class MXBeanFallbackTest { - public static void main(String[] args) throws Exception { - testPrivateMXBean("Private", new Private()); - - if (failures == 0) - System.out.println("Test passed"); - else - throw new Exception("TEST FAILURES: " + failures); - } - - private static int failures = 0; - - private static interface PrivateMXBean { - public int[] getInts(); - } - - public static class Private implements PrivateMXBean { - public int[] getInts() { - return new int[]{1,2,3}; - } - } - - private static void testPrivateMXBean(String type, Object bean) throws Exception { - System.out.println(type + " MXBean test..."); - MBeanServer mbs = MBeanServerFactory.newMBeanServer(); - ObjectName on = new ObjectName("test:type=" + type); - try { - mbs.registerMBean(bean, on); - success("Private MXBean registered"); - } catch (NotCompliantMBeanException e) { - failure("Failed to register the private MXBean - " + - bean.getClass().getInterfaces()[0].getName()); - } - } - - private static void success(String what) { - System.out.println("OK: " + what); - } - - private static void failure(String what) { - System.out.println("FAILED: " + what); - failures++; - } -} diff --git a/test/jdk/javax/management/mxbean/SameObjectTwoNamesTest.java b/test/jdk/javax/management/mxbean/SameObjectTwoNamesTest.java index 10022c592f7..130289e10da 100644 --- a/test/jdk/javax/management/mxbean/SameObjectTwoNamesTest.java +++ b/test/jdk/javax/management/mxbean/SameObjectTwoNamesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, 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 @@ -30,7 +30,6 @@ * @author Eamonn McManus * * @run main SameObjectTwoNamesTest - * @run main/othervm -Djmx.mxbean.multiname=true SameObjectTwoNamesTest */ import javax.management.InstanceAlreadyExistsException; @@ -41,8 +40,6 @@ public class SameObjectTwoNamesTest { public static void main(String[] args) throws Exception { - boolean expectException = - (System.getProperty("jmx.mxbean.multiname") == null); try { ObjectName objectName1 = new ObjectName("test:index=1"); ObjectName objectName2 = new ObjectName("test:index=2"); @@ -53,19 +50,10 @@ public static void main(String[] args) throws Exception { mbs.registerMBean(mxBeanObject, objectName2); - if (expectException) { - throw new Exception("TEST FAILED: " + - "InstanceAlreadyExistsException was not thrown"); - } else - System.out.println("Correctly got no exception with compat property"); + throw new Exception("TEST FAILED: InstanceAlreadyExistsException was not thrown"); } catch (InstanceAlreadyExistsException e) { - if (expectException) { - System.out.println("Got expected InstanceAlreadyExistsException:"); - e.printStackTrace(System.out); - } else { - throw new Exception( - "TEST FAILED: Got exception even though compat property set", e); - } + System.out.println("Got expected InstanceAlreadyExistsException:"); + e.printStackTrace(System.out); } System.out.println("TEST PASSED"); } diff --git a/test/jdk/javax/management/openmbean/TabularDataOrderTest.java b/test/jdk/javax/management/openmbean/TabularDataOrderTest.java index 68e9fefdc7c..0a1a02c949f 100644 --- a/test/jdk/javax/management/openmbean/TabularDataOrderTest.java +++ b/test/jdk/javax/management/openmbean/TabularDataOrderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, 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 @@ -57,8 +57,6 @@ public class TabularDataOrderTest { private static String failure; - private static final String COMPAT_PROP_NAME = "jmx.tabular.data.hash.map"; - private static final String[] intNames = { "unus", "duo", "tres", "quatuor", "quinque", "sex", "septem", "octo", "novem", "decim", @@ -129,44 +127,6 @@ public static void main(String[] args) throws Exception { if (!ordered) fail("Order not preserved"); - // Now test the undocumented property that causes HashMap to be used - // instead of LinkedHashMap, in case serializing to a 1.3 client. - // We serialize and deserialize in case the implementation handles - // this at serialization time. Then we look at object fields; that's - // not guaranteed to work but at worst it will fail spuriously and - // we'll have to update the test. - System.out.println("Testing compatible behaviour"); - System.setProperty(COMPAT_PROP_NAME, "true"); - td = makeTable(); - System.out.println(td); - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - ObjectOutputStream oout = new ObjectOutputStream(bout); - oout.writeObject(td); - oout.close(); - byte[] bytes = bout.toByteArray(); - ByteArrayInputStream bin = new ByteArrayInputStream(bytes); - ObjectInputStream oin = new ObjectInputStream(bin); - td = (TabularData) oin.readObject(); - boolean found = false; - for (Field f : td.getClass().getDeclaredFields()) { - if (Modifier.isStatic(f.getModifiers())) - continue; - f.setAccessible(true); - Object x = f.get(td); - if (x != null && x.getClass() == HashMap.class) { - found = true; - System.out.println( - x.getClass().getName() + " TabularDataSupport." + - f.getName() + " = " + x); - break; - } - } - if (!found) { - fail("TabularDataSupport does not contain HashMap though " + - COMPAT_PROP_NAME + "=true"); - } - System.clearProperty(COMPAT_PROP_NAME); - System.out.println("Testing MXBean behaviour"); MBeanServer mbs = MBeanServerFactory.newMBeanServer(); ObjectName name = new ObjectName("a:b=c"); diff --git a/test/jdk/javax/management/proxy/JMXProxyFallbackTest.java b/test/jdk/javax/management/proxy/JMXProxyFallbackTest.java deleted file mode 100644 index c68a93654af..00000000000 --- a/test/jdk/javax/management/proxy/JMXProxyFallbackTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * 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 javax.management.JMX; -import javax.management.MBeanServer; -import javax.management.MBeanServerFactory; -import javax.management.NotCompliantMBeanException; -import javax.management.ObjectName; - -/* - * @test - * @bug 8010285 - * @summary Tests the fallback for creating JMX proxies for private interfaces - * It needs to be a separate class because the "jdk.jmx.mbeans.allowNonPublic" - * system property must be set before c.s.j.m.MBeanAnalyzer has been loaded. - * @author Jaroslav Bachorik - * - * @run clean JMXProxyFallbackTest - * @run build JMXProxyFallbackTest - * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true JMXProxyFallbackTest - */ -public class JMXProxyFallbackTest { - private static interface PrivateMBean { - public int[] getInts(); - } - - private static interface PrivateMXBean { - public int[] getInts(); - } - - public static class Private implements PrivateMXBean, PrivateMBean { - public int[] getInts() { - return new int[]{1,2,3}; - } - } - - private static int failures = 0; - - public static void main(String[] args) throws Exception { - testPrivate(PrivateMBean.class); - testPrivate(PrivateMXBean.class); - - if (failures == 0) - System.out.println("Test passed"); - else - throw new Exception("TEST FAILURES: " + failures); - } - - private static void fail(String msg) { - failures++; - System.out.println("FAIL: " + msg); - } - - private static void success(String msg) { - System.out.println("OK: " + msg); - } - - private static void testPrivate(Class iface) throws Exception { - try { - System.out.println("Creating a proxy for private M(X)Bean " + - iface.getName() + " ..."); - - MBeanServer mbs = MBeanServerFactory.newMBeanServer(); - ObjectName on = new ObjectName("test:type=Proxy"); - - JMX.newMBeanProxy(mbs, on, iface); - success("Created a proxy for private M(X)Bean - " + iface.getName()); - } catch (Exception e) { - Throwable t = e; - while (t != null && !(t instanceof NotCompliantMBeanException)) { - t = t.getCause(); - } - if (t != null) { - fail("Proxy not created"); - } else { - throw e; - } - } - } -} diff --git a/test/jdk/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java b/test/jdk/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java index 94a06904282..8f4fe0a24f0 100644 --- a/test/jdk/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java +++ b/test/jdk/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2015, 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 @@ -23,7 +23,7 @@ /* * @test NotifBufferSizePropertyNameTest - * @bug 6174229 + * @bug 6174229 8345045 * @summary Verify the property name specifying server notification buffer size. * @author Shanliang JIANG * @@ -52,35 +52,25 @@ public void handleNotification(Notification n, Object hb) { }; public static void main(String[] args) throws Exception { - System.out.println( - "Verify the property name specifying the server notification buffer size."); + System.out.println("Verify the property name specifying the server notification buffer size."); oname = new ObjectName ("Default:name=NotificationEmitter"); url = new JMXServiceURL("rmi", null, 0); Map env = new HashMap(2); - System.out.println("Test the new property name."); + System.out.println("Test the property name."); env.put("jmx.remote.x.notification.buffer.size", String.valueOf(bufferSize)); test(env); - System.out.println("Test the old property name."); - env.remove("jmx.remote.x.notification.buffer.size"); - env.put("jmx.remote.x.buffer.size", String.valueOf(bufferSize)); - test(env); - + // Recognition of the old, incorrect property "jmx.remote.x.buffer.size" has been dropped. + // Do not test old name is recognised, but do test it does not interfere with correct name: System.out.println("Test that the new property name overwrite the old one."); env.put("jmx.remote.x.notification.buffer.size", String.valueOf(bufferSize)); env.put("jmx.remote.x.buffer.size", String.valueOf(bufferSize*6)); test(env); - System.out.println("Test the old property name on system."); - System.setProperty("jmx.remote.x.buffer.size", String.valueOf(bufferSize)); - test(null); - - System.out.println( - "Test that the new property name overwrite the old one on system."); - System.setProperty("jmx.remote.x.notification.buffer.size", - String.valueOf(bufferSize)); + System.out.println("Test that the new property name overwrite the old one on system."); + System.setProperty("jmx.remote.x.notification.buffer.size", String.valueOf(bufferSize)); System.setProperty("jmx.remote.x.buffer.size", String.valueOf(bufferSize*6)); test(null); } diff --git a/test/jdk/javax/print/CUPSPrinterImageableAreaTest.java b/test/jdk/javax/print/CUPSPrinterImageableAreaTest.java new file mode 100644 index 00000000000..b07cc39c6ff --- /dev/null +++ b/test/jdk/javax/print/CUPSPrinterImageableAreaTest.java @@ -0,0 +1,338 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, BELLSOFT. All rights reserved. + * 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.BasicStroke; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Graphics; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.LayoutManager; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.print.PageFormat; +import java.awt.print.Paper; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.util.ArrayList; +import java.util.List; +import javax.print.PrintService; +import javax.print.PrintServiceLookup; +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.Size2DSyntax; +import javax.print.attribute.standard.Media; +import javax.print.attribute.standard.MediaPrintableArea; +import javax.print.attribute.standard.MediaSize; +import javax.print.attribute.standard.MediaSizeName; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.plaf.basic.BasicComboBoxRenderer; + +/* + * @test + * @bug 8344119 + * @key printer + * @requires (os.family == "linux" | os.family == "mac") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary CUPSPrinter imageable area + * @run main/manual CUPSPrinterImageableAreaTest + */ + +public class CUPSPrinterImageableAreaTest { + + private static final List ALLOWED_MEDIA_LIST = List.of(MediaSizeName.ISO_A4, MediaSizeName.NA_LETTER); + private static final double DPI = 72.0; + private static final double MM_PER_INCH = 2.54; + private static final String INSTRUCTIONS = """ + +

        + The test checks that the media margins fetched from the printer's PPD file are correct.
        + Press the 'Print sample' button to print a test page.
        + Required paper size and expected margins will be shown on the print dialog. + A passing test will print the page with a black rectangle along the printable area. + Ensure that all sides of the rectangle are printed.
        + Click 'Pass' button, or click 'Fail' button if the test failed. +
        + + """; + private static final String PAPER_INSTRUCTIONS_FORMAT = """ + + Required paper size:
        • %s
        + Expected margins:
        • left: %.1f
        • +
        • bottom: %.1f
        • +
        • right: %.1f
        • +
        • top: %.1f
        • +
        + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .testUI(createTestUI()) + .columns(55) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + final TestServiceData[] testServiceList = getTestServiceList(); + if (testServiceList.length == 0) { + throw new RuntimeException("Print services support borderless print only"); + } + + final JFrame frame = new JFrame("CUPS Printer imageable area test"); + JPanel pnlRoot = new JPanel(); + JLabel lblPrintServices = new JLabel("Select a print service for the test"); + JComboBox cbPrintServices = new JComboBox<>(); + JPanel pnlInstruction = new JPanel(); + JLabel lblInstruction = new JLabel(); + JButton btnPrint = new JButton("Print sample"); + + lblPrintServices.setLabelFor(cbPrintServices); + lblPrintServices.setAlignmentX(SwingConstants.LEFT); + + lblInstruction.setPreferredSize(new Dimension(250, 150)); + pnlInstruction.setBackground(Color.white); + pnlInstruction.add(lblInstruction); + + cbPrintServices.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + int selectedIndex = cbPrintServices.getSelectedIndex(); + if (selectedIndex < 0) { + lblInstruction.setText(""); + btnPrint.setEnabled(false); + return; + } + + TestServiceData testServiceData = testServiceList[selectedIndex]; + PageFormat pageFormat = testServiceData.pageFormat; + // margins: left, bottom, right, top + double[] margins = new double[]{ + pageFormat.getImageableX(), + pageFormat.getHeight() - pageFormat.getImageableHeight() - pageFormat.getImageableY(), + pageFormat.getWidth() - pageFormat.getImageableWidth() - pageFormat.getImageableX(), + pageFormat.getImageableY() + }; + String printServiceInstructions = PAPER_INSTRUCTIONS_FORMAT.formatted( + testServiceData.mediaSizeName.toString(), inchesToMM(margins[0]), + inchesToMM(margins[1]), inchesToMM(margins[2]), inchesToMM(margins[3])); + lblInstruction.setText(printServiceInstructions); + btnPrint.setEnabled(true); + } + }); + + DefaultComboBoxModel model = new DefaultComboBoxModel<>(); + for(TestServiceData tsd : testServiceList) { + model.addElement(tsd.printService.getName()); + } + cbPrintServices.setModel(model); + cbPrintServices.setSelectedIndex(-1); + PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService(); + if (defaultPrintService != null && model.getIndexOf(defaultPrintService.getName()) >= 0) { + cbPrintServices.setSelectedItem(defaultPrintService.getName()); + } else { + cbPrintServices.setSelectedIndex(0); + } + + btnPrint.setPreferredSize(new Dimension(200, 80)); + btnPrint.addActionListener((e) -> { + int selectedIndex = cbPrintServices.getSelectedIndex(); + if (selectedIndex < 0) { + return; + } + btnPrint.setEnabled(false); + cbPrintServices.setEnabled(false); + TestServiceData testServiceData = testServiceList[selectedIndex]; + PrinterJob job = PrinterJob.getPrinterJob(); + try { + job.setPrintService(testServiceData.printService); + job.setPrintable(new RectPrintable(), testServiceData.pageFormat); + job.print(); + } catch (PrinterException ex) { + throw new RuntimeException(ex); + } + }); + + LayoutManager layout = new GridBagLayout(); + pnlRoot.setLayout(layout); + + addGridBagComponent(pnlRoot, lblPrintServices, 0); + addGridBagComponent(pnlRoot, cbPrintServices, 1); + addGridBagComponent(pnlRoot, pnlInstruction, 2); + addGridBagComponent(pnlRoot, btnPrint, 3); + + frame.add(pnlRoot); + frame.pack(); + frame.setResizable(false); + return frame; + } + + private static TestServiceData[] getTestServiceList() { + PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null); + if (printServices == null || printServices.length == 0) { + throw new RuntimeException("Print services not found"); + } + + List testServiceList = new ArrayList<>(); + for (PrintService ps : printServices) { + try { + MediaSizeName msn = getTestMediaSizeName(ps); + PageFormat pf = createTestPageFormat(msn, ps); + testServiceList.add(new TestServiceData(ps, msn, pf)); + } catch (Exception ignore) { //in case if can't create required PageFormat + } + } + return testServiceList.toArray(TestServiceData[]::new); + } + + private static MediaSizeName getTestMediaSizeName(PrintService printService) { + //Use printer's default media or one of the alloed medias + Media testMedia = (Media) printService.getDefaultAttributeValue(Media.class); + if (testMedia == null) { + Media[] medias = (Media[]) printService + .getSupportedAttributeValues(Media.class, null, null); + if (medias == null || medias.length == 0) { + throw new RuntimeException("Medias not found"); + } + for (Media media : medias) { + if (ALLOWED_MEDIA_LIST.contains(media)) { + testMedia = media; + break; + } + } + } + if (!(testMedia instanceof MediaSizeName)) { + throw new RuntimeException("Test media not found"); + } + return (MediaSizeName) testMedia; + } + + private static PageFormat createTestPageFormat(MediaSizeName testMedia, PrintService printService) { + MediaSize ms = MediaSize.getMediaSizeForName(testMedia); + if (ms == null) { + throw new RuntimeException("Media size not defined"); + } + + MediaPrintableArea mpa = getMaximumMediaPrintableArea(testMedia, ms, printService); + if (mpa == null) { + throw new RuntimeException("Media printable area not defined"); + } + + PageFormat pageFormat = new PageFormat(); + pageFormat.setOrientation(PageFormat.PORTRAIT); + Paper paper = new Paper(); + paper.setSize(ms.getX(MediaSize.INCH) * DPI, ms.getY(MediaSize.INCH) * DPI); + paper.setImageableArea(mpa.getX(MediaPrintableArea.INCH) * DPI, + mpa.getY(MediaPrintableArea.INCH) * DPI, + mpa.getWidth(MediaPrintableArea.INCH) * DPI, + mpa.getHeight(MediaPrintableArea.INCH) * DPI); + pageFormat.setPaper(paper); + return pageFormat; + } + + private static MediaPrintableArea getMaximumMediaPrintableArea(MediaSizeName msn, MediaSize ms, + PrintService printService) { + final float paperSizeX = ms.getX(Size2DSyntax.MM); + final float paperSizeY = ms.getY(Size2DSyntax.MM); + final float sizeDev = 0.2f; + + PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet(); + attrs.add(msn); + MediaPrintableArea[] mpas = (MediaPrintableArea[]) printService + .getSupportedAttributeValues(MediaPrintableArea.class, null, attrs); + if (mpas == null || mpas.length == 0) { + throw new RuntimeException("Printable area not found"); + } + + MediaPrintableArea mpa = null; + for (MediaPrintableArea area : mpas) { + float mpaSize = area.getWidth(MediaPrintableArea.MM) * area.getHeight(MediaPrintableArea.MM); + //do not use borderless printable area + if (sizeDev >= Math.abs(paperSizeX - area.getWidth(MediaPrintableArea.MM)) && + sizeDev >= Math.abs(paperSizeY - area.getHeight(MediaPrintableArea.MM))) { + continue; + } + if (mpa == null) { + mpa = area; + } else if (mpaSize > (area.getWidth(MediaPrintableArea.MM) * area.getHeight(MediaPrintableArea.MM))) { + mpa = area; + } + } + return mpa; + } + + private static double inchesToMM(double inches) { + return inches / MM_PER_INCH; + } + + private static void addGridBagComponent(JPanel p, Component c, int y) { + GridBagConstraints constraints = new GridBagConstraints(); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.insets = new Insets(4, 4, 4, 4); + constraints.gridx = 0; + constraints.gridy = y; + p.add(c, constraints); + } + + private static class RectPrintable implements Printable { + + @Override + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { + if (pageIndex == 0) { + Graphics2D g = (Graphics2D) graphics; + g.setStroke(new BasicStroke(3)); + g.drawRect((int) pageFormat.getImageableX(), (int) pageFormat.getImageableY(), + (int) pageFormat.getImageableWidth(), (int) pageFormat.getImageableHeight()); + return PAGE_EXISTS; + } + return NO_SUCH_PAGE; + } + } + + private static class TestServiceData { + + final PrintService printService; + final MediaSizeName mediaSizeName; + final PageFormat pageFormat; + + private TestServiceData(PrintService printService, MediaSizeName mediaSizeName, PageFormat pageFormat) { + this.printService = printService; + this.mediaSizeName = mediaSizeName; + this.pageFormat = pageFormat; + } + } +} diff --git a/test/jdk/javax/swing/JPopupMenu/FocusablePopupDismissTest.java b/test/jdk/javax/swing/JPopupMenu/FocusablePopupDismissTest.java index 2704c9789e3..cb3811265dc 100644 --- a/test/jdk/javax/swing/JPopupMenu/FocusablePopupDismissTest.java +++ b/test/jdk/javax/swing/JPopupMenu/FocusablePopupDismissTest.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 @@ -24,22 +24,28 @@ /* * @test * @key headful - * @bug 8319103 + * @bug 8319103 8342096 * @requires (os.family == "linux") - * @library /java/awt/regtesthelpers - * @build PassFailJFrame + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame jtreg.SkippedException * @summary Tests if the focusable popup can be dismissed when the parent * window or the popup itself loses focus in Wayland. * @run main/manual FocusablePopupDismissTest */ +import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JTextField; import java.awt.Window; import java.util.List; +import jtreg.SkippedException; + public class FocusablePopupDismissTest { private static final String INSTRUCTIONS = """ A frame with a "Click me" button should appear next to the window @@ -47,44 +53,72 @@ public class FocusablePopupDismissTest { Click on the "Click me" button. - If the JTextField popup with "Some text" is not showing on the screen, - click Fail. + A menu should appear next to the window. If you move the cursor over + the first menu, the JTextField popup should appear on the screen. + If it doesn't, click Fail. The following steps require some focusable system window to be displayed on the screen. This could be a system settings window, file manager, etc. Click on the "Click me" button if the popup is not displayed - on the screen. + on the screen, move the mouse pointer over the menu. While the popup is displayed, click on some other window on the desktop. - If the popup has disappeared, click Pass, otherwise click Fail. + If the popup does not disappear, click Fail. + + Open the menu again, move the mouse cursor over the following: + "Focusable 1" -> "Focusable 2" -> "Editor Focusable 2" + Move the mouse to the focusable system window + (keeping the "Editor Focusable 2" JTextField open) and click on it. + + If the popup does not disappear, click Fail, otherwise click Pass. """; public static void main(String[] args) throws Exception { if (System.getenv("WAYLAND_DISPLAY") == null) { - //test is valid only when running on Wayland. - return; + throw new SkippedException("XWayland only test"); } PassFailJFrame.builder() .title("FocusablePopupDismissTest") .instructions(INSTRUCTIONS) - .rows(20) .columns(45) .testUI(FocusablePopupDismissTest::createTestUI) .build() .awaitAndCheck(); } + static JMenu getMenuWithMenuItem(boolean isSubmenuItemFocusable, String text) { + JMenu menu = new JMenu(text); + menu.add(isSubmenuItemFocusable + ? new JTextField("Editor " + text, 11) + : new JMenuItem("Menu item" + text) + ); + return menu; + } + static List createTestUI() { JFrame frame = new JFrame("FocusablePopupDismissTest"); JButton button = new JButton("Click me"); - frame.add(button); + + JPanel wrapper = new JPanel(); + wrapper.setBorder(BorderFactory.createEmptyBorder(16, 16, 16, 16)); + wrapper.add(button); + + frame.add(wrapper); button.addActionListener(e -> { JPopupMenu popupMenu = new JPopupMenu(); - JTextField textField = new JTextField("Some text", 10); - popupMenu.add(textField); + + JMenu menu1 = new JMenu("Menu 1"); + menu1.add(new JTextField("Some text", 10)); + JMenu menu2 = new JMenu("Menu 2"); + menu2.add(new JTextField("Some text", 10)); + + popupMenu.add(getMenuWithMenuItem(true, "Focusable 1")); + popupMenu.add(getMenuWithMenuItem(true, "Focusable 2")); + popupMenu.add(getMenuWithMenuItem(false, "Non-Focusable 1")); + popupMenu.add(getMenuWithMenuItem(false, "Non-Focusable 2")); popupMenu.show(button, 0, button.getHeight()); }); frame.pack(); diff --git a/test/jdk/javax/swing/JPopupMenu/NestedFocusablePopupTest.java b/test/jdk/javax/swing/JPopupMenu/NestedFocusablePopupTest.java new file mode 100644 index 00000000000..55963b081a5 --- /dev/null +++ b/test/jdk/javax/swing/JPopupMenu/NestedFocusablePopupTest.java @@ -0,0 +1,187 @@ +/* + * 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 tests if nested menu is displayed on Wayland + * @requires (os.family == "linux") + * @key headful + * @bug 8342096 + * @library /test/lib + * @build jtreg.SkippedException + * @run main NestedFocusablePopupTest + */ + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.IllegalComponentStateException; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.FutureTask; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import jtreg.SkippedException; + +public class NestedFocusablePopupTest { + + static volatile JMenu menuWithFocusableItem; + static volatile JMenu menuWithNonFocusableItem; + static volatile JPopupMenu popupMenu; + static volatile JFrame frame; + static volatile Robot robot; + + public static void main(String[] args) throws Exception { + if (System.getenv("WAYLAND_DISPLAY") == null) { + throw new SkippedException("XWayland only test"); + } + + robot = new Robot(); + robot.setAutoDelay(50); + + try { + SwingUtilities.invokeAndWait(NestedFocusablePopupTest::initAndShowGui); + test0(); + test1(); + } finally { + SwingUtilities.invokeAndWait(frame::dispose); + } + } + + public static void waitTillShown(final Component component, long msTimeout) + throws InterruptedException, TimeoutException { + long startTime = System.currentTimeMillis(); + + while (true) { + try { + Thread.sleep(50); + component.getLocationOnScreen(); + break; + } catch (IllegalComponentStateException e) { + if (System.currentTimeMillis() - startTime > msTimeout) { + throw new TimeoutException("Component not shown within the specified timeout"); + } + } + } + } + + static Rectangle waitAndGetOnScreenBoundsOnEDT(Component component) + throws InterruptedException, TimeoutException, ExecutionException { + waitTillShown(component, 500); + robot.waitForIdle(); + + FutureTask task = new FutureTask<>(() + -> new Rectangle(component.getLocationOnScreen(), component.getSize())); + SwingUtilities.invokeLater(task); + return task.get(500, TimeUnit.MILLISECONDS); + } + + static void test0() throws Exception { + Rectangle frameBounds = waitAndGetOnScreenBoundsOnEDT(frame); + robot.mouseMove(frameBounds.x + frameBounds.width / 2, + frameBounds.y + frameBounds.height / 2); + + robot.mousePress(InputEvent.BUTTON3_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK); + + Rectangle menuBounds = waitAndGetOnScreenBoundsOnEDT(menuWithFocusableItem); + robot.mouseMove(menuBounds.x + 5, menuBounds.y + 5); + + // Give popup some time to disappear (in case of failure) + robot.waitForIdle(); + robot.delay(200); + + try { + waitTillShown(popupMenu, 500); + } catch (TimeoutException e) { + throw new RuntimeException("The popupMenu disappeared when it shouldn't have."); + } + } + + static void test1() throws Exception { + Rectangle frameBounds = waitAndGetOnScreenBoundsOnEDT(frame); + robot.mouseMove(frameBounds.x + frameBounds.width / 2, + frameBounds.y + frameBounds.height / 2); + + robot.mousePress(InputEvent.BUTTON3_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK); + + Rectangle menuBounds = waitAndGetOnScreenBoundsOnEDT(menuWithFocusableItem); + robot.mouseMove(menuBounds.x + 5, menuBounds.y + 5); + robot.waitForIdle(); + robot.delay(200); + + menuBounds = waitAndGetOnScreenBoundsOnEDT(menuWithNonFocusableItem); + robot.mouseMove(menuBounds.x + 5, menuBounds.y + 5); + + // Give popup some time to disappear (in case of failure) + robot.waitForIdle(); + robot.delay(200); + + try { + waitTillShown(popupMenu, 500); + } catch (TimeoutException e) { + throw new RuntimeException("The popupMenu disappeared when it shouldn't have."); + } + } + + static JMenu getMenuWithMenuItem(boolean isSubmenuItemFocusable, String text) { + JMenu menu = new JMenu(text); + menu.add(isSubmenuItemFocusable + ? new JButton(text) + : new JMenuItem(text) + ); + return menu; + } + + private static void initAndShowGui() { + frame = new JFrame("NestedFocusablePopupTest"); + JPanel panel = new JPanel(); + panel.setPreferredSize(new Dimension(200, 180)); + + + popupMenu = new JPopupMenu(); + menuWithFocusableItem = + getMenuWithMenuItem(true, "focusable subitem"); + menuWithNonFocusableItem = + getMenuWithMenuItem(false, "non-focusable subitem"); + + popupMenu.add(menuWithFocusableItem); + popupMenu.add(menuWithNonFocusableItem); + + panel.setComponentPopupMenu(popupMenu); + frame.add(panel); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } +} diff --git a/test/jdk/javax/swing/JProgressBar/TestProgressBarUI.java b/test/jdk/javax/swing/JProgressBar/TestProgressBarUI.java new file mode 100644 index 00000000000..0091fe625c9 --- /dev/null +++ b/test/jdk/javax/swing/JProgressBar/TestProgressBarUI.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. + */ + +/* + * @test + * @bug 8318577 + * @summary Tests JProgressBarUI renders correctly in Windows L&F + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestProgressBarUI + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; + +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +public class TestProgressBarUI { + + private static final String instructionsText = """ + Two progressbar "Good" and "Bad" + will be shown with different preferred size, + If the "Bad" progressbar is rendered at the same + height as "Good" progressbar, + without any difference in padding internally + the test passes, otherwise fails. """; + + public static void main(String[] args) throws Exception { + System.setProperty("sun.java2d.uiScale", "2.0"); + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + PassFailJFrame.builder() + .title("ProgressBar Instructions") + .instructions(instructionsText) + .rows(9) + .columns(36) + .testUI(TestProgressBarUI::doTest) + .build() + .awaitAndCheck(); + } + + public static JFrame doTest() { + JFrame frame = new JFrame("JProgressBar"); + + JPanel panel = new JPanel(new FlowLayout(20, 20, FlowLayout.LEADING)); + panel.setBackground(Color.white); + + JProgressBar p1 = new JProgressBar(0, 100); + p1.setValue(50); + p1.setStringPainted(true); + p1.setString("GOOD"); + p1.setPreferredSize(new Dimension(100, 21)); + panel.add(p1); + + JProgressBar p2 = new JProgressBar(0, 100); + p2.setValue(50); + p2.setStringPainted(true); + p2.setString("BAD"); + + p2.setPreferredSize(new Dimension(100, 22)); + panel.add(p2); + + JComponent c = (JComponent) frame.getContentPane(); + c.add(panel, BorderLayout.CENTER); + + frame.pack(); + frame.setLocationByPlatform(true); + return frame; + } +} diff --git a/test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.java b/test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.java index e1790e6e174..48886db87c6 100644 --- a/test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.java +++ b/test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.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 @@ -68,14 +68,11 @@ public class CheckCSMs { // The goal is to remove this list of Non-final instance @CS methods // over time. Do not add any new one to this list. - private static final Set KNOWN_NON_FINAL_CSMS = - Set.of("java/lang/Runtime#load (Ljava/lang/String;)V", - "java/lang/Runtime#loadLibrary (Ljava/lang/String;)V" - ); + private static final Set KNOWN_NON_FINAL_CSMS = Set.of(); // These non-static non-final methods must not have @CallerSensitiveAdapter // methods that takes an additional caller class parameter. - private static Set UNSUPPORTED_VIRTUAL_METHODS = Set.of(); + private static final Set UNSUPPORTED_VIRTUAL_METHODS = Set.of(); public static void main(String[] args) throws Exception { if (args.length > 0 && args[0].equals("--list")) { diff --git a/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamAvailable.java b/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamAvailable.java index 07f796d47d3..e4eaccc0057 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamAvailable.java +++ b/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamAvailable.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Alibaba Group Holding Limited. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +24,7 @@ /** * @test TestChunkInputStreamAvailable - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestChunkInputStreamAvailable diff --git a/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamBulkRead.java b/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamBulkRead.java index 15bf1b7707c..5733f2f0cf6 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamBulkRead.java +++ b/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamBulkRead.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Palantir Technologies, Inc. and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +24,7 @@ /** * @test TestChunkInputStreamBulkRead - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestChunkInputStreamBulkRead diff --git a/test/jdk/jdk/jfr/api/consumer/TestFieldAccess.java b/test/jdk/jdk/jfr/api/consumer/TestFieldAccess.java index 3a35ca6d751..bb2e145467c 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestFieldAccess.java +++ b/test/jdk/jdk/jfr/api/consumer/TestFieldAccess.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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestFieldAccess diff --git a/test/jdk/jdk/jfr/api/consumer/TestGetStackTrace.java b/test/jdk/jdk/jfr/api/consumer/TestGetStackTrace.java index fa26270cceb..9dcdfaf84e0 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestGetStackTrace.java +++ b/test/jdk/jdk/jfr/api/consumer/TestGetStackTrace.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 @@ -42,7 +42,7 @@ /** * @test * @summary Verifies that a recorded JFR event has the correct stack trace info - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestGetStackTrace diff --git a/test/jdk/jdk/jfr/api/consumer/TestHiddenMethod.java b/test/jdk/jdk/jfr/api/consumer/TestHiddenMethod.java index ad68e016a1a..969016ebf35 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestHiddenMethod.java +++ b/test/jdk/jdk/jfr/api/consumer/TestHiddenMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, 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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @library /test/lib diff --git a/test/jdk/jdk/jfr/api/consumer/TestMethodGetModifiers.java b/test/jdk/jdk/jfr/api/consumer/TestMethodGetModifiers.java index 9b5505c55de..d98fbdfcfd5 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestMethodGetModifiers.java +++ b/test/jdk/jdk/jfr/api/consumer/TestMethodGetModifiers.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 @@ -40,7 +40,7 @@ /** * @test * @summary Verifies that a recorded method has the correct modifier - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xint jdk.jfr.api.consumer.TestMethodGetModifiers diff --git a/test/jdk/jdk/jfr/api/consumer/TestReadTwice.java b/test/jdk/jdk/jfr/api/consumer/TestReadTwice.java index 97ef76ece85..8990ffaa03d 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestReadTwice.java +++ b/test/jdk/jdk/jfr/api/consumer/TestReadTwice.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 @@ -37,7 +37,7 @@ /** * @test * @summary Reads the recorded file two times and verifies that both reads are the same - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestReadTwice diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java index 19c63704919..003e8c91edd 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java @@ -35,7 +35,7 @@ /** * @test * @summary Verifies methods of RecordedClass - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedClass diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedClassLoader.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedClassLoader.java index a7b03149ce9..f58c4051d3c 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedClassLoader.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedClassLoader.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 @@ -37,7 +37,7 @@ /** * @test * @summary Verifies the methods of the RecordedClassLoader - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedClassLoader diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedEvent.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedEvent.java index 9223d2ef5ad..1bfeb8accec 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedEvent.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedEvent.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 @@ -38,7 +38,7 @@ /** * @test * @summary Verifies the methods of the RecordedEvent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedEvent diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThread.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThread.java index d3d581bc374..f05846b7284 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThread.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThread.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 @@ -35,7 +35,7 @@ /** * @test * @summary Tests that the RecordedEvent.getThread() returns th expected info - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedEventGetThread diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThreadOther.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThreadOther.java index daaec8c0557..2e5e767b0e1 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThreadOther.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThreadOther.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 @@ -37,7 +37,7 @@ /** * @test * @summary Tests that the RecordedEvent.getThread() returns th expected info - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedEventGetThreadOther diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedFrame.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedFrame.java index 611ed0e688f..2e6abd960a8 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedFrame.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedFrame.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 @@ -39,7 +39,7 @@ /** * @test * @summary Simple test for RecordedFrame APIs - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedFrame diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedFrameType.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedFrameType.java index a44bdd371f0..c988f37bd0b 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedFrameType.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedFrameType.java @@ -39,7 +39,7 @@ /** * @test * @summary Test jdk.jfr.consumer.RecordedFrame::getType() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.compiler1.enabled * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedFullStackTrace.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedFullStackTrace.java index 18fcb300382..75069329811 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedFullStackTrace.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedFullStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedFullStackTrace diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedInstantEventTimestamp.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedInstantEventTimestamp.java index 8c37fe8743b..c4f2966d40a 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedInstantEventTimestamp.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedInstantEventTimestamp.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 @@ -34,7 +34,7 @@ /** * @test * @summary Tests that an instant event gets recorded with its start time equal to its end time - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedInstantEventTimestamp diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedMethodDescriptor.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedMethodDescriptor.java index 884697c26a5..a8020354396 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedMethodDescriptor.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedMethodDescriptor.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 @@ -41,7 +41,7 @@ /** * @test * @summary Verifies that the method descriptor is correct - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedMethodDescriptor diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedObject.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedObject.java index 17878ff7e6c..772a0ca6419 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedObject.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedObject.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 @@ -49,7 +49,7 @@ /** * @test * @summary Verifies the methods of the RecordedObject - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedObject diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedThreadGroupParent.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedThreadGroupParent.java index dae9b8fc11a..e5b40a34d1e 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedThreadGroupParent.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedThreadGroupParent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -34,7 +34,7 @@ /** * @test * @summary Tests getParent method in RecordedThreadGroup - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedThreadGroupParent diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java b/test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java index a81262f9405..5aeee69cadc 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordingFile.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 @@ -50,7 +50,7 @@ /** * @test * @summary Verifies that all methods in RecordingFIle are working - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr*=info jdk.jfr.api.consumer.TestRecordingFile diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordingFileReadEventEof.java b/test/jdk/jdk/jfr/api/consumer/TestRecordingFileReadEventEof.java index 1c98f293c24..c92b2362ce4 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordingFileReadEventEof.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordingFileReadEventEof.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 @@ -34,7 +34,7 @@ /** * @test * @summary Verifies that RecordingFile.readEvent() throws EOF when past the last record - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordingFileReadEventEof diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordingFileSanitization.java b/test/jdk/jdk/jfr/api/consumer/TestRecordingFileSanitization.java index 75e01f82cd4..dfa39b4ad85 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordingFileSanitization.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordingFileSanitization.java @@ -35,7 +35,7 @@ /** * @test * @summary Verifies that all traces of sensitive data is removed - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordingFileSanitization diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordingFileWrite.java b/test/jdk/jdk/jfr/api/consumer/TestRecordingFileWrite.java index f4cf5a20805..5fc0dab0d30 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordingFileWrite.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordingFileWrite.java @@ -39,7 +39,7 @@ /** * @test * @summary Tests RecordingFile::write(Path, Predicate) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordingFileWrite diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordingInternals.java b/test/jdk/jdk/jfr/api/consumer/TestRecordingInternals.java index 75513f5b7b4..efa36c79987 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordingInternals.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordingInternals.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 @@ -33,7 +33,7 @@ /** * @test * @summary Tests that chunks are read in order and constant pools from multiple chunks can be read - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordingInternals diff --git a/test/jdk/jdk/jfr/api/consumer/TestSingleRecordedEvent.java b/test/jdk/jdk/jfr/api/consumer/TestSingleRecordedEvent.java index f8bd63b915a..1580647b43c 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestSingleRecordedEvent.java +++ b/test/jdk/jdk/jfr/api/consumer/TestSingleRecordedEvent.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 @@ -35,7 +35,7 @@ /** * @test * @summary Verifies that a single JFR event is recorded as expected - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestSingleRecordedEvent diff --git a/test/jdk/jdk/jfr/api/consumer/TestToString.java b/test/jdk/jdk/jfr/api/consumer/TestToString.java index 3c363176624..7f75a55e0f1 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestToString.java +++ b/test/jdk/jdk/jfr/api/consumer/TestToString.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 @@ -35,7 +35,7 @@ /** * @test * @summary Sanity checks that RecordedEvent#toString returns something valid - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestToString diff --git a/test/jdk/jdk/jfr/api/consumer/TestValueDescriptorRecorded.java b/test/jdk/jdk/jfr/api/consumer/TestValueDescriptorRecorded.java index 4fc90c10cf1..aa6ac255ba0 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestValueDescriptorRecorded.java +++ b/test/jdk/jdk/jfr/api/consumer/TestValueDescriptorRecorded.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 @@ -38,7 +38,7 @@ /** * @test * @summary Verifies that the recorded value descriptors are correct - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestValueDescriptorRecorded diff --git a/test/jdk/jdk/jfr/api/consumer/filestream/TestMultipleChunk.java b/test/jdk/jdk/jfr/api/consumer/filestream/TestMultipleChunk.java index d0fed7477eb..5efe2031614 100644 --- a/test/jdk/jdk/jfr/api/consumer/filestream/TestMultipleChunk.java +++ b/test/jdk/jdk/jfr/api/consumer/filestream/TestMultipleChunk.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 @@ -34,7 +34,7 @@ /** * @test * @summary Verifies that it is possible to stream contents from a multichunked file - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.filestream.TestMultipleChunk diff --git a/test/jdk/jdk/jfr/api/consumer/filestream/TestOrdered.java b/test/jdk/jdk/jfr/api/consumer/filestream/TestOrdered.java index 58f23350dd0..a2c127afdce 100644 --- a/test/jdk/jdk/jfr/api/consumer/filestream/TestOrdered.java +++ b/test/jdk/jdk/jfr/api/consumer/filestream/TestOrdered.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 @@ -40,7 +40,7 @@ /** * @test * @summary Test EventStream::setOrdered(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.filestream.TestOrdered diff --git a/test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.java b/test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.java index ff26fd7269d..7d34f00c891 100644 --- a/test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.java +++ b/test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.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 @@ -39,7 +39,7 @@ /** * @test * @summary Test EventStream::setReuse(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.filestream.TestReuse diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestContent.java b/test/jdk/jdk/jfr/api/consumer/log/TestContent.java index c6ef6f960f5..75a2b98ac96 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestContent.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestContent.java @@ -32,7 +32,7 @@ * @test * @summary Tests that the event payload is printed when using * -Xlog:jfr+event=trace - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestDiskOnOff.java b/test/jdk/jdk/jfr/api/consumer/log/TestDiskOnOff.java index 0f8f0cf3ba7..220820e3c99 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestDiskOnOff.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestDiskOnOff.java @@ -27,7 +27,7 @@ /** * @test * @summary Tests that event logging can't be turned on and off - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestDynamicStart.java b/test/jdk/jdk/jfr/api/consumer/log/TestDynamicStart.java index b24e96c53bb..e598d4302a1 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestDynamicStart.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestDynamicStart.java @@ -35,7 +35,7 @@ * @test * @summary Tests that log responds to log level changes after JVM has * started - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestMemoryDiskTransition.java b/test/jdk/jdk/jfr/api/consumer/log/TestMemoryDiskTransition.java index 133318e837d..6ffb22a38eb 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestMemoryDiskTransition.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestMemoryDiskTransition.java @@ -27,7 +27,7 @@ /** * @test * @summary Tests that transition between disk=true/false works - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestMemoryOnly.java b/test/jdk/jdk/jfr/api/consumer/log/TestMemoryOnly.java index d9faa0805ff..618dbaffad8 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestMemoryOnly.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestMemoryOnly.java @@ -27,7 +27,7 @@ /** * @test * @summary Tests that a stream is not started if disk=false - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestSystemEvents.java b/test/jdk/jdk/jfr/api/consumer/log/TestSystemEvents.java index 01b57ed3275..8d90684e523 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestSystemEvents.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestSystemEvents.java @@ -30,7 +30,7 @@ /** * @test * @summary Tests that only system events are emitted - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestTruncation.java b/test/jdk/jdk/jfr/api/consumer/log/TestTruncation.java index 84075053793..d2f6bf5b051 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestTruncation.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestTruncation.java @@ -31,7 +31,7 @@ /** * @test * @summary Tests that large output is truncated - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestUserEvents.java b/test/jdk/jdk/jfr/api/consumer/log/TestUserEvents.java index a6d2074645b..62feb2b9dbd 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestUserEvents.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestUserEvents.java @@ -30,7 +30,7 @@ /** * @test * @summary Tests that only user events are emitted - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestVerbosity.java b/test/jdk/jdk/jfr/api/consumer/log/TestVerbosity.java index 0533a0177f3..841f990a8d3 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestVerbosity.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestVerbosity.java @@ -32,7 +32,7 @@ /** * @test * @summary Tests output from various tag sets and levels - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestWithStreaming.java b/test/jdk/jdk/jfr/api/consumer/log/TestWithStreaming.java index fc5cd7b4fe0..78b4e959182 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestWithStreaming.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestWithStreaming.java @@ -35,7 +35,7 @@ /** * @test * @summary Checks that it is possible to stream together with log stream - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestAwaitTermination.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestAwaitTermination.java index 6d99f9dbb69..4477dc4f901 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestAwaitTermination.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestAwaitTermination.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 @@ -32,7 +32,7 @@ /** * @test * @summary Test RecordingStream::awaitTermination(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestAwaitTermination diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestBasics.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestBasics.java index 1dbfeefa968..3adbbd1af43 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestBasics.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestBasics.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 @@ -31,7 +31,7 @@ /** * @test * @summary Basic/sanity test for JFR event streaming - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestBasics diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestClose.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestClose.java index 8b3fbe88b90..c7e6c6e5922 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestClose.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestClose.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 @@ -35,7 +35,7 @@ /** * @test * @summary Tests RecordingStream::close() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -Xlog:jfr+streaming+system=trace jdk.jfr.api.consumer.recordingstream.TestClose diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestConstructor.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestConstructor.java index 5cfc21d698c..0597300d83f 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestConstructor.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestConstructor.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 @@ -33,7 +33,7 @@ /** * @test * @summary Tests RecordingStream::RecordingStream() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestConstructor diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDisable.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDisable.java index e0eccf9198e..73345f346e3 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDisable.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDisable.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 @@ -33,7 +33,7 @@ /** * @test * @summary Tests RecordingStream::disable(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestDisable diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDump.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDump.java index 86c131aa246..cf4dad5477e 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDump.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDump.java @@ -41,7 +41,7 @@ /** * @test * @summary Tests RecordingStream::dump(Path) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestDump diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestEnable.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestEnable.java index 27ca64b7907..cde7d74ae08 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestEnable.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestEnable.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 @@ -33,7 +33,7 @@ /** * @test * @summary Tests RecordingStream::enable(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestEnable diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestMaxAge.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestMaxAge.java index 8803272e919..64dbfa4173b 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestMaxAge.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestMaxAge.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 @@ -31,7 +31,7 @@ /** * @test * @summary Tests RecordingStream::setMaxAge(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestMaxAge diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnClose.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnClose.java index 98405118232..3da0c62b8c8 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnClose.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnClose.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 @@ -32,7 +32,7 @@ /** * @test * @summary Tests RecordingStream::onClose(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestOnClose diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorAsync.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorAsync.java index 7939a634d4d..4e7effae9a2 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorAsync.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorAsync.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 @@ -36,7 +36,7 @@ * @test * @summary Tests RecordingStream::onError(...) when using * RecordingStream:startAsync - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestOnErrorAsync diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorSync.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorSync.java index 2936070c3bf..4bf0ed0f6f6 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorSync.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorSync.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 @@ -36,7 +36,7 @@ /** * @test * @summary Tests RecordingStream::onError(...) when using RecordingStream:start - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestOnErrorSync diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnEvent.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnEvent.java index 390df2a2f56..fa655539399 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnEvent.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnEvent.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 @@ -32,7 +32,7 @@ /** * @test * @summary Tests RecordingStream::onEvent(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -Xlog:jfr+system+streaming=debug jdk.jfr.api.consumer.recordingstream.TestOnEvent diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnFlush.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnFlush.java index d8951102749..5f623f7ae5c 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnFlush.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnFlush.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 @@ -31,7 +31,7 @@ /** * @test * @summary Tests RecordingStream::onFlush(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestOnFlush diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnMetadata.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnMetadata.java index 79ca6634454..e8085736613 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnMetadata.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, 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 @@ -46,7 +46,7 @@ /** * @test * @summary Tests RecordingStream::onMetadata(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestOnMetadata diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecordingName.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecordingName.java index 813150e0d19..18f23375478 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecordingName.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecordingName.java @@ -31,7 +31,7 @@ * @test * @bug 8257424 * @summary Tests recording name for RecordingStrream -* @key jfr +* @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestRecordingName diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecursive.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecursive.java index fb62d62b6c9..49cc9fc644f 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecursive.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecursive.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, 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 @@ -37,7 +37,7 @@ /** * @test * @summary Tests that events are not emitted in handlers - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @build jdk.jfr.api.consumer.recordingstream.EventProducer diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRemove.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRemove.java index fc4ca6e272e..d8d0aeacfa0 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRemove.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRemove.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 @@ -35,7 +35,7 @@ /** * @test * @summary Tests RecordingStrream::remove(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestRemove diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetEndTime.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetEndTime.java index 478e7a7f77e..1e7a630e084 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetEndTime.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetEndTime.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 @@ -44,7 +44,7 @@ /** * @test * @summary Tests EventStream::setEndTime - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps jdk.jfr.api.consumer.recordingstream.TestSetEndTime diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxAge.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxAge.java index b8c2674e5c1..80e05a6995c 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxAge.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxAge.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 @@ -31,7 +31,7 @@ /** * @test * @summary Tests RecordingStrream::setMaxAge - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestSetMaxAge diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxSize.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxSize.java index 8b350084e48..764082b2f9e 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxSize.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxSize.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 @@ -29,7 +29,7 @@ /** * @test * @summary Tests RecordingStrream::setMaxSize -* @key jfr +* @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestSetMaxSize diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetSettings.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetSettings.java index 9f55c26540b..e9cc19734e3 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetSettings.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetSettings.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 @@ -35,7 +35,7 @@ /** * @test * @summary Tests RecordingStream::setSettings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr+system+parser jdk.jfr.api.consumer.recordingstream.TestSetSettings diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetStartTime.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetStartTime.java index 06b28aaa79c..95807cb2deb 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetStartTime.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetStartTime.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 @@ -38,7 +38,7 @@ /** * @test * @summary Tests EventStream::setStartTime - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestSetStartTime diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStart.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStart.java index 719411b2fa0..f14d2cdceec 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStart.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStart.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 @@ -32,7 +32,7 @@ /** * @test * @summary Tests RecordingStream::start() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @build jdk.jfr.api.consumer.recordingstream.EventProducer diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStartAsync.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStartAsync.java index 362fd130115..087b55801cd 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStartAsync.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStartAsync.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 @@ -31,7 +31,7 @@ /** * @test * @summary Tests RecordingStream::startAsync() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestStartAsync diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStop.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStop.java index 36bbaa3c557..5f23943e6cb 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStop.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStop.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -37,7 +37,7 @@ /** * @test * @summary Tests RecordingStream::stop() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @build jdk.jfr.api.consumer.recordingstream.EventProducer diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStoppedRecording.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStoppedRecording.java index c0593f4d97b..a8bcb7f3368 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStoppedRecording.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStoppedRecording.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 @@ -33,7 +33,7 @@ * @test * @summary Tests that a RecordingStream is closed if the underlying Recording * is stopped. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestStoppedRecording diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryAfterStart.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryAfterStart.java index 6c4e5b80615..2e0aceb3825 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryAfterStart.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryAfterStart.java @@ -32,7 +32,7 @@ * @test * @summary Test that it is possible to start a stream against a directory, * specified on command, line before the application starts - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.streaming.Application diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryBeforeStart.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryBeforeStart.java index 10f87402778..180a0098843 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryBeforeStart.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryBeforeStart.java @@ -32,7 +32,7 @@ * @test * @summary Test that it is possible to start a stream against a directory, * specified on command line, after the application starts - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.streaming.Application diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryLastModified.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryLastModified.java index 2ca1c474acc..6a9e8376ed2 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryLastModified.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryLastModified.java @@ -31,7 +31,7 @@ /** * @test * @summary Test that a stream starts against the latest created repository - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.streaming.Application diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryMultipleProcesses.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryMultipleProcesses.java index 6bda427b387..95f6c5d4e59 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryMultipleProcesses.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryMultipleProcesses.java @@ -33,7 +33,7 @@ * @summary Test that it is possible to start a stream against a directory, * specified on command line, where multiple processes starts * simultaneously - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.streaming.Application diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestChunkGap.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestChunkGap.java index 052914f08db..bf5507815d6 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestChunkGap.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestChunkGap.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 @@ -35,7 +35,7 @@ * @test * @summary Tests that a stream can gracefully handle chunk being removed in the * middle - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestChunkGap diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.java index 313b5f026e1..b4bc1fec8f8 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.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 @@ -42,7 +42,7 @@ * @test * @summary Test scenario where JFR event producer is in a different process * with respect to the JFR event stream consumer. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.attach diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestEmptyChunks.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestEmptyChunks.java index 15de9597d63..76940a99775 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestEmptyChunks.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestEmptyChunks.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 @@ -32,7 +32,7 @@ /** * @test * @summary Test that it is possible to iterate over chunk without normal events - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestEmptyChunks diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestEnableEvents.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestEnableEvents.java index 6e68872c464..99df63105a2 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestEnableEvents.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestEnableEvents.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 @@ -35,7 +35,7 @@ * @test * @summary Verifies that it is possible to stream contents from specified event * settings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestEventRegistration.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestEventRegistration.java index 1934f4802af..d61fb197f75 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestEventRegistration.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestEventRegistration.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 @@ -33,7 +33,7 @@ /** * @test * @summary Test that it is possible to register new metadata in a chunk - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestEventRegistration diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java index 18bfa57a4b1..423e3969af8 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.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 @@ -31,7 +31,7 @@ /** * @test * @summary Test that it is possible to iterate over chunk with normal events - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestFilledChunks diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestFiltering.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestFiltering.java index a591faf3444..d493a4475be 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestFiltering.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestFiltering.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 @@ -32,7 +32,7 @@ /** * @test * @summary Verifies that it is possible to filter a stream for an event - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestFiltering diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestInProcessMigration.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestInProcessMigration.java index 955226ec3fb..5b9aeb50fa2 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestInProcessMigration.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestInProcessMigration.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 @@ -38,7 +38,7 @@ * @test * @summary Verifies that is possible to stream from an in-process repository * that is being moved. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.consumer.streaming.TestInProcessMigration diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMCrash.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMCrash.java index e1a95380477..3586421d41e 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMCrash.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMCrash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, 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 @@ -31,7 +31,7 @@ /** * @test * @summary Test that a stream ends/closes when an application crashes. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr jdk.attach java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMExit.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMExit.java index 27dfb0224c1..9485919c8e3 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMExit.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMExit.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 @@ -30,7 +30,7 @@ /** * @test * @summary Test that a stream ends/closes when an application exists. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr jdk.attach java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestLatestEvent.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestLatestEvent.java index 4515ae9832a..43c0559d473 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestLatestEvent.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestLatestEvent.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 @@ -44,7 +44,7 @@ /** * @test * @summary Verifies that EventStream::openRepository() read from the latest flush - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestLatestEvent diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestOutOfProcessMigration.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestOutOfProcessMigration.java index a21d5a3fda4..0067467cf1b 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestOutOfProcessMigration.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestOutOfProcessMigration.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 @@ -36,7 +36,7 @@ * @test * @summary Verifies that a out-of-process stream is closed when the repository * is changed. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr jdk.attach java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestRecordingBefore.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestRecordingBefore.java index e79b6de6738..c5eca13cef4 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestRecordingBefore.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestRecordingBefore.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 @@ -34,7 +34,7 @@ * @test * @summary Verifies that it is possible to start a stream when there are * already chunk in the repository - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestRecordingBefore diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestRemovedChunks.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestRemovedChunks.java index 05a8d8c5e51..f279f3acdfd 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestRemovedChunks.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestRemovedChunks.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 @@ -32,7 +32,7 @@ /** * @test * @summary Tests that a stream can gracefully handle chunk being removed - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr*=info jdk.jfr.api.consumer.streaming.TestRemovedChunks diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryProperty.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryProperty.java index e1fa206477f..e5151e8a496 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryProperty.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryProperty.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 @@ -39,7 +39,7 @@ * @test * @summary Verifies that it is possible to access JFR repository from a system * property - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.attach diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java index baae06b8ec7..fbc27b051b0 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.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 @@ -36,7 +36,7 @@ * @test * @summary Verifies that it is possible to stream contents of ongoing * recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr+system+streaming=trace diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestStartSingleChunk.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestStartSingleChunk.java index b97c8a76453..92eeb5282c4 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestStartSingleChunk.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestStartSingleChunk.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 @@ -34,7 +34,7 @@ * @test * @summary Verifies that it is possible to stream contents of ongoing * recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr+system+streaming=trace diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestUnstarted.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestUnstarted.java index 998a8681519..1e947c092ed 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestUnstarted.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestUnstarted.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 @@ -29,7 +29,7 @@ * @test * @summary Verifies that it is possible to open a stream when a repository doesn't * exists - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestUnstarted diff --git a/test/jdk/jdk/jfr/api/event/TestAbstractEvent.java b/test/jdk/jdk/jfr/api/event/TestAbstractEvent.java index 1d6ac835be9..d1b320b94bf 100644 --- a/test/jdk/jdk/jfr/api/event/TestAbstractEvent.java +++ b/test/jdk/jdk/jfr/api/event/TestAbstractEvent.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 @@ -38,7 +38,7 @@ /** * @test * @summary Tests that abstract events are not part of metadata - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestAbstractEvent diff --git a/test/jdk/jdk/jfr/api/event/TestBeginEnd.java b/test/jdk/jdk/jfr/api/event/TestBeginEnd.java index 698b4f94ca2..4dfafa321ef 100644 --- a/test/jdk/jdk/jfr/api/event/TestBeginEnd.java +++ b/test/jdk/jdk/jfr/api/event/TestBeginEnd.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 @@ -33,7 +33,7 @@ /** * @test * @summary Test for RecordedEvent.getDuration() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestBeginEnd diff --git a/test/jdk/jdk/jfr/api/event/TestClinitRegistration.java b/test/jdk/jdk/jfr/api/event/TestClinitRegistration.java index 99a851eba7f..099fb8e7216 100644 --- a/test/jdk/jdk/jfr/api/event/TestClinitRegistration.java +++ b/test/jdk/jdk/jfr/api/event/TestClinitRegistration.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test enable/disable event and verify recording has expected events. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestClinitRegistration diff --git a/test/jdk/jdk/jfr/api/event/TestClonedEvent.java b/test/jdk/jdk/jfr/api/event/TestClonedEvent.java index adad7269bbd..336dee96099 100644 --- a/test/jdk/jdk/jfr/api/event/TestClonedEvent.java +++ b/test/jdk/jdk/jfr/api/event/TestClonedEvent.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 @@ -36,7 +36,7 @@ /** * @test * @summary Tests that a cloned event can be successfully committed. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestClonedEvent diff --git a/test/jdk/jdk/jfr/api/event/TestEnableDisable.java b/test/jdk/jdk/jfr/api/event/TestEnableDisable.java index a953feafabe..6b7576d74b9 100644 --- a/test/jdk/jdk/jfr/api/event/TestEnableDisable.java +++ b/test/jdk/jdk/jfr/api/event/TestEnableDisable.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 @@ -37,7 +37,7 @@ /** * @test * @summary Test enable/disable event and verify recording has expected events. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestEnableDisable diff --git a/test/jdk/jdk/jfr/api/event/TestEventDuration.java b/test/jdk/jdk/jfr/api/event/TestEventDuration.java index f043ee26c53..d8b30f4af8e 100644 --- a/test/jdk/jdk/jfr/api/event/TestEventDuration.java +++ b/test/jdk/jdk/jfr/api/event/TestEventDuration.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 @@ -32,7 +32,7 @@ /** * @test * @summary Tests that a duration is recorded. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestEventDuration diff --git a/test/jdk/jdk/jfr/api/event/TestEventFactory.java b/test/jdk/jdk/jfr/api/event/TestEventFactory.java index 43c89f490b4..4aaf2e749ba 100644 --- a/test/jdk/jdk/jfr/api/event/TestEventFactory.java +++ b/test/jdk/jdk/jfr/api/event/TestEventFactory.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 @@ -38,7 +38,7 @@ /** * @test * @summary EventFactory simple test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestEventFactory diff --git a/test/jdk/jdk/jfr/api/event/TestEventFactoryRegisterTwice.java b/test/jdk/jdk/jfr/api/event/TestEventFactoryRegisterTwice.java index ed32b3586c2..479de103353 100644 --- a/test/jdk/jdk/jfr/api/event/TestEventFactoryRegisterTwice.java +++ b/test/jdk/jdk/jfr/api/event/TestEventFactoryRegisterTwice.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 @@ -34,7 +34,7 @@ /** * @test * @summary Verifies that EventFactory can register the same event twice - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestEventFactoryRegisterTwice diff --git a/test/jdk/jdk/jfr/api/event/TestEventFactoryRegistration.java b/test/jdk/jdk/jfr/api/event/TestEventFactoryRegistration.java index 313c8060972..15640f56b68 100644 --- a/test/jdk/jdk/jfr/api/event/TestEventFactoryRegistration.java +++ b/test/jdk/jdk/jfr/api/event/TestEventFactoryRegistration.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 @@ -38,7 +38,7 @@ /** * @test * @summary EventFactory register/unregister API test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestEventFactoryRegistration diff --git a/test/jdk/jdk/jfr/api/event/TestExtends.java b/test/jdk/jdk/jfr/api/event/TestExtends.java index eae47911ba0..0121f2ce091 100644 --- a/test/jdk/jdk/jfr/api/event/TestExtends.java +++ b/test/jdk/jdk/jfr/api/event/TestExtends.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 @@ -35,7 +35,7 @@ /** * @test * @summary Test with event class inheritance - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestExtends diff --git a/test/jdk/jdk/jfr/api/event/TestGetDuration.java b/test/jdk/jdk/jfr/api/event/TestGetDuration.java index b25969198ed..c4f6377f219 100644 --- a/test/jdk/jdk/jfr/api/event/TestGetDuration.java +++ b/test/jdk/jdk/jfr/api/event/TestGetDuration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, 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 @@ -37,7 +37,7 @@ /** * @test * @summary Test for RecordedEvent.getDuration() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestGetDuration diff --git a/test/jdk/jdk/jfr/api/event/TestIsEnabled.java b/test/jdk/jdk/jfr/api/event/TestIsEnabled.java index a94bea9ba62..8474646608c 100644 --- a/test/jdk/jdk/jfr/api/event/TestIsEnabled.java +++ b/test/jdk/jdk/jfr/api/event/TestIsEnabled.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,7 +31,7 @@ /** * @test * @summary Test Event.isEnabled() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestIsEnabled diff --git a/test/jdk/jdk/jfr/api/event/TestIsEnabledMultiple.java b/test/jdk/jdk/jfr/api/event/TestIsEnabledMultiple.java index 66256c69e4b..69db35cbf49 100644 --- a/test/jdk/jdk/jfr/api/event/TestIsEnabledMultiple.java +++ b/test/jdk/jdk/jfr/api/event/TestIsEnabledMultiple.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,7 +31,7 @@ /** * @test * @summary Test Event.isEnabled() with multiple recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestIsEnabledMultiple diff --git a/test/jdk/jdk/jfr/api/event/TestOwnCommit.java b/test/jdk/jdk/jfr/api/event/TestOwnCommit.java index 6ca058cfcc4..0186d86d82d 100644 --- a/test/jdk/jdk/jfr/api/event/TestOwnCommit.java +++ b/test/jdk/jdk/jfr/api/event/TestOwnCommit.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 @@ -35,7 +35,7 @@ /** * @test * @summary Use custom event that reuse method names begin, end and commit. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestOwnCommit diff --git a/test/jdk/jdk/jfr/api/event/TestShouldCommit.java b/test/jdk/jdk/jfr/api/event/TestShouldCommit.java index f28884b77a2..f26bb6c67fc 100644 --- a/test/jdk/jdk/jfr/api/event/TestShouldCommit.java +++ b/test/jdk/jdk/jfr/api/event/TestShouldCommit.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 @@ -39,7 +39,7 @@ /** * @test * @summary Test jdk.jfr.Event::shouldCommit() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestShouldCommit diff --git a/test/jdk/jdk/jfr/api/event/TestStaticEnable.java b/test/jdk/jdk/jfr/api/event/TestStaticEnable.java index b1bc9bdab97..e7d116917b1 100644 --- a/test/jdk/jdk/jfr/api/event/TestStaticEnable.java +++ b/test/jdk/jdk/jfr/api/event/TestStaticEnable.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 @@ -34,7 +34,7 @@ /** * @test * @summary Enable an event from a static function in the event. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestStaticEnable diff --git a/test/jdk/jdk/jfr/api/event/dynamic/TestDynamicAnnotations.java b/test/jdk/jdk/jfr/api/event/dynamic/TestDynamicAnnotations.java index 18fb3cc5865..c98be5bdbe3 100644 --- a/test/jdk/jdk/jfr/api/event/dynamic/TestDynamicAnnotations.java +++ b/test/jdk/jdk/jfr/api/event/dynamic/TestDynamicAnnotations.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 @@ -51,7 +51,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.dynamic.TestDynamicAnnotations diff --git a/test/jdk/jdk/jfr/api/event/dynamic/TestEventFactory.java b/test/jdk/jdk/jfr/api/event/dynamic/TestEventFactory.java index f61c81bb9eb..4385c459e36 100644 --- a/test/jdk/jdk/jfr/api/event/dynamic/TestEventFactory.java +++ b/test/jdk/jdk/jfr/api/event/dynamic/TestEventFactory.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 @@ -53,7 +53,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.dynamic.TestEventFactory diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestAddListenerTwice.java b/test/jdk/jdk/jfr/api/flightrecorder/TestAddListenerTwice.java index 8b273e9b905..3a6d566fb1d 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestAddListenerTwice.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestAddListenerTwice.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,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.flightrecorder.TestAddListenerTwice diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestAddPeriodicEvent.java b/test/jdk/jdk/jfr/api/flightrecorder/TestAddPeriodicEvent.java index 78950a723da..d838f31b8d9 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestAddPeriodicEvent.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestAddPeriodicEvent.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 @@ -36,7 +36,7 @@ /** * @test * @summary - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestAddPeriodicEvent diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestFlightRecorderListenerRecorderInitialized.java b/test/jdk/jdk/jfr/api/flightrecorder/TestFlightRecorderListenerRecorderInitialized.java index 9f9315ea1c4..72e2e3cc929 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestFlightRecorderListenerRecorderInitialized.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestFlightRecorderListenerRecorderInitialized.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestFlightRecorderListenerRecorderInitialized diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestGetEventTypes.java b/test/jdk/jdk/jfr/api/flightrecorder/TestGetEventTypes.java index 8a3abdb3046..248a4f385cf 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestGetEventTypes.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestGetEventTypes.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm/timeout=600 jdk.jfr.api.flightrecorder.TestGetEventTypes diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestGetPlatformRecorder.java b/test/jdk/jdk/jfr/api/flightrecorder/TestGetPlatformRecorder.java index bdbf0c53fa2..52597f81b0d 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestGetPlatformRecorder.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestGetPlatformRecorder.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,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestGetPlatformRecorder diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestGetRecordings.java b/test/jdk/jdk/jfr/api/flightrecorder/TestGetRecordings.java index d4318134c58..e0c8f9f0432 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestGetRecordings.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestGetRecordings.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestGetRecordings diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestGetSettings.java b/test/jdk/jdk/jfr/api/flightrecorder/TestGetSettings.java index 68472f04bc4..85aaa177cf4 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestGetSettings.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestGetSettings.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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestGetSettings diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestIsAvailable.java b/test/jdk/jdk/jfr/api/flightrecorder/TestIsAvailable.java index 6e2cf4cf942..9665319e643 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestIsAvailable.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestIsAvailable.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,7 +28,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -XX:+FlightRecorder jdk.jfr.api.flightrecorder.TestIsAvailable true diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestIsInitialized.java b/test/jdk/jdk/jfr/api/flightrecorder/TestIsInitialized.java index 8d8dda1eaac..ebb6be41045 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestIsInitialized.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestIsInitialized.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,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestIsInitialized diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestListener.java b/test/jdk/jdk/jfr/api/flightrecorder/TestListener.java index f039a60a245..90ceadfaf82 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestListener.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestListener.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,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.flightrecorder.TestListener diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestListenerNull.java b/test/jdk/jdk/jfr/api/flightrecorder/TestListenerNull.java index dab7f551af4..cab7346fa60 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestListenerNull.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestListenerNull.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,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestListenerNull diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestPeriodicEventsSameHook.java b/test/jdk/jdk/jfr/api/flightrecorder/TestPeriodicEventsSameHook.java index f6e7f6a2340..5556020dc0f 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestPeriodicEventsSameHook.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestPeriodicEventsSameHook.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,7 +29,7 @@ /** * @test * @summary Check that an IllegalArgumentException is thrown if event is added twice - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestPeriodicEventsSameHook diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestRecorderInitializationCallback.java b/test/jdk/jdk/jfr/api/flightrecorder/TestRecorderInitializationCallback.java index ccb2245551b..a97b7b865bf 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestRecorderInitializationCallback.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestRecorderInitializationCallback.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 @@ -33,7 +33,7 @@ /** * @test * @summary Test Flight Recorder initialization callback is only called once - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestRecorderInitializationCallback diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestRegisterUnregisterEvent.java b/test/jdk/jdk/jfr/api/flightrecorder/TestRegisterUnregisterEvent.java index 2a0088ec52a..1481750c74c 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestRegisterUnregisterEvent.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestRegisterUnregisterEvent.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,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestRegisterUnregisterEvent diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestSettingsControl.java b/test/jdk/jdk/jfr/api/flightrecorder/TestSettingsControl.java index 0b54f218c43..e186db41bc2 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestSettingsControl.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestSettingsControl.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestSettingsControl diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestSnapshot.java b/test/jdk/jdk/jfr/api/flightrecorder/TestSnapshot.java index fbb41b7f157..6070c68236d 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestSnapshot.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestSnapshot.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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestSnapshot diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestCategory.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestCategory.java index 4bb0083a0f3..dbd33d013ae 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestCategory.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestCategory.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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestCategory diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestContentType.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestContentType.java index 0c72ae80571..1c38c21c3ae 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestContentType.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestContentType.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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestContentType diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestDescription.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestDescription.java index 57d86e85fde..6232346b871 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestDescription.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestDescription.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 @@ -41,7 +41,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestDescription diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestDynamicAnnotation.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestDynamicAnnotation.java index 5b2cae92781..726ac9070d6 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestDynamicAnnotation.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestDynamicAnnotation.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestDynamicAnnotation diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestEnabled.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestEnabled.java index b5e60cedb8a..3aafd264ff5 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestEnabled.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestEnabled.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestEnabled diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestExperimental.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestExperimental.java index 3420debafa0..5f044d34e24 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestExperimental.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestExperimental.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestExperimental diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestFieldAnnotations.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestFieldAnnotations.java index 088639b6748..879ba0727f2 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestFieldAnnotations.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestFieldAnnotations.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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestFieldAnnotations diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestFormatMissingValue.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestFormatMissingValue.java index b7b61d09aba..90ecb9fa7d8 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestFormatMissingValue.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestFormatMissingValue.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Check that event values are properly formatted and sanity check * that extreme values don't throws exceptions * @requires vm.hasJFR diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestHasValue.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestHasValue.java index c5194f1381c..a2367cc3fe2 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestHasValue.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestHasValue.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestHasValue diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestInheritedAnnotations.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestInheritedAnnotations.java index 16c7f20a9b5..7434f51ca02 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestInheritedAnnotations.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestInheritedAnnotations.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 @@ -48,7 +48,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestInheritedAnnotations diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestLabel.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestLabel.java index ca1b74e10f2..0f8f8531072 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestLabel.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestLabel.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 @@ -42,7 +42,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestLabel diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestMetadata.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestMetadata.java index 1287aa5e20d..8939272b0f7 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestMetadata.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestMetadata.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestMetadata diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestName.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestName.java index 411f5da67e1..269ddbecc20 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestName.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestName.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 @@ -45,7 +45,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestName diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestPeriod.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestPeriod.java index 893b1ab4720..bf679b05bbf 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestPeriod.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestPeriod.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestLabel diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestRegistered.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestRegistered.java index 1c1177ac040..f9e89c2c12d 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestRegistered.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestRegistered.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestRegistered diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestRegisteredFalseAndRunning.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestRegisteredFalseAndRunning.java index 95bfbf527e1..2f2246ac336 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestRegisteredFalseAndRunning.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestRegisteredFalseAndRunning.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 @@ -29,7 +29,7 @@ /** * @test Tests that commit doesn't throw exception when an event has not been registered. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestRegisteredFalseAndRunning diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestRelational.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestRelational.java index 7b2d6e89689..d5236409175 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestRelational.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestRelational.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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestRelational diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestSimpleMetadataEvent.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestSimpleMetadataEvent.java index 720da6da9ba..cbb9cc54af6 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestSimpleMetadataEvent.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestSimpleMetadataEvent.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestSimpleMetadataEvent diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestStackFilter.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestStackFilter.java index 2acd369b6cd..b7c3a67ae68 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestStackFilter.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestStackFilter.java @@ -47,7 +47,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules jdk.jfr/jdk.jfr.events * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestStackTrace.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestStackTrace.java index 8223d313a08..11e651d40cd 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestStackTrace.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestStackTrace.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestStackTrace diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestThreshold.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestThreshold.java index 2ff1c3410a0..8cbb276c145 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestThreshold.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestThreshold.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestThreshold diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestTypesIdentical.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestTypesIdentical.java index 9faae6ba564..79838281525 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestTypesIdentical.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestTypesIdentical.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 @@ -51,7 +51,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestTypesIdentical diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotation.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotation.java index 2af6870af5b..b4a8e87735f 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotation.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotation.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 @@ -36,7 +36,7 @@ /** * @test * @summary Test getAnnotations() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetAnnotation diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotationElements.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotationElements.java index 34b84779d3e..0ce8767f8c1 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotationElements.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotationElements.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 @@ -63,7 +63,7 @@ /** * @test * @summary Test for AnnotationElement.getAnnotationElements() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetAnnotationElements diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotations.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotations.java index 895f9f4050f..b86ef6dafac 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotations.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotations.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test getAnnotations() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetAnnotations diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetCategory.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetCategory.java index ec92be1eb4e..d4b70ff18b0 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetCategory.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetCategory.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 @@ -33,7 +33,7 @@ /** * @test * @summary Test setName(). - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetCategory diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDefaultValues.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDefaultValues.java index be7264966c3..a5664af1484 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDefaultValues.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDefaultValues.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 @@ -32,7 +32,7 @@ /** * @test * @summary Test getDefaultValues() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetDefaultValues diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDescription.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDescription.java index 19eb83fcf6e..91732ed9a9b 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDescription.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDescription.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 @@ -37,7 +37,7 @@ /** * @test * @summary Test descriptive annotations for EventType - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetDescription diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetEventType.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetEventType.java index 4dbd2e7cc6f..9e7571577a9 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetEventType.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetEventType.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,7 +30,7 @@ /** * @test * @summary Test getEventType() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetEventType diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetField.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetField.java index 28a39d649f7..aec07fdd136 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetField.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetField.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,7 +31,7 @@ /** * @test * @summary Test getField() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetField diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetFields.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetFields.java index 237239b6035..1c8d98132f5 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetFields.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetFields.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 @@ -34,7 +34,7 @@ /** * @test * @summary Test getFields() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetFields diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetSettings.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetSettings.java index f47d451edfb..ab5cccf8bd8 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetSettings.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetSettings.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 @@ -32,7 +32,7 @@ /** * @test * @summary Test getSettings() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetSettings diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestUnloadingEventClass.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestUnloadingEventClass.java index d86a9d10452..07daab8fa45 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestUnloadingEventClass.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestUnloadingEventClass.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test that verifies event metadata is removed when an event class is unloaded. * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestDefaultValue.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestDefaultValue.java index 8ded0a5830d..c88b2101348 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestDefaultValue.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestDefaultValue.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 @@ -30,7 +30,7 @@ /** * @test * @summary Test SettingDescriptor.getName() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestDefaultValue diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotation.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotation.java index 70d58074fcb..8c45e82c3cb 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotation.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotation.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 @@ -34,7 +34,7 @@ /** * @test * @summary Test SettingDescriptor.getAnnotation(); - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetAnnotation diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotationElement.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotationElement.java index 74ffad14b72..91a490e24c9 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotationElement.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotationElement.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 @@ -37,7 +37,7 @@ /** * @test * @summary Test SettingDescriptor.getAnnotationElements() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetAnnotationElement diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetContentType.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetContentType.java index 2af0bb3af11..ba8e25dd449 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetContentType.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetContentType.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 @@ -35,7 +35,7 @@ /** * @test * @summary Test SettingDescriptor.getContentType() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetDescription diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetDescription.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetDescription.java index 2e23b17962a..1b913617714 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetDescription.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetDescription.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 @@ -32,7 +32,7 @@ /** * @test * @summary Test SettingDescriptor.getDescription() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetDescription diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetLabel.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetLabel.java index 961261bae19..19b9f72c1d5 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetLabel.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetLabel.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 @@ -32,7 +32,7 @@ /** * @test * @summary Test SettingDescriptor.getLabel() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetLabel diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetName.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetName.java index 38b1fcb8085..f9ddc217bb7 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetName.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetName.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 @@ -29,7 +29,7 @@ /** * @test * @summary Test SettingDescriptor.getName() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetName diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeId.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeId.java index b1d123855bf..16d35f8d5c7 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeId.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeId.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 @@ -30,7 +30,7 @@ /** * @test * @summary Test SettingDescriptor.getTypeId() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetTypeId diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeName.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeName.java index 20d1ea957ec..98c7a3c0d0b 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeName.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeName.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 @@ -30,7 +30,7 @@ /** * @test * @summary Test SettingDescriptor.getTypeName(); - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetTypeName diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestClasses.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestClasses.java index 477beeab3b5..851ed0da7af 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestClasses.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestClasses.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 @@ -34,7 +34,7 @@ /** * @test * @summary Test ValueDescriptor.getAnnotations() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestClasses diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestConstructor.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestConstructor.java index 056f216d677..c8d33bc0004 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestConstructor.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestConstructor.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 @@ -34,7 +34,7 @@ /** * @test * @summary Test ValueDescriptor.getAnnotations() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestConstructor diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetAnnotations.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetAnnotations.java index bc2a227a8f5..eefbb876c8b 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetAnnotations.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetAnnotations.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test ValueDescriptor.getAnnotations() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestGetAnnotations diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetFields.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetFields.java index 0576615ba22..a965e046643 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetFields.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetFields.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,7 +29,7 @@ /** * @test * @summary Test ValueDescriptor.getAnnotations() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestGetFields diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestIsArray.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestIsArray.java index 983d7e29d5c..d3a002ea016 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestIsArray.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestIsArray.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,7 +31,7 @@ /** * @test * @summary Test ValueDescriptor.isArray(). - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestIsArray diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestSimpleTypes.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestSimpleTypes.java index cf506197a18..c75737426a3 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestSimpleTypes.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestSimpleTypes.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 @@ -39,7 +39,7 @@ /** * @test * @summary Test all basic types in ValueDescriptor. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestSimpleTypes diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestValueDescriptorContentType.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestValueDescriptorContentType.java index 73acc71db68..cc5f8e82564 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestValueDescriptorContentType.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestValueDescriptorContentType.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test ValueDescriptor.getContentType() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestValueDescriptorContentType diff --git a/test/jdk/jdk/jfr/api/recorder/TestRecorderInitialized.java b/test/jdk/jdk/jfr/api/recorder/TestRecorderInitialized.java index c4f48b9ce79..bc791e6cb33 100644 --- a/test/jdk/jdk/jfr/api/recorder/TestRecorderInitialized.java +++ b/test/jdk/jdk/jfr/api/recorder/TestRecorderInitialized.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,7 +29,7 @@ /** * @test TestRecorderListener - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/api/recorder/TestRecorderListener.java b/test/jdk/jdk/jfr/api/recorder/TestRecorderListener.java index c6a1e853771..87790b57392 100644 --- a/test/jdk/jdk/jfr/api/recorder/TestRecorderListener.java +++ b/test/jdk/jdk/jfr/api/recorder/TestRecorderListener.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 @@ -32,7 +32,7 @@ /** * @test TestRecorderListener * - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @run main/othervm jdk.jfr.api.recorder.TestRecorderListener */ diff --git a/test/jdk/jdk/jfr/api/recorder/TestRecorderListenerWithDump.java b/test/jdk/jdk/jfr/api/recorder/TestRecorderListenerWithDump.java index 0053c710195..74d1f632ac5 100644 --- a/test/jdk/jdk/jfr/api/recorder/TestRecorderListenerWithDump.java +++ b/test/jdk/jdk/jfr/api/recorder/TestRecorderListenerWithDump.java @@ -9,7 +9,7 @@ /** * @test TestRecorderListenerWithDump * - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @run main/othervm jdk.jfr.api.recorder.TestRecorderListenerWithDump */ diff --git a/test/jdk/jdk/jfr/api/recorder/TestStartStopRecording.java b/test/jdk/jdk/jfr/api/recorder/TestStartStopRecording.java index 4f78f6888e2..1b923ab8ad2 100644 --- a/test/jdk/jdk/jfr/api/recorder/TestStartStopRecording.java +++ b/test/jdk/jdk/jfr/api/recorder/TestStartStopRecording.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 @@ -35,7 +35,7 @@ /** * @test TestStartStopRecording * - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recorder.TestStartStopRecording diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestFileExist.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestFileExist.java index 42f5e277ced..22df06e164a 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestFileExist.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestFileExist.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 @@ -39,7 +39,7 @@ /** * @test * @summary Set destination to an existing file. File should be overwritten. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestFileExist diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestFileReadOnly.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestFileReadOnly.java index d7fc0bdd0aa..94289f93978 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestFileReadOnly.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestFileReadOnly.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 @@ -34,7 +34,7 @@ /** * @test * @summary Set destination to a read-only file. Expects exception. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestFileReadOnly diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestInvalid.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestInvalid.java index 93e2709c222..e3c099707f4 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestInvalid.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestInvalid.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 @@ -40,7 +40,7 @@ /** * @test * @summary Test setDestination to invalid paths - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestInvalid diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestLongPath.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestLongPath.java index 9ab67cfc02e..045362bea14 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestLongPath.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestLongPath.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 @@ -38,7 +38,7 @@ /** * @test * @summary Set destination to a long path - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestLongPath diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestMultiple.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestMultiple.java index bf7d3f3b0fb..4e3eef91c85 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestMultiple.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestMultiple.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test setDestination with concurrent recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr=trace jdk.jfr.api.recording.destination.TestDestMultiple diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestReadOnly.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestReadOnly.java index 8c4a132cb71..b6b2ddd8ce3 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestReadOnly.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestReadOnly.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 @@ -41,7 +41,7 @@ /** * @test * @summary Test setDestination to read-only dir - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestReadOnly diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestState.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestState.java index 99ded47f5ea..233d898be10 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestState.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestState.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 @@ -37,7 +37,7 @@ /** * @test * @summary Call setDestination() when recording in different states - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestState diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskFalse.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskFalse.java index 4930916a1d9..1f264af21f8 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskFalse.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskFalse.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 @@ -40,7 +40,7 @@ /** * @test * @summary Basic test for setDestination with disk=false - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestToDiskFalse diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskTrue.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskTrue.java index 3684c6e65e8..b685c2c17bd 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskTrue.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskTrue.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 @@ -39,7 +39,7 @@ /** * @test * @summary Basic test for setDestination with disk=true - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestToDiskTrue diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestWithDuration.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestWithDuration.java index ba305a18c2a..eb9226fa2d8 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestWithDuration.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestWithDuration.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 @@ -40,7 +40,7 @@ /** * @test * @summary Test that recording is auto closed after duration - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestWithDuration diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDump.java b/test/jdk/jdk/jfr/api/recording/dump/TestDump.java index 36706ecde3a..1818cacca20 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDump.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDump.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 @@ -35,7 +35,7 @@ /** * @test * @summary Test copyTo and parse file - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.dump.TestDump diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDumpDevNull.java b/test/jdk/jdk/jfr/api/recording/dump/TestDumpDevNull.java index d74dd7fede2..b83f9686868 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDumpDevNull.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDumpDevNull.java @@ -29,7 +29,7 @@ /** * @test * @summary Tests that it's possible to dump to /dev/null without a livelock - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & (os.family != "windows") * @library /test/lib * @run main/othervm -Xlog:jfr jdk.jfr.api.recording.dump.TestDumpDevNull diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDumpInvalid.java b/test/jdk/jdk/jfr/api/recording/dump/TestDumpInvalid.java index 7b69f552afe..41250336d89 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDumpInvalid.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDumpInvalid.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test copyTo and parse file - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.dump.TestDumpInvalid diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDumpLongPath.java b/test/jdk/jdk/jfr/api/recording/dump/TestDumpLongPath.java index a1d2f714f4e..d3b08cc8e04 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDumpLongPath.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDumpLongPath.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test copyTo and parse file - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.dump.TestDumpLongPath diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDumpMultiple.java b/test/jdk/jdk/jfr/api/recording/dump/TestDumpMultiple.java index 3eab84cb44a..2b14700e179 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDumpMultiple.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDumpMultiple.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 @@ -37,7 +37,7 @@ /** * @test * @summary Test copyTo and parse file - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.dump.TestDumpMultiple diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDumpReadOnly.java b/test/jdk/jdk/jfr/api/recording/dump/TestDumpReadOnly.java index 8ffbfa75952..9e05d8a2037 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDumpReadOnly.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDumpReadOnly.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 @@ -36,7 +36,7 @@ /** * @test * @summary Test copyTo and parse file - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.dump.TestDumpReadOnly diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDumpState.java b/test/jdk/jdk/jfr/api/recording/dump/TestDumpState.java index 7b464ff85b1..b315117f726 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDumpState.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDumpState.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 @@ -43,7 +43,7 @@ /** * @test * @summary call copyTo() with recording in all states. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.dump.TestDumpState diff --git a/test/jdk/jdk/jfr/api/recording/event/TestChunkPeriod.java b/test/jdk/jdk/jfr/api/recording/event/TestChunkPeriod.java index 71ffa1f3a9f..9ce6af58615 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestChunkPeriod.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestChunkPeriod.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test periodic setting that involves chunks. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestChunkPeriod diff --git a/test/jdk/jdk/jfr/api/recording/event/TestEnableClass.java b/test/jdk/jdk/jfr/api/recording/event/TestEnableClass.java index ea14efd1ce9..cce06973d1c 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestEnableClass.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestEnableClass.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,7 +29,7 @@ /** * @test * @summary Simple enable Event class. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestEnableClass diff --git a/test/jdk/jdk/jfr/api/recording/event/TestEnableName.java b/test/jdk/jdk/jfr/api/recording/event/TestEnableName.java index c513fa64466..a1647918abb 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestEnableName.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestEnableName.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 @@ -36,7 +36,7 @@ /** * @test * @summary Simple enable Event class. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestEnableName diff --git a/test/jdk/jdk/jfr/api/recording/event/TestEventTime.java b/test/jdk/jdk/jfr/api/recording/event/TestEventTime.java index 7ee9748520a..54c735fff69 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestEventTime.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestEventTime.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 @@ -39,7 +39,7 @@ /** * @test * @summary Test getStartTime() and getEndTime(). Verify startTime <= endTime - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestEventTime diff --git a/test/jdk/jdk/jfr/api/recording/event/TestLoadEventAfterStart.java b/test/jdk/jdk/jfr/api/recording/event/TestLoadEventAfterStart.java index 4bd96871b45..0586389d86a 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestLoadEventAfterStart.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestLoadEventAfterStart.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 @@ -37,7 +37,7 @@ /** * @test * @summary Load event class after recording started. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.lib.jfr.SimpleEvent diff --git a/test/jdk/jdk/jfr/api/recording/event/TestPeriod.java b/test/jdk/jdk/jfr/api/recording/event/TestPeriod.java index a3a76953fff..e667fe010ef 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestPeriod.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestPeriod.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 @@ -36,7 +36,7 @@ /** * @test * @summary Test periodic events. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestPeriod diff --git a/test/jdk/jdk/jfr/api/recording/event/TestReEnableClass.java b/test/jdk/jdk/jfr/api/recording/event/TestReEnableClass.java index 57d274abaa7..82631f5dcfe 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestReEnableClass.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestReEnableClass.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 @@ -32,7 +32,7 @@ /** * @test * @summary Enable, disable, enable event during recording. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestReEnableClass diff --git a/test/jdk/jdk/jfr/api/recording/event/TestReEnableMultiple.java b/test/jdk/jdk/jfr/api/recording/event/TestReEnableMultiple.java index 4bbd0714c08..392450ee92e 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestReEnableMultiple.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestReEnableMultiple.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 @@ -40,7 +40,7 @@ /** * @test * @summary Enable, disable, enable event during recording. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestReEnableMultiple diff --git a/test/jdk/jdk/jfr/api/recording/event/TestReEnableName.java b/test/jdk/jdk/jfr/api/recording/event/TestReEnableName.java index 45f254956d6..3b6092f384c 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestReEnableName.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestReEnableName.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 @@ -36,7 +36,7 @@ /** * @test * @summary Enable/disable event by name during recording. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestReEnableName diff --git a/test/jdk/jdk/jfr/api/recording/event/TestRecordingEnableDisable.java b/test/jdk/jdk/jfr/api/recording/event/TestRecordingEnableDisable.java index dd9d5089ae4..e0751c98aa9 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestRecordingEnableDisable.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestRecordingEnableDisable.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 @@ -37,7 +37,7 @@ /** * @test * @summary Enable, disable, enable event during recording. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestRecordingEnableDisable diff --git a/test/jdk/jdk/jfr/api/recording/event/TestShortPeriod.java b/test/jdk/jdk/jfr/api/recording/event/TestShortPeriod.java index e53fd90a75c..a7c6d995bfb 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestShortPeriod.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestShortPeriod.java @@ -33,7 +33,7 @@ /** * @test Tests that periodic events are not disabled when using a very short * period - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.recording.event.TestShortPeriod diff --git a/test/jdk/jdk/jfr/api/recording/event/TestThreshold.java b/test/jdk/jdk/jfr/api/recording/event/TestThreshold.java index a0b42f66b89..fdde42cdf5a 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestThreshold.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestThreshold.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 @@ -35,7 +35,7 @@ /** * @test * @summary Test event threshold. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestThreshold diff --git a/test/jdk/jdk/jfr/api/recording/misc/TestGetId.java b/test/jdk/jdk/jfr/api/recording/misc/TestGetId.java index de4d17a741c..979a59c7ca0 100644 --- a/test/jdk/jdk/jfr/api/recording/misc/TestGetId.java +++ b/test/jdk/jdk/jfr/api/recording/misc/TestGetId.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 @@ -32,7 +32,7 @@ /** * @test * @summary Verify that each recording get unique a id - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.misc.TestGetId diff --git a/test/jdk/jdk/jfr/api/recording/misc/TestGetSize.java b/test/jdk/jdk/jfr/api/recording/misc/TestGetSize.java index dc2176f5901..ba540e6ae40 100644 --- a/test/jdk/jdk/jfr/api/recording/misc/TestGetSize.java +++ b/test/jdk/jdk/jfr/api/recording/misc/TestGetSize.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 @@ -36,7 +36,7 @@ /** * @test * @summary Test recording file size with Recording.getSize() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.misc.TestGetSize diff --git a/test/jdk/jdk/jfr/api/recording/misc/TestGetSizeToMem.java b/test/jdk/jdk/jfr/api/recording/misc/TestGetSizeToMem.java index 2b7ad3d4e6b..4529c9059c5 100644 --- a/test/jdk/jdk/jfr/api/recording/misc/TestGetSizeToMem.java +++ b/test/jdk/jdk/jfr/api/recording/misc/TestGetSizeToMem.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 @@ -37,7 +37,7 @@ /** * @test * @summary Test recording file size with Recording.getSize() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.misc.TestGetSizeToMem diff --git a/test/jdk/jdk/jfr/api/recording/misc/TestGetStream.java b/test/jdk/jdk/jfr/api/recording/misc/TestGetStream.java index 3b353d0968b..3db25490199 100644 --- a/test/jdk/jdk/jfr/api/recording/misc/TestGetStream.java +++ b/test/jdk/jdk/jfr/api/recording/misc/TestGetStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, 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 @@ -44,7 +44,7 @@ /** * @test * @summary A simple test for Recording.getStream() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.misc.TestGetStream diff --git a/test/jdk/jdk/jfr/api/recording/misc/TestRecordingBase.java b/test/jdk/jdk/jfr/api/recording/misc/TestRecordingBase.java index a17a7eb9959..4122a203db1 100644 --- a/test/jdk/jdk/jfr/api/recording/misc/TestRecordingBase.java +++ b/test/jdk/jdk/jfr/api/recording/misc/TestRecordingBase.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 @@ -41,7 +41,7 @@ /** * @test * @summary Basic tests for Recording - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.misc.TestRecordingBase diff --git a/test/jdk/jdk/jfr/api/recording/misc/TestRecordingCopy.java b/test/jdk/jdk/jfr/api/recording/misc/TestRecordingCopy.java index 8d539ed68c4..1234655f31a 100644 --- a/test/jdk/jdk/jfr/api/recording/misc/TestRecordingCopy.java +++ b/test/jdk/jdk/jfr/api/recording/misc/TestRecordingCopy.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 @@ -36,7 +36,7 @@ /** * @test * @summary A simple test for Recording.copy() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.misc.TestRecordingCopy diff --git a/test/jdk/jdk/jfr/api/recording/options/TestDuration.java b/test/jdk/jdk/jfr/api/recording/options/TestDuration.java index 8f231ab77a0..d0bb1938f6b 100644 --- a/test/jdk/jdk/jfr/api/recording/options/TestDuration.java +++ b/test/jdk/jdk/jfr/api/recording/options/TestDuration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -34,7 +34,7 @@ /** * @test * @summary Test setDuration(). Verify recording is stopped automatically. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.options.TestDuration diff --git a/test/jdk/jdk/jfr/api/recording/options/TestName.java b/test/jdk/jdk/jfr/api/recording/options/TestName.java index c0042b4458a..a1b1747c700 100644 --- a/test/jdk/jdk/jfr/api/recording/options/TestName.java +++ b/test/jdk/jdk/jfr/api/recording/options/TestName.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,7 +31,7 @@ /** * @test * @summary Test setName(). - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.options.TestName diff --git a/test/jdk/jdk/jfr/api/recording/settings/TestConfigurationGetContents.java b/test/jdk/jdk/jfr/api/recording/settings/TestConfigurationGetContents.java index 9365c7cf13e..ceea62bed2a 100644 --- a/test/jdk/jdk/jfr/api/recording/settings/TestConfigurationGetContents.java +++ b/test/jdk/jdk/jfr/api/recording/settings/TestConfigurationGetContents.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 @@ -33,7 +33,7 @@ /** * @test * @summary Verifies Configuration.getContents() for every configuration - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.settings.TestConfigurationGetContents diff --git a/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromPath.java b/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromPath.java index b64d0055dcb..bd46c75c18b 100644 --- a/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromPath.java +++ b/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromPath.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 @@ -36,7 +36,7 @@ /** * @test * @summary Test setName(). - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.settings.TestCreateConfigFromPath diff --git a/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromReader.java b/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromReader.java index e96fab76899..219a1003852 100644 --- a/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromReader.java +++ b/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromReader.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 @@ -36,7 +36,7 @@ /** * @test * @summary Test setName(). - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.settings.TestCreateConfigFromReader diff --git a/test/jdk/jdk/jfr/api/recording/settings/TestGetConfigurations.java b/test/jdk/jdk/jfr/api/recording/settings/TestGetConfigurations.java index 67f8714408d..1ce6b5a8c2d 100644 --- a/test/jdk/jdk/jfr/api/recording/settings/TestGetConfigurations.java +++ b/test/jdk/jdk/jfr/api/recording/settings/TestGetConfigurations.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 @@ -31,7 +31,7 @@ * @test * @summary Verifies that there is the default config and that it has * the expected parameters - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.settings.TestGetConfigurations diff --git a/test/jdk/jdk/jfr/api/recording/settings/TestSettingsAvailability.java b/test/jdk/jdk/jfr/api/recording/settings/TestSettingsAvailability.java index e5d90e4b80b..dc22644b4d0 100644 --- a/test/jdk/jdk/jfr/api/recording/settings/TestSettingsAvailability.java +++ b/test/jdk/jdk/jfr/api/recording/settings/TestSettingsAvailability.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 @@ -40,7 +40,7 @@ /** * @test * @summary Verifies that event types has the correct type of settings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.settings.TestSettingsAvailability diff --git a/test/jdk/jdk/jfr/api/recording/state/TestOptionState.java b/test/jdk/jdk/jfr/api/recording/state/TestOptionState.java index 4e9dd4f2f72..4b43f0fd5cb 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestOptionState.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestOptionState.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,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test options in different states * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/api/recording/state/TestState.java b/test/jdk/jdk/jfr/api/recording/state/TestState.java index 5c548977ad7..724b885d280 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestState.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestState.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 @@ -32,7 +32,7 @@ /** * @test * @summary Test Recording state - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.state.TestState diff --git a/test/jdk/jdk/jfr/api/recording/state/TestStateDuration.java b/test/jdk/jdk/jfr/api/recording/state/TestStateDuration.java index 5e8ef60b367..ac54d69e4ab 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestStateDuration.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestStateDuration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -35,7 +35,7 @@ /** * @test * @summary Test Recording state - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.state.TestStateDuration diff --git a/test/jdk/jdk/jfr/api/recording/state/TestStateIdenticalListeners.java b/test/jdk/jdk/jfr/api/recording/state/TestStateIdenticalListeners.java index 216ac64c79c..295f5b3c0c9 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestStateIdenticalListeners.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestStateIdenticalListeners.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 @@ -32,7 +32,7 @@ /** * @test * @summary Test Recording state with concurrent recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.state.TestStateIdenticalListeners diff --git a/test/jdk/jdk/jfr/api/recording/state/TestStateInvalid.java b/test/jdk/jdk/jfr/api/recording/state/TestStateInvalid.java index ba190c68d85..5108fb03291 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestStateInvalid.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestStateInvalid.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,7 +31,7 @@ /** * @test * @summary Test start/stop/close recording from different recording states. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.state.TestStateInvalid diff --git a/test/jdk/jdk/jfr/api/recording/state/TestStateMultiple.java b/test/jdk/jdk/jfr/api/recording/state/TestStateMultiple.java index 21ccd736074..9745cab7351 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestStateMultiple.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestStateMultiple.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,7 +31,7 @@ /** * @test * @summary Test Recording state with concurrent recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.state.TestStateMultiple diff --git a/test/jdk/jdk/jfr/api/recording/state/TestStateScheduleStart.java b/test/jdk/jdk/jfr/api/recording/state/TestStateScheduleStart.java index 3708ded56f1..ba95407dad2 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestStateScheduleStart.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestStateScheduleStart.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -34,7 +34,7 @@ /** * @test * @summary Test Recording state - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.state.TestStateScheduleStart diff --git a/test/jdk/jdk/jfr/api/recording/time/TestTime.java b/test/jdk/jdk/jfr/api/recording/time/TestTime.java index 66e729f7568..3ece99b9e46 100644 --- a/test/jdk/jdk/jfr/api/recording/time/TestTime.java +++ b/test/jdk/jdk/jfr/api/recording/time/TestTime.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,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test Recording.get*Time() * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/api/recording/time/TestTimeDuration.java b/test/jdk/jdk/jfr/api/recording/time/TestTimeDuration.java index 7f71c0c9004..12b5368db88 100644 --- a/test/jdk/jdk/jfr/api/recording/time/TestTimeDuration.java +++ b/test/jdk/jdk/jfr/api/recording/time/TestTimeDuration.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,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test Recording.setDuration() and Recording.get*Time() * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/api/recording/time/TestTimeMultiple.java b/test/jdk/jdk/jfr/api/recording/time/TestTimeMultiple.java index 057d9150b6a..aab608267b5 100644 --- a/test/jdk/jdk/jfr/api/recording/time/TestTimeMultiple.java +++ b/test/jdk/jdk/jfr/api/recording/time/TestTimeMultiple.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,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test recording times with concurrent recordings * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/api/recording/time/TestTimeScheduleStart.java b/test/jdk/jdk/jfr/api/recording/time/TestTimeScheduleStart.java index 3698a683c50..83d8399e41e 100644 --- a/test/jdk/jdk/jfr/api/recording/time/TestTimeScheduleStart.java +++ b/test/jdk/jdk/jfr/api/recording/time/TestTimeScheduleStart.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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test Recording.scheduleStart() and Recording.get*Time() * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/api/settings/TestFilterEvents.java b/test/jdk/jdk/jfr/api/settings/TestFilterEvents.java index 67619fb10b4..ed20c44c688 100644 --- a/test/jdk/jdk/jfr/api/settings/TestFilterEvents.java +++ b/test/jdk/jdk/jfr/api/settings/TestFilterEvents.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -35,7 +35,7 @@ /** * @test * @summary The test uses SettingControl - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.settings.TestFilterEvents diff --git a/test/jdk/jdk/jfr/api/settings/TestSettingControl.java b/test/jdk/jdk/jfr/api/settings/TestSettingControl.java index 5543953482d..ef38626eedb 100644 --- a/test/jdk/jdk/jfr/api/settings/TestSettingControl.java +++ b/test/jdk/jdk/jfr/api/settings/TestSettingControl.java @@ -44,7 +44,7 @@ /** * @test * @summary Tests that methods on all SettingControls have expected behavior. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.settings.TestSettingControl diff --git a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationInNewTLABEvent.java b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationInNewTLABEvent.java index 1fe34253722..9112cfbc247 100644 --- a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationInNewTLABEvent.java +++ b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationInNewTLABEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, 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 @@ -36,7 +36,7 @@ /** * @test * @summary Test that event is triggered when an object is allocated in a new TLAB. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationOutsideTLABEvent.java b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationOutsideTLABEvent.java index d2f2a3a1bc4..a7695b76849 100644 --- a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationOutsideTLABEvent.java +++ b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationOutsideTLABEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, 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 @@ -36,7 +36,7 @@ /** * @test * @summary Test that when an object is allocated outside a TLAB an event will be triggered. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java index 2f7d3cc1503..6f22476bcbf 100644 --- a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java +++ b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java @@ -33,7 +33,7 @@ /** * @test * @summary Tests ObjectAllocationSampleEvent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -XX:+UseTLAB -XX:TLABSize=2k -XX:-ResizeTLAB jdk.jfr.event.allocation.TestObjectAllocationSampleEvent diff --git a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEventThrottling.java b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEventThrottling.java index a38aae51c01..47f5b31f881 100644 --- a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEventThrottling.java +++ b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEventThrottling.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, 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 @@ -38,7 +38,7 @@ /** * @test * @summary Test that when an object is allocated outside a TLAB an event will be triggered. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.java b/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.java index cfc2115d68b..defc9cba1be 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -34,7 +34,7 @@ /** * @test TestCodeCacheConfig - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/compiler/TestCodeCacheStats.java b/test/jdk/jdk/jfr/event/compiler/TestCodeCacheStats.java index 2930b79883e..2256e6a21fa 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCodeCacheStats.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCodeCacheStats.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.compiler.TestCodeCacheStats diff --git a/test/jdk/jdk/jfr/event/compiler/TestCodeSweeper.java b/test/jdk/jdk/jfr/event/compiler/TestCodeSweeper.java index 62fb137b1cf..dd227489a0c 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCodeSweeper.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCodeSweeper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, 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 @@ -49,7 +49,7 @@ */ /** * @test TestCodeSweeper - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerCompile.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerCompile.java index e13bcaa80b5..d39e006f5ca 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerCompile.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerCompile.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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.compMode == "Xmixed" * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerConfig.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerConfig.java index 0e4834ccfa1..cc5455f98d9 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerConfig.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.compiler.TestCompilerConfig diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerInlining.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerInlining.java index 2d0ce579dd8..9694c054f6a 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerInlining.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerInlining.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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 @@ -54,7 +54,7 @@ /* * @test CompilerInliningTest * @bug 8073607 - * @key jfr + * @requires vm.flagless * @summary Verifies that corresponding JFR events are emitted in case of inlining. * @requires vm.hasJFR * @requires vm.compMode == "Xmixed" diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerPhase.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerPhase.java index 02e235a23ca..33884d448bf 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerPhase.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerPhase.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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.compMode!="Xint" & vm.flavor == "server" & (vm.opt.TieredStopAtLevel == 4 | vm.opt.TieredStopAtLevel == null) * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerQueueUtilization.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerQueueUtilization.java index 081cb5296d5..d4e4e12eaa3 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerQueueUtilization.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerQueueUtilization.java @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.compMode!="Xint" * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerStats.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerStats.java index 389a7da25b4..053aedf94c8 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerStats.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerStats.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.compiler.TestCompilerStats diff --git a/test/jdk/jdk/jfr/event/compiler/TestDeoptimization.java b/test/jdk/jdk/jfr/event/compiler/TestDeoptimization.java index bd6d57b3176..eb19965a644 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestDeoptimization.java +++ b/test/jdk/jdk/jfr/event/compiler/TestDeoptimization.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 @@ -48,7 +48,7 @@ public static void dummyMethod(boolean b) { /** * @test - * @key jfr + * @requires vm.flagless * @summary sanity test for Deoptimization event, depends on Compilation event * @requires vm.hasJFR * @requires vm.compMode == "Xmixed" diff --git a/test/jdk/jdk/jfr/event/diagnostics/TestHeapDump.java b/test/jdk/jdk/jfr/event/diagnostics/TestHeapDump.java index 20577d8257d..14b04895058 100644 --- a/test/jdk/jdk/jfr/event/diagnostics/TestHeapDump.java +++ b/test/jdk/jdk/jfr/event/diagnostics/TestHeapDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, 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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules java.management diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestG1ParallelPhases.java b/test/jdk/jdk/jfr/event/gc/collection/TestG1ParallelPhases.java index 86da3907e9d..568104a7b50 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestG1ParallelPhases.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestG1ParallelPhases.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -51,7 +51,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk /test/hotspot/jtreg diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1ConcurrentMark.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1ConcurrentMark.java index e0ea218a07f..3cd8f6612bf 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1ConcurrentMark.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1ConcurrentMark.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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "G1" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1FullCollection.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1FullCollection.java index 308a544adeb..40c5129eb23 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1FullCollection.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1FullCollection.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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "G1" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithParallelOld.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithParallelOld.java index 16217c0cbe1..785d761f4ee 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithParallelOld.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithParallelOld.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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "Parallel" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithSerial.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithSerial.java index 344c61043a2..f8f95070c1c 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithSerial.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithSerial.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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "Serial" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1ConcurrentMark.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1ConcurrentMark.java index 2282783ae14..fcd33cbb1b5 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1ConcurrentMark.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1ConcurrentMark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires (vm.gc == "G1" | vm.gc == null) diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1FullCollection.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1FullCollection.java index 5c3da24fa1b..a698497cf95 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1FullCollection.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1FullCollection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires (vm.gc == "G1" | vm.gc == null) diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithParallelOld.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithParallelOld.java index 9f95ca364f8..c06b046f473 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithParallelOld.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithParallelOld.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "Parallel" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithSerial.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithSerial.java index 6499f18c164..6fc675a93e7 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithSerial.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithSerial.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "Serial" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCGarbageCollectionEvent.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCGarbageCollectionEvent.java index e228f7fd067..ff23291fa41 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCGarbageCollectionEvent.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCGarbageCollectionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:gc*=debug -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps jdk.jfr.event.gc.collection.TestGCGarbageCollectionEvent diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCWithFasttime.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCWithFasttime.java index edce5e76190..d6b271e4669 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCWithFasttime.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCWithFasttime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMajor.java b/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMajor.java index 5305cfd8d67..e2dd258818b 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMajor.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMajor.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 @@ -36,7 +36,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -Xmx50m -XX:+UseZGC -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -Xlog:gc* jdk.jfr.event.gc.collection.TestGarbageCollectionEventWithZMajor */ diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMinor.java b/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMinor.java index 65c177d3a68..8e0d48682fc 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMinor.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMinor.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 @@ -39,9 +39,9 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @build jdk.test.whitebox.WhiteBox * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestSystemGC.java b/test/jdk/jdk/jfr/event/gc/collection/TestSystemGC.java index c5614ad1cbe..c22670e4528 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestSystemGC.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestSystemGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:+ExplicitGCInvokesConcurrent jdk.jfr.event.gc.collection.TestSystemGC true diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithDefNew.java b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithDefNew.java index 95c1a9c40ee..c6798c770a6 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithDefNew.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithDefNew.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Serial" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithG1New.java b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithG1New.java index 931721011aa..5f026fc50e8 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithG1New.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithG1New.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithParallelScavenge.java b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithParallelScavenge.java index b731f1936bb..f9adb6a45a6 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithParallelScavenge.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithParallelScavenge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestZOldGarbageCollectionEvent.java b/test/jdk/jdk/jfr/event/gc/collection/TestZOldGarbageCollectionEvent.java index 38e5ca49e60..77abb19922b 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestZOldGarbageCollectionEvent.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestZOldGarbageCollectionEvent.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 @@ -36,7 +36,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -Xmx50m -XX:+UseZGC -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -Xlog:gc* jdk.jfr.event.gc.collection.TestZOldGarbageCollectionEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestZYoungGarbageCollectionEvent.java b/test/jdk/jdk/jfr/event/gc/collection/TestZYoungGarbageCollectionEvent.java index 40c0a2adec3..10c1407b96a 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestZYoungGarbageCollectionEvent.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestZYoungGarbageCollectionEvent.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 @@ -36,7 +36,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -Xmx50m -XX:+UseZGC -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -Xlog:gc* jdk.jfr.event.gc.collection.TestZYoungGarbageCollectionEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEvent.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEvent.java index e459b0f2e7b..7b7cc8a4376 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEvent.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "Parallel" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != true diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEventWithDefaultPauseTarget.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEventWithDefaultPauseTarget.java index c3a28030338..6e411cf9105 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEventWithDefaultPauseTarget.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEventWithDefaultPauseTarget.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps jdk.jfr.event.gc.configuration.TestGCConfigurationEventWithDefaultPauseTarget diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWith32BitOops.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWith32BitOops.java index 0a61a288cc2..9ef90afb063 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWith32BitOops.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWith32BitOops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, 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 @@ -30,7 +30,7 @@ /* * @test TestGCHeapConfigurationEventWith32BitOops - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @requires os.family == "linux" | os.family == "windows" diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithHeapBasedOops.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithHeapBasedOops.java index a6fdcbde6b1..5346c7a7103 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithHeapBasedOops.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithHeapBasedOops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, 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 @@ -28,7 +28,7 @@ /* * @test TestGCHeapConfigurationEventWith32BitOops - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @requires os.family == "linux" | os.family == "windows" diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithZeroBasedOops.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithZeroBasedOops.java index d63ca856bc3..62d858eef98 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithZeroBasedOops.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithZeroBasedOops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, 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 @@ -28,7 +28,7 @@ /* * @test TestGCHeapConfigurationEventWithZeroBasedOops - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @requires os.family == "linux" | os.family == "windows" diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCSurvivorConfigurationEvent.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCSurvivorConfigurationEvent.java index fde69412a7a..2a282660b03 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCSurvivorConfigurationEvent.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCSurvivorConfigurationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCTLABConfigurationEvent.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCTLABConfigurationEvent.java index b69e4fb8490..cabf6ac1fab 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCTLABConfigurationEvent.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCTLABConfigurationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithMinAndMaxSize.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithMinAndMaxSize.java index d347378b606..b58bb2ae7bf 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithMinAndMaxSize.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithMinAndMaxSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run driver jdk.jfr.event.gc.configuration.TestGCYoungGenerationConfigurationEventWithMinAndMaxSize diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithNewRatio.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithNewRatio.java index 0c78f1e9541..c360ae3fa86 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithNewRatio.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithNewRatio.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -28,7 +28,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:NewRatio=4 jdk.jfr.event.gc.configuration.TestGCYoungGenerationConfigurationEventWithNewRatio diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java index 584900620d4..41cfbf97b95 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, 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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @bug 8263461 * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationInfoEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationInfoEvent.java index 420f083758d..0ec33a9d5ee 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationInfoEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationInfoEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1AIHOPEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1AIHOPEvent.java index deed6b64626..6570bbdd6af 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1AIHOPEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1AIHOPEvent.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1ConcurrentModeFailureEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1ConcurrentModeFailureEvent.java index dade7aea8b6..d178a429560 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1ConcurrentModeFailureEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1ConcurrentModeFailureEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "G1" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1EvacMemoryStatsEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1EvacMemoryStatsEvent.java index e32cfda41a9..56798b09db3 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1EvacMemoryStatsEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1EvacMemoryStatsEvent.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1HeapRegionTypeChangeEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1HeapRegionTypeChangeEvent.java index b716295b507..399d82aa0f0 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1HeapRegionTypeChangeEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1HeapRegionTypeChangeEvent.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 @@ -38,7 +38,7 @@ * @bug 8149650 * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -XX:NewSize=2m -XX:MaxNewSize=2m -Xmx32m -XX:G1HeapRegionSize=1m -XX:+UseG1GC jdk.jfr.event.gc.detailed.TestG1HeapRegionTypeChangeEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1IHOPEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1IHOPEvent.java index 4a5bce6a69f..20ec6fa76f4 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1IHOPEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1IHOPEvent.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1InvalidHeapRegionTypeChangeEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1InvalidHeapRegionTypeChangeEvent.java index 023020f2a29..7939a769ccb 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1InvalidHeapRegionTypeChangeEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1InvalidHeapRegionTypeChangeEvent.java @@ -39,7 +39,7 @@ * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @requires vm.debug - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @summary Make sure that there are no Old->Old and Free->Free events sent. * @run main/othervm -XX:+G1GCAllocationFailureALot -XX:NewSize=2m -XX:MaxNewSize=2m -XX:MaxTenuringThreshold=1 diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1MMUEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1MMUEvent.java index 967a3bc03d5..49b4a721472 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1MMUEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1MMUEvent.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestGCCPUTimeEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestGCCPUTimeEvent.java index 9e7d7ca5413..cd9f0046cbb 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestGCCPUTimeEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestGCCPUTimeEvent.java @@ -32,7 +32,7 @@ /** * @test id=Serial - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.Serial * @library /test/lib /test/jdk @@ -43,7 +43,7 @@ /** * @test id=Parallel - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.Parallel * @library /test/lib /test/jdk @@ -54,7 +54,7 @@ /** * @test id=G1 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.G1 * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryPoolUsageEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryPoolUsageEvent.java index 6d5308408d6..1286c53d938 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryPoolUsageEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryPoolUsageEvent.java @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:-ExplicitGCInvokesConcurrent jdk.jfr.event.gc.detailed.TestGCHeapMemoryPoolUsageEvent diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryUsageEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryUsageEvent.java index 7f1d96a3993..d54ca7a723d 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryUsageEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryUsageEvent.java @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:-ExplicitGCInvokesConcurrent jdk.jfr.event.gc.detailed.TestGCHeapMemoryUsageEvent diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestGCLockerEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestGCLockerEvent.java index 596af47de39..1ad0fbd86b8 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestGCLockerEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestGCLockerEvent.java @@ -24,7 +24,7 @@ /** * @test TestGCLockerEvent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.Serial | vm.gc.Parallel * @requires vm.gc != null diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestGCPhaseConcurrent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestGCPhaseConcurrent.java index 66e3e026536..fde4cd9c2d6 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestGCPhaseConcurrent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestGCPhaseConcurrent.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 @@ -32,7 +32,7 @@ /** * @test id=Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @requires vm.hasJFR & vm.gc.Z * @run main/othervm -XX:+UseZGC -Xmx32M jdk.jfr.event.gc.detailed.TestGCPhaseConcurrent Z @@ -40,7 +40,7 @@ /** * @test TestGCPhaseConcurrent - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @requires vm.hasJFR & vm.gc.Shenandoah * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx32M jdk.jfr.event.gc.detailed.TestGCPhaseConcurrent Shenandoah diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithG1.java b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithG1.java index ac646e7c14a..3e763699402 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithG1.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithG1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, 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 * @bug 8212766 - * @key jfr + * @requires vm.flagless * @summary Test that events are created when an object is aged or promoted during a GC and the copying of the object requires a new PLAB or direct heap allocation * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithParallelScavenge.java b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithParallelScavenge.java index 30b18a9df4a..13de75ff583 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithParallelScavenge.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithParallelScavenge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, 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 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test that events are created when an object is aged or promoted during a GC and the copying of the object requires a new PLAB or direct heap allocation * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithDefNew.java b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithDefNew.java index 53382ea8ba2..b239f6f78ba 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithDefNew.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithDefNew.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "Serial" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithParallelScavenge.java b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithParallelScavenge.java index 98abeabdacb..4880640b772 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithParallelScavenge.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithParallelScavenge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "Parallel" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahEvacuationInformationEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahEvacuationInformationEvent.java index 33310ab721a..4f2334284cc 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahEvacuationInformationEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahEvacuationInformationEvent.java @@ -39,7 +39,7 @@ * @test * @bug 8221507 * @requires vm.hasJFR & vm.gc.Shenandoah - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -Xmx64m -XX:+UnlockExperimentalVMOptions -XX:ShenandoahRegionSize=1m -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational jdk.jfr.event.gc.detailed.TestShenandoahEvacuationInformationEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionInformationEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionInformationEvent.java index 2f220571b7d..88538928145 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionInformationEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionInformationEvent.java @@ -38,7 +38,7 @@ * @test * @bug 8221507 * @requires vm.hasJFR & vm.gc.Shenandoah - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -Xmx32m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGarbageThreshold=1 jdk.jfr.event.gc.detailed.TestShenandoahHeapRegionInformationEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionStateChangeEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionStateChangeEvent.java index 3162497f52c..dfd0c0f86bc 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionStateChangeEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionStateChangeEvent.java @@ -38,7 +38,7 @@ * @test * @bug 8221507 * @requires vm.hasJFR & vm.gc.Shenandoah - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -Xmx32m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGarbageThreshold=1 jdk.jfr.event.gc.detailed.TestShenandoahHeapRegionStateChangeEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestTenuringDistributionEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestTenuringDistributionEvent.java index 9002373caef..843219d61d2 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestTenuringDistributionEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestTenuringDistributionEvent.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 @@ -37,7 +37,7 @@ * @bug 8009538 * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -XX:NewSize=2m -XX:MaxNewSize=2m -Xmx32m -XX:+UseG1GC -XX:+NeverTenure jdk.jfr.event.gc.detailed.TestTenuringDistributionEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java index b17c678ec55..b2f20450d0d 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.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 @@ -34,7 +34,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @run main/othervm -XX:+UseZGC -Xmx32M -Xlog:gc*:gc.log::filecount=0 jdk.jfr.event.gc.detailed.TestZAllocationStallEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZPageAllocationEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZPageAllocationEvent.java index c17e19193db..83caddbbaaf 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZPageAllocationEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZPageAllocationEvent.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 @@ -34,7 +34,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @run main/othervm -XX:+UseZGC -Xmx32M jdk.jfr.event.gc.detailed.TestZPageAllocationEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetEvent.java index baae61d5cd8..e64d6f83ab8 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetEvent.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 @@ -34,7 +34,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @run main/othervm -XX:+UseZGC -Xmx32M jdk.jfr.event.gc.detailed.TestZRelocationSetEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetGroupEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetGroupEvent.java index 0e93aed8b8e..29e1de24224 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetGroupEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetGroupEvent.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 @@ -34,7 +34,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @run main/othervm -XX:+UseZGC -Xmx32M jdk.jfr.event.gc.detailed.TestZRelocationSetGroupEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZUncommitEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZUncommitEvent.java index 1aa2ba6af0b..f77ada9bf1b 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZUncommitEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZUncommitEvent.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 @@ -36,7 +36,7 @@ /** * @test id=Z * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @run main/othervm -XX:+UseZGC -Xms32M -Xmx128M -Xlog:gc,gc+heap -XX:+ZUncommit -XX:ZUncommitDelay=1 jdk.jfr.event.gc.detailed.TestZUncommitEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZUnmapEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZUnmapEvent.java index fabbdce9c94..93ed6253de2 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZUnmapEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZUnmapEvent.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 @@ -34,7 +34,7 @@ /** * @test id=Z * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @run main/othervm -XX:+UseZGC -Xmx32M jdk.jfr.event.gc.detailed.TestZUnmapEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryCommittedSize.java b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryCommittedSize.java index 2606757721f..33578d854b6 100644 --- a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryCommittedSize.java +++ b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryCommittedSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, 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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventDefNewSerial.java b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventDefNewSerial.java index b46d52e46f1..f70d7a85f16 100644 --- a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventDefNewSerial.java +++ b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventDefNewSerial.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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Serial" | vm.gc == null * @library /test/lib /test/jdk @@ -36,7 +36,7 @@ /** * @test * @bug 8264008 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.bits == 64 * @requires vm.gc == "Serial" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventG1.java b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventG1.java index fc30a8dec73..edecfaf1406 100644 --- a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventG1.java +++ b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventG1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != true diff --git a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventPSParOld.java b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventPSParOld.java index 475c0ff84fe..306b23f88b7 100644 --- a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventPSParOld.java +++ b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventPSParOld.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1ConcurrentMark.java b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1ConcurrentMark.java index 3fe9e0f360d..eb69289aa5e 100644 --- a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1ConcurrentMark.java +++ b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1ConcurrentMark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != false diff --git a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1FullCollection.java b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1FullCollection.java index 54b8ebc33e4..6e91cf4c644 100644 --- a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1FullCollection.java +++ b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1FullCollection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != true diff --git a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithParallelOld.java b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithParallelOld.java index 8d88c8d6d8e..2a17e540be8 100644 --- a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithParallelOld.java +++ b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithParallelOld.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithSerial.java b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithSerial.java index 6401a0002e2..888eb089027 100644 --- a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithSerial.java +++ b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithSerial.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Serial" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountEvent.java b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountEvent.java index 2f7c7513b25..a9034ba0eaa 100644 --- a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountEvent.java +++ b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Serial" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithDefNew.java b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithDefNew.java index 5e3ce6928c9..bc26ad792d0 100644 --- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithDefNew.java +++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithDefNew.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Serial" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1ConcurrentMark.java b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1ConcurrentMark.java index 7a635d4812e..33547a1ca67 100644 --- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1ConcurrentMark.java +++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1ConcurrentMark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != false diff --git a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1FullCollection.java b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1FullCollection.java index b06d68c5cc3..2bf13facffc 100644 --- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1FullCollection.java +++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1FullCollection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != true diff --git a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1New.java b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1New.java index 16e87232a51..139e95980a5 100644 --- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1New.java +++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1New.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelOld.java b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelOld.java index a2810a8c8b2..5faae179fe0 100644 --- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelOld.java +++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelOld.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelScavenge.java b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelScavenge.java index 21ae0a319a8..ce9dd0b936c 100644 --- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelScavenge.java +++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelScavenge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestDefNewAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestDefNewAllocationPendingStackTrace.java index 4f83b37765d..8741d433570 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestDefNewAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestDefNewAllocationPendingStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "Serial" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1HumongousAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1HumongousAllocationPendingStackTrace.java index 0cc00bb1e4b..a61a87fd539 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1HumongousAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1HumongousAllocationPendingStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "G1" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1OldAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1OldAllocationPendingStackTrace.java index e74528c20e1..1346c36c04f 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1OldAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1OldAllocationPendingStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "G1" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1YoungAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1YoungAllocationPendingStackTrace.java index 0454d8fe77f..8c951919feb 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1YoungAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1YoungAllocationPendingStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "G1" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMarkSweepCompactAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMarkSweepCompactAllocationPendingStackTrace.java index 07a1c63fda1..8b3261e3a00 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMarkSweepCompactAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMarkSweepCompactAllocationPendingStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "Serial" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceG1GCAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceG1GCAllocationPendingStackTrace.java index 5a0cc9288b6..06c0d23788b 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceG1GCAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceG1GCAllocationPendingStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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 @@ -23,7 +23,7 @@ package jdk.jfr.event.gc.stacktrace; /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "G1" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceParallelGCAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceParallelGCAllocationPendingStackTrace.java index 8e71c8d55a8..13bfc7c9ea6 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceParallelGCAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceParallelGCAllocationPendingStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "Parallel" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceSerialGCAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceSerialGCAllocationPendingStackTrace.java index 4d9a53e9afd..36bf59741ee 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceSerialGCAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceSerialGCAllocationPendingStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "Serial" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelMarkSweepAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelMarkSweepAllocationPendingStackTrace.java index 733b4935481..93e6b5b17e7 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelMarkSweepAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelMarkSweepAllocationPendingStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "Parallel" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelScavengeAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelScavengeAllocationPendingStackTrace.java index 341a3e53aa8..7771965dc97 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelScavengeAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelScavengeAllocationPendingStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "Parallel" diff --git a/test/jdk/jdk/jfr/event/io/TestAsynchronousFileChannelEvents.java b/test/jdk/jdk/jfr/event/io/TestAsynchronousFileChannelEvents.java index f1ddba369eb..e0752c6d319 100644 --- a/test/jdk/jdk/jfr/event/io/TestAsynchronousFileChannelEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestAsynchronousFileChannelEvents.java @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestAsynchronousFileChannelEvents diff --git a/test/jdk/jdk/jfr/event/io/TestDeserializationEvent.java b/test/jdk/jdk/jfr/event/io/TestDeserializationEvent.java index 28b26165e2f..04e5126ca00 100644 --- a/test/jdk/jdk/jfr/event/io/TestDeserializationEvent.java +++ b/test/jdk/jdk/jfr/event/io/TestDeserializationEvent.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 @@ -49,7 +49,7 @@ * @test * @bug 8261160 * @summary Add a deserialization JFR event - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run testng/othervm jdk.jfr.event.io.TestDeserializationEvent diff --git a/test/jdk/jdk/jfr/event/io/TestDisabledEvents.java b/test/jdk/jdk/jfr/event/io/TestDisabledEvents.java index 0b523b80523..5a6835c4ce2 100644 --- a/test/jdk/jdk/jfr/event/io/TestDisabledEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestDisabledEvents.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 @@ -41,7 +41,7 @@ /** * @test * @summary Test with FlightRecorder enabled but with the events disabled. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestDisabledEvents diff --git a/test/jdk/jdk/jfr/event/io/TestFileChannelEvents.java b/test/jdk/jdk/jfr/event/io/TestFileChannelEvents.java index 11ae0a12e4f..490e16d3e52 100644 --- a/test/jdk/jdk/jfr/event/io/TestFileChannelEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestFileChannelEvents.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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestFileChannelEvents diff --git a/test/jdk/jdk/jfr/event/io/TestFileReadOnly.java b/test/jdk/jdk/jfr/event/io/TestFileReadOnly.java index 6986c43e3fe..f28c20d8881 100644 --- a/test/jdk/jdk/jfr/event/io/TestFileReadOnly.java +++ b/test/jdk/jdk/jfr/event/io/TestFileReadOnly.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 @@ -41,7 +41,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestFileReadOnly diff --git a/test/jdk/jdk/jfr/event/io/TestFileStreamEvents.java b/test/jdk/jdk/jfr/event/io/TestFileStreamEvents.java index d557a8dfd7d..a710335e63d 100644 --- a/test/jdk/jdk/jfr/event/io/TestFileStreamEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestFileStreamEvents.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 @@ -39,7 +39,7 @@ /** * @test TestFileStreamEvents - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestFileStreamEvents diff --git a/test/jdk/jdk/jfr/event/io/TestInstrumentation.java b/test/jdk/jdk/jfr/event/io/TestInstrumentation.java index beef8437a34..37a196237e8 100644 --- a/test/jdk/jdk/jfr/event/io/TestInstrumentation.java +++ b/test/jdk/jdk/jfr/event/io/TestInstrumentation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -51,7 +51,7 @@ /* * @test * @summary Test that will instrument the same classes that JFR will also instrument. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/io/TestRandomAccessFileEvents.java b/test/jdk/jdk/jfr/event/io/TestRandomAccessFileEvents.java index 47fbc62d08d..4da995533f8 100644 --- a/test/jdk/jdk/jfr/event/io/TestRandomAccessFileEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestRandomAccessFileEvents.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestRandomAccessFileEvents diff --git a/test/jdk/jdk/jfr/event/io/TestRandomAccessFileThread.java b/test/jdk/jdk/jfr/event/io/TestRandomAccessFileThread.java index a815a1231ce..54b989cbf3c 100644 --- a/test/jdk/jdk/jfr/event/io/TestRandomAccessFileThread.java +++ b/test/jdk/jdk/jfr/event/io/TestRandomAccessFileThread.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,7 +44,7 @@ /** * @test * @summary Verify the event time stamp and thread name - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps jdk.jfr.event.io.TestRandomAccessFileThread diff --git a/test/jdk/jdk/jfr/event/io/TestSerializationMisdeclarationEvent.java b/test/jdk/jdk/jfr/event/io/TestSerializationMisdeclarationEvent.java index 7c7b8366a04..b746d50689e 100644 --- a/test/jdk/jdk/jfr/event/io/TestSerializationMisdeclarationEvent.java +++ b/test/jdk/jdk/jfr/event/io/TestSerializationMisdeclarationEvent.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 @@ -50,7 +50,7 @@ * @bug 8275338 8324220 * @summary Check generation of JFR events for misdeclared fields and methods * relevant to serialization - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run junit/othervm jdk.jfr.event.io.TestSerializationMisdeclarationEvent diff --git a/test/jdk/jdk/jfr/event/io/TestSocketAdapterEvents.java b/test/jdk/jdk/jfr/event/io/TestSocketAdapterEvents.java index 9ac57b839fb..77a083ad8fe 100644 --- a/test/jdk/jdk/jfr/event/io/TestSocketAdapterEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestSocketAdapterEvents.java @@ -48,7 +48,7 @@ * @test * @bug 8310978 * @summary test socket read/write events on socket adaptors - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestSocketAdapterEvents diff --git a/test/jdk/jdk/jfr/event/io/TestSocketChannelEvents.java b/test/jdk/jdk/jfr/event/io/TestSocketChannelEvents.java index fc045e55caa..1a40edde0fd 100644 --- a/test/jdk/jdk/jfr/event/io/TestSocketChannelEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestSocketChannelEvents.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 @@ -44,7 +44,7 @@ /** * @test * @summary test socket read/write events on SocketChannel - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestSocketChannelEvents diff --git a/test/jdk/jdk/jfr/event/io/TestSocketEvents.java b/test/jdk/jdk/jfr/event/io/TestSocketEvents.java index d73c5010cf7..144b9592b22 100644 --- a/test/jdk/jdk/jfr/event/io/TestSocketEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestSocketEvents.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 @@ -45,7 +45,7 @@ /** * @test * @summary test socket read/write events on Socket - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestSocketEvents diff --git a/test/jdk/jdk/jfr/event/metadata/TestDefaultConfigurations.java b/test/jdk/jdk/jfr/event/metadata/TestDefaultConfigurations.java index 3b8b0d975eb..3a14937e21d 100644 --- a/test/jdk/jdk/jfr/event/metadata/TestDefaultConfigurations.java +++ b/test/jdk/jdk/jfr/event/metadata/TestDefaultConfigurations.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 @@ -53,7 +53,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/metadata/TestEventMetadata.java b/test/jdk/jdk/jfr/event/metadata/TestEventMetadata.java index afdb84952f4..e3255909fcc 100644 --- a/test/jdk/jdk/jfr/event/metadata/TestEventMetadata.java +++ b/test/jdk/jdk/jfr/event/metadata/TestEventMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.metadata.TestEventMetadata diff --git a/test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.java b/test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.java index 981579ba341..5b8aacfb1d2 100644 --- a/test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.java +++ b/test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -42,7 +42,7 @@ /** * @test Check for JFR events not covered by tests - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main jdk.jfr.event.metadata.TestLookForUntestedEvents diff --git a/test/jdk/jdk/jfr/event/oldobject/TestAllocationTime.java b/test/jdk/jdk/jfr/event/oldobject/TestAllocationTime.java index ce3e3057699..0ce109368a5 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestAllocationTime.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestAllocationTime.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 @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestArrayInformation.java b/test/jdk/jdk/jfr/event/oldobject/TestArrayInformation.java index 028024fdd28..393a734aa26 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestArrayInformation.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestArrayInformation.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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestCircularReference.java b/test/jdk/jdk/jfr/event/oldobject/TestCircularReference.java index b3dbfef090c..a601cefad40 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestCircularReference.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestCircularReference.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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestClassLoaderLeak.java b/test/jdk/jdk/jfr/event/oldobject/TestClassLoaderLeak.java index 6f7337d3777..b9aab92b924 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestClassLoaderLeak.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestClassLoaderLeak.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.flagless * @comment Marked as flagless until JDK-8322597 is fixed diff --git a/test/jdk/jdk/jfr/event/oldobject/TestFieldInformation.java b/test/jdk/jdk/jfr/event/oldobject/TestFieldInformation.java index fb0f5eebd7f..0d3e1dcc2e5 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestFieldInformation.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestFieldInformation.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestG1.java b/test/jdk/jdk/jfr/event/oldobject/TestG1.java index 79df63953c5..4c3d65a3ece 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestG1.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestG1.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.G1 * @summary Test leak profiler with G1 GC diff --git a/test/jdk/jdk/jfr/event/oldobject/TestHeapDeep.java b/test/jdk/jdk/jfr/event/oldobject/TestHeapDeep.java index b7cbb233f31..7461a9f1503 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestHeapDeep.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestHeapDeep.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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestHeapShallow.java b/test/jdk/jdk/jfr/event/oldobject/TestHeapShallow.java index 8d8b7f3c97a..bca93871cd9 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestHeapShallow.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestHeapShallow.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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.java b/test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.java index 4fe432e6493..c2a4cc5264c 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.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 @@ -43,7 +43,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestLastKnownHeapUsage.java b/test/jdk/jdk/jfr/event/oldobject/TestLastKnownHeapUsage.java index d51c52ab7e3..36fdef6c86b 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestLastKnownHeapUsage.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestLastKnownHeapUsage.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 @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestListenerLeak.java b/test/jdk/jdk/jfr/event/oldobject/TestListenerLeak.java index 92610283525..fd895fae91b 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestListenerLeak.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestListenerLeak.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestMetadataRetention.java b/test/jdk/jdk/jfr/event/oldobject/TestMetadataRetention.java index b84160a0ac5..1747939390b 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestMetadataRetention.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestMetadataRetention.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 @@ -43,7 +43,7 @@ * @test * @summary The test verifies that an old object sample maintains references to "stale" metadata * @requires vm.hasJFR - * @key jfr + * @requires vm.flagless * @modules jdk.jfr/jdk.jfr.internal.test * @library /test/lib /test/jdk * @build jdk.jfr.event.oldobject.TestMetadataObject @@ -86,7 +86,7 @@ public static void main(String[] args) throws Throwable { // System.gc() will trigger class unloading if -XX:+ExplicitGCInvokesConcurrent // is NOT set. If this flag is set G1 will never unload classes on System.gc(). - // As far as the "jfr" key guarantees no VM flags are set from the + // As far as the vm.flagless guarantees no VM flags are set from the // outside it should be enough with System.gc(). System.gc(); diff --git a/test/jdk/jdk/jfr/event/oldobject/TestObjectAge.java b/test/jdk/jdk/jfr/event/oldobject/TestObjectAge.java index cd3ff535762..6346326d620 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestObjectAge.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestObjectAge.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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestObjectDescription.java b/test/jdk/jdk/jfr/event/oldobject/TestObjectDescription.java index 447d2bb9cec..60f85e6ba72 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestObjectDescription.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestObjectDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc != "Shenandoah" * @requires vm.flagless diff --git a/test/jdk/jdk/jfr/event/oldobject/TestObjectSize.java b/test/jdk/jdk/jfr/event/oldobject/TestObjectSize.java index 7b8a1003edd..c10da3b498c 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestObjectSize.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestObjectSize.java @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestParallel.java b/test/jdk/jdk/jfr/event/oldobject/TestParallel.java index 547619c1283..e41b86e51d6 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestParallel.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestParallel.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.Parallel * @summary Test leak profiler with Parallel GC diff --git a/test/jdk/jdk/jfr/event/oldobject/TestReferenceChainLimit.java b/test/jdk/jdk/jfr/event/oldobject/TestReferenceChainLimit.java index 640819e9bc6..be8cb03fb39 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestReferenceChainLimit.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestReferenceChainLimit.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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.java b/test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.java index 30186db8def..b03f5e94f7b 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.flagless * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/oldobject/TestSerial.java b/test/jdk/jdk/jfr/event/oldobject/TestSerial.java index 8ed4d51c19d..4e6ee3c39d3 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestSerial.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestSerial.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.Serial * @summary Test leak profiler with Serial GC diff --git a/test/jdk/jdk/jfr/event/oldobject/TestShenandoah.java b/test/jdk/jdk/jfr/event/oldobject/TestShenandoah.java index 6d348391030..14b3dec5eb3 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestShenandoah.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestShenandoah.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.gc.Shenandoah * @summary Test leak profiler with Shenandoah * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/oldobject/TestThreadLocalLeak.java b/test/jdk/jdk/jfr/event/oldobject/TestThreadLocalLeak.java index c82636e9146..3ccc6952cdc 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestThreadLocalLeak.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestThreadLocalLeak.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestZ.java b/test/jdk/jdk/jfr/event/oldobject/TestZ.java index 8aff89ce7de..9ae406c9369 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestZ.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestZ.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,7 +35,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @summary Test leak profiler with ZGC * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/os/TestCPUInformation.java b/test/jdk/jdk/jfr/event/os/TestCPUInformation.java index c5166580010..5a9e631141c 100644 --- a/test/jdk/jdk/jfr/event/os/TestCPUInformation.java +++ b/test/jdk/jdk/jfr/event/os/TestCPUInformation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestCPUInformation diff --git a/test/jdk/jdk/jfr/event/os/TestCPULoad.java b/test/jdk/jdk/jfr/event/os/TestCPULoad.java index 1edb1639699..09ceb0a79b7 100644 --- a/test/jdk/jdk/jfr/event/os/TestCPULoad.java +++ b/test/jdk/jdk/jfr/event/os/TestCPULoad.java @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestCPULoad diff --git a/test/jdk/jdk/jfr/event/os/TestCPUTimeStampCounter.java b/test/jdk/jdk/jfr/event/os/TestCPUTimeStampCounter.java index fd37ef195a5..464de5557be 100644 --- a/test/jdk/jdk/jfr/event/os/TestCPUTimeStampCounter.java +++ b/test/jdk/jdk/jfr/event/os/TestCPUTimeStampCounter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestCPUTimeStampCounter diff --git a/test/jdk/jdk/jfr/event/os/TestInitialEnvironmentVariable.java b/test/jdk/jdk/jfr/event/os/TestInitialEnvironmentVariable.java index d8fd9a6e673..e869a3da3c7 100644 --- a/test/jdk/jdk/jfr/event/os/TestInitialEnvironmentVariable.java +++ b/test/jdk/jdk/jfr/event/os/TestInitialEnvironmentVariable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main jdk.jfr.event.os.TestInitialEnvironmentVariable diff --git a/test/jdk/jdk/jfr/event/os/TestOSInfo.java b/test/jdk/jdk/jfr/event/os/TestOSInfo.java index ce7565e3f51..5dfce35683b 100644 --- a/test/jdk/jdk/jfr/event/os/TestOSInfo.java +++ b/test/jdk/jdk/jfr/event/os/TestOSInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestOSInfo diff --git a/test/jdk/jdk/jfr/event/os/TestPhysicalMemoryEvent.java b/test/jdk/jdk/jfr/event/os/TestPhysicalMemoryEvent.java index 13e05227278..79810a58b3a 100644 --- a/test/jdk/jdk/jfr/event/os/TestPhysicalMemoryEvent.java +++ b/test/jdk/jdk/jfr/event/os/TestPhysicalMemoryEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestPhysicalMemoryEvent diff --git a/test/jdk/jdk/jfr/event/os/TestProcessStart.java b/test/jdk/jdk/jfr/event/os/TestProcessStart.java index bcf216857bb..2d1d80f5941 100644 --- a/test/jdk/jdk/jfr/event/os/TestProcessStart.java +++ b/test/jdk/jdk/jfr/event/os/TestProcessStart.java @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestProcessStart diff --git a/test/jdk/jdk/jfr/event/os/TestSwapSpaceEvent.java b/test/jdk/jdk/jfr/event/os/TestSwapSpaceEvent.java index 5ea2ed139ea..cf92db85ace 100644 --- a/test/jdk/jdk/jfr/event/os/TestSwapSpaceEvent.java +++ b/test/jdk/jdk/jfr/event/os/TestSwapSpaceEvent.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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (os.family != "linux") * @library /test/lib @@ -41,7 +41,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (os.family == "linux") * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/os/TestSystemProcess.java b/test/jdk/jdk/jfr/event/os/TestSystemProcess.java index 0af7a7ff379..a76060bac9d 100644 --- a/test/jdk/jdk/jfr/event/os/TestSystemProcess.java +++ b/test/jdk/jdk/jfr/event/os/TestSystemProcess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestSystemProcess diff --git a/test/jdk/jdk/jfr/event/os/TestThreadContextSwitches.java b/test/jdk/jdk/jfr/event/os/TestThreadContextSwitches.java index 00b846b87e2..7b3dfc79ce9 100644 --- a/test/jdk/jdk/jfr/event/os/TestThreadContextSwitches.java +++ b/test/jdk/jdk/jfr/event/os/TestThreadContextSwitches.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestThreadContextSwitches diff --git a/test/jdk/jdk/jfr/event/os/TestVirtualizationInfo.java b/test/jdk/jdk/jfr/event/os/TestVirtualizationInfo.java index 0c3c86d5829..2c30e102c73 100644 --- a/test/jdk/jdk/jfr/event/os/TestVirtualizationInfo.java +++ b/test/jdk/jdk/jfr/event/os/TestVirtualizationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestVirtualizationInfo diff --git a/test/jdk/jdk/jfr/event/profiling/TestFullStackTrace.java b/test/jdk/jdk/jfr/event/profiling/TestFullStackTrace.java index b7abbc0a587..424b519c1e0 100644 --- a/test/jdk/jdk/jfr/event/profiling/TestFullStackTrace.java +++ b/test/jdk/jdk/jfr/event/profiling/TestFullStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.profiling.TestFullStackTrace diff --git a/test/jdk/jdk/jfr/event/profiling/TestNative.java b/test/jdk/jdk/jfr/event/profiling/TestNative.java index 21949bcc313..e7e076051f4 100644 --- a/test/jdk/jdk/jfr/event/profiling/TestNative.java +++ b/test/jdk/jdk/jfr/event/profiling/TestNative.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 @@ -32,7 +32,7 @@ /* * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/event/profiling/TestSamplingLongPeriod.java b/test/jdk/jdk/jfr/event/profiling/TestSamplingLongPeriod.java index c2cd4cb7bd1..2402a948ef9 100644 --- a/test/jdk/jdk/jfr/event/profiling/TestSamplingLongPeriod.java +++ b/test/jdk/jdk/jfr/event/profiling/TestSamplingLongPeriod.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 @@ -31,7 +31,7 @@ /* * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/event/runtime/TestActiveRecordingEvent.java b/test/jdk/jdk/jfr/event/runtime/TestActiveRecordingEvent.java index e786e8c933d..778acf48306 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestActiveRecordingEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestActiveRecordingEvent.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 @@ -44,7 +44,7 @@ /** * @test * @summary Tests that the recording properties are properly reflected in the ActiveRecording event - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestActiveRecordingEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java b/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java index 2b55a012d44..92298eaece0 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.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 @@ -45,7 +45,7 @@ /** * @test * @summary Tests that active setting are available in the ActiveSettingevent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestActiveSettingEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestAgentEvent.java b/test/jdk/jdk/jfr/event/runtime/TestAgentEvent.java index 240868d5670..ca7b6dfc0f1 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestAgentEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestAgentEvent.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 @@ -44,7 +44,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests Agent Loaded event by starting native and Java agents * @requires vm.hasJFR & vm.jvmti * diff --git a/test/jdk/jdk/jfr/event/runtime/TestClassDefineEvent.java b/test/jdk/jdk/jfr/event/runtime/TestClassDefineEvent.java index 3681e73b527..b0522741a1e 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestClassDefineEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestClassDefineEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, 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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestClassLoadEvent.java b/test/jdk/jdk/jfr/event/runtime/TestClassLoadEvent.java index ec72253bc06..102ff92db71 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestClassLoadEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestClassLoadEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, 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 @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestClassLoaderStatsEvent.java b/test/jdk/jdk/jfr/event/runtime/TestClassLoaderStatsEvent.java index 62b9ef1eccd..f73876e677c 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestClassLoaderStatsEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestClassLoaderStatsEvent.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 @@ -42,7 +42,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestClassLoadingStatisticsEvent.java b/test/jdk/jdk/jfr/event/runtime/TestClassLoadingStatisticsEvent.java index 8bbbdcbc447..6184a6f627e 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestClassLoadingStatisticsEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestClassLoadingStatisticsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestClassRedefinition.java b/test/jdk/jdk/jfr/event/runtime/TestClassRedefinition.java index 23c2f2cbc3a..5367d76dbf5 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestClassRedefinition.java +++ b/test/jdk/jdk/jfr/event/runtime/TestClassRedefinition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, 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 @@ -40,7 +40,7 @@ /** * @test * @summary Tests ClassRedefinition event by redefining classes in a Java agent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.instrument diff --git a/test/jdk/jdk/jfr/event/runtime/TestClassUnloadEvent.java b/test/jdk/jdk/jfr/event/runtime/TestClassUnloadEvent.java index 6507b7e53bf..f25b9a69650 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestClassUnloadEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestClassUnloadEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, 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 @@ -38,7 +38,7 @@ /** * @test * @summary The test verifies that a class unload event is created when class is unloaded - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestDeprecatedEvent.java b/test/jdk/jdk/jfr/event/runtime/TestDeprecatedEvent.java index 183d82bc5e2..e2ecea43a88 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestDeprecatedEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestDeprecatedEvent.java @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules jdk.jfr/jdk.jfr.internal.test * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/runtime/TestDirectBufferStatisticsEvent.java b/test/jdk/jdk/jfr/event/runtime/TestDirectBufferStatisticsEvent.java index 777f2d5fca2..b007083dde9 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestDirectBufferStatisticsEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestDirectBufferStatisticsEvent.java @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestDumpReason.java b/test/jdk/jdk/jfr/event/runtime/TestDumpReason.java index 83af0de239d..f801829d8eb 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestDumpReason.java +++ b/test/jdk/jdk/jfr/event/runtime/TestDumpReason.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, 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 @@ -41,7 +41,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules java.base/jdk.internal.misc jdk.jfr diff --git a/test/jdk/jdk/jfr/event/runtime/TestExceptionEvents.java b/test/jdk/jdk/jfr/event/runtime/TestExceptionEvents.java index 46488f0221a..8c447ac44bf 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestExceptionEvents.java +++ b/test/jdk/jdk/jfr/event/runtime/TestExceptionEvents.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestExceptionEvents diff --git a/test/jdk/jdk/jfr/event/runtime/TestExceptionSubclass.java b/test/jdk/jdk/jfr/event/runtime/TestExceptionSubclass.java index f6917faa8e2..0c55b27364e 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestExceptionSubclass.java +++ b/test/jdk/jdk/jfr/event/runtime/TestExceptionSubclass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -27,7 +27,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @bug 8013122 * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/runtime/TestFinalizerStatisticsEvent.java b/test/jdk/jdk/jfr/event/runtime/TestFinalizerStatisticsEvent.java index 8256a62b571..ead77f467ac 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestFinalizerStatisticsEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestFinalizerStatisticsEvent.java @@ -36,7 +36,7 @@ * @test * @bug 8266936 8276422 * @summary The test verifies that classes overriding finalize() are represented as events. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -Xlog:class+unload,finalizer -Xmx16m jdk.jfr.event.runtime.TestFinalizerStatisticsEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestFlush.java b/test/jdk/jdk/jfr/event/runtime/TestFlush.java index ad8706a6493..5c450eab05f 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestFlush.java +++ b/test/jdk/jdk/jfr/event/runtime/TestFlush.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 @@ -41,7 +41,7 @@ /** * @test * @summary Verifies at the metalevel that stream contents are written to ongoing recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr+system+streaming=trace jdk.jfr.event.runtime.TestFlush diff --git a/test/jdk/jdk/jfr/event/runtime/TestJavaBlockedEvent.java b/test/jdk/jdk/jfr/event/runtime/TestJavaBlockedEvent.java index 23fb1cd8433..c29cebc3d1d 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestJavaBlockedEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestJavaBlockedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorInflateEvent.java b/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorInflateEvent.java index 596b50f5b0c..5b7fb3e19ca 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorInflateEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorInflateEvent.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 @@ -38,7 +38,7 @@ /** * @test TestJavaMonitorInflateEvent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestJavaMonitorInflateEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitEvent.java b/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitEvent.java index a9cbd040192..d16503f1fdc 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestJavaMonitorWaitEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitTimeOut.java b/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitTimeOut.java index 0e200f68f9e..379b9a97a29 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitTimeOut.java +++ b/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitTimeOut.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestJavaMonitorWaitTimeOut diff --git a/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEvent.java b/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEvent.java index 4a6c991ec3c..92d86b1163c 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestJavaThreadStatisticsEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEventBean.java b/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEventBean.java index 1702d5cd235..dae73cb76b5 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEventBean.java +++ b/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEventBean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/event/runtime/TestModuleEvents.java b/test/jdk/jdk/jfr/event/runtime/TestModuleEvents.java index dc877e1cafc..4998cb29d3d 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestModuleEvents.java +++ b/test/jdk/jdk/jfr/event/runtime/TestModuleEvents.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 @@ -37,7 +37,7 @@ /** * @test * @summary Tests the JFR events related to modules - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires !vm.graal.enabled * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/runtime/TestNativeLibrariesEvent.java b/test/jdk/jdk/jfr/event/runtime/TestNativeLibrariesEvent.java index 571809ddab4..132cc7e73b8 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestNativeLibrariesEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestNativeLibrariesEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -38,7 +38,7 @@ /** * @test * @bug 8216559 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestNativeLibrariesEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestNativeLibraryLoadEvent.java b/test/jdk/jdk/jfr/event/runtime/TestNativeLibraryLoadEvent.java index 240045c1d60..e0931d7453f 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestNativeLibraryLoadEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestNativeLibraryLoadEvent.java @@ -39,7 +39,7 @@ /** * @test * @bug 8313251 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestNativeLibraryLoadEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestNativeMemoryUsageEvents.java b/test/jdk/jdk/jfr/event/runtime/TestNativeMemoryUsageEvents.java index b1a564cb4a0..9373f745591 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestNativeMemoryUsageEvents.java +++ b/test/jdk/jdk/jfr/event/runtime/TestNativeMemoryUsageEvents.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.opt.NativeMemoryTracking == null * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/runtime/TestNetworkUtilizationEvent.java b/test/jdk/jdk/jfr/event/runtime/TestNetworkUtilizationEvent.java index a1b5485a5bd..ac33c39a1a2 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestNetworkUtilizationEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestNetworkUtilizationEvent.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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/event/runtime/TestRedefineClasses.java b/test/jdk/jdk/jfr/event/runtime/TestRedefineClasses.java index 40fc583872f..c4c73ec3d57 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestRedefineClasses.java +++ b/test/jdk/jdk/jfr/event/runtime/TestRedefineClasses.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, 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 @@ -39,7 +39,7 @@ * @test * @summary Tests RedefinitionClasses event by redefining a class in a Java * agent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.instrument diff --git a/test/jdk/jdk/jfr/event/runtime/TestResidentSetSizeEvent.java b/test/jdk/jdk/jfr/event/runtime/TestResidentSetSizeEvent.java index facf222279c..8b9bd99bf5e 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestResidentSetSizeEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestResidentSetSizeEvent.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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/event/runtime/TestRetransformClasses.java b/test/jdk/jdk/jfr/event/runtime/TestRetransformClasses.java index a02f97366c3..582422d8c80 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestRetransformClasses.java +++ b/test/jdk/jdk/jfr/event/runtime/TestRetransformClasses.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, 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 @@ -41,7 +41,7 @@ * @test * @summary Tests the RetransformClasses event by redefining a class in a Java * agent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.instrument diff --git a/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java b/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java index 8ea0181b0dd..0dccbc4495a 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java +++ b/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.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 @@ -38,7 +38,7 @@ /** * @test TestSafepointEvents - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java b/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java index d680dde023d..61d99fbec4f 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.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 @@ -45,7 +45,7 @@ /** * @test * @summary Test Shutdown event - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/event/runtime/TestSizeTFlags.java b/test/jdk/jdk/jfr/event/runtime/TestSizeTFlags.java index 3eaf4cccf6c..0c53d7c91a7 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestSizeTFlags.java +++ b/test/jdk/jdk/jfr/event/runtime/TestSizeTFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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 @@ -37,7 +37,7 @@ * @bug 8058552 * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null - * @key jfr + * @requires vm.flagless * @summary Test checks that flags of type size_t are being sent to the jfr * @library /test/lib * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:+UseG1GC -XX:+UseTLAB -XX:MinTLABSize=3k -XX:YoungPLABSize=3k -XX:MaxDirectMemorySize=5M jdk.jfr.event.runtime.TestSizeTFlags diff --git a/test/jdk/jdk/jfr/event/runtime/TestSyncOnValueBasedClassEvent.java b/test/jdk/jdk/jfr/event/runtime/TestSyncOnValueBasedClassEvent.java index f20175da37f..7ad50c83399 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestSyncOnValueBasedClassEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestSyncOnValueBasedClassEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, 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 * @bug 8242263 * @requires vm.hasJFR - * @key jfr + * @requires vm.flagless * @library /test/lib * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:DiagnoseSyncOnValueBasedClasses=2 jdk.jfr.event.runtime.TestSyncOnValueBasedClassEvent */ diff --git a/test/jdk/jdk/jfr/event/runtime/TestSystemPropertyEvent.java b/test/jdk/jdk/jfr/event/runtime/TestSystemPropertyEvent.java index 9cb506c45cb..7adc1fabc23 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestSystemPropertyEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestSystemPropertyEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestSystemPropertyEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestTableStatisticsEvent.java b/test/jdk/jdk/jfr/event/runtime/TestTableStatisticsEvent.java index 1f5884c4b46..9652b5d501c 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestTableStatisticsEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestTableStatisticsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, 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,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadAllocationEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadAllocationEvent.java index 192559cd69b..69511a4b521 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadAllocationEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadAllocationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -43,7 +43,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadCpuTimeEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadCpuTimeEvent.java index a6520614eab..e6cd9d95d16 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadCpuTimeEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadCpuTimeEvent.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 @@ -41,7 +41,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadDumpEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadDumpEvent.java index b583d486926..302874880c2 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadDumpEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadDumpEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestThreadDumpEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadEndEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadEndEvent.java index 160702de360..0b70cd5bcbc 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadEndEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadEndEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @compile TestThreadEndEvent.java LatchedThread.java diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadParkEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadParkEvent.java index d65a4074306..3887af38aeb 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadParkEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadParkEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadSleepEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadSleepEvent.java index c084808ce79..e372766b95d 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadSleepEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadSleepEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestThreadSleepEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadStartEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadStartEvent.java index 9e8f7b13e31..5b0a6ea68a3 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadStartEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadStartEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @compile TestThreadStartEvent.java LatchedThread.java diff --git a/test/jdk/jdk/jfr/event/runtime/TestVMInfoEvent.java b/test/jdk/jdk/jfr/event/runtime/TestVMInfoEvent.java index 82a05273979..2571530a470 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestVMInfoEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestVMInfoEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.gc == "Serial" | vm.gc == null * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/runtime/TestVMOperation.java b/test/jdk/jdk/jfr/event/runtime/TestVMOperation.java index 31fb306c04d..d9ed619ac36 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestVMOperation.java +++ b/test/jdk/jdk/jfr/event/runtime/TestVMOperation.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 @@ -36,7 +36,7 @@ * @test * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null - * @key jfr + * @requires vm.flagless * @library /test/lib * @run main/othervm -XX:+UseParallelGC jdk.jfr.event.runtime.TestVMOperation */ diff --git a/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadEndEvent.java b/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadEndEvent.java index 355ef163e6f..7de0b321864 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadEndEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadEndEvent.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @compile TestVirtualThreadEndEvent.java LatchedThread.java diff --git a/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadStartEvent.java b/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadStartEvent.java index 7b4bdb4b28e..cc1f38b8a72 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadStartEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadStartEvent.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @compile TestVirtualThreadStartEvent.java LatchedThread.java diff --git a/test/jdk/jdk/jfr/event/runtime/TestVmFlagChangedEvent.java b/test/jdk/jdk/jfr/event/runtime/TestVmFlagChangedEvent.java index a386adc8ac2..a24996f0e55 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestVmFlagChangedEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestVmFlagChangedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, 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 @@ -37,7 +37,7 @@ /** * @test TestVmFlagChangedEvent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/event/security/TestInitialSecurityPropertyEvent.java b/test/jdk/jdk/jfr/event/security/TestInitialSecurityPropertyEvent.java index bebd44782d2..bed89be84c2 100644 --- a/test/jdk/jdk/jfr/event/security/TestInitialSecurityPropertyEvent.java +++ b/test/jdk/jdk/jfr/event/security/TestInitialSecurityPropertyEvent.java @@ -38,7 +38,7 @@ * @test * @bug 8292177 * @summary InitialSecurityProperty JFR event - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules java.base/jdk.internal.access diff --git a/test/jdk/jdk/jfr/event/security/TestSecurityPropertyModificationEvent.java b/test/jdk/jdk/jfr/event/security/TestSecurityPropertyModificationEvent.java index ff5919b2590..4ede92aee41 100644 --- a/test/jdk/jdk/jfr/event/security/TestSecurityPropertyModificationEvent.java +++ b/test/jdk/jdk/jfr/event/security/TestSecurityPropertyModificationEvent.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 @@ -37,7 +37,7 @@ * @test * @bug 8148188 * @summary Enhance the security libraries to record events of interest - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.security.TestSecurityPropertyModificationEvent diff --git a/test/jdk/jdk/jfr/event/security/TestSecurityProviderServiceEvent.java b/test/jdk/jdk/jfr/event/security/TestSecurityProviderServiceEvent.java index df801c51907..70ed6f3d867 100644 --- a/test/jdk/jdk/jfr/event/security/TestSecurityProviderServiceEvent.java +++ b/test/jdk/jdk/jfr/event/security/TestSecurityProviderServiceEvent.java @@ -42,7 +42,7 @@ * @test * @bug 8254711 * @summary Add JFR events for security crypto algorithms - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.events diff --git a/test/jdk/jdk/jfr/event/security/TestTLSHandshakeEvent.java b/test/jdk/jdk/jfr/event/security/TestTLSHandshakeEvent.java index 7c5240a2a72..559290f50b4 100644 --- a/test/jdk/jdk/jfr/event/security/TestTLSHandshakeEvent.java +++ b/test/jdk/jdk/jfr/event/security/TestTLSHandshakeEvent.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 @@ -35,7 +35,7 @@ * @test * @bug 8148188 * @summary Enhance the security libraries to record events of interest - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.security.TestTLSHandshakeEvent diff --git a/test/jdk/jdk/jfr/event/security/TestX509CertificateEvent.java b/test/jdk/jdk/jfr/event/security/TestX509CertificateEvent.java index e7e905830a4..60b1406a0dc 100644 --- a/test/jdk/jdk/jfr/event/security/TestX509CertificateEvent.java +++ b/test/jdk/jdk/jfr/event/security/TestX509CertificateEvent.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 @@ -37,7 +37,7 @@ * @test * @bug 8148188 8292033 * @summary Enhance the security libraries to record events of interest - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules java.base/sun.security.x509 java.base/sun.security.tools.keytool * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/security/TestX509ValidationEvent.java b/test/jdk/jdk/jfr/event/security/TestX509ValidationEvent.java index 651a6390f68..92dc99ef8c7 100644 --- a/test/jdk/jdk/jfr/event/security/TestX509ValidationEvent.java +++ b/test/jdk/jdk/jfr/event/security/TestX509ValidationEvent.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 @@ -36,7 +36,7 @@ * @test * @bug 8148188 * @summary Enhance the security libraries to record events of interest - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.events java.base/sun.security.x509 java.base/sun.security.tools.keytool diff --git a/test/jdk/jdk/jfr/javaagent/TestEventInstrumentation.java b/test/jdk/jdk/jfr/javaagent/TestEventInstrumentation.java index d5997f1ad46..1a5ad27725b 100644 --- a/test/jdk/jdk/jfr/javaagent/TestEventInstrumentation.java +++ b/test/jdk/jdk/jfr/javaagent/TestEventInstrumentation.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 @@ -48,7 +48,7 @@ * @test * @summary Verify that a subclass of the JFR Event class * can be successfully instrumented. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jartool/sun.tools.jar diff --git a/test/jdk/jdk/jfr/javaagent/TestLoadedAgent.java b/test/jdk/jdk/jfr/javaagent/TestLoadedAgent.java index deb38d5e8db..92b88336b3e 100644 --- a/test/jdk/jdk/jfr/javaagent/TestLoadedAgent.java +++ b/test/jdk/jdk/jfr/javaagent/TestLoadedAgent.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 @@ -23,7 +23,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests emitting events in a dynamically loaded Java agent * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/javaagent/TestPremainAgent.java b/test/jdk/jdk/jfr/javaagent/TestPremainAgent.java index 19a39ff7ef0..388779fcc7f 100644 --- a/test/jdk/jdk/jfr/javaagent/TestPremainAgent.java +++ b/test/jdk/jdk/jfr/javaagent/TestPremainAgent.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 @@ -23,7 +23,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests emitting event before main using a Java agent * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/jcmd/TestFilenameExpansion.java b/test/jdk/jdk/jfr/jcmd/TestFilenameExpansion.java index 9b9f67ba0fa..789d5cbe5bd 100644 --- a/test/jdk/jdk/jfr/jcmd/TestFilenameExpansion.java +++ b/test/jdk/jdk/jfr/jcmd/TestFilenameExpansion.java @@ -34,7 +34,7 @@ /** * @test * @summary The test verifies JFR.start/dump/stop commands - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestFilenameExpansion diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdChangeLogLevel.java b/test/jdk/jdk/jfr/jcmd/TestJcmdChangeLogLevel.java index dfb755a7f21..c4ef5ecfa74 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdChangeLogLevel.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdChangeLogLevel.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 @@ -35,7 +35,7 @@ /** * @test TestJcmdLogLevelChange - * @key jfr + * @requires vm.flagless * @summary Test changing log level * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java b/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java index 29e666a830c..f64c99bedbc 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java @@ -38,7 +38,7 @@ /** * @test * @summary The test verifies JFR.configure command - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdConfigureReadOnly.java b/test/jdk/jdk/jfr/jcmd/TestJcmdConfigureReadOnly.java index 6ddf3a75234..9eefbd183b2 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdConfigureReadOnly.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdConfigureReadOnly.java @@ -28,7 +28,7 @@ /** * @test * @summary The test verifies JFR.configure command can only set certain options before JFR is started. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdConfigureReadOnly diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdDump.java b/test/jdk/jdk/jfr/jcmd/TestJcmdDump.java index 6f4be44ff63..2bc7aa857e3 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdDump.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDump.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 @@ -41,7 +41,7 @@ /** * @test * @summary The test verifies JFR.dump command - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:FlightRecorderOptions:maxchunksize=1M jdk.jfr.jcmd.TestJcmdDump diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpGeneratedFilename.java b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpGeneratedFilename.java index 4612e7c7c8c..eca991eaab6 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpGeneratedFilename.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpGeneratedFilename.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 @@ -35,7 +35,7 @@ /** * @test * @summary The test verifies JFR.dump command - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdDumpGeneratedFilename diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpLimited.java b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpLimited.java index ce4b11937c6..8b8ba050245 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpLimited.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpLimited.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 @@ /** * @test * @summary The test verifies JFR.dump command - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdDumpLimited diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.java b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.java index 5d469c698c1..499bf9452be 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.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 @@ -45,7 +45,7 @@ * @requires vm.hasJFR * @modules jdk.jfr/jdk.jfr.internal.test * @library /test/lib /test/jdk - * @key jfr + * @requires vm.flagless * * @run main/othervm -XX:TLABSize=2k jdk.jfr.jcmd.TestJcmdDumpPathToGCRoots */ diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java index 93265dc677c..268d250418d 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.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 @@ -34,7 +34,7 @@ /** * @test * @bug 8220657 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdDumpWithFileName diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdLegacy.java b/test/jdk/jdk/jfr/jcmd/TestJcmdLegacy.java index a6aa2143f41..33e5d9542ef 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdLegacy.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdLegacy.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 @@ -38,7 +38,7 @@ /** * @test TestClassId - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdOptionSpecifiedOnce.java b/test/jdk/jdk/jfr/jcmd/TestJcmdOptionSpecifiedOnce.java index bb057cce386..a9b9bcc5872 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdOptionSpecifiedOnce.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdOptionSpecifiedOnce.java @@ -25,7 +25,7 @@ /** * @test * @summary The test verifies that options can only be specified once with jcmd JFR - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.dcmd diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdPreserveRepository.java b/test/jdk/jdk/jfr/jcmd/TestJcmdPreserveRepository.java index 374c760ae9b..9f42bef6e7e 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdPreserveRepository.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdPreserveRepository.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,7 +35,7 @@ /** * @test * @summary Test verifies that files are left after preserve-repository has been set using jcmd JFR.configure - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdPreserveRepository diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdSaveToFile.java b/test/jdk/jdk/jfr/jcmd/TestJcmdSaveToFile.java index b6542420bd5..b7ce317f928 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdSaveToFile.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdSaveToFile.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 @@ -31,7 +31,7 @@ /** * @test * @summary The test verifies that recording can be written to a file both with JFR.start and JFR.stop - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdSaveToFile diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartDirNotExist.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartDirNotExist.java index 49035cff8f4..e683880195b 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartDirNotExist.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartDirNotExist.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 @@ -31,7 +31,7 @@ /** * @test * @summary Verify error when starting with a dir that does not exist. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStartDirNotExist diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartFlushInterval.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartFlushInterval.java index 0d6e8fa0760..046ecd190f8 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartFlushInterval.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartFlushInterval.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 @@ -32,7 +32,7 @@ /** * @test * @summary Start a recording with a flush interval - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr:open diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartGeneratedFilename.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartGeneratedFilename.java index d3e4dd7b2c2..bf365b9c248 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartGeneratedFilename.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartGeneratedFilename.java @@ -38,7 +38,7 @@ /** * @test * @summary Verify that a filename is generated - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStartGeneratedFilename diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartInvaldFile.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartInvaldFile.java index 718ee55a839..e8e40557eab 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartInvaldFile.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartInvaldFile.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 @@ /** * @test * @summary Verify error when starting with invalid file. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStartInvaldFile diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartPathToGCRoots.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartPathToGCRoots.java index ff87d2b68a1..5e116480aa8 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartPathToGCRoots.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartPathToGCRoots.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 @@ -35,7 +35,7 @@ * @summary Start a recording with or without path-to-gc-roots * @requires vm.hasJFR * @library /test/lib /test/jdk - * @key jfr + * @requires vm.flagless * * @run main/othervm jdk.jfr.jcmd.TestJcmdStartPathToGCRoots */ diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartReadOnlyFile.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartReadOnlyFile.java index c1727c9ef97..d74c29ae7bf 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartReadOnlyFile.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartReadOnlyFile.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 @@ -32,7 +32,7 @@ /** * @test * @summary Verify error when starting with read-only file. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStartReadOnlyFile diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartStopDefault.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartStopDefault.java index 5985b85b167..374234fe07b 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartStopDefault.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartStopDefault.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 @@ -35,7 +35,7 @@ /** * @test * @summary Start a recording without name. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStartStopDefault diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithOptions.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithOptions.java index fe8db5f773a..41c144c16ee 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithOptions.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithOptions.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 @@ -33,7 +33,7 @@ /** * @test * @summary The test verifies that recording can be started with options delay|duration|maxage|maxsize - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:FlightRecorderOptions:maxchunksize=2097152 jdk.jfr.jcmd.TestJcmdStartWithOptions diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithSettings.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithSettings.java index d0e502c52a3..afe405ef29d 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithSettings.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithSettings.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 @@ -36,7 +36,7 @@ /** * @test * @summary The test verifies that recording can be started with setting file(s) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStartWithSettings diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStopInvalidFile.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStopInvalidFile.java index 63f201c08bd..dc74674ca99 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStopInvalidFile.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStopInvalidFile.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 @@ /** * @test * @summary Verify error when stopping with invalid file. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStopInvalidFile diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStopReadOnlyFile.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStopReadOnlyFile.java index 10401bdf12f..a91f11a55d6 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStopReadOnlyFile.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStopReadOnlyFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -32,7 +32,7 @@ /** * @test * @summary Verify error when stopping with read-only file. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStopReadOnlyFile diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStopWithoutFilename.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStopWithoutFilename.java index 3cd7a572427..a4a8051937f 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStopWithoutFilename.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStopWithoutFilename.java @@ -28,7 +28,7 @@ /** * @test * @summary The test verifies JFR.stop - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStopWithoutFilename diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdView.java b/test/jdk/jdk/jfr/jcmd/TestJcmdView.java index 44db54e7850..92e5c950f9b 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdView.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdView.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 @@ -33,7 +33,7 @@ /** * @test * @summary The test verifies JFR.view command - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != false diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdViewMissingData.java b/test/jdk/jdk/jfr/jcmd/TestJcmdViewMissingData.java index 9ba7e9119d9..b7a22b1adcc 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdViewMissingData.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdViewMissingData.java @@ -30,7 +30,7 @@ /** * @test * @summary The test verifies JFR.view command - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdViewMissingData diff --git a/test/jdk/jdk/jfr/jmx/TestClone.java b/test/jdk/jdk/jfr/jmx/TestClone.java index 9e1c2d4e9a5..586a58a607c 100644 --- a/test/jdk/jdk/jfr/jmx/TestClone.java +++ b/test/jdk/jdk/jfr/jmx/TestClone.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestClone diff --git a/test/jdk/jdk/jfr/jmx/TestCloneRepeat.java b/test/jdk/jdk/jfr/jmx/TestCloneRepeat.java index 61458b676c9..099aec3b478 100644 --- a/test/jdk/jdk/jfr/jmx/TestCloneRepeat.java +++ b/test/jdk/jdk/jfr/jmx/TestCloneRepeat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestCloneRepeat diff --git a/test/jdk/jdk/jfr/jmx/TestConfigurationInfo.java b/test/jdk/jdk/jfr/jmx/TestConfigurationInfo.java index 450caaa93ed..4b6f786ee61 100644 --- a/test/jdk/jdk/jfr/jmx/TestConfigurationInfo.java +++ b/test/jdk/jdk/jfr/jmx/TestConfigurationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestConfigurationInfo diff --git a/test/jdk/jdk/jfr/jmx/TestCopyTo.java b/test/jdk/jdk/jfr/jmx/TestCopyTo.java index 3da3e266fca..6ed7f14547e 100644 --- a/test/jdk/jdk/jfr/jmx/TestCopyTo.java +++ b/test/jdk/jdk/jfr/jmx/TestCopyTo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestCopyTo diff --git a/test/jdk/jdk/jfr/jmx/TestCopyToInvalidPath.java b/test/jdk/jdk/jfr/jmx/TestCopyToInvalidPath.java index 032e1c3dc9b..d868eb4c3dd 100644 --- a/test/jdk/jdk/jfr/jmx/TestCopyToInvalidPath.java +++ b/test/jdk/jdk/jfr/jmx/TestCopyToInvalidPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestCopyToInvalidPath diff --git a/test/jdk/jdk/jfr/jmx/TestCopyToReadOnlyDir.java b/test/jdk/jdk/jfr/jmx/TestCopyToReadOnlyDir.java index faaae63fbb2..c9364f2b43c 100644 --- a/test/jdk/jdk/jfr/jmx/TestCopyToReadOnlyDir.java +++ b/test/jdk/jdk/jfr/jmx/TestCopyToReadOnlyDir.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestCopyToReadOnlyDir diff --git a/test/jdk/jdk/jfr/jmx/TestCopyToRunning.java b/test/jdk/jdk/jfr/jmx/TestCopyToRunning.java index a8afc2110f1..82e45305724 100644 --- a/test/jdk/jdk/jfr/jmx/TestCopyToRunning.java +++ b/test/jdk/jdk/jfr/jmx/TestCopyToRunning.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Copy a recording to file while it is running. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/TestEventTypes.java b/test/jdk/jdk/jfr/jmx/TestEventTypes.java index 4f284b399ce..a7d0219661d 100644 --- a/test/jdk/jdk/jfr/jmx/TestEventTypes.java +++ b/test/jdk/jdk/jfr/jmx/TestEventTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -42,7 +42,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Verifies that EventTypes from jmx and FlightRecorder are the same. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/TestFlightRecorderMXBeanLeak.java b/test/jdk/jdk/jfr/jmx/TestFlightRecorderMXBeanLeak.java index d2096fde915..54f4fa14123 100644 --- a/test/jdk/jdk/jfr/jmx/TestFlightRecorderMXBeanLeak.java +++ b/test/jdk/jdk/jfr/jmx/TestFlightRecorderMXBeanLeak.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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Verifies that attributes in FlightRecorderMXBean can be inspected * without causing a memory leak. * @requires vm.hasJFR diff --git a/test/jdk/jdk/jfr/jmx/TestGetRecordings.java b/test/jdk/jdk/jfr/jmx/TestGetRecordings.java index 339953fcbf4..af930be5f17 100644 --- a/test/jdk/jdk/jfr/jmx/TestGetRecordings.java +++ b/test/jdk/jdk/jfr/jmx/TestGetRecordings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, 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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -Djdk.attach.allowAttachSelf=true -Dcom.sun.management.jmxremote jdk.jfr.jmx.TestGetRecordings diff --git a/test/jdk/jdk/jfr/jmx/TestGetRecordingsMultiple.java b/test/jdk/jdk/jfr/jmx/TestGetRecordingsMultiple.java index cbaaeda98a0..87880972287 100644 --- a/test/jdk/jdk/jfr/jmx/TestGetRecordingsMultiple.java +++ b/test/jdk/jdk/jfr/jmx/TestGetRecordingsMultiple.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestGetRecordingsMultiple diff --git a/test/jdk/jdk/jfr/jmx/TestMultipleRecordings.java b/test/jdk/jdk/jfr/jmx/TestMultipleRecordings.java index 4d1619ed30d..316a4104db6 100644 --- a/test/jdk/jdk/jfr/jmx/TestMultipleRecordings.java +++ b/test/jdk/jdk/jfr/jmx/TestMultipleRecordings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestMultipleRecordings diff --git a/test/jdk/jdk/jfr/jmx/TestNotificationListener.java b/test/jdk/jdk/jfr/jmx/TestNotificationListener.java index 950e5fa6d59..a27059a2fae 100644 --- a/test/jdk/jdk/jfr/jmx/TestNotificationListener.java +++ b/test/jdk/jdk/jfr/jmx/TestNotificationListener.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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestNotificationListener diff --git a/test/jdk/jdk/jfr/jmx/TestPredefinedConfiguration.java b/test/jdk/jdk/jfr/jmx/TestPredefinedConfiguration.java index 6aa6d6bbbbd..d329ceae734 100644 --- a/test/jdk/jdk/jfr/jmx/TestPredefinedConfiguration.java +++ b/test/jdk/jdk/jfr/jmx/TestPredefinedConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestPredefinedConfiguration diff --git a/test/jdk/jdk/jfr/jmx/TestPredefinedConfigurationInvalid.java b/test/jdk/jdk/jfr/jmx/TestPredefinedConfigurationInvalid.java index d68bacbcbd0..32d5f30540c 100644 --- a/test/jdk/jdk/jfr/jmx/TestPredefinedConfigurationInvalid.java +++ b/test/jdk/jdk/jfr/jmx/TestPredefinedConfigurationInvalid.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestPredefinedConfigurationInvalid diff --git a/test/jdk/jdk/jfr/jmx/TestRecordingOptions.java b/test/jdk/jdk/jfr/jmx/TestRecordingOptions.java index 6cab6b4a2eb..8f048ace3c3 100644 --- a/test/jdk/jdk/jfr/jmx/TestRecordingOptions.java +++ b/test/jdk/jdk/jfr/jmx/TestRecordingOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestRecordingOptions diff --git a/test/jdk/jdk/jfr/jmx/TestRecordingSettings.java b/test/jdk/jdk/jfr/jmx/TestRecordingSettings.java index 026485e4942..d7c0387e8cf 100644 --- a/test/jdk/jdk/jfr/jmx/TestRecordingSettings.java +++ b/test/jdk/jdk/jfr/jmx/TestRecordingSettings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestRecordingSettings diff --git a/test/jdk/jdk/jfr/jmx/TestRecordingSettingsInvalid.java b/test/jdk/jdk/jfr/jmx/TestRecordingSettingsInvalid.java index 669b30cf36b..a29bd3a61d1 100644 --- a/test/jdk/jdk/jfr/jmx/TestRecordingSettingsInvalid.java +++ b/test/jdk/jdk/jfr/jmx/TestRecordingSettingsInvalid.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Verify exception when setting invalid settings. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/TestRecordingSettingsMultiple.java b/test/jdk/jdk/jfr/jmx/TestRecordingSettingsMultiple.java index c1ab3d80f38..c383e1b2fd5 100644 --- a/test/jdk/jdk/jfr/jmx/TestRecordingSettingsMultiple.java +++ b/test/jdk/jdk/jfr/jmx/TestRecordingSettingsMultiple.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestRecordingSettingsMultiple diff --git a/test/jdk/jdk/jfr/jmx/TestRecordingState.java b/test/jdk/jdk/jfr/jmx/TestRecordingState.java index de9b316ef2c..05d57f01b44 100644 --- a/test/jdk/jdk/jfr/jmx/TestRecordingState.java +++ b/test/jdk/jdk/jfr/jmx/TestRecordingState.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestRecordingState diff --git a/test/jdk/jdk/jfr/jmx/TestRecordingStateInvalid.java b/test/jdk/jdk/jfr/jmx/TestRecordingStateInvalid.java index 91e5384eb4b..dbfc6783c54 100644 --- a/test/jdk/jdk/jfr/jmx/TestRecordingStateInvalid.java +++ b/test/jdk/jdk/jfr/jmx/TestRecordingStateInvalid.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestRecordingStateInvalid diff --git a/test/jdk/jdk/jfr/jmx/TestSetConfiguration.java b/test/jdk/jdk/jfr/jmx/TestSetConfiguration.java index e3a6c9addf0..168633d1520 100644 --- a/test/jdk/jdk/jfr/jmx/TestSetConfiguration.java +++ b/test/jdk/jdk/jfr/jmx/TestSetConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestSetConfiguration diff --git a/test/jdk/jdk/jfr/jmx/TestSetConfigurationInvalid.java b/test/jdk/jdk/jfr/jmx/TestSetConfigurationInvalid.java index ec5bcffdc9a..82c3681b1bf 100644 --- a/test/jdk/jdk/jfr/jmx/TestSetConfigurationInvalid.java +++ b/test/jdk/jdk/jfr/jmx/TestSetConfigurationInvalid.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Verify Exception when setting invalid config. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/TestSnapshot.java b/test/jdk/jdk/jfr/jmx/TestSnapshot.java index b4eb13216b5..09cd515c4ae 100644 --- a/test/jdk/jdk/jfr/jmx/TestSnapshot.java +++ b/test/jdk/jdk/jfr/jmx/TestSnapshot.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestSnapshot diff --git a/test/jdk/jdk/jfr/jmx/TestStartRecording.java b/test/jdk/jdk/jfr/jmx/TestStartRecording.java index 52a43b1f80e..1ff3eab6d53 100644 --- a/test/jdk/jdk/jfr/jmx/TestStartRecording.java +++ b/test/jdk/jdk/jfr/jmx/TestStartRecording.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestStartRecording diff --git a/test/jdk/jdk/jfr/jmx/TestStream.java b/test/jdk/jdk/jfr/jmx/TestStream.java index 3763054ae3b..53d0ba473b3 100644 --- a/test/jdk/jdk/jfr/jmx/TestStream.java +++ b/test/jdk/jdk/jfr/jmx/TestStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestStream diff --git a/test/jdk/jdk/jfr/jmx/TestStreamClosed.java b/test/jdk/jdk/jfr/jmx/TestStreamClosed.java index 5f6c49544ca..3533f7c94e7 100644 --- a/test/jdk/jdk/jfr/jmx/TestStreamClosed.java +++ b/test/jdk/jdk/jfr/jmx/TestStreamClosed.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Call readStream() after closeStream() * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/TestStreamMultiple.java b/test/jdk/jdk/jfr/jmx/TestStreamMultiple.java index f973376574a..85518790b1f 100644 --- a/test/jdk/jdk/jfr/jmx/TestStreamMultiple.java +++ b/test/jdk/jdk/jfr/jmx/TestStreamMultiple.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestStreamMultiple diff --git a/test/jdk/jdk/jfr/jmx/TestWrongId.java b/test/jdk/jdk/jfr/jmx/TestWrongId.java index 8a88b970248..598a7f05a37 100644 --- a/test/jdk/jdk/jfr/jmx/TestWrongId.java +++ b/test/jdk/jdk/jfr/jmx/TestWrongId.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Call functions with invalid argument id. Verify Exception. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/info/TestConfigurationInfo.java b/test/jdk/jdk/jfr/jmx/info/TestConfigurationInfo.java index c82f064ae42..5158d2f7ce1 100644 --- a/test/jdk/jdk/jfr/jmx/info/TestConfigurationInfo.java +++ b/test/jdk/jdk/jfr/jmx/info/TestConfigurationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test for ConfigurationInfo. Compare infos from java API and jmx API. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/info/TestEventTypeInfo.java b/test/jdk/jdk/jfr/jmx/info/TestEventTypeInfo.java index 001147e8e5c..79421d6ef56 100644 --- a/test/jdk/jdk/jfr/jmx/info/TestEventTypeInfo.java +++ b/test/jdk/jdk/jfr/jmx/info/TestEventTypeInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test for EventTypeInfo * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/info/TestRecordingInfo.java b/test/jdk/jdk/jfr/jmx/info/TestRecordingInfo.java index a653af76dc0..7aaff146f2b 100644 --- a/test/jdk/jdk/jfr/jmx/info/TestRecordingInfo.java +++ b/test/jdk/jdk/jfr/jmx/info/TestRecordingInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test for RecordingInfo * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/info/TestSettingDescriptorInfo.java b/test/jdk/jdk/jfr/jmx/info/TestSettingDescriptorInfo.java index 59d5aaa5fa9..fbfaa250351 100644 --- a/test/jdk/jdk/jfr/jmx/info/TestSettingDescriptorInfo.java +++ b/test/jdk/jdk/jfr/jmx/info/TestSettingDescriptorInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test for SettingDescriptorInfo. Compare infos from java API and jmx API. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestClose.java b/test/jdk/jdk/jfr/jmx/streaming/TestClose.java index d742422e69c..08c302d6d4b 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestClose.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestClose.java @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that a RemoteRecordingStream can be closed * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestDelegated.java b/test/jdk/jdk/jfr/jmx/streaming/TestDelegated.java index 04a9139b122..e20f92c3014 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestDelegated.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestDelegated.java @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Sanity test methods that delegates to an ordinary stream * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestDumpOrder.java b/test/jdk/jdk/jfr/jmx/streaming/TestDumpOrder.java index 0c6d8fe313d..7535960366c 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestDumpOrder.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestDumpOrder.java @@ -42,7 +42,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that chunks arrive in the same order they were committed * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java b/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java index 6a07c57ff78..06e9691cfa2 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that event settings for a RemoteRecordingStream can be changed * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java b/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java index 7bf389c75ad..b79fbc2bcf0 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that max size can be set for a RemoteRecordingStream * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestMetadataEvent.java b/test/jdk/jdk/jfr/jmx/streaming/TestMetadataEvent.java index 935ef292a55..3e0e8773f0a 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestMetadataEvent.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestMetadataEvent.java @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Sanity tests RemoteRecordingStream::onMetadata * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestMultipleChunks.java b/test/jdk/jdk/jfr/jmx/streaming/TestMultipleChunks.java index e91a58da7b8..942f64a5da4 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestMultipleChunks.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestMultipleChunks.java @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that a RemoteRecordingStream can stream over multiple chunks * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestNew.java b/test/jdk/jdk/jfr/jmx/streaming/TestNew.java index 9cf7a0cd16f..d2489730b03 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestNew.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestNew.java @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test constructors of RemoteRecordingStream * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java b/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java index 51e0c815dc0..9390857c09e 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, 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 @@ /** * @test * @summary Tests RecordingStream::dump(Path) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.jmx.streaming.TestRemoteDump diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestRotate.java b/test/jdk/jdk/jfr/jmx/streaming/TestRotate.java index cf78ea399e7..8a7c7428a99 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestRotate.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestRotate.java @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that streaming can work over chunk rotations * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestSetSettings.java b/test/jdk/jdk/jfr/jmx/streaming/TestSetSettings.java index d0a9acab9cd..2d1cb50dcfc 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestSetSettings.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestSetSettings.java @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that a RemoteRecordingStream can be configured using * setSettings * @requires vm.hasJFR diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestStart.java b/test/jdk/jdk/jfr/jmx/streaming/TestStart.java index 0755e99cb04..6d4bfc10f81 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestStart.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestStart.java @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Sanity tests RemoteRecordingStream::start() * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestStop.java b/test/jdk/jdk/jfr/jmx/streaming/TestStop.java index 83656cba8a7..572577786a1 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestStop.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestStop.java @@ -40,7 +40,7 @@ /** * @test * @summary Tests RemoteRecordingStream::stop() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @build jdk.jfr.api.consumer.recordingstream.EventProducer diff --git a/test/jdk/jdk/jfr/jvm/TestBeginAndEnd.java b/test/jdk/jdk/jfr/jvm/TestBeginAndEnd.java index c85b0966b6e..e25d216ab5f 100644 --- a/test/jdk/jdk/jfr/jvm/TestBeginAndEnd.java +++ b/test/jdk/jdk/jfr/jvm/TestBeginAndEnd.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 @@ -28,7 +28,7 @@ /** * @test TestBeginAndEnd - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules jdk.jfr/jdk.jfr.internal * @run main/othervm jdk.jfr.jvm.TestBeginAndEnd diff --git a/test/jdk/jdk/jfr/jvm/TestChunkIntegrity.java b/test/jdk/jdk/jfr/jvm/TestChunkIntegrity.java index aba19bd37b7..c66d323d11d 100644 --- a/test/jdk/jdk/jfr/jvm/TestChunkIntegrity.java +++ b/test/jdk/jdk/jfr/jvm/TestChunkIntegrity.java @@ -56,7 +56,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm/timeout=300 jdk.jfr.jvm.TestChunkIntegrity diff --git a/test/jdk/jdk/jfr/jvm/TestClassId.java b/test/jdk/jdk/jfr/jvm/TestClassId.java index 058183472e8..b82abb64d50 100644 --- a/test/jdk/jdk/jfr/jvm/TestClassId.java +++ b/test/jdk/jdk/jfr/jvm/TestClassId.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 @@ -32,7 +32,7 @@ /** * @test TestClassId - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestClearStaleConstants.java b/test/jdk/jdk/jfr/jvm/TestClearStaleConstants.java index 70e34bcd514..81f2a34a6b8 100644 --- a/test/jdk/jdk/jfr/jvm/TestClearStaleConstants.java +++ b/test/jdk/jdk/jfr/jvm/TestClearStaleConstants.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 @@ -39,7 +39,7 @@ /** * @test * @bug 8231081 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules jdk.jfr/jdk.jfr.internal * @library /test/lib /test/jdk @@ -49,7 +49,7 @@ /** * System.gc() will trigger class unloading if -XX:+ExplicitGCInvokesConcurrent is NOT set. * If this flag is set G1 will never unload classes on System.gc() and - * As far as the "jfr" key guarantees no VM flags are set from the outside + * As far as the vm.flagless guarantees no VM flags are set from the outside * it should be enough with System.gc(). */ public final class TestClearStaleConstants { diff --git a/test/jdk/jdk/jfr/jvm/TestCounterTime.java b/test/jdk/jdk/jfr/jvm/TestCounterTime.java index f06fdd0eed6..6cd60eae894 100644 --- a/test/jdk/jdk/jfr/jvm/TestCounterTime.java +++ b/test/jdk/jdk/jfr/jvm/TestCounterTime.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,7 +30,7 @@ /** * @test TestCounterTime - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestCreateNative.java b/test/jdk/jdk/jfr/jvm/TestCreateNative.java index 1050856161d..9ebbe7891b3 100644 --- a/test/jdk/jdk/jfr/jvm/TestCreateNative.java +++ b/test/jdk/jdk/jfr/jvm/TestCreateNative.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 @@ -31,7 +31,7 @@ /** * @test * @summary Checks that the JVM can rollback on native initialization failures. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java b/test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java index 29e21ddd89d..a7e620b203c 100644 --- a/test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java +++ b/test/jdk/jdk/jfr/jvm/TestDumpOnCrash.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Verifies that data associated with a running recording can be evacuated to an hs_err_pidXXX.jfr when the VM crashes * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/jvm/TestEventDuration.java b/test/jdk/jdk/jfr/jvm/TestEventDuration.java index 53a7af9e323..1b0a44d843a 100644 --- a/test/jdk/jdk/jfr/jvm/TestEventDuration.java +++ b/test/jdk/jdk/jfr/jvm/TestEventDuration.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,7 +30,7 @@ /** * @test Tests that the event duration is zero after a chunk rotation - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestEventWriterLog.java b/test/jdk/jdk/jfr/jvm/TestEventWriterLog.java index 9e68d0501df..ca56a3feb41 100644 --- a/test/jdk/jdk/jfr/jvm/TestEventWriterLog.java +++ b/test/jdk/jdk/jfr/jvm/TestEventWriterLog.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 @@ -24,7 +24,7 @@ /* * @test TestEventWriterLog * @summary Test that log message of JFR when handle bytecodes - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm TestEventWriterLog diff --git a/test/jdk/jdk/jfr/jvm/TestFatEvent.java b/test/jdk/jdk/jfr/jvm/TestFatEvent.java index 93e8a838de1..3e10074cce9 100644 --- a/test/jdk/jdk/jfr/jvm/TestFatEvent.java +++ b/test/jdk/jdk/jfr/jvm/TestFatEvent.java @@ -36,7 +36,7 @@ /** * @test TestFatEvent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Dprop1=12345678901234567890123456789012345678901234567890 diff --git a/test/jdk/jdk/jfr/jvm/TestFormatDuration.java b/test/jdk/jdk/jfr/jvm/TestFormatDuration.java index 0fb1bbe07c5..a0d5b729fcf 100644 --- a/test/jdk/jdk/jfr/jvm/TestFormatDuration.java +++ b/test/jdk/jdk/jfr/jvm/TestFormatDuration.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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal.util diff --git a/test/jdk/jdk/jfr/jvm/TestGetAllEventClasses.java b/test/jdk/jdk/jfr/jvm/TestGetAllEventClasses.java index b758520ac81..2849258868a 100644 --- a/test/jdk/jdk/jfr/jvm/TestGetAllEventClasses.java +++ b/test/jdk/jdk/jfr/jvm/TestGetAllEventClasses.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,7 +31,7 @@ /** * @test TestGetAllEventClasses - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestGetEventWriter.java b/test/jdk/jdk/jfr/jvm/TestGetEventWriter.java index 7920678b7f0..a22e59a39fe 100644 --- a/test/jdk/jdk/jfr/jvm/TestGetEventWriter.java +++ b/test/jdk/jdk/jfr/jvm/TestGetEventWriter.java @@ -39,7 +39,7 @@ /** * @test id=default - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.internal.vm.ci/jdk.vm.ci.meta @@ -71,7 +71,7 @@ /** * @test id=jvmci - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.jvmci * @library /test/lib diff --git a/test/jdk/jdk/jfr/jvm/TestGetEventWriterPackage.java b/test/jdk/jdk/jfr/jvm/TestGetEventWriterPackage.java index 065458d4ac7..3d96330f6ac 100644 --- a/test/jdk/jdk/jfr/jvm/TestGetEventWriterPackage.java +++ b/test/jdk/jdk/jfr/jvm/TestGetEventWriterPackage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ import jdk.jfr.Registered; /** * @test Tests that a module can't execute code in jdk.jfr.internal.event unless an event has been registered. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm diff --git a/test/jdk/jdk/jfr/jvm/TestGetEventWriterReflection.java b/test/jdk/jdk/jfr/jvm/TestGetEventWriterReflection.java index 2e0f87020e6..dae4e9a67b5 100644 --- a/test/jdk/jdk/jfr/jvm/TestGetEventWriterReflection.java +++ b/test/jdk/jdk/jfr/jvm/TestGetEventWriterReflection.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 @@ -29,7 +29,7 @@ import jdk.jfr.Registered; /** * @test Tests that reflective access works as (normally) expected - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/jvm/TestGetStackTraceId.java b/test/jdk/jdk/jfr/jvm/TestGetStackTraceId.java index 8a23e551408..637a5f3920d 100644 --- a/test/jdk/jdk/jfr/jvm/TestGetStackTraceId.java +++ b/test/jdk/jdk/jfr/jvm/TestGetStackTraceId.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, 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 @@ -29,7 +29,7 @@ /** * @test TestGetStackTraceId - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestHiddenWait.java b/test/jdk/jdk/jfr/jvm/TestHiddenWait.java index b064285329c..aaefc60527c 100644 --- a/test/jdk/jdk/jfr/jvm/TestHiddenWait.java +++ b/test/jdk/jdk/jfr/jvm/TestHiddenWait.java @@ -38,7 +38,7 @@ /** * @test TestHiddenWait - * @key jfr + * @requires vm.flagless * @summary Checks that JFR code don't emit noise in the form of ThreadSleep and JavaMonitorWait events. * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.java b/test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.java index 6d3ea8d015a..a846eac2350 100644 --- a/test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.java +++ b/test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.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 @@ -24,7 +24,7 @@ /** * @test * @summary Intrinsic for JFR - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/jvm/TestJavaEvent.java b/test/jdk/jdk/jfr/jvm/TestJavaEvent.java index 0a2f2ecaf5b..8a006dd9eaf 100644 --- a/test/jdk/jdk/jfr/jvm/TestJavaEvent.java +++ b/test/jdk/jdk/jfr/jvm/TestJavaEvent.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 @@ -41,7 +41,7 @@ /** * @test TestGetThreadId - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent512k.java b/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent512k.java index eacffb7a13b..530004d3ebd 100644 --- a/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent512k.java +++ b/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent512k.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -43,7 +43,7 @@ /** * @test TestLargeJavaEvent512k - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent64k.java b/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent64k.java index 0de03efb35c..b71ed0ec361 100644 --- a/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent64k.java +++ b/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent64k.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, 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 @@ -43,7 +43,7 @@ /** * @test TestLargeJavaEvent64k - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestLogImplementation.java b/test/jdk/jdk/jfr/jvm/TestLogImplementation.java index d9d42074b7b..faa7bc18a3c 100644 --- a/test/jdk/jdk/jfr/jvm/TestLogImplementation.java +++ b/test/jdk/jdk/jfr/jvm/TestLogImplementation.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,7 +30,7 @@ /** * @test TestLogImplementation - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestLogOutput.java b/test/jdk/jdk/jfr/jvm/TestLogOutput.java index 18527abb90b..5580270027a 100644 --- a/test/jdk/jdk/jfr/jvm/TestLogOutput.java +++ b/test/jdk/jdk/jfr/jvm/TestLogOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, 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,7 +31,7 @@ /** * @test TestLogOutput - * @key jfr + * @requires vm.flagless * @summary Sanity test jfr logging output * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/jvm/TestLongStringsInPool.java b/test/jdk/jdk/jfr/jvm/TestLongStringsInPool.java index 8ce3fd3859f..45b66d508cd 100644 --- a/test/jdk/jdk/jfr/jvm/TestLongStringsInPool.java +++ b/test/jdk/jdk/jfr/jvm/TestLongStringsInPool.java @@ -36,7 +36,7 @@ /** * @test * @summary Verify that duplicate longer strings doesn't take up unneccessary space - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.jvm.TestLongStringsInPool diff --git a/test/jdk/jdk/jfr/jvm/TestModularImage.java b/test/jdk/jdk/jfr/jvm/TestModularImage.java index 9643324afd8..fe49b460f18 100644 --- a/test/jdk/jdk/jfr/jvm/TestModularImage.java +++ b/test/jdk/jdk/jfr/jvm/TestModularImage.java @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Checks that a JDK image with and without the jdk.jfr module behaves * as expected * @requires vm.hasJFR diff --git a/test/jdk/jdk/jfr/jvm/TestPid.java b/test/jdk/jdk/jfr/jvm/TestPid.java index 20a8b42f8a5..f71042d1c84 100644 --- a/test/jdk/jdk/jfr/jvm/TestPid.java +++ b/test/jdk/jdk/jfr/jvm/TestPid.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,7 +29,7 @@ /** * @test TestPid - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestPrimitiveClasses.java b/test/jdk/jdk/jfr/jvm/TestPrimitiveClasses.java index bb0163bc925..548bb3fc19e 100644 --- a/test/jdk/jdk/jfr/jvm/TestPrimitiveClasses.java +++ b/test/jdk/jdk/jfr/jvm/TestPrimitiveClasses.java @@ -34,7 +34,7 @@ /** * @test TestPrimitiveClasses - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.jvm.TestPrimitiveClasses diff --git a/test/jdk/jdk/jfr/jvm/TestThreadExclusion.java b/test/jdk/jdk/jfr/jvm/TestThreadExclusion.java index 411710881ca..000923d2678 100644 --- a/test/jdk/jdk/jfr/jvm/TestThreadExclusion.java +++ b/test/jdk/jdk/jfr/jvm/TestThreadExclusion.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestUnloadEventClassCount.java b/test/jdk/jdk/jfr/jvm/TestUnloadEventClassCount.java index ddb7ec3c757..23b45f0b5f7 100644 --- a/test/jdk/jdk/jfr/jvm/TestUnloadEventClassCount.java +++ b/test/jdk/jdk/jfr/jvm/TestUnloadEventClassCount.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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Unit test for JVM#getUnloadedEventClassCount * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/jvm/TestUnsupportedVM.java b/test/jdk/jdk/jfr/jvm/TestUnsupportedVM.java index 81a83222c75..a3dbeef6d5c 100644 --- a/test/jdk/jdk/jfr/jvm/TestUnsupportedVM.java +++ b/test/jdk/jdk/jfr/jvm/TestUnsupportedVM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, 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 @@ -68,7 +68,7 @@ /** * @test TestUnsupportedVM - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/jvm/TestVerifyInstrumentation.java b/test/jdk/jdk/jfr/jvm/TestVerifyInstrumentation.java index e003a4b3e48..ec9e64972ec 100644 --- a/test/jdk/jdk/jfr/jvm/TestVerifyInstrumentation.java +++ b/test/jdk/jdk/jfr/jvm/TestVerifyInstrumentation.java @@ -29,7 +29,7 @@ /** * @test * @bug 8316271 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xverify:all jdk.jfr.jvm.TestVerifyInstrumentation diff --git a/test/jdk/jdk/jfr/jvm/TestVirtualThreadExclusion.java b/test/jdk/jdk/jfr/jvm/TestVirtualThreadExclusion.java index e7a4713c223..c2a820aaf9a 100644 --- a/test/jdk/jdk/jfr/jvm/TestVirtualThreadExclusion.java +++ b/test/jdk/jdk/jfr/jvm/TestVirtualThreadExclusion.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestWaste.java b/test/jdk/jdk/jfr/jvm/TestWaste.java index afa2dda4ee1..c755ca4c3d0 100644 --- a/test/jdk/jdk/jfr/jvm/TestWaste.java +++ b/test/jdk/jdk/jfr/jvm/TestWaste.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -43,7 +43,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/startupargs/TestBadOptionValues.java b/test/jdk/jdk/jfr/startupargs/TestBadOptionValues.java index 50514e02024..bae1dcd08cb 100644 --- a/test/jdk/jdk/jfr/startupargs/TestBadOptionValues.java +++ b/test/jdk/jdk/jfr/startupargs/TestBadOptionValues.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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @library /test/lib diff --git a/test/jdk/jdk/jfr/startupargs/TestDumpOnExit.java b/test/jdk/jdk/jfr/startupargs/TestDumpOnExit.java index bca93044fc9..66b27e5978d 100644 --- a/test/jdk/jdk/jfr/startupargs/TestDumpOnExit.java +++ b/test/jdk/jdk/jfr/startupargs/TestDumpOnExit.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 @@ -39,7 +39,7 @@ /** * @test * @summary Start a FlightRecording with dumponexit. Verify dump exists. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.startupargs.TestDumpOnExit diff --git a/test/jdk/jdk/jfr/startupargs/TestEventSettings.java b/test/jdk/jdk/jfr/startupargs/TestEventSettings.java index 41e59523339..37af394affd 100644 --- a/test/jdk/jdk/jfr/startupargs/TestEventSettings.java +++ b/test/jdk/jdk/jfr/startupargs/TestEventSettings.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 @@ -32,7 +32,7 @@ /** * @test * @summary Start a recording with custom settings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/startupargs/TestFlushInterval.java b/test/jdk/jdk/jfr/startupargs/TestFlushInterval.java index 83c4d07c23b..25beb590879 100644 --- a/test/jdk/jdk/jfr/startupargs/TestFlushInterval.java +++ b/test/jdk/jdk/jfr/startupargs/TestFlushInterval.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 @@ -33,7 +33,7 @@ /** * @test * @summary Start a recording with a flush interval - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/startupargs/TestJFCWarnings.java b/test/jdk/jdk/jfr/startupargs/TestJFCWarnings.java index cf0cb021216..092ec73546f 100644 --- a/test/jdk/jdk/jfr/startupargs/TestJFCWarnings.java +++ b/test/jdk/jdk/jfr/startupargs/TestJFCWarnings.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 @@ -28,7 +28,7 @@ /** * @test * @summary Start a recording with custom settings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java b/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java index 9c90d04691a..6827c663ee3 100644 --- a/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java +++ b/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java b/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java index 24be874a87f..c70f9810568 100644 --- a/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java +++ b/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.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,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @library /test/lib diff --git a/test/jdk/jdk/jfr/startupargs/TestOldObjectQueueSize.java b/test/jdk/jdk/jfr/startupargs/TestOldObjectQueueSize.java index 0613906afac..f85baed6f90 100644 --- a/test/jdk/jdk/jfr/startupargs/TestOldObjectQueueSize.java +++ b/test/jdk/jdk/jfr/startupargs/TestOldObjectQueueSize.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 @@ -38,7 +38,7 @@ * @requires vm.hasJFR * @modules jdk.jfr/jdk.jfr.internal.test * @library /test/lib - * @key jfr + * @requires vm.flagless * * @run main/othervm -XX:TLABSize=2k -XX:FlightRecorderOptions:old-object-queue-size=0 jdk.jfr.startupargs.TestOldObjectQueueSize off * @run main/othervm -XX:TLABSize=2k -Xlog:gc+tlab=trace -XX:FlightRecorderOptions:old-object-queue-size=10000 jdk.jfr.startupargs.TestOldObjectQueueSize many diff --git a/test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java b/test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java index 3a4d3f20732..27c1533ca3b 100644 --- a/test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java +++ b/test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java @@ -12,7 +12,7 @@ * @test * @summary Checks that locale is respected when using -XX:FlightRecorderOptions * See JDK-8244508 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules jdk.jfr * @library /test/lib diff --git a/test/jdk/jdk/jfr/startupargs/TestPreserveRepository.java b/test/jdk/jdk/jfr/startupargs/TestPreserveRepository.java index 4f4ee195e1f..74023639f47 100644 --- a/test/jdk/jdk/jfr/startupargs/TestPreserveRepository.java +++ b/test/jdk/jdk/jfr/startupargs/TestPreserveRepository.java @@ -31,7 +31,7 @@ /** * @test * @summary Tests that -XX:FlightRecorderOptions:preserve-repository works - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules jdk.jfr * @library /test/lib diff --git a/test/jdk/jdk/jfr/startupargs/TestRepositoryPath.java b/test/jdk/jdk/jfr/startupargs/TestRepositoryPath.java index a5052b42d6d..fcddff8aca4 100644 --- a/test/jdk/jdk/jfr/startupargs/TestRepositoryPath.java +++ b/test/jdk/jdk/jfr/startupargs/TestRepositoryPath.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 @@ -32,7 +32,7 @@ /** * @test * @summary Set repository path. Verify recording created in repo. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:StartFlightRecording:name=TestStartRecording,settings=profile -XX:FlightRecorderOptions:repository=./repo jdk.jfr.startupargs.TestRepositoryPath diff --git a/test/jdk/jdk/jfr/startupargs/TestRepositoryPathLong.java b/test/jdk/jdk/jfr/startupargs/TestRepositoryPathLong.java index 4dda1ab23d2..73bc600d782 100644 --- a/test/jdk/jdk/jfr/startupargs/TestRepositoryPathLong.java +++ b/test/jdk/jdk/jfr/startupargs/TestRepositoryPathLong.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 @@ -32,7 +32,7 @@ /** * @test * @summary Set repository path. Verify recording created in repo. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:StartFlightRecording:name=myrec,settings=profile -XX:FlightRecorderOptions:repository=./subdirectory/subdirectory1/subdirectory2/subdirectory3/subdirectory4/subdirectory5/subdirectory6/subdirectory7/subdirectory8/subdirectory9/subdirectory10/subdirectory11/subdirectory12/subdirectory13/subdirectory14/subdirectory15 jdk.jfr.startupargs.TestRepositoryPathLong diff --git a/test/jdk/jdk/jfr/startupargs/TestRetransform.java b/test/jdk/jdk/jfr/startupargs/TestRetransform.java index 2e4067ae544..5d26a4bb0a9 100644 --- a/test/jdk/jdk/jfr/startupargs/TestRetransform.java +++ b/test/jdk/jdk/jfr/startupargs/TestRetransform.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 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -XX:FlightRecorderOptions:retransform=false jdk.jfr.startupargs.TestRetransform diff --git a/test/jdk/jdk/jfr/startupargs/TestRetransformUsingLog.java b/test/jdk/jdk/jfr/startupargs/TestRetransformUsingLog.java index 186a87a12c2..02636e4b715 100644 --- a/test/jdk/jdk/jfr/startupargs/TestRetransformUsingLog.java +++ b/test/jdk/jdk/jfr/startupargs/TestRetransformUsingLog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, 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 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.startupargs.TestRetransformUsingLog diff --git a/test/jdk/jdk/jfr/startupargs/TestStartDelay.java b/test/jdk/jdk/jfr/startupargs/TestStartDelay.java index 7036e373a41..5470ae7936e 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartDelay.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartDelay.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 @@ -34,7 +34,7 @@ /** * @test * @summary Start a recording with delay. Verify recording starts later. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:StartFlightRecording:name=TestStartDelay,delay=5000s jdk.jfr.startupargs.TestStartDelay diff --git a/test/jdk/jdk/jfr/startupargs/TestStartDelayRunning.java b/test/jdk/jdk/jfr/startupargs/TestStartDelayRunning.java index b74714b9bdd..b7563c35c36 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartDelayRunning.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartDelayRunning.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 @@ -33,7 +33,7 @@ /** * @test * @summary Verify that a recopding with a delay is started. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:StartFlightRecording:name=TestStartDelay,delay=1s jdk.jfr.startupargs.TestStartDelayRunning diff --git a/test/jdk/jdk/jfr/startupargs/TestStartDuration.java b/test/jdk/jdk/jfr/startupargs/TestStartDuration.java index d9697492d94..fcc2f4abdd5 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartDuration.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartDuration.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 @@ -36,7 +36,7 @@ /** * @test * @summary Start a recording with duration. Verify recording stops. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.flagless * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/startupargs/TestStartHelp.java b/test/jdk/jdk/jfr/startupargs/TestStartHelp.java index 4d4edbf68dc..0b3b5869cad 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartHelp.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartHelp.java @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main jdk.jfr.startupargs.TestStartHelp diff --git a/test/jdk/jdk/jfr/startupargs/TestStartMaxAgeSize.java b/test/jdk/jdk/jfr/startupargs/TestStartMaxAgeSize.java index 95a6b436ddb..df9af580b40 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartMaxAgeSize.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartMaxAgeSize.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 @@ -33,7 +33,7 @@ /** * @test * @summary Start a recording with delay. Verify recording starts later. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:StartFlightRecording:name=TestStartMaxAgeSize,maxage=10s,maxsize=1000000 jdk.jfr.startupargs.TestStartMaxAgeSize diff --git a/test/jdk/jdk/jfr/startupargs/TestStartName.java b/test/jdk/jdk/jfr/startupargs/TestStartName.java index 7ab4a7d0f7e..7dd11125f8f 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartName.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartName.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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main jdk.jfr.startupargs.TestStartName diff --git a/test/jdk/jdk/jfr/startupargs/TestStartNoSettings.java b/test/jdk/jdk/jfr/startupargs/TestStartNoSettings.java index ac5f5efa5c1..61188f224e0 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartNoSettings.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartNoSettings.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 @@ -32,7 +32,7 @@ /** * @test * @summary Start a FlightRecording without any settings (not even default). - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.startupargs.TestStartNoSettings diff --git a/test/jdk/jdk/jfr/startupargs/TestStartRecording.java b/test/jdk/jdk/jfr/startupargs/TestStartRecording.java index 7eb24cc8fa6..6b3239951c7 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartRecording.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartRecording.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 @@ -33,7 +33,7 @@ /** * @test * @summary Start a recording with -XX:StartFlightRecording. Dump recording with jcmd. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:StartFlightRecording:name=TestStartRecording,settings=profile jdk.jfr.startupargs.TestStartRecording diff --git a/test/jdk/jdk/jfr/startupargs/TestStartupMessage.java b/test/jdk/jdk/jfr/startupargs/TestStartupMessage.java index b919f80e9da..4a934ebb36d 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartupMessage.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartupMessage.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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main jdk.jfr.startupargs.TestStartupMessage diff --git a/test/jdk/jdk/jfr/startupargs/TestStartupOptionSpecifiedOnce.java b/test/jdk/jdk/jfr/startupargs/TestStartupOptionSpecifiedOnce.java index 756402b0c60..11749504eba 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartupOptionSpecifiedOnce.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartupOptionSpecifiedOnce.java @@ -26,7 +26,7 @@ /** * @test The test verifies that options can only be specified once with --XX:StartFlightRecording - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main jdk.jfr.startupargs.TestStartupOptionSpecifiedOnce diff --git a/test/jdk/jdk/jfr/threading/TestDeepVirtualStackTrace.java b/test/jdk/jdk/jfr/threading/TestDeepVirtualStackTrace.java index 3fecd91ea62..2be72626006 100644 --- a/test/jdk/jdk/jfr/threading/TestDeepVirtualStackTrace.java +++ b/test/jdk/jdk/jfr/threading/TestDeepVirtualStackTrace.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 @@ -38,7 +38,7 @@ * @test * @summary Tests emitting an event, both in Java and native, in a virtual * thread with the maximum number of allowed stack frames for JFR - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/threading/TestManyVirtualThreads.java b/test/jdk/jdk/jfr/threading/TestManyVirtualThreads.java index f0c3b52cf14..228abb6439e 100644 --- a/test/jdk/jdk/jfr/threading/TestManyVirtualThreads.java +++ b/test/jdk/jdk/jfr/threading/TestManyVirtualThreads.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 @@ -40,7 +40,7 @@ /** * @test * @summary Tests starting virtual threads from a set of ordinary threads - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/threading/TestNestedVirtualThreads.java b/test/jdk/jdk/jfr/threading/TestNestedVirtualThreads.java index 26be901804a..15901be9490 100644 --- a/test/jdk/jdk/jfr/threading/TestNestedVirtualThreads.java +++ b/test/jdk/jdk/jfr/threading/TestNestedVirtualThreads.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, 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 @@ -37,7 +37,7 @@ * @test * @summary Tests committing an event in a virtual thread created by a virtual * thread - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/threading/TestStringPoolVirtualThreadPinning.java b/test/jdk/jdk/jfr/threading/TestStringPoolVirtualThreadPinning.java index 0dc1ef85661..ef2a3698edc 100644 --- a/test/jdk/jdk/jfr/threading/TestStringPoolVirtualThreadPinning.java +++ b/test/jdk/jdk/jfr/threading/TestStringPoolVirtualThreadPinning.java @@ -41,7 +41,7 @@ * @test * @bug 8338417 * @summary Tests pinning of virtual threads when the JFR string pool monitor is contended. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.threading.TestStringPoolVirtualThreadPinning diff --git a/test/jdk/jdk/jfr/tool/TestAssemble.java b/test/jdk/jdk/jfr/tool/TestAssemble.java index 2ac90b535a5..43c862d8999 100644 --- a/test/jdk/jdk/jfr/tool/TestAssemble.java +++ b/test/jdk/jdk/jfr/tool/TestAssemble.java @@ -41,7 +41,7 @@ /** * @test * @summary Test jfr reconstruct - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/tool/TestConfigure.java b/test/jdk/jdk/jfr/tool/TestConfigure.java index 90f6f39be00..e200054319e 100644 --- a/test/jdk/jdk/jfr/tool/TestConfigure.java +++ b/test/jdk/jdk/jfr/tool/TestConfigure.java @@ -34,7 +34,7 @@ /** * @test * @summary Test jfr configure - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestConfigure diff --git a/test/jdk/jdk/jfr/tool/TestDisassemble.java b/test/jdk/jdk/jfr/tool/TestDisassemble.java index da7f9489665..68088fdc5bb 100644 --- a/test/jdk/jdk/jfr/tool/TestDisassemble.java +++ b/test/jdk/jdk/jfr/tool/TestDisassemble.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, 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 @@ -40,7 +40,7 @@ * @test * @bug 8253050 * @summary Test jfr split - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestDisassemble diff --git a/test/jdk/jdk/jfr/tool/TestHelp.java b/test/jdk/jdk/jfr/tool/TestHelp.java index 91bd7d82a2b..b0113fca5bf 100644 --- a/test/jdk/jdk/jfr/tool/TestHelp.java +++ b/test/jdk/jdk/jfr/tool/TestHelp.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 @@ -28,7 +28,7 @@ /** * @test * @summary Test help - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestHelp diff --git a/test/jdk/jdk/jfr/tool/TestMetadata.java b/test/jdk/jdk/jfr/tool/TestMetadata.java index c321f4e3fe6..76afc110f5d 100644 --- a/test/jdk/jdk/jfr/tool/TestMetadata.java +++ b/test/jdk/jdk/jfr/tool/TestMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, 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 @@ -42,7 +42,7 @@ /** * @test * @summary Test jfr info - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestMetadata diff --git a/test/jdk/jdk/jfr/tool/TestPrint.java b/test/jdk/jdk/jfr/tool/TestPrint.java index 6f7e89f8355..fcedca3bcb9 100644 --- a/test/jdk/jdk/jfr/tool/TestPrint.java +++ b/test/jdk/jdk/jfr/tool/TestPrint.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 @@ -33,7 +33,7 @@ /** * @test * @summary Test jfr print - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestPrint diff --git a/test/jdk/jdk/jfr/tool/TestPrintDefault.java b/test/jdk/jdk/jfr/tool/TestPrintDefault.java index 215845e6c99..8dd04c61e04 100644 --- a/test/jdk/jdk/jfr/tool/TestPrintDefault.java +++ b/test/jdk/jdk/jfr/tool/TestPrintDefault.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 @@ -29,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests print --json * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/tool/TestPrintJSON.java b/test/jdk/jdk/jfr/tool/TestPrintJSON.java index 6a8977a672e..3d79c75300f 100644 --- a/test/jdk/jdk/jfr/tool/TestPrintJSON.java +++ b/test/jdk/jdk/jfr/tool/TestPrintJSON.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, 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 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests print --json * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/tool/TestPrintXML.java b/test/jdk/jdk/jfr/tool/TestPrintXML.java index c8d60166d4c..2c1c4a518e2 100644 --- a/test/jdk/jdk/jfr/tool/TestPrintXML.java +++ b/test/jdk/jdk/jfr/tool/TestPrintXML.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 @@ -61,7 +61,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests print --xml * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/tool/TestScrub.java b/test/jdk/jdk/jfr/tool/TestScrub.java index ba02f7d3126..43b9fca7ee4 100644 --- a/test/jdk/jdk/jfr/tool/TestScrub.java +++ b/test/jdk/jdk/jfr/tool/TestScrub.java @@ -40,7 +40,7 @@ /** * @test * @summary Test jfr scrub - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestScrub diff --git a/test/jdk/jdk/jfr/tool/TestSummary.java b/test/jdk/jdk/jfr/tool/TestSummary.java index 641d951f63c..550de0c0811 100644 --- a/test/jdk/jdk/jfr/tool/TestSummary.java +++ b/test/jdk/jdk/jfr/tool/TestSummary.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 @@ -32,7 +32,7 @@ /** * @test * @summary Test jfr info - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestSummary diff --git a/test/jdk/jdk/jfr/tool/TestView.java b/test/jdk/jdk/jfr/tool/TestView.java index 89c74133286..89c45c3e068 100644 --- a/test/jdk/jdk/jfr/tool/TestView.java +++ b/test/jdk/jdk/jfr/tool/TestView.java @@ -31,7 +31,7 @@ /** * @test * @summary Test jfr view - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != false diff --git a/test/jdk/sun/security/pkcs11/nss/p11-nss-sensitive.txt b/test/jdk/sun/security/pkcs11/nss/p11-nss-sensitive.txt index 4579dd59398..df891c7097a 100644 --- a/test/jdk/sun/security/pkcs11/nss/p11-nss-sensitive.txt +++ b/test/jdk/sun/security/pkcs11/nss/p11-nss-sensitive.txt @@ -49,10 +49,12 @@ attributes(*,CKO_PRIVATE_KEY,CKK_DH) = { # Make all private keys sensitive attributes(*,CKO_PRIVATE_KEY,*) = { CKA_SENSITIVE = true + CKA_EXTRACTABLE = false } # Make all secret keys sensitive attributes(*,CKO_SECRET_KEY,*) = { CKA_SENSITIVE = true + CKA_EXTRACTABLE = false } diff --git a/test/jdk/sun/security/provider/FileInputStreamPool/FileInputStreamPoolTest.java b/test/jdk/sun/security/provider/FileInputStreamPool/FileInputStreamPoolTest.java index 860b2d99910..32bdea4e153 100644 --- a/test/jdk/sun/security/provider/FileInputStreamPool/FileInputStreamPoolTest.java +++ b/test/jdk/sun/security/provider/FileInputStreamPool/FileInputStreamPoolTest.java @@ -25,7 +25,6 @@ * @test * @bug 8047769 * @modules java.base/java.io:open - * java.base/java.lang.ref:open * java.base/sun.security.provider:open * @summary SecureRandom should be more frugal with file descriptors */ @@ -133,11 +132,9 @@ public static void main(String[] args) throws Exception { /** * A proxy for (package)private static methods: * sun.security.provider.FileInputStreamPool.getInputStream - * java.lang.ref.Reference.waitForReferenceProcessing */ static class TestProxy { private static final Method getInputStreamMethod; - private static final Method waitForReferenceProcessingMethod; private static final Field inField; static { @@ -149,10 +146,6 @@ static class TestProxy { "getInputStream", File.class); getInputStreamMethod.setAccessible(true); - waitForReferenceProcessingMethod = - Reference.class.getDeclaredMethod("waitForReferenceProcessing"); - waitForReferenceProcessingMethod.setAccessible(true); - inField = FilterInputStream.class.getDeclaredField("in"); inField.setAccessible(true); } catch (Exception e) { @@ -180,25 +173,6 @@ static InputStream FileInputStreamPool_getInputStream(File file) } } - static boolean Reference_waitForReferenceProcessing() { - try { - return (boolean) waitForReferenceProcessingMethod.invoke(null); - } catch (InvocationTargetException e) { - Throwable te = e.getTargetException(); - if (te instanceof InterruptedException) { - return true; - } else if (te instanceof RuntimeException) { - throw (RuntimeException) te; - } else if (te instanceof Error) { - throw (Error) te; - } else { - throw new UndeclaredThrowableException(te); - } - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } - static FileInputStream FilterInputStream_getInField(FilterInputStream fis) { try { return (FileInputStream) inField.get(fis); diff --git a/test/jdk/sun/security/provider/certpath/OCSP/OCSPReadTimeoutDefault.java b/test/jdk/sun/security/provider/certpath/OCSP/OCSPReadTimeoutDefault.java new file mode 100644 index 00000000000..312435b0026 --- /dev/null +++ b/test/jdk/sun/security/provider/certpath/OCSP/OCSPReadTimeoutDefault.java @@ -0,0 +1,70 @@ +/* + * 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 8347506 + * @summary Compatible OCSP readtimeout property with OCSP timeout + * @modules java.base/sun.security.provider.certpath + * @run main/othervm + * --add-opens java.base/sun.security.provider.certpath=ALL-UNNAMED + * OCSPReadTimeoutDefault 15000 + * @run main/othervm + * --add-opens java.base/sun.security.provider.certpath=ALL-UNNAMED + * -Dcom.sun.security.ocsp.timeout=6 + * OCSPReadTimeoutDefault 6000 + * @run main/othervm + * --add-opens java.base/sun.security.provider.certpath=ALL-UNNAMED + * -Dcom.sun.security.ocsp.timeout=6 -Dcom.sun.security.ocsp.readtimeout=1 + * OCSPReadTimeoutDefault 1000 + */ + +import java.lang.reflect.*; + +public class OCSPReadTimeoutDefault { + + public static void main(String[] args) throws Exception { + if (args == null || args.length < 1) { + throw new RuntimeException("Missing mandatory readtimeout value"); + } + + int expectedReadTimeout = Integer.parseInt(args[0]); + + Class ocspClazz = sun.security.provider.certpath.OCSP.class; + System.out.println("OCSP Class: " + ocspClazz); + + Field cto = ocspClazz.getDeclaredField("CONNECT_TIMEOUT"); + Field rto = ocspClazz.getDeclaredField("READ_TIMEOUT"); + cto.setAccessible(true); + rto.setAccessible(true); + int ctoVal = cto.getInt(null); + int rtoVal = rto.getInt(null); + + System.out.println("Expected read timeout: " + expectedReadTimeout); + System.out.println("CTOVal: " + ctoVal + ", RTOVal: " + rtoVal); + if (rtoVal != expectedReadTimeout) { + throw new RuntimeException("Expected read timeout value of " + + expectedReadTimeout + ", found " + rtoVal); + } + } +} \ No newline at end of file diff --git a/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java index d6ec20c93d2..65311e97701 100644 --- a/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java +++ b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.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 @@ -109,8 +109,8 @@ public static void main(String args[]) throws Exception { } p.close(); - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Djavax.net.debug=ssl,handshake" + " -Djava.security.properties=" + f.getName()); diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTClient.java b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTClient.java index 57f61a6cd8a..ff086e35a07 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTClient.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTClient.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 @@ -65,8 +65,8 @@ public static void main(String[] args) throws Exception { sb.append(" "); }); String params = sb.toString(); - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Dtest.root=" + System.getProperty("test.root") + " -Djavax.net.debug=ssl,handshake " + params diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.java b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.java index f80270afd37..9a615f9b884 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.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 @@ -51,8 +51,8 @@ public static void main(String[] args) throws Exception { StringBuilder sb = new StringBuilder(); Arrays.stream(args).forEach(a -> sb.append(a).append(" ")); String params = sb.toString(); - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Dtest.root=" + System.getProperty("test.root") + " -Djavax.net.debug=ssl,handshake " + params); diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTParallel.java b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTParallel.java index bff14113ea5..34c9cc940d5 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTParallel.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTParallel.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 @@ -102,8 +102,8 @@ public static void main(String[] args) throws Exception { sb.append(" ").append(args[i]); } String params = sb.toString(); - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Dtest.root=" + System.getProperty("test.root") + " -Djavax.net.debug=ssl,handshake " + diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTSequence.java b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTSequence.java index 888dba56a50..645650674ea 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTSequence.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTSequence.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 @@ -60,8 +60,8 @@ public static void main(String[] args) throws Exception { StringBuilder sb = new StringBuilder(); Arrays.stream(args).forEach(a -> sb.append(a).append(" ")); String params = sb.toString(); - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Dtest.root=" + System.getProperty("test.root") + " -Djavax.net.debug=ssl,handshake " + params diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java index ea7f4895785..87db7eed296 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.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 @@ -179,8 +179,8 @@ SBListener doClientSide() throws Exception { public static void main(String[] args) throws Exception { if (args.length == 0) { - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Djavax.net.debug=ssl,handshake"); diff --git a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java index f0519a94249..fc26b60e4d4 100644 --- a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.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 @@ -125,8 +125,8 @@ public static void main(String args[]) throws Exception { } p.close(); System.out.println("Keyusage path = " + f.getAbsolutePath()); - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Djavax.net.debug=ssl,handshake" + " -Djava.security.properties=" + f.getName()); diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Camerfirma.java b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Camerfirma.java new file mode 100644 index 00000000000..50a723441a5 --- /dev/null +++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Camerfirma.java @@ -0,0 +1,75 @@ +/* + * 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.io.File; +import java.security.Security; +import java.time.*; +import java.util.*; +import javax.net.ssl.*; + +/** + * @test + * @bug 8346587 + * @summary Check that TLS Server certificates chaining back to distrusted + * Camerfirma roots are invalid + * @library /test/lib + * @modules java.base/sun.security.validator + * @run main/othervm Camerfirma after policyOn invalid + * @run main/othervm Camerfirma after policyOff valid + * @run main/othervm Camerfirma before policyOn valid + * @run main/othervm Camerfirma before policyOff valid + */ + +public class Camerfirma { + + private static final String certPath = "chains" + File.separator + "camerfirma"; + + // Each of the roots have a test certificate chain stored in a file + // named "-chain.pem". + private static String[] rootsToTest = new String[] { + "camerfirmachamberscommerceca", "camerfirmachambersca", + "camerfirmachambersignca"}; + + // Date after the restrictions take effect + private static final ZonedDateTime DISTRUST_DATE = + LocalDate.of(2025, 04, 16).atStartOfDay(ZoneOffset.UTC); + + public static void main(String[] args) throws Exception { + + // All of the test certificates are signed with SHA-1 so we need + // to remove the constraint that disallows SHA-1 certificates. + String prop = Security.getProperty("jdk.certpath.disabledAlgorithms"); + String newProp = prop.replace(", SHA1 jdkCA & usage TLSServer", ""); + Security.setProperty("jdk.certpath.disabledAlgorithms", newProp); + + Distrust distrust = new Distrust(args); + + X509TrustManager[] tms = new X509TrustManager[]{ + distrust.getTMF("PKIX", null), + distrust.getTMF("SunX509", null) + }; + + Date notBefore = distrust.getNotBefore(DISTRUST_DATE); + distrust.testCertificateChain(certPath, notBefore, tms, rootsToTest); + } +} diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Distrust.java b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Distrust.java index 18178f65ec1..3430a1b8276 100644 --- a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Distrust.java +++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Distrust.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 @@ -198,7 +198,13 @@ public boolean[] getIssuerUniqueID() { public boolean[] getSubjectUniqueID() { return cert.getSubjectUniqueID(); } - public boolean[] getKeyUsage() { return cert.getKeyUsage(); } + public boolean[] getKeyUsage() { + // Turn on the Digital Signature bit. Some certs that we want + // to use as test certs don't have this bit turned on. + boolean[] withDigitalSignature = cert.getKeyUsage(); + withDigitalSignature[0] = true; + return withDigitalSignature; + } public int getBasicConstraints() { return cert.getBasicConstraints(); } public byte[] getEncoded() throws CertificateEncodingException { return cert.getEncoded(); diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersca-chain.pem b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersca-chain.pem new file mode 100644 index 00000000000..f23c6dafedd --- /dev/null +++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersca-chain.pem @@ -0,0 +1,64 @@ +Owner: CN=Camerfirma Corporate Server II - 2015, + L=Madrid (see current address at https://www.camerfirma.com/address), + SERIALNUMBER=A82743287, + O=AC Camerfirma S.A., OU=AC CAMERFIRMA, C=ES +Issuer: CN=Chambers of Commerce Root - 2008, + O=AC Camerfirma S.A., SERIALNUMBER=A82743287, + L=Madrid (see current address at www.camerfirma.com/address), C=EU +Serial number: 621ff31c489ba136 +Valid from: Thu Jan 15 01:21:16 PST 2015 until: Tue Dec 15 01:21:16 PST 2037 +Certificate fingerprints: + SHA1: FE:72:7A:78:EA:0C:03:35:CD:DA:9C:2E:D7:5F:D4:D4:6F:35:C2:EF + SHA256: 66:EA:E2:70:9B:54:CD:D1:69:31:77:B1:33:2F:F0:36:CD:D0:F7:23:DB:30:39:ED:31:15:55:A6:CB:F5:FF:3E +Signature algorithm name: SHA256withRSA +Subject Public Key Algorithm: 4096-bit RSA key +Version: 3 + +-----BEGIN CERTIFICATE----- +MIIIkzCCBnugAwIBAgIIYh/zHEiboTYwDQYJKoZIhvcNAQELBQAwga4xCzAJBgNV +BAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQg +d3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcx +GzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMg +b2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwHhcNMTUwMTE1MDkyMTE2WhcNMzcxMjE1 +MDkyMTE2WjCB0zELMAkGA1UEBhMCRVMxFjAUBgNVBAsMDUFDIENBTUVSRklSTUEx +GzAZBgNVBAoMEkFDIENhbWVyZmlybWEgUy5BLjESMBAGA1UEBRMJQTgyNzQzMjg3 +MUswSQYDVQQHDEJNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgaHR0cHM6 +Ly93d3cuY2FtZXJmaXJtYS5jb20vYWRkcmVzcykxLjAsBgNVBAMMJUNhbWVyZmly +bWEgQ29ycG9yYXRlIFNlcnZlciBJSSAtIDIwMTUwggIiMA0GCSqGSIb3DQEBAQUA +A4ICDwAwggIKAoICAQC3ndKNpFufVq9v+15dRoT9oVkgwEfDdsPw0Ly0R+eM5MOk +35zEil/+hqEMbQmcvosAh6I8iAskkXasqh+SMbMIjvXbDyNILeGzsoP0uz3btHM7 +oN3yHXDhhd1NGNocP54Wehe9+RE3WP0yEEo+D2YmMwUHuv4KiXtveiPksv+Xkkz5 +auqppPMaYlD6y49AEsGY2zOEUI8PO4+tOxUKhvsiMuW817vH3VdmMwOjRe0SdYAi +YLQIiyqJGNdEo3u+fw8UXxaJSRXhmF+jUn5DvdzWWNAxxwAKy95EPlpLQsx/7t2W +2ntoELPHGJk4V+/yA0d2olLEqBADkRtP2HiC0wly+zp7OGmjtfjbqLrVjmo/mLP3 +zpmYbpUtubrHiY0rlW6wo5FZLcTUvcAxFjxLWVIELPjnTebOuHvoJTb97rhA1Oqq +woq5FWJHFI9idzXzFLO0LX/4ugI9LZWxmvWW0O4CePtnhp0aNE/GgAw6lMx7bjZe +DXxxQnUDEE/mAqOHRUCnvRUSKVbuBBE0oz5fz3nUwcWVVgrm/jkgqTX4EqnZe+yB +mKV6hFEYV+1oVh7kzNN4Hg7nzGuByS7cCuBEwULFhfUja1Bu9EqgndJ3CV0XCWIA +XVhJnPNPi6y4W11jLJ7XSGSz3sCh21g0Gpgi2pXHGDB65Jc/QJHZ5ZaHCrzFnwID +AQABo4ICjDCCAogwEgYDVR0TAQH/BAgwBgEB/wIBAjAdBgNVHQ4EFgQUY+nw8FYA +aGWwIWwOXNcZCJ0INGUwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKe +FxmhgbSkgbEwga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBj +dXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIw +EAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEp +MCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiCCQCj2kJ+ +pLGu2jB6BggrBgEFBQcBAQRuMGwwQgYIKwYBBQUHMAKGNmh0dHA6Ly93d3cuY2Ft +ZXJmaXJtYS5jb20vY2VydHMvcm9vdF9jaGFtYmVycy0yMDA4LmNydDAmBggrBgEF +BQcwAYYaaHR0cDovL29jc3AuY2FtZXJmaXJtYS5jb20wDgYDVR0PAQH/BAQDAgEG +MCcGA1UdJQQgMB4GCCsGAQUFBwMEBggrBgEFBQcDAgYIKwYBBQUHAwEwPgYDVR0g +BDcwNTAzBgRVHSAAMCswKQYIKwYBBQUHAgEWHWh0dHBzOi8vcG9saWN5LmNhbWVy +ZmlybWEuY29tMHgGA1UdHwRxMG8wNaAzoDGGL2h0dHA6Ly9jcmwuY2FtZXJmaXJt +YS5jb20vY2hhbWJlcnNyb290LTIwMDguY3JsMDagNKAyhjBodHRwOi8vY3JsMS5j +YW1lcmZpcm1hLmNvbS9jaGFtYmVyc3Jvb3QtMjAwOC5jcmwwDQYJKoZIhvcNAQEL +BQADggIBAKhqaZwalwf89f4wPqfcE/lrsHdx8+q9RG46ouBXhTJMqXjwstXOZSL4 +3Dqs3GaVuMPIM9OG7CK0I93mAt+FWtr49ACFTyPBxPg/knrZ4RHyEto+/6w0WZ9H +owNw0aUg3ZAkhIvMRPVou8PrVukqj2lGKIh3hRdrbHwYwwmKKNlWBoC9gWk3mTYU +zfNt/KTzQCCl5+s6YDa+XInMLWaGd/pE/e++a22vY24cv7kN3NAFMjAMELPwh9ic +zLoPX8B52r+GgwpKY0c0hZdVTii6psLQ+BenyMlh+6lHRBOlTCSRtNi16o7H8fRq +CY2wyQi7N+EmdY1DhvECCi1nLbOnIx1bSAW0cVwPVrjQ/vsAxPNc3SGe/Xnanm3a +zAgFspzeuAhxxG0VKOvtPBnPQNsQ0cK664+IrWRsfa6aYhEfKvfsn5o4HpBWDobf +zrtNbqjjOuiM6JkT+DxXo5UK7t2q75KCJiimTtAuPcZ5wErZISLvZ34BodIHL2xK +b3Vww7K2FE1QaNsuQkGbUk++B9/+vV3H57vzskObdFWeWKSCpxIil4vZwIIH17zn +WU+O2WIY1F0aO9zp3E7qwfmYT4MJ38NF9R7FSlxRlgVc1uUHu/iyUU4N1O6F3VdX +P2Y+tgLFZLYV4kApfXk5l9h94dgKyfVcIpvS6yVpLfONPnlCNOxy +-----END CERTIFICATE----- diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachamberscommerceca-chain.pem b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachamberscommerceca-chain.pem new file mode 100644 index 00000000000..b27d46c17c8 --- /dev/null +++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachamberscommerceca-chain.pem @@ -0,0 +1,48 @@ +Owner: CN=AC Camerfirma Certificados Camerales, + O=AC Camerfirma SA, SERIALNUMBER=A82743287, + L=Madrid (see current address at www.camerfirma.com/address), + EMAILADDRESS=ac_camerfirma_cc@camerfirma.com, C=ES +Issuer: CN=Chambers of Commerce Root, OU=http://www.chambersign.org, + O=AC Camerfirma SA CIF A82743287, C=EU +Serial number: 5 +Valid from: Mon Feb 09 07:42:47 PST 2004 until: Thu Feb 09 07:42:47 PST 2034 +Certificate fingerprints: + SHA1: 9F:36:B4:BE:9D:AF:1C:91:01:B2:D7:61:58:FB:95:CB:53:82:01:10 + SHA256: C7:D8:43:81:E1:1F:7C:57:46:77:1A:F5:B0:50:DC:51:FC:6F:DA:D6:F6:F3:5B:B5:3A:3D:E9:13:82:2E:A0:9E +Signature algorithm name: SHA1withRSA (weak) +Subject Public Key Algorithm: 2048-bit RSA key +Version: 3 + +-----BEGIN CERTIFICATE----- +MIIFwDCCBKigAwIBAgIBBTANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEn +MCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQL +ExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMg +b2YgQ29tbWVyY2UgUm9vdDAeFw0wNDAyMDkxNTQyNDdaFw0zNDAyMDkxNTQyNDda +MIHgMQswCQYDVQQGEwJFUzEuMCwGCSqGSIb3DQEJARYfYWNfY2FtZXJmaXJtYV9j +Y0BjYW1lcmZpcm1hLmNvbTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBh +ZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ +QTgyNzQzMjg3MRkwFwYDVQQKExBBQyBDYW1lcmZpcm1hIFNBMS0wKwYDVQQDEyRB +QyBDYW1lcmZpcm1hIENlcnRpZmljYWRvcyBDYW1lcmFsZXMwggEgMA0GCSqGSIb3 +DQEBAQUAA4IBDQAwggEIAoIBAQCjxnvvj01f36lgGhihRYVf1fAPEXsTJKrY4aLQ +cEUSh5szZE7VTtGiyMTMc2uCmnaXafjYHK8Lgmy6T9xxGEZ5OS4x6rgtuPyy13AP +tu3X3Y2kPVLu7ZMw5HoQC64wBj6YcnxTnBwmVW05DjzRXp6OyBIEKEaAB9vv2qEl +fh/Y234FG6Wd/ut1s0ScRZAo+6CSMNQxaY+ryXKD11uWkzWXJa9UZOasG7z4uPqc +Gr4/Hz2/CTLDTgp0xkMJYuzOztpUvOACrxlkS2utKUwVlAikJnboNwf/en94RbHN +zkKc5t0SAbzCf57ueawbzxSdPa+SAC25FNur64FKkfdq5PPjAgEDo4IB5TCCAeEw +EgYDVR0TAQH/BAgwBgEB/wIBCzA8BgNVHR8ENTAzMDGgL6AthitodHRwOi8vY3Js +LmNoYW1iZXJzaWduLm9yZy9jaGFtYmVyc3Jvb3QuY3JsMB0GA1UdDgQWBBS2H06d +HGiRLjdyYOFGj1qlKjExuTCBqwYDVR0jBIGjMIGggBTjlPWxTenboSlbV4tNdgZ2 +4dGiiqGBhKSBgTB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt +YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJz +aWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdIIBADAO +BgNVHQ8BAf8EBAMCAYYwKgYDVR0RBCMwIYEfYWNfY2FtZXJmaXJtYV9jY0BjYW1l +cmZpcm1hLmNvbTAnBgNVHRIEIDAegRxjaGFtYmVyc3Jvb3RAY2hhbWJlcnNpZ24u +b3JnMFsGA1UdIARUMFIwUAYLKwYBBAGBhy4KCQEwQTA/BggrBgEFBQcCARYzaHR0 +cDovL2Nwcy5jYW1lcmZpcm1hLmNvbS9jcHMvYWNfY2FtZXJmaXJtYV9jYy5odG1s +MA0GCSqGSIb3DQEBBQUAA4IBAQBl8KoPBYL//EBonqQWS0N+hLfxImP1eQ6nac+v +R5QfF/0w+VCTkShfKwHaa6V/W1dPlVwXSECuvXHkX6DYrtxFGGFB6qxuP1rkIpRs +sTkAlpvOx3REiFjIkhsijKd/ijvqxjbMbuYU+EFACK/jQIRoj+LEEZ+haiqbALZB +Iqq/26HTqX0itDosBj6M94YWcIpbTDefQNWCGsSnZcw2+k+az/wAOZT6xAxlnEim +HpDDlgRsmaLrHpDPDoIRYOih0gbJTnn4mKex9Wgr0sZ+XFl03j+bvcXL1tiuQnwb +9dMRDe/OdXABT35W4ZzLbpost65ZW3Tx+oi/bLbmu6pbKCgs +-----END CERTIFICATE----- diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersignca-chain.pem b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersignca-chain.pem new file mode 100644 index 00000000000..2ab3091439c --- /dev/null +++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersignca-chain.pem @@ -0,0 +1,62 @@ +Owner: CN=AC Camerfirma - 2009, + L=Madrid (see current address at https://www.camerfirma.com/address), + SERIALNUMBER=A82743287, O=AC Camerfirma S.A., C=ES +Issuer: CN=Global Chambersign Root - 2008, + O=AC Camerfirma S.A., SERIALNUMBER=A82743287, + L=Madrid (see current address at www.camerfirma.com/address), C=EU +Serial number: 2 +Valid from: Mon Mar 16 10:16:25 PDT 2009 until: Sun Mar 11 10:16:25 PDT 2029 +Certificate fingerprints: + SHA1: BA:BA:69:CF:D5:CC:C9:4D:05:6B:5B:E7:80:5F:E2:03:CB:EB:5C:57 + SHA256: B6:8D:5D:9B:4E:A6:35:95:7C:0C:32:15:C2:0D:35:B2:21:7B:69:E3:49:C7:A3:04:C4:F9:7F:20:C4:08:1F:88 +Signature algorithm name: SHA1withRSA (weak) +Subject Public Key Algorithm: 4096-bit RSA key +Version: 3 + +-----BEGIN CERTIFICATE----- +MIIIPzCCBiegAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBrDELMAkGA1UEBhMCRVUx +QzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2Ft +ZXJmaXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UE +ChMSQUMgQ2FtZXJmaXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNp +Z24gUm9vdCAtIDIwMDgwHhcNMDkwMzE2MTcxNjI1WhcNMjkwMzExMTcxNjI1WjCB +qjELMAkGA1UEBhMCRVMxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjESMBAG +A1UEBRMJQTgyNzQzMjg3MUswSQYDVQQHE0JNYWRyaWQgKHNlZSBjdXJyZW50IGFk +ZHJlc3MgYXQgaHR0cHM6Ly93d3cuY2FtZXJmaXJtYS5jb20vYWRkcmVzcykxHTAb +BgNVBAMTFEFDIENhbWVyZmlybWEgLSAyMDA5MIICIjANBgkqhkiG9w0BAQEFAAOC +Ag8AMIICCgKCAgEAmbHxFEYTJmMdPcYiPlWUGZu2+tQo4voohYi3dwCwoVuGdHSp +kyoqs1B3YGx4u5KT4n0A7+Bb8YQ/QzbNy7UQ4JXAK+rT8JpNeKIvfN4lHnQJaChE +4fdn0KpvHWymaNq2k+EbQClquZB6OsTLvsivwSuSnyLcUw5rbajj53wq77fwB12y +phMjwz2AnD1BvHZd3vLOaH1jRQP3zzNmyjT/Oj6+jdux7SBKlJWgQEaKflwcvYyc +DPFPhGM4KPwEGX61PCrS+l8Lw0Kdy6K4lE+GrfgJrXM5m1Ey1R0c9McYQQPAtYcm +cOnHHgkJdEAFVDa76T9C+lcMP6DNckbJIyc/ENrmM2v4rq/JnsJKEEx0VLyLizQx +cGU3gp4ckg0ImQ9hV3H/DLWEqfrPuD++zaV81gpstnc9+pLg0Jibvwg3qvIr7nS5 +acc//qqxH0iJGYoStHW5J5HoM9HcBvhACq5rjzjrNLPYSJqbPJwBHKcql/uUjQ6S +SVWe3/CeJp6/vGuY1aRXAk9c/8oO0ZDrLKE8LsUgZesTLnWGd1LQcyQf6UMG1nb9 +5C3eZRkCVpKma6Hl/SUQNukerlbLOU9InFGNPdeEVq1Jo62XeEi8KMbTPdXou6Yl +rpe99dFnOUjVOdY7gfBGSgIVJjORqf/V70jwsxcYz7j6PKl0XulJs06vpSECAwEA +AaOCAmowggJmMBIGA1UdEwEB/wQIMAYBAf8CAQIwHQYDVR0OBBYEFMgAD/zGUvyf +2ztkLjK5bi5x82V5MIHhBgNVHSMEgdkwgdaAFLkJypwe29NsOmuu7VTxW5MGNS5e +oYGypIGvMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3Vy +cmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAG +A1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAl +BgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwOIIJAMnN0+nVfSPO +MH0GCCsGAQUFBwEBBHEwbzBFBggrBgEFBQcwAoY5aHR0cDovL3d3dy5jYW1lcmZp +cm1hLmNvbS9jZXJ0cy9yb290X2NoYW1iZXJzaWduLTIwMDguY3J0MCYGCCsGAQUF +BzABhhpodHRwOi8vb2NzcC5jYW1lcmZpcm1hLmNvbTAOBgNVHQ8BAf8EBAMCAQYw +PgYDVR0gBDcwNTAzBgRVHSAAMCswKQYIKwYBBQUHAgEWHWh0dHBzOi8vcG9saWN5 +LmNhbWVyZmlybWEuY29tMH4GA1UdHwR3MHUwOKA2oDSGMmh0dHA6Ly9jcmwuY2Ft +ZXJmaXJtYS5jb20vY2hhbWJlcnNpZ25yb290LTIwMDguY3JsMDmgN6A1hjNodHRw +Oi8vY3JsMS5jYW1lcmZpcm1hLmNvbS9jaGFtYmVyc2lnbnJvb3QtMjAwOC5jcmww +DQYJKoZIhvcNAQEFBQADggIBABNYG4jBwoI7e8pCuUyDc6rwpE9H6AgrUdL7O1xK +TgTjDGBrMOBK+ZPS4Si8J3yZngvSrL694a1HmiiblJ+CmCdNGli2nBBM+OPK3tQB +4TW6hgkIe3vSNg/9o9y6+MAJcm8Kn0nPCBkSRME87NwvpehtekuF1G2ng1KDVwAn +F+eCXfNanEwY++vWbJAuPE69Z/0+rCgNyH1PzihiNu6vrUlSlLWKaG34O1DEttX+ +SsWTpEbpH9w5y9Vmw6WQ/B5nfhPM551HaMbiGgSxT9jHmf8APYQ3iT8EktcdTAdw +m1miiyxfKG+WjPT7P/x8Np1spJZw+sNIDTLdZ0T1XQ6obVkBTFUDSULKW8949HDu +VSwdl9Hu9lkDzzh9tyVYwwjEWVFZOiD/4TPVLfphf4ZEiyHt5YpNd9kZJIGGDxdc +CdtzPm2dQODFpv72LnPQHbuBQPJ71zkoAmyeM/1Qj0DlrFsPcYnbRasck1VmYgDc +Xc0+is0wcgCd7Gpx1zpEeVqwMD96am2xZPzd6nsbXvo+6TzsKLRMJo6nOERwrzuI +F+/eq3WXxYMt2UenJsHqwSgPJRMdl3SFz0+SZN0viHeLuwb7qaHN74qC6GP8yHGp +2xe6Z11mJDPLDSrQQ2dOceSJ1LurJgLP7amYmFlWwVnmM7LnfShhMWMV+MDrICnL +2ksL +-----END CERTIFICATE----- diff --git a/test/jdk/sun/util/resources/TimeZone/Bug4640234.java b/test/jdk/sun/util/resources/TimeZone/Bug4640234.java index 954932003af..553323fe2dc 100644 --- a/test/jdk/sun/util/resources/TimeZone/Bug4640234.java +++ b/test/jdk/sun/util/resources/TimeZone/Bug4640234.java @@ -23,7 +23,7 @@ /** * @test - * @bug 4640234 4946057 4938151 4873691 5023181 8347841 + * @bug 4640234 4946057 4938151 4873691 5023181 8347841 8347955 * @summary Verifies the translation of time zone names, this test will catch * presence of country name for english and selected locales for all * ISO country codes. @@ -43,7 +43,6 @@ import java.text.SimpleDateFormat; import java.time.ZoneId; -import java.util.Arrays; import java.util.Date; import java.util.Locale; import java.util.Enumeration; @@ -86,7 +85,7 @@ public static void main(String[] args) throws Exception { StringBuffer errors = new StringBuffer(""); StringBuffer warnings = new StringBuffer(""); - String[] timezones = Arrays.stream(TimeZone.getAvailableIDs()) + String[] timezones = TimeZone.availableIDs() .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) .toArray(String[]::new); String[] countries = locEn.getISOCountries(); diff --git a/test/langtools/jdk/javadoc/doclet/testModuleSpecificStylesheet/TestModuleSpecificStylesheet.java b/test/langtools/jdk/javadoc/doclet/testModuleSpecificStylesheet/TestModuleSpecificStylesheet.java index 48b4750573b..68deacb0e47 100644 --- a/test/langtools/jdk/javadoc/doclet/testModuleSpecificStylesheet/TestModuleSpecificStylesheet.java +++ b/test/langtools/jdk/javadoc/doclet/testModuleSpecificStylesheet/TestModuleSpecificStylesheet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, 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 8219313 + * @bug 8219313 8347058 * @summary Support module specific stylesheets * @library /tools/lib ../../lib * @modules jdk.compiler/com.sun.tools.javac.api @@ -82,22 +82,22 @@ public void test(Path base) throws Exception { checkOutput("ma/module-summary.html", true, """ - """); + """); checkOutput("ma/pa/package-summary.html", true, """ - """); + """); checkOutput("ma/pa/A.html", true, """ - """); + """); checkOutput("ma/pa/pb/B.html", true, """ - """); + """); checkOutput("ma/pa/pb/package-summary.html", true, """ - """); + """); } } diff --git a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java index 898a498ddee..e0413538211 100644 --- a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java +++ b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, 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,7 +24,7 @@ /* * @test * @bug 4749567 8071982 8175200 8186332 8185371 8182765 8217034 8261976 8261976 - * 8275786 + * 8275786 8347058 * @summary Test the output for -header, -footer, -nooverview, -nodeprecatedlist, * -nonavbar, -notree, -stylesheetfile, --main-stylesheet, --add-stylesheet, * --add-script options. @@ -118,7 +118,7 @@ public void testStylesheetFile() { checkOutput("resource-files/custom-stylesheet.css", true, "Custom javadoc style sheet"); checkOutput("pkg/Foo.html", true, """ - """); + """); } @Test @@ -131,7 +131,7 @@ public void testStylesheetFileAltOption() { checkOutput("resource-files/custom-stylesheet.css", true, "Custom javadoc style sheet"); checkOutput("pkg/Foo.html", true, """ - """); + """); } @Test @@ -149,9 +149,9 @@ public void testAdditionalStylesheetFile() { checkOutput("resource-files/additional-stylesheet-3.css", true, "Additional javadoc style sheet 3"); checkOutput("pkg/Foo.html", true, """ - - - """); + + + """); } @Test diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java b/test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java index 9c6ddc5616d..284b7957759 100644 --- a/test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java +++ b/test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, 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 8213354 + * @bug 8213354 8347058 * @summary Support package-specific stylesheets * @library /tools/lib ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -82,15 +82,15 @@ public void test(Path base) throws Exception { checkOutput("pkg/A.html", true, """ - """); + """); checkOutput("pkg/package-summary.html", true, """ - """); + """); checkOutput("pkg2/B.html", false, """ - """); + """); } } diff --git a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java index 292d8245982..ba3f64cd8b2 100644 --- a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java +++ b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, 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 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881 * 8181622 8182263 8074407 8187521 8198522 8182765 8199278 8196201 8196202 * 8184205 8214468 8222548 8223378 8234746 8241219 8254627 8247994 8263528 - * 8266808 8248863 8305710 8318082 + * 8266808 8248863 8305710 8318082 8347058 * @summary Test the search feature of javadoc. * @library ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -418,7 +418,7 @@ void checkSearchOutput(String fileName, boolean expectedOutput) { // Test for search related markup checkOutput(fileName, expectedOutput, """ - + """, """ diff --git a/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java b/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java index 06663d2f418..a3dce5448f0 100644 --- a/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java +++ b/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, 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,7 @@ * @test * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417 * 8175218 8176452 8181215 8182263 8183511 8169819 8183037 8185369 8182765 8196201 8184205 8223378 8241544 - * 8253117 8263528 8289334 8292594 + * 8253117 8263528 8289334 8292594 8347058 * @summary Run tests on doclet stylesheet. * @library /tools/lib ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -186,7 +186,7 @@ public void test(Path base) { // Test whether a link to the stylesheet file is inserted properly // in the class documentation. """ - """, + """, """
        Test comment for a class which has an anchor_with_name and an anchor_with_id.
        """); @@ -200,7 +200,7 @@ public void test(Path base) { checkOutput("index.html", true, """ - """); + """); checkOutput("resource-files/stylesheet.css", false, """ diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsInConstantInit.java b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsInConstantInit.java new file mode 100644 index 00000000000..b7b91119bc9 --- /dev/null +++ b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsInConstantInit.java @@ -0,0 +1,81 @@ +/* + * 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 8346751 + * @summary Verify type annotations inside constant expression field initializers + are handled correctly + * @library /tools/lib + * @modules + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * jdk.compiler/com.sun.tools.javac.code + * jdk.compiler/com.sun.tools.javac.util + * @build toolbox.ToolBox toolbox.JavacTask + * @run main TypeAnnotationsInConstantInit + */ + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import toolbox.JavacTask; +import toolbox.ToolBox; + +public class TypeAnnotationsInConstantInit { + + public static void main(String... args) throws Exception { + new TypeAnnotationsInConstantInit().run(); + } + + ToolBox tb = new ToolBox(); + + void run() throws Exception { + typeAnnotationInConstantExpressionFieldInit(Paths.get(".")); + } + + void typeAnnotationInConstantExpressionFieldInit(Path base) throws Exception { + Path src = base.resolve("src"); + Path classes = base.resolve("classes"); + tb.writeJavaFiles(src, + """ + import java.lang.annotation.*; + + @SuppressWarnings(Decl.VALUE) + public class Decl { + public static final @Nullable String VALUE = (@Nullable String) ""; + } + + @Retention(RetentionPolicy.RUNTIME) + @Target({ ElementType.TYPE_USE }) + @interface Nullable {} + """); + Files.createDirectories(classes); + new JavacTask(tb) + .options("-d", classes.toString()) + .files(tb.findJavaFiles(src)) + .run() + .writeAll(); + } + +} diff --git a/test/langtools/tools/javac/api/TestJavacTaskWithWarning.java b/test/langtools/tools/javac/api/TestJavacTaskWithWarning.java new file mode 100644 index 00000000000..70d8332720e --- /dev/null +++ b/test/langtools/tools/javac/api/TestJavacTaskWithWarning.java @@ -0,0 +1,88 @@ +/* + * 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 8348212 + * @summary Ensure the warn() phase executes when the compiler is invoked via the API + * @modules jdk.compiler/com.sun.tools.javac.api + */ + +import com.sun.tools.javac.api.JavacTaskImpl; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.List; + +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; + +public class TestJavacTaskWithWarning { + + static final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + static final StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null); + + public static void warningTest() throws Exception { + + // Create a source file that will generate a warning + String srcdir = System.getProperty("test.src"); + File file = new File(srcdir, "GeneratesWarning.java"); + try (PrintStream out = new PrintStream(new FileOutputStream(file))) { + out.print( + """ + public class GeneratesWarning { + public GeneratesWarning() { + hashCode(); // generates a "this-escape" warning + } + } + """); + } + + // Compile it using API + Iterable files = fm.getJavaFileObjectsFromFiles(List.of(file)); + StringWriter buf = new StringWriter(); + List options = List.of( + "-Xlint:this-escape", + "-XDrawDiagnostics" + ); + JavacTaskImpl task = (JavacTaskImpl)compiler.getTask(new PrintWriter(buf), fm, null, options, null, files); + task.analyze(); + + // Verify warning was generated + if (!buf.toString().contains("compiler.warn.possible.this.escape")) + throw new AssertionError("warning not found in:\n" + buf); + } + + public static void main(String[] args) throws Exception { + try { + warningTest(); + } finally { + fm.close(); + } + } +} diff --git a/test/micro/org/openjdk/bench/java/lang/StringBuilders.java b/test/micro/org/openjdk/bench/java/lang/StringBuilders.java index ed5c0d30db8..f857a77d80e 100644 --- a/test/micro/org/openjdk/bench/java/lang/StringBuilders.java +++ b/test/micro/org/openjdk/bench/java/lang/StringBuilders.java @@ -54,6 +54,8 @@ public class StringBuilders { private StringBuilder sbLatin2; private StringBuilder sbUtf16; private StringBuilder sbUtf17; + private int[] intArray; + private long[] longArray; @Setup public void setup() { @@ -69,6 +71,13 @@ public void setup() { sbLatin2 = new StringBuilder("Latin1 string"); sbUtf16 = new StringBuilder("UTF-\uFF11\uFF16 string"); sbUtf17 = new StringBuilder("UTF-\uFF11\uFF16 string"); + int size = 16; + intArray = new int[size]; + longArray = new long[size]; + for (int i = 0; i < longArray.length; i++) { + intArray[i] = ((100 * i + i) << 24) + 4543 + i * 4; + longArray[i] = ((100L * i + i) << 32) + 4543 + i * 4L; + } } @Benchmark @@ -224,6 +233,45 @@ public String toStringCharWithInt8() { return result.toString(); } + @Benchmark + public int appendWithIntLatin1() { + StringBuilder buf = sbLatin1; + buf.setLength(0); + for (int i : intArray) { + buf.append(i); + } + return buf.length(); + } + + @Benchmark + public int appendWithIntUtf16() { + StringBuilder buf = sbUtf16; + buf.setLength(0); + for (int i : intArray) { + buf.append(i); + } + return buf.length(); + } + + @Benchmark + public int appendWithLongLatin1() { + StringBuilder buf = sbLatin1; + buf.setLength(0); + for (long l : longArray) { + buf.append(l); + } + return buf.length(); + } + + @Benchmark + public int appendWithLongUtf16() { + StringBuilder buf = sbUtf16; + buf.setLength(0); + for (long l : longArray) { + buf.append(l); + } + return buf.length(); + } @Benchmark public int appendWithBool8Latin1() { diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadByValue.java b/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadByValue.java new file mode 100644 index 00000000000..8fae1905472 --- /dev/null +++ b/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadByValue.java @@ -0,0 +1,96 @@ +/* + * 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 org.openjdk.bench.java.lang.foreign; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.TearDown; +import org.openjdk.jmh.annotations.Warmup; + +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; +import java.lang.foreign.MemoryLayout; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.SegmentAllocator; +import java.lang.foreign.SymbolLookup; +import java.lang.foreign.ValueLayout; +import java.lang.invoke.MethodHandle; +import java.util.concurrent.TimeUnit; + +import static org.openjdk.bench.java.lang.foreign.CLayouts.C_DOUBLE; + +@BenchmarkMode(Mode.AverageTime) +@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@State(org.openjdk.jmh.annotations.Scope.Thread) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED", "-Djava.library.path=micro/native" }) +public class CallOverheadByValue { + + public static final MemoryLayout POINT_LAYOUT = MemoryLayout.structLayout( + C_DOUBLE, C_DOUBLE + ); + private static final MethodHandle MH_UNIT_BY_VALUE; + private static final MethodHandle MH_UNIT_BY_PTR; + + static { + Linker abi = Linker.nativeLinker(); + System.loadLibrary("CallOverheadByValue"); + SymbolLookup loaderLibs = SymbolLookup.loaderLookup(); + MH_UNIT_BY_VALUE = abi.downcallHandle( + loaderLibs.findOrThrow("unit"), + FunctionDescriptor.of(POINT_LAYOUT) + ); + MH_UNIT_BY_PTR = abi.downcallHandle( + loaderLibs.findOrThrow("unit_ptr"), + FunctionDescriptor.ofVoid(ValueLayout.ADDRESS) + ); + } + + Arena arena = Arena.ofConfined(); + MemorySegment point = arena.allocate(POINT_LAYOUT); + + @TearDown + public void tearDown() { + arena.close(); + } + + @Benchmark + public void byValue() throws Throwable { + // point = unit(); + MemorySegment unused = (MemorySegment) MH_UNIT_BY_VALUE.invokeExact( + (SegmentAllocator) (_, _) -> point); + } + + @Benchmark + public void byPtr() throws Throwable { + // unit_ptr(&point); + MH_UNIT_BY_PTR.invokeExact(point); + } +} diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/libCallOverheadByValue.c b/test/micro/org/openjdk/bench/java/lang/foreign/libCallOverheadByValue.c new file mode 100644 index 00000000000..2eb80f537d8 --- /dev/null +++ b/test/micro/org/openjdk/bench/java/lang/foreign/libCallOverheadByValue.c @@ -0,0 +1,38 @@ +/* + * 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 "export.h" + +typedef struct { + double x; + double y; +} DoublePoint; + +EXPORT DoublePoint unit() { + DoublePoint result = { 1, 0 }; + return result; +} + +EXPORT void unit_ptr(DoublePoint* out) { + *out = unit(); +}